diff --git a/sdk/monitor/azure-mgmt-monitor/CHANGELOG.md b/sdk/monitor/azure-mgmt-monitor/CHANGELOG.md index 7138c4721b61..964fd3ee4699 100644 --- a/sdk/monitor/azure-mgmt-monitor/CHANGELOG.md +++ b/sdk/monitor/azure-mgmt-monitor/CHANGELOG.md @@ -1,5 +1,430 @@ # Release History +## 7.0.0b2 (2025-05-13) + +### Features Added + + - Client `MonitorManagementClient` added method `send_request` + - Client `MonitorManagementClient` added operation group `azure_monitor_workspaces` + - Client `MonitorManagementClient` added operation group `pipeline_groups` + - Model `ErrorDetail` added property `details` + - Model `Operation` added property `is_data_action` + - Model `Operation` added property `origin` + - Model `Operation` added property `action_type` + - Model `OperationDisplay` added property `description` + - Model `PrivateEndpointConnection` added property `properties` + - Model `PrivateEndpointConnection` added property `system_data` + - Enum `ProvisioningState` added member `CREATING` + - Enum `ProvisioningState` added member `DELETING` + - Model `Resource` added property `system_data` + - Added enum `ActionType` + - Added model `AzureMonitorWorkspace` + - Added model `AzureMonitorWorkspaceLogsApiConfig` + - Added model `AzureMonitorWorkspaceLogsExporter` + - Added model `AzureMonitorWorkspaceProperties` + - Added model `AzureMonitorWorkspaceUpdate` + - Added model `AzureMonitorWorkspaceUpdateProperties` + - Added model `BatchProcessor` + - Added model `CacheConfiguration` + - Added model `ConcurrencyConfiguration` + - Added model `Exporter` + - Added enum `ExporterType` + - Added model `ExtendedLocation` + - Added enum `ExtendedLocationType` + - Added enum `ExternalNetworkingMode` + - Added model `IngestionSettings` + - Added model `Metrics` + - Added model `NetworkingConfiguration` + - Added model `NetworkingRoute` + - Added enum `Origin` + - Added model `OtlpReceiver` + - Added model `PersistenceConfigurations` + - Added model `Pipeline` + - Added model `PipelineGroup` + - Added model `PipelineGroupProperties` + - Added model `PipelineGroupUpdate` + - Added model `PipelineGroupUpdateProperties` + - Added enum `PipelineType` + - Added model `PrivateEndpoint` + - Added model `PrivateEndpointConnectionProperties` + - Added enum `PrivateEndpointConnectionProvisioningState` + - Added enum `PrivateEndpointServiceConnectionStatus` + - Added model `PrivateLinkServiceConnectionState` + - Added model `Processor` + - Added enum `ProcessorType` + - Added enum `PublicNetworkAccess` + - Added model `Receiver` + - Added enum `ReceiverType` + - Added model `RecordMap` + - Added model `ResourceMap` + - Added model `SchemaMap` + - Added model `ScopeMap` + - Added model `Service` + - Added enum `StreamEncodingType` + - Added enum `SyslogProtocol` + - Added model `SyslogReceiver` + - Added model `TcpExporter` + - Added model `TrackedResource` + - Added model `UdpReceiver` + - Added model `AzureMonitorWorkspacesOperations` + - Added model `PipelineGroupsOperations` + - Method `ErrorResponse.__init__` has a new overload `def __init__(self: None, error: Optional[_models.ErrorDetail])` + - Method `ErrorResponse.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `Operation.__init__` has a new overload `def __init__(self: None, display: Optional[_models.OperationDisplay])` + - Method `Operation.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PrivateEndpointConnection.__init__` has a new overload `def __init__(self: None, properties: Optional[_models.PrivateEndpointConnectionProperties])` + - Method `PrivateEndpointConnection.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `SystemData.__init__` has a new overload `def __init__(self: None, created_by: Optional[str], created_by_type: Optional[Union[str, _models.CreatedByType]], created_at: Optional[datetime], last_modified_by: Optional[str], last_modified_by_type: Optional[Union[str, _models.CreatedByType]], last_modified_at: Optional[datetime])` + - Method `SystemData.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `AzureMonitorWorkspace.__init__` has a new overload `def __init__(self: None, location: str, tags: Optional[Dict[str, str]], properties: Optional[_models.AzureMonitorWorkspaceProperties])` + - Method `AzureMonitorWorkspace.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `AzureMonitorWorkspace.__init__` has a new overload `def __init__(self: None, location: str, tags: Optional[Dict[str, str]])` + - Method `AzureMonitorWorkspace.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `AzureMonitorWorkspaceLogsApiConfig.__init__` has a new overload `def __init__(self: None, data_collection_endpoint_url: str, stream: str, data_collection_rule: str, schema: _models.SchemaMap)` + - Method `AzureMonitorWorkspaceLogsApiConfig.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `AzureMonitorWorkspaceLogsExporter.__init__` has a new overload `def __init__(self: None, api: _models.AzureMonitorWorkspaceLogsApiConfig, concurrency: Optional[_models.ConcurrencyConfiguration], cache: Optional[_models.CacheConfiguration])` + - Method `AzureMonitorWorkspaceLogsExporter.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `AzureMonitorWorkspaceProperties.__init__` has a new overload `def __init__(self: None, metrics: Optional[_models.Metrics])` + - Method `AzureMonitorWorkspaceProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `AzureMonitorWorkspaceUpdate.__init__` has a new overload `def __init__(self: None, tags: Optional[Dict[str, str]], properties: Optional[_models.AzureMonitorWorkspaceUpdateProperties])` + - Method `AzureMonitorWorkspaceUpdate.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `AzureMonitorWorkspaceUpdateProperties.__init__` has a new overload `def __init__(self: None, metrics: Optional[_models.Metrics])` + - Method `AzureMonitorWorkspaceUpdateProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `BatchProcessor.__init__` has a new overload `def __init__(self: None, batch_size: Optional[int], timeout: Optional[int])` + - Method `BatchProcessor.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `CacheConfiguration.__init__` has a new overload `def __init__(self: None, max_storage_usage: Optional[int], retention_period: Optional[int])` + - Method `CacheConfiguration.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ConcurrencyConfiguration.__init__` has a new overload `def __init__(self: None, worker_count: Optional[int], batch_queue_size: Optional[int])` + - Method `ConcurrencyConfiguration.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `Exporter.__init__` has a new overload `def __init__(self: None, type: Union[str, _models.ExporterType], name: str, azure_monitor_workspace_logs: Optional[_models.AzureMonitorWorkspaceLogsExporter], tcp: Optional[_models.TcpExporter])` + - Method `Exporter.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ExtendedLocation.__init__` has a new overload `def __init__(self: None, name: str, type: Union[str, _models.ExtendedLocationType])` + - Method `ExtendedLocation.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `NetworkingConfiguration.__init__` has a new overload `def __init__(self: None, external_networking_mode: Union[str, _models.ExternalNetworkingMode], routes: List[_models.NetworkingRoute], host: Optional[str])` + - Method `NetworkingConfiguration.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `NetworkingRoute.__init__` has a new overload `def __init__(self: None, receiver: str, port: Optional[int], path: Optional[str], subdomain: Optional[str])` + - Method `NetworkingRoute.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `OtlpReceiver.__init__` has a new overload `def __init__(self: None, endpoint: str)` + - Method `OtlpReceiver.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PersistenceConfigurations.__init__` has a new overload `def __init__(self: None, persistent_volume_name: str)` + - Method `PersistenceConfigurations.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `Pipeline.__init__` has a new overload `def __init__(self: None, name: str, type: Union[str, _models.PipelineType], receivers: List[str], exporters: List[str], processors: Optional[List[str]])` + - Method `Pipeline.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PipelineGroup.__init__` has a new overload `def __init__(self: None, location: str, tags: Optional[Dict[str, str]], properties: Optional[_models.PipelineGroupProperties], extended_location: Optional[_models.ExtendedLocation])` + - Method `PipelineGroup.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PipelineGroup.__init__` has a new overload `def __init__(self: None, location: str, tags: Optional[Dict[str, str]])` + - Method `PipelineGroup.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PipelineGroupProperties.__init__` has a new overload `def __init__(self: None, receivers: List[_models.Receiver], processors: List[_models.Processor], exporters: List[_models.Exporter], service: _models.Service, replicas: Optional[int], networking_configurations: Optional[List[_models.NetworkingConfiguration]])` + - Method `PipelineGroupProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PipelineGroupUpdate.__init__` has a new overload `def __init__(self: None, tags: Optional[Dict[str, str]], properties: Optional[_models.PipelineGroupUpdateProperties])` + - Method `PipelineGroupUpdate.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PipelineGroupUpdateProperties.__init__` has a new overload `def __init__(self: None, replicas: Optional[int], receivers: Optional[List[_models.Receiver]], processors: Optional[List[_models.Processor]], exporters: Optional[List[_models.Exporter]], service: Optional[_models.Service], networking_configurations: Optional[List[_models.NetworkingConfiguration]])` + - Method `PipelineGroupUpdateProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PrivateEndpointConnectionProperties.__init__` has a new overload `def __init__(self: None, private_link_service_connection_state: _models.PrivateLinkServiceConnectionState, private_endpoint: Optional[_models.PrivateEndpoint])` + - Method `PrivateEndpointConnectionProperties.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `PrivateLinkServiceConnectionState.__init__` has a new overload `def __init__(self: None, status: Optional[Union[str, _models.PrivateEndpointServiceConnectionStatus]], description: Optional[str], actions_required: Optional[str])` + - Method `PrivateLinkServiceConnectionState.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `Processor.__init__` has a new overload `def __init__(self: None, type: Union[str, _models.ProcessorType], name: str, batch: Optional[_models.BatchProcessor])` + - Method `Processor.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `Receiver.__init__` has a new overload `def __init__(self: None, type: Union[str, _models.ReceiverType], name: str, syslog: Optional[_models.SyslogReceiver], otlp: Optional[_models.OtlpReceiver], udp: Optional[_models.UdpReceiver])` + - Method `Receiver.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `RecordMap.__init__` has a new overload `def __init__(self: None, from_property: str, to: str)` + - Method `RecordMap.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ResourceMap.__init__` has a new overload `def __init__(self: None, from_property: str, to: str)` + - Method `ResourceMap.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `SchemaMap.__init__` has a new overload `def __init__(self: None, record_map: List[_models.RecordMap], resource_map: Optional[List[_models.ResourceMap]], scope_map: Optional[List[_models.ScopeMap]])` + - Method `SchemaMap.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `ScopeMap.__init__` has a new overload `def __init__(self: None, from_property: str, to: str)` + - Method `ScopeMap.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `Service.__init__` has a new overload `def __init__(self: None, pipelines: List[_models.Pipeline], persistence: Optional[_models.PersistenceConfigurations])` + - Method `Service.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `SyslogReceiver.__init__` has a new overload `def __init__(self: None, endpoint: str, protocol: Optional[Union[str, _models.SyslogProtocol]])` + - Method `SyslogReceiver.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `TcpExporter.__init__` has a new overload `def __init__(self: None, url: str)` + - Method `TcpExporter.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `TrackedResource.__init__` has a new overload `def __init__(self: None, location: str, tags: Optional[Dict[str, str]])` + - Method `TrackedResource.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `UdpReceiver.__init__` has a new overload `def __init__(self: None, endpoint: str, encoding: Optional[Union[str, _models.StreamEncodingType]], read_queue_length: Optional[int])` + - Method `UdpReceiver.__init__` has a new overload `def __init__(self: None, mapping: Mapping[str, Any])` + - Method `AzureMonitorWorkspacesOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, azure_monitor_workspace_name: str, resource: AzureMonitorWorkspace, content_type: str)` + - Method `AzureMonitorWorkspacesOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, azure_monitor_workspace_name: str, resource: JSON, content_type: str)` + - Method `AzureMonitorWorkspacesOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, azure_monitor_workspace_name: str, resource: IO[bytes], content_type: str)` + - Method `AzureMonitorWorkspacesOperations.update` has a new overload `def update(self: None, resource_group_name: str, azure_monitor_workspace_name: str, properties: AzureMonitorWorkspaceUpdate, content_type: str)` + - Method `AzureMonitorWorkspacesOperations.update` has a new overload `def update(self: None, resource_group_name: str, azure_monitor_workspace_name: str, properties: JSON, content_type: str)` + - Method `AzureMonitorWorkspacesOperations.update` has a new overload `def update(self: None, resource_group_name: str, azure_monitor_workspace_name: str, properties: IO[bytes], content_type: str)` + - Method `PipelineGroupsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, pipeline_group_name: str, resource: PipelineGroup, content_type: str)` + - Method `PipelineGroupsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, pipeline_group_name: str, resource: JSON, content_type: str)` + - Method `PipelineGroupsOperations.begin_create_or_update` has a new overload `def begin_create_or_update(self: None, resource_group_name: str, pipeline_group_name: str, resource: IO[bytes], content_type: str)` + - Method `PipelineGroupsOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, pipeline_group_name: str, properties: PipelineGroupUpdate, content_type: str)` + - Method `PipelineGroupsOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, pipeline_group_name: str, properties: JSON, content_type: str)` + - Method `PipelineGroupsOperations.begin_update` has a new overload `def begin_update(self: None, resource_group_name: str, pipeline_group_name: str, properties: IO[bytes], content_type: str)` + +### Breaking Changes + + - Deleted or renamed client operation group `MonitorManagementClient.action_groups` + - 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.scheduled_query_rules` + - 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` + - Method `Operations.list` changed from `asynchronous` to `synchronous` + - Model `ErrorAdditionalInfo` deleted or renamed its instance variable `additional_properties` + - Model `ErrorDetail` deleted or renamed its instance variable `additional_properties` + - Model `ErrorResponse` deleted or renamed its instance variable `code` + - Model `ErrorResponse` deleted or renamed its instance variable `message` + - Model `ErrorResponse` deleted or renamed its instance variable `additional_properties` + - Model `Operation` deleted or renamed its instance variable `additional_properties` + - Model `OperationDisplay` deleted or renamed its instance variable `additional_properties` + - Model `PrivateEndpointConnection` deleted or renamed its instance variable `private_endpoint` + - Model `PrivateEndpointConnection` deleted or renamed its instance variable `private_link_service_connection_state` + - Model `PrivateEndpointConnection` deleted or renamed its instance variable `provisioning_state` + - Model `PrivateEndpointConnection` deleted or renamed its instance variable `additional_properties` + - Deleted or renamed enum value `ProvisioningState.DEPLOYING` + - Model `Resource` deleted or renamed its instance variable `location` + - Model `Resource` deleted or renamed its instance variable `tags` + - Model `Resource` deleted or renamed its instance variable `additional_properties` + - Model `SystemData` deleted or renamed its instance variable `additional_properties` + - Deleted or renamed model `Action` + - Deleted or renamed model `ActionDetail` + - Deleted or renamed model `ActionGroupList` + - Deleted or renamed model `ActionGroupPatchBody` + - Deleted or renamed model `ActionGroupResource` + - 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 `AlertSeverity` + - Deleted or renamed model `AlertingAction` + - Deleted or renamed model `ArmRoleReceiver` + - Deleted or renamed model `AutomationRunbookReceiver` + - 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 `AzureAppPushReceiver` + - Deleted or renamed model `AzureFunctionReceiver` + - Deleted or renamed model `AzureMonitorPrivateLinkScope` + - Deleted or renamed model `AzureResource` + - 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 `Context` + - Deleted or renamed model `Criteria` + - Deleted or renamed model `CriterionType` + - 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 `Dimension` + - 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 `EmailReceiver` + - Deleted or renamed model `EnableRequest` + - Deleted or renamed model `Enabled` + - Deleted or renamed model `Error` + - Deleted or renamed model `ErrorContract` + - Deleted or renamed model `ErrorDetailAdditionalInfoItem` + - Deleted or renamed model `ErrorResponseAutoGenerated` + - 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 `EventHubReceiver` + - 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 `ItsmReceiver` + - 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 `LogicAppReceiver` + - 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 `NotificationRequestBody` + - Deleted or renamed model `Odatatype` + - Deleted or renamed model `OnboardingStatus` + - 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 `PrivateEndpointProperty` + - Deleted or renamed model `PrivateLinkResource` + - Deleted or renamed model `PrivateLinkScopesResource` + - Deleted or renamed model `PrivateLinkServiceConnectionStateProperty` + - Deleted or renamed model `ProxyOnlyResource` + - Deleted or renamed model `ProxyResource` + - Deleted or renamed model `QueryType` + - Deleted or renamed model `ReceiverStatus` + - Deleted or renamed model `Recurrence` + - Deleted or renamed model `RecurrenceFrequency` + - Deleted or renamed model `RecurrentSchedule` + - 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 `SmsReceiver` + - 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 `TestNotificationDetailsResponse` + - 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 `VoiceReceiver` + - Deleted or renamed model `WebhookNotification` + - Deleted or renamed model `WebhookReceiver` + - Deleted or renamed model `WebtestLocationAvailabilityCriteria` + - Deleted or renamed model `WorkspaceInfo` + - Deleted or renamed model `ActionGroupsOperations` + - 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 `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 `ScheduledQueryRulesOperations` + - 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..cfeb42cbaa6a 100644 --- a/sdk/monitor/azure-mgmt-monitor/_meta.json +++ b/sdk/monitor/azure-mgmt-monitor/_meta.json @@ -1,11 +1,6 @@ { - "commit": "a86a97dd03e0b9e692b5583e369feec3a579ef55", + "commit": "079f70d6f2b754db6b736e117196104efd2dd496", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest": "3.10.2", - "use": [ - "@autorest/python@6.27.4", - "@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", - "readme": "specification/monitor/resource-manager/readme.md" + "typespec_src": "specification/monitor/Microsoft.Monitor.Management", + "@azure-tools/typespec-python": "0.44.2" } \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/apiview-properties.json b/sdk/monitor/azure-mgmt-monitor/apiview-properties.json new file mode 100644 index 000000000000..5b176fff4444 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/apiview-properties.json @@ -0,0 +1,90 @@ +{ + "CrossLanguagePackageId": "Microsoft.Monitor", + "CrossLanguageDefinitionId": { + "azure.mgmt.monitor.models.Resource": "Azure.ResourceManager.CommonTypes.Resource", + "azure.mgmt.monitor.models.TrackedResource": "Azure.ResourceManager.CommonTypes.TrackedResource", + "azure.mgmt.monitor.models.AzureMonitorWorkspace": "Microsoft.Monitor.AzureMonitorWorkspace", + "azure.mgmt.monitor.models.AzureMonitorWorkspaceLogsApiConfig": "Microsoft.Monitor.AzureMonitorWorkspaceLogsApiConfig", + "azure.mgmt.monitor.models.AzureMonitorWorkspaceLogsExporter": "Microsoft.Monitor.AzureMonitorWorkspaceLogsExporter", + "azure.mgmt.monitor.models.AzureMonitorWorkspaceProperties": "Microsoft.Monitor.AzureMonitorWorkspaceProperties", + "azure.mgmt.monitor.models.AzureMonitorWorkspaceUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", + "azure.mgmt.monitor.models.AzureMonitorWorkspaceUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "azure.mgmt.monitor.models.BatchProcessor": "Microsoft.Monitor.BatchProcessor", + "azure.mgmt.monitor.models.CacheConfiguration": "Microsoft.Monitor.CacheConfiguration", + "azure.mgmt.monitor.models.ConcurrencyConfiguration": "Microsoft.Monitor.ConcurrencyConfiguration", + "azure.mgmt.monitor.models.ErrorAdditionalInfo": "Azure.ResourceManager.CommonTypes.ErrorAdditionalInfo", + "azure.mgmt.monitor.models.ErrorDetail": "Azure.ResourceManager.CommonTypes.ErrorDetail", + "azure.mgmt.monitor.models.ErrorResponse": "Azure.ResourceManager.CommonTypes.ErrorResponse", + "azure.mgmt.monitor.models.Exporter": "Microsoft.Monitor.Exporter", + "azure.mgmt.monitor.models.ExtendedLocation": "Azure.ResourceManager.CommonTypes.ExtendedLocation", + "azure.mgmt.monitor.models.IngestionSettings": "Microsoft.Monitor.IngestionSettings", + "azure.mgmt.monitor.models.Metrics": "Microsoft.Monitor.Metrics", + "azure.mgmt.monitor.models.NetworkingConfiguration": "Microsoft.Monitor.NetworkingConfiguration", + "azure.mgmt.monitor.models.NetworkingRoute": "Microsoft.Monitor.NetworkingRoute", + "azure.mgmt.monitor.models.Operation": "Azure.ResourceManager.CommonTypes.Operation", + "azure.mgmt.monitor.models.OperationDisplay": "Azure.ResourceManager.CommonTypes.OperationDisplay", + "azure.mgmt.monitor.models.OtlpReceiver": "Microsoft.Monitor.OtlpReceiver", + "azure.mgmt.monitor.models.PersistenceConfigurations": "Microsoft.Monitor.PersistenceConfigurations", + "azure.mgmt.monitor.models.Pipeline": "Microsoft.Monitor.Pipeline", + "azure.mgmt.monitor.models.PipelineGroup": "Microsoft.Monitor.PipelineGroup", + "azure.mgmt.monitor.models.PipelineGroupProperties": "Microsoft.Monitor.PipelineGroupProperties", + "azure.mgmt.monitor.models.PipelineGroupUpdate": "Azure.ResourceManager.Foundations.ResourceUpdateModel", + "azure.mgmt.monitor.models.PipelineGroupUpdateProperties": "Azure.ResourceManager.Foundations.ResourceUpdateModelProperties", + "azure.mgmt.monitor.models.PrivateEndpoint": "Azure.ResourceManager.CommonTypes.PrivateEndpoint", + "azure.mgmt.monitor.models.PrivateEndpointConnection": "Azure.ResourceManager.CommonTypes.PrivateEndpointConnection", + "azure.mgmt.monitor.models.PrivateEndpointConnectionProperties": "Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProperties", + "azure.mgmt.monitor.models.PrivateLinkServiceConnectionState": "Azure.ResourceManager.CommonTypes.PrivateLinkServiceConnectionState", + "azure.mgmt.monitor.models.Processor": "Microsoft.Monitor.Processor", + "azure.mgmt.monitor.models.Receiver": "Microsoft.Monitor.Receiver", + "azure.mgmt.monitor.models.RecordMap": "Microsoft.Monitor.RecordMap", + "azure.mgmt.monitor.models.ResourceMap": "Microsoft.Monitor.ResourceMap", + "azure.mgmt.monitor.models.SchemaMap": "Microsoft.Monitor.SchemaMap", + "azure.mgmt.monitor.models.ScopeMap": "Microsoft.Monitor.ScopeMap", + "azure.mgmt.monitor.models.Service": "Microsoft.Monitor.Service", + "azure.mgmt.monitor.models.SyslogReceiver": "Microsoft.Monitor.SyslogReceiver", + "azure.mgmt.monitor.models.SystemData": "Azure.ResourceManager.CommonTypes.SystemData", + "azure.mgmt.monitor.models.TcpExporter": "Microsoft.Monitor.TcpExporter", + "azure.mgmt.monitor.models.UdpReceiver": "Microsoft.Monitor.UdpReceiver", + "azure.mgmt.monitor.models.Origin": "Azure.ResourceManager.CommonTypes.Origin", + "azure.mgmt.monitor.models.ActionType": "Azure.ResourceManager.CommonTypes.ActionType", + "azure.mgmt.monitor.models.CreatedByType": "Azure.ResourceManager.CommonTypes.createdByType", + "azure.mgmt.monitor.models.ProvisioningState": "Microsoft.Monitor.ProvisioningState", + "azure.mgmt.monitor.models.PrivateEndpointServiceConnectionStatus": "Azure.ResourceManager.CommonTypes.PrivateEndpointServiceConnectionStatus", + "azure.mgmt.monitor.models.PrivateEndpointConnectionProvisioningState": "Azure.ResourceManager.CommonTypes.PrivateEndpointConnectionProvisioningState", + "azure.mgmt.monitor.models.PublicNetworkAccess": "Microsoft.Monitor.PublicNetworkAccess", + "azure.mgmt.monitor.models.ReceiverType": "Microsoft.Monitor.ReceiverType", + "azure.mgmt.monitor.models.SyslogProtocol": "Microsoft.Monitor.SyslogProtocol", + "azure.mgmt.monitor.models.StreamEncodingType": "Microsoft.Monitor.StreamEncodingType", + "azure.mgmt.monitor.models.ProcessorType": "Microsoft.Monitor.ProcessorType", + "azure.mgmt.monitor.models.ExporterType": "Microsoft.Monitor.ExporterType", + "azure.mgmt.monitor.models.PipelineType": "Microsoft.Monitor.PipelineType", + "azure.mgmt.monitor.models.ExternalNetworkingMode": "Microsoft.Monitor.ExternalNetworkingMode", + "azure.mgmt.monitor.models.ExtendedLocationType": "Azure.ResourceManager.CommonTypes.ExtendedLocationType", + "azure.mgmt.monitor.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.monitor.aio.operations.Operations.list": "Azure.ResourceManager.Operations.list", + "azure.mgmt.monitor.operations.AzureMonitorWorkspacesOperations.get": "Microsoft.Monitor.AzureMonitorWorkspaces.get", + "azure.mgmt.monitor.aio.operations.AzureMonitorWorkspacesOperations.get": "Microsoft.Monitor.AzureMonitorWorkspaces.get", + "azure.mgmt.monitor.operations.AzureMonitorWorkspacesOperations.begin_create_or_update": "Microsoft.Monitor.AzureMonitorWorkspaces.createOrUpdate", + "azure.mgmt.monitor.aio.operations.AzureMonitorWorkspacesOperations.begin_create_or_update": "Microsoft.Monitor.AzureMonitorWorkspaces.createOrUpdate", + "azure.mgmt.monitor.operations.AzureMonitorWorkspacesOperations.update": "Microsoft.Monitor.AzureMonitorWorkspaces.update", + "azure.mgmt.monitor.aio.operations.AzureMonitorWorkspacesOperations.update": "Microsoft.Monitor.AzureMonitorWorkspaces.update", + "azure.mgmt.monitor.operations.AzureMonitorWorkspacesOperations.begin_delete": "Microsoft.Monitor.AzureMonitorWorkspaces.delete", + "azure.mgmt.monitor.aio.operations.AzureMonitorWorkspacesOperations.begin_delete": "Microsoft.Monitor.AzureMonitorWorkspaces.delete", + "azure.mgmt.monitor.operations.AzureMonitorWorkspacesOperations.list_by_resource_group": "Microsoft.Monitor.AzureMonitorWorkspaces.listByResourceGroup", + "azure.mgmt.monitor.aio.operations.AzureMonitorWorkspacesOperations.list_by_resource_group": "Microsoft.Monitor.AzureMonitorWorkspaces.listByResourceGroup", + "azure.mgmt.monitor.operations.AzureMonitorWorkspacesOperations.list_by_subscription": "Microsoft.Monitor.AzureMonitorWorkspaces.listBySubscription", + "azure.mgmt.monitor.aio.operations.AzureMonitorWorkspacesOperations.list_by_subscription": "Microsoft.Monitor.AzureMonitorWorkspaces.listBySubscription", + "azure.mgmt.monitor.operations.PipelineGroupsOperations.get": "Microsoft.Monitor.PipelineGroups.get", + "azure.mgmt.monitor.aio.operations.PipelineGroupsOperations.get": "Microsoft.Monitor.PipelineGroups.get", + "azure.mgmt.monitor.operations.PipelineGroupsOperations.begin_create_or_update": "Microsoft.Monitor.PipelineGroups.createOrUpdate", + "azure.mgmt.monitor.aio.operations.PipelineGroupsOperations.begin_create_or_update": "Microsoft.Monitor.PipelineGroups.createOrUpdate", + "azure.mgmt.monitor.operations.PipelineGroupsOperations.begin_delete": "Microsoft.Monitor.PipelineGroups.delete", + "azure.mgmt.monitor.aio.operations.PipelineGroupsOperations.begin_delete": "Microsoft.Monitor.PipelineGroups.delete", + "azure.mgmt.monitor.operations.PipelineGroupsOperations.begin_update": "Microsoft.Monitor.PipelineGroups.update", + "azure.mgmt.monitor.aio.operations.PipelineGroupsOperations.begin_update": "Microsoft.Monitor.PipelineGroups.update", + "azure.mgmt.monitor.operations.PipelineGroupsOperations.list_by_resource_group": "Microsoft.Monitor.PipelineGroups.listByResourceGroup", + "azure.mgmt.monitor.aio.operations.PipelineGroupsOperations.list_by_resource_group": "Microsoft.Monitor.PipelineGroups.listByResourceGroup", + "azure.mgmt.monitor.operations.PipelineGroupsOperations.list_by_subscription": "Microsoft.Monitor.PipelineGroups.listBySubscription", + "azure.mgmt.monitor.aio.operations.PipelineGroupsOperations.list_by_subscription": "Microsoft.Monitor.PipelineGroups.listBySubscription" + } +} \ No newline at end of file diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/__init__.py index 42cc62301757..9f0bfd4504e2 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._monitor_management_client import MonitorManagementClient # type: ignore +from ._client import MonitorManagementClient # type: ignore from ._version import VERSION __version__ = VERSION diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_client.py new file mode 100644 index 000000000000..0e360a245cbb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_client.py @@ -0,0 +1,132 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +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 ._configuration import MonitorManagementClientConfiguration +from ._utils.serialization import Deserializer, Serializer +from .operations import AzureMonitorWorkspacesOperations, Operations, PipelineGroupsOperations + +if TYPE_CHECKING: + from azure.core.credentials import TokenCredential + + +class MonitorManagementClient: + """Provides operations for working with Azure Monitor. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.monitor.operations.Operations + :ivar azure_monitor_workspaces: AzureMonitorWorkspacesOperations operations + :vartype azure_monitor_workspaces: + azure.mgmt.monitor.operations.AzureMonitorWorkspacesOperations + :ivar pipeline_groups: PipelineGroupsOperations operations + :vartype pipeline_groups: azure.mgmt.monitor.operations.PipelineGroupsOperations + :param credential: Credential used to authenticate requests to the service. Required. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :param base_url: Service host. Default value is None. + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is + "2023-10-01-preview". Note that overriding this default value may result in unsupported + behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, credential: "TokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + ) -> None: + _endpoint = "{endpoint}" + _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, + base_url=cast(str, base_url), + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + ARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: ARMPipelineClient = ARMPipelineClient(base_url=cast(str, _endpoint), policies=_policies, **kwargs) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.azure_monitor_workspaces = AzureMonitorWorkspacesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.pipeline_groups = PipelineGroupsOperations(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. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + def close(self) -> None: + self._client.close() + + def __enter__(self) -> Self: + self._client.__enter__() + return self + + def __exit__(self, *exc_details: Any) -> None: + self._client.__exit__(*exc_details) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_configuration.py index 09aa0711746e..47f671cf2103 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -23,13 +23,27 @@ class MonitorManagementClientConfiguration: # pylint: disable=too-many-instance Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is + "2023-10-01-preview". Note that overriding this default value may result in unsupported + behavior. + :paramtype api_version: str """ - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2023-10-01-preview") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -37,6 +51,8 @@ def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url + self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-monitor/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) 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 deleted file mode 100644 index df9319e1ae77..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_monitor_management_client.py +++ /dev/null @@ -1,273 +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 copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -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, -) - -if TYPE_CHECKING: - from azure.core.credentials import TokenCredential - - -class MonitorManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """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". - :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 - ) -> None: - self._config = MonitorManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - 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) - - 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. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_patch.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_patch.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize 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..8026245c2abc --- /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) Python 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/_utils/model_base.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_utils/model_base.py new file mode 100644 index 000000000000..49d5c7259389 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_utils/model_base.py @@ -0,0 +1,1232 @@ +# pylint: disable=too-many-lines +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=protected-access, broad-except + +import copy +import calendar +import decimal +import functools +import sys +import logging +import base64 +import re +import typing +import enum +import email.utils +from datetime import datetime, date, time, timedelta, timezone +from json import JSONEncoder +import xml.etree.ElementTree as ET +from collections.abc import MutableMapping +from typing_extensions import Self +import isodate +from azure.core.exceptions import DeserializationError +from azure.core import CaseInsensitiveEnumMeta +from azure.core.pipeline import PipelineResponse +from azure.core.serialization import _Null + +_LOGGER = logging.getLogger(__name__) + +__all__ = ["SdkJSONEncoder", "Model", "rest_field", "rest_discriminator"] + +TZ_UTC = timezone.utc +_T = typing.TypeVar("_T") + + +def _timedelta_as_isostr(td: timedelta) -> str: + """Converts a datetime.timedelta object into an ISO 8601 formatted string, e.g. 'P4DT12H30M05S' + + Function adapted from the Tin Can Python project: https://github.com/RusticiSoftware/TinCanPython + + :param timedelta td: The timedelta to convert + :rtype: str + :return: ISO8601 version of this timedelta + """ + + # Split seconds to larger units + seconds = td.total_seconds() + minutes, seconds = divmod(seconds, 60) + hours, minutes = divmod(minutes, 60) + days, hours = divmod(hours, 24) + + days, hours, minutes = list(map(int, (days, hours, minutes))) + seconds = round(seconds, 6) + + # Build date + date_str = "" + if days: + date_str = "%sD" % days + + if hours or minutes or seconds: + # Build time + time_str = "T" + + # Hours + bigger_exists = date_str or hours + if bigger_exists: + time_str += "{:02}H".format(hours) + + # Minutes + bigger_exists = bigger_exists or minutes + if bigger_exists: + time_str += "{:02}M".format(minutes) + + # Seconds + try: + if seconds.is_integer(): + seconds_string = "{:02}".format(int(seconds)) + else: + # 9 chars long w/ leading 0, 6 digits after decimal + seconds_string = "%09.6f" % seconds + # Remove trailing zeros + seconds_string = seconds_string.rstrip("0") + except AttributeError: # int.is_integer() raises + seconds_string = "{:02}".format(seconds) + + time_str += "{}S".format(seconds_string) + else: + time_str = "" + + return "P" + date_str + time_str + + +def _serialize_bytes(o, format: typing.Optional[str] = None) -> str: + encoded = base64.b64encode(o).decode() + if format == "base64url": + return encoded.strip("=").replace("+", "-").replace("/", "_") + return encoded + + +def _serialize_datetime(o, format: typing.Optional[str] = None): + if hasattr(o, "year") and hasattr(o, "hour"): + if format == "rfc7231": + return email.utils.format_datetime(o, usegmt=True) + if format == "unix-timestamp": + return int(calendar.timegm(o.utctimetuple())) + + # astimezone() fails for naive times in Python 2.7, so make make sure o is aware (tzinfo is set) + if not o.tzinfo: + iso_formatted = o.replace(tzinfo=TZ_UTC).isoformat() + else: + iso_formatted = o.astimezone(TZ_UTC).isoformat() + # Replace the trailing "+00:00" UTC offset with "Z" (RFC 3339: https://www.ietf.org/rfc/rfc3339.txt) + return iso_formatted.replace("+00:00", "Z") + # Next try datetime.date or datetime.time + return o.isoformat() + + +def _is_readonly(p): + try: + return p._visibility == ["read"] + except AttributeError: + return False + + +class SdkJSONEncoder(JSONEncoder): + """A JSON encoder that's capable of serializing datetime objects and bytes.""" + + def __init__(self, *args, exclude_readonly: bool = False, format: typing.Optional[str] = None, **kwargs): + super().__init__(*args, **kwargs) + self.exclude_readonly = exclude_readonly + self.format = format + + def default(self, o): # pylint: disable=too-many-return-statements + if _is_model(o): + if self.exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + return {k: v for k, v in o.items() if k not in readonly_props} + return dict(o.items()) + try: + return super(SdkJSONEncoder, self).default(o) + except TypeError: + if isinstance(o, _Null): + return None + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, self.format) + try: + # First try datetime.datetime + return _serialize_datetime(o, self.format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return super(SdkJSONEncoder, self).default(o) + + +_VALID_DATE = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" + r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") +_VALID_RFC7231 = re.compile( + r"(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s\d{2}\s" + r"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\s\d{2}:\d{2}:\d{2}\sGMT" +) + + +def _deserialize_datetime(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize ISO-8601 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + attr = attr.upper() + match = _VALID_DATE.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + check_decimal = attr.split(".") + if len(check_decimal) > 1: + decimal_str = "" + for digit in check_decimal[1]: + if digit.isdigit(): + decimal_str += digit + else: + break + if len(decimal_str) > 6: + attr = attr.replace(decimal_str, decimal_str[0:6]) + + date_obj = isodate.parse_datetime(attr) + test_utc = date_obj.utctimetuple() + if test_utc.tm_year > 9999 or test_utc.tm_year < 1: + raise OverflowError("Hit max or min date") + return date_obj + + +def _deserialize_datetime_rfc7231(attr: typing.Union[str, datetime]) -> datetime: + """Deserialize RFC7231 formatted string into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + match = _VALID_RFC7231.match(attr) + if not match: + raise ValueError("Invalid datetime string: " + attr) + + return email.utils.parsedate_to_datetime(attr) + + +def _deserialize_datetime_unix_timestamp(attr: typing.Union[float, datetime]) -> datetime: + """Deserialize unix timestamp into Datetime object. + + :param str attr: response string to be deserialized. + :rtype: ~datetime.datetime + :returns: The datetime object from that input + """ + if isinstance(attr, datetime): + # i'm already deserialized + return attr + return datetime.fromtimestamp(attr, TZ_UTC) + + +def _deserialize_date(attr: typing.Union[str, date]) -> date: + """Deserialize ISO-8601 formatted string into Date object. + :param str attr: response string to be deserialized. + :rtype: date + :returns: The date object from that input + """ + # This must NOT use defaultmonth/defaultday. Using None ensure this raises an exception. + if isinstance(attr, date): + return attr + return isodate.parse_date(attr, defaultmonth=None, defaultday=None) # type: ignore + + +def _deserialize_time(attr: typing.Union[str, time]) -> time: + """Deserialize ISO-8601 formatted string into time object. + + :param str attr: response string to be deserialized. + :rtype: datetime.time + :returns: The time object from that input + """ + if isinstance(attr, time): + return attr + return isodate.parse_time(attr) + + +def _deserialize_bytes(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + return bytes(base64.b64decode(attr)) + + +def _deserialize_bytes_base64(attr): + if isinstance(attr, (bytes, bytearray)): + return attr + padding = "=" * (3 - (len(attr) + 3) % 4) # type: ignore + attr = attr + padding # type: ignore + encoded = attr.replace("-", "+").replace("_", "/") + return bytes(base64.b64decode(encoded)) + + +def _deserialize_duration(attr): + if isinstance(attr, timedelta): + return attr + return isodate.parse_duration(attr) + + +def _deserialize_decimal(attr): + if isinstance(attr, decimal.Decimal): + return attr + return decimal.Decimal(str(attr)) + + +def _deserialize_int_as_str(attr): + if isinstance(attr, int): + return attr + return int(attr) + + +_DESERIALIZE_MAPPING = { + datetime: _deserialize_datetime, + date: _deserialize_date, + time: _deserialize_time, + bytes: _deserialize_bytes, + bytearray: _deserialize_bytes, + timedelta: _deserialize_duration, + typing.Any: lambda x: x, + decimal.Decimal: _deserialize_decimal, +} + +_DESERIALIZE_MAPPING_WITHFORMAT = { + "rfc3339": _deserialize_datetime, + "rfc7231": _deserialize_datetime_rfc7231, + "unix-timestamp": _deserialize_datetime_unix_timestamp, + "base64": _deserialize_bytes, + "base64url": _deserialize_bytes_base64, +} + + +def get_deserializer(annotation: typing.Any, rf: typing.Optional["_RestField"] = None): + if annotation is int and rf and rf._format == "str": + return _deserialize_int_as_str + if rf and rf._format: + return _DESERIALIZE_MAPPING_WITHFORMAT.get(rf._format) + return _DESERIALIZE_MAPPING.get(annotation) # pyright: ignore + + +def _get_type_alias_type(module_name: str, alias_name: str): + types = { + k: v + for k, v in sys.modules[module_name].__dict__.items() + if isinstance(v, typing._GenericAlias) # type: ignore + } + if alias_name not in types: + return alias_name + return types[alias_name] + + +def _get_model(module_name: str, model_name: str): + models = {k: v for k, v in sys.modules[module_name].__dict__.items() if isinstance(v, type)} + module_end = module_name.rsplit(".", 1)[0] + models.update({k: v for k, v in sys.modules[module_end].__dict__.items() if isinstance(v, type)}) + if isinstance(model_name, str): + model_name = model_name.split(".")[-1] + if model_name not in models: + return model_name + return models[model_name] + + +_UNSET = object() + + +class _MyMutableMapping(MutableMapping[str, typing.Any]): + def __init__(self, data: typing.Dict[str, typing.Any]) -> None: + self._data = data + + def __contains__(self, key: typing.Any) -> bool: + return key in self._data + + def __getitem__(self, key: str) -> typing.Any: + return self._data.__getitem__(key) + + def __setitem__(self, key: str, value: typing.Any) -> None: + self._data.__setitem__(key, value) + + def __delitem__(self, key: str) -> None: + self._data.__delitem__(key) + + def __iter__(self) -> typing.Iterator[typing.Any]: + return self._data.__iter__() + + def __len__(self) -> int: + return self._data.__len__() + + def __ne__(self, other: typing.Any) -> bool: + return not self.__eq__(other) + + def keys(self) -> typing.KeysView[str]: + """ + :returns: a set-like object providing a view on D's keys + :rtype: ~typing.KeysView + """ + return self._data.keys() + + def values(self) -> typing.ValuesView[typing.Any]: + """ + :returns: an object providing a view on D's values + :rtype: ~typing.ValuesView + """ + return self._data.values() + + def items(self) -> typing.ItemsView[str, typing.Any]: + """ + :returns: set-like object providing a view on D's items + :rtype: ~typing.ItemsView + """ + return self._data.items() + + def get(self, key: str, default: typing.Any = None) -> typing.Any: + """ + Get the value for key if key is in the dictionary, else default. + :param str key: The key to look up. + :param any default: The value to return if key is not in the dictionary. Defaults to None + :returns: D[k] if k in D, else d. + :rtype: any + """ + try: + return self[key] + except KeyError: + return default + + @typing.overload + def pop(self, key: str) -> typing.Any: ... # pylint: disable=arguments-differ + + @typing.overload + def pop(self, key: str, default: _T) -> _T: ... # pylint: disable=signature-differs + + @typing.overload + def pop(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Removes specified key and return the corresponding value. + :param str key: The key to pop. + :param any default: The value to return if key is not in the dictionary + :returns: The value corresponding to the key. + :rtype: any + :raises KeyError: If key is not found and default is not given. + """ + if default is _UNSET: + return self._data.pop(key) + return self._data.pop(key, default) + + def popitem(self) -> typing.Tuple[str, typing.Any]: + """ + Removes and returns some (key, value) pair + :returns: The (key, value) pair. + :rtype: tuple + :raises KeyError: if D is empty. + """ + return self._data.popitem() + + def clear(self) -> None: + """ + Remove all items from D. + """ + self._data.clear() + + def update(self, *args: typing.Any, **kwargs: typing.Any) -> None: # pylint: disable=arguments-differ + """ + Updates D from mapping/iterable E and F. + :param any args: Either a mapping object or an iterable of key-value pairs. + """ + self._data.update(*args, **kwargs) + + @typing.overload + def setdefault(self, key: str, default: None = None) -> None: ... + + @typing.overload + def setdefault(self, key: str, default: typing.Any) -> typing.Any: ... # pylint: disable=signature-differs + + def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any: + """ + Same as calling D.get(k, d), and setting D[k]=d if k not found + :param str key: The key to look up. + :param any default: The value to set if key is not in the dictionary + :returns: D[k] if k in D, else d. + :rtype: any + """ + if default is _UNSET: + return self._data.setdefault(key) + return self._data.setdefault(key, default) + + def __eq__(self, other: typing.Any) -> bool: + try: + other_model = self.__class__(other) + except Exception: + return False + return self._data == other_model._data + + def __repr__(self) -> str: + return str(self._data) + + +def _is_model(obj: typing.Any) -> bool: + return getattr(obj, "_is_model", False) + + +def _serialize(o, format: typing.Optional[str] = None): # pylint: disable=too-many-return-statements + if isinstance(o, list): + return [_serialize(x, format) for x in o] + if isinstance(o, dict): + return {k: _serialize(v, format) for k, v in o.items()} + if isinstance(o, set): + return {_serialize(x, format) for x in o} + if isinstance(o, tuple): + return tuple(_serialize(x, format) for x in o) + if isinstance(o, (bytes, bytearray)): + return _serialize_bytes(o, format) + if isinstance(o, decimal.Decimal): + return float(o) + if isinstance(o, enum.Enum): + return o.value + if isinstance(o, int): + if format == "str": + return str(o) + return o + try: + # First try datetime.datetime + return _serialize_datetime(o, format) + except AttributeError: + pass + # Last, try datetime.timedelta + try: + return _timedelta_as_isostr(o) + except AttributeError: + # This will be raised when it hits value.total_seconds in the method above + pass + return o + + +def _get_rest_field( + attr_to_rest_field: typing.Dict[str, "_RestField"], rest_name: str +) -> typing.Optional["_RestField"]: + try: + return next(rf for rf in attr_to_rest_field.values() if rf._rest_name == rest_name) + except StopIteration: + return None + + +def _create_value(rf: typing.Optional["_RestField"], value: typing.Any) -> typing.Any: + if not rf: + return _serialize(value, None) + if rf._is_multipart_file_input: + return value + if rf._is_model: + return _deserialize(rf._type, value) + if isinstance(value, ET.Element): + value = _deserialize(rf._type, value) + return _serialize(value, rf._format) + + +class Model(_MyMutableMapping): + _is_model = True + # label whether current class's _attr_to_rest_field has been calculated + # could not see _attr_to_rest_field directly because subclass inherits it from parent class + _calculated: typing.Set[str] = set() + + def __init__(self, *args: typing.Any, **kwargs: typing.Any) -> None: + class_name = self.__class__.__name__ + if len(args) > 1: + raise TypeError(f"{class_name}.__init__() takes 2 positional arguments but {len(args) + 1} were given") + dict_to_pass = { + rest_field._rest_name: rest_field._default + for rest_field in self._attr_to_rest_field.values() + if rest_field._default is not _UNSET + } + if args: # pylint: disable=too-many-nested-blocks + if isinstance(args[0], ET.Element): + existed_attr_keys = [] + model_meta = getattr(self, "_xml", {}) + + for rf in self._attr_to_rest_field.values(): + prop_meta = getattr(rf, "_xml", {}) + xml_name = prop_meta.get("name", rf._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + # attribute + if prop_meta.get("attribute", False) and args[0].get(xml_name) is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].get(xml_name)) + continue + + # unwrapped element is array + if prop_meta.get("unwrapped", False): + # unwrapped array could either use prop items meta/prop meta + if prop_meta.get("itemsName"): + xml_name = prop_meta.get("itemsName") + xml_ns = prop_meta.get("itemNs") + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + items = args[0].findall(xml_name) # pyright: ignore + if len(items) > 0: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, items) + continue + + # text element is primitive type + if prop_meta.get("text", False): + if args[0].text is not None: + dict_to_pass[rf._rest_name] = _deserialize(rf._type, args[0].text) + continue + + # wrapped element could be normal property or array, it should only have one element + item = args[0].find(xml_name) + if item is not None: + existed_attr_keys.append(xml_name) + dict_to_pass[rf._rest_name] = _deserialize(rf._type, item) + + # rest thing is additional properties + for e in args[0]: + if e.tag not in existed_attr_keys: + dict_to_pass[e.tag] = _convert_element(e) + else: + dict_to_pass.update( + {k: _create_value(_get_rest_field(self._attr_to_rest_field, k), v) for k, v in args[0].items()} + ) + else: + non_attr_kwargs = [k for k in kwargs if k not in self._attr_to_rest_field] + if non_attr_kwargs: + # actual type errors only throw the first wrong keyword arg they see, so following that. + raise TypeError(f"{class_name}.__init__() got an unexpected keyword argument '{non_attr_kwargs[0]}'") + dict_to_pass.update( + { + self._attr_to_rest_field[k]._rest_name: _create_value(self._attr_to_rest_field[k], v) + for k, v in kwargs.items() + if v is not None + } + ) + super().__init__(dict_to_pass) + + def copy(self) -> "Model": + return Model(self.__dict__) + + def __new__(cls, *args: typing.Any, **kwargs: typing.Any) -> Self: + if f"{cls.__module__}.{cls.__qualname__}" not in cls._calculated: + # we know the last nine classes in mro are going to be 'Model', '_MyMutableMapping', 'MutableMapping', + # 'Mapping', 'Collection', 'Sized', 'Iterable', 'Container' and 'object' + mros = cls.__mro__[:-9][::-1] # ignore parents, and reverse the mro order + attr_to_rest_field: typing.Dict[str, _RestField] = { # map attribute name to rest_field property + k: v for mro_class in mros for k, v in mro_class.__dict__.items() if k[0] != "_" and hasattr(v, "_type") + } + annotations = { + k: v + for mro_class in mros + if hasattr(mro_class, "__annotations__") + for k, v in mro_class.__annotations__.items() + } + for attr, rf in attr_to_rest_field.items(): + rf._module = cls.__module__ + if not rf._type: + rf._type = rf._get_deserialize_callable_from_annotation(annotations.get(attr, None)) + if not rf._rest_name_input: + rf._rest_name_input = attr + cls._attr_to_rest_field: typing.Dict[str, _RestField] = dict(attr_to_rest_field.items()) + cls._calculated.add(f"{cls.__module__}.{cls.__qualname__}") + + return super().__new__(cls) + + def __init_subclass__(cls, discriminator: typing.Optional[str] = None) -> None: + for base in cls.__bases__: + if hasattr(base, "__mapping__"): + base.__mapping__[discriminator or cls.__name__] = cls # type: ignore + + @classmethod + def _get_discriminator(cls, exist_discriminators) -> typing.Optional["_RestField"]: + for v in cls.__dict__.values(): + if isinstance(v, _RestField) and v._is_discriminator and v._rest_name not in exist_discriminators: + return v + return None + + @classmethod + def _deserialize(cls, data, exist_discriminators): + if not hasattr(cls, "__mapping__"): + return cls(data) + discriminator = cls._get_discriminator(exist_discriminators) + if discriminator is None: + return cls(data) + exist_discriminators.append(discriminator._rest_name) + if isinstance(data, ET.Element): + model_meta = getattr(cls, "_xml", {}) + prop_meta = getattr(discriminator, "_xml", {}) + xml_name = prop_meta.get("name", discriminator._rest_name) + xml_ns = prop_meta.get("ns", model_meta.get("ns", None)) + if xml_ns: + xml_name = "{" + xml_ns + "}" + xml_name + + if data.get(xml_name) is not None: + discriminator_value = data.get(xml_name) + else: + discriminator_value = data.find(xml_name).text # pyright: ignore + else: + discriminator_value = data.get(discriminator._rest_name) + mapped_cls = cls.__mapping__.get(discriminator_value, cls) # pyright: ignore # pylint: disable=no-member + return mapped_cls._deserialize(data, exist_discriminators) + + def as_dict(self, *, exclude_readonly: bool = False) -> typing.Dict[str, typing.Any]: + """Return a dict that can be turned into json using json.dump. + + :keyword bool exclude_readonly: Whether to remove the readonly properties. + :returns: A dict JSON compatible object + :rtype: dict + """ + + result = {} + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in self._attr_to_rest_field.values() if _is_readonly(p)] + for k, v in self.items(): + if exclude_readonly and k in readonly_props: # pyright: ignore + continue + is_multipart_file_input = False + try: + is_multipart_file_input = next( + rf for rf in self._attr_to_rest_field.values() if rf._rest_name == k + )._is_multipart_file_input + except StopIteration: + pass + result[k] = v if is_multipart_file_input else Model._as_dict_value(v, exclude_readonly=exclude_readonly) + return result + + @staticmethod + def _as_dict_value(v: typing.Any, exclude_readonly: bool = False) -> typing.Any: + if v is None or isinstance(v, _Null): + return None + if isinstance(v, (list, tuple, set)): + return type(v)(Model._as_dict_value(x, exclude_readonly=exclude_readonly) for x in v) + if isinstance(v, dict): + return {dk: Model._as_dict_value(dv, exclude_readonly=exclude_readonly) for dk, dv in v.items()} + return v.as_dict(exclude_readonly=exclude_readonly) if hasattr(v, "as_dict") else v + + +def _deserialize_model(model_deserializer: typing.Optional[typing.Callable], obj): + if _is_model(obj): + return obj + return _deserialize(model_deserializer, obj) + + +def _deserialize_with_optional(if_obj_deserializer: typing.Optional[typing.Callable], obj): + if obj is None: + return obj + return _deserialize_with_callable(if_obj_deserializer, obj) + + +def _deserialize_with_union(deserializers, obj): + for deserializer in deserializers: + try: + return _deserialize(deserializer, obj) + except DeserializationError: + pass + raise DeserializationError() + + +def _deserialize_dict( + value_deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj: typing.Dict[typing.Any, typing.Any], +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = {child.tag: child for child in obj} + return {k: _deserialize(value_deserializer, v, module) for k, v in obj.items()} + + +def _deserialize_multiple_sequence( + entry_deserializers: typing.List[typing.Optional[typing.Callable]], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + return type(obj)(_deserialize(deserializer, entry, module) for entry, deserializer in zip(obj, entry_deserializers)) + + +def _deserialize_sequence( + deserializer: typing.Optional[typing.Callable], + module: typing.Optional[str], + obj, +): + if obj is None: + return obj + if isinstance(obj, ET.Element): + obj = list(obj) + return type(obj)(_deserialize(deserializer, entry, module) for entry in obj) + + +def _sorted_annotations(types: typing.List[typing.Any]) -> typing.List[typing.Any]: + return sorted( + types, + key=lambda x: hasattr(x, "__name__") and x.__name__.lower() in ("str", "float", "int", "bool"), + ) + + +def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-return-statements, too-many-branches + annotation: typing.Any, + module: typing.Optional[str], + rf: typing.Optional["_RestField"] = None, +) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + if not annotation: + return None + + # is it a type alias? + if isinstance(annotation, str): + if module is not None: + annotation = _get_type_alias_type(module, annotation) + + # is it a forward ref / in quotes? + if isinstance(annotation, (str, typing.ForwardRef)): + try: + model_name = annotation.__forward_arg__ # type: ignore + except AttributeError: + model_name = annotation + if module is not None: + annotation = _get_model(module, model_name) # type: ignore + + try: + if module and _is_model(annotation): + if rf: + rf._is_model = True + + return functools.partial(_deserialize_model, annotation) # pyright: ignore + except Exception: + pass + + # is it a literal? + try: + if annotation.__origin__ is typing.Literal: # pyright: ignore + return None + except AttributeError: + pass + + # is it optional? + try: + if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore + if len(annotation.__args__) <= 2: # pyright: ignore + if_obj_deserializer = _get_deserialize_callable_from_annotation( + next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_with_optional, if_obj_deserializer) + # the type is Optional[Union[...]], we need to remove the None type from the Union + annotation_copy = copy.copy(annotation) + annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore + return _get_deserialize_callable_from_annotation(annotation_copy, module, rf) + except AttributeError: + pass + + # is it union? + if getattr(annotation, "__origin__", None) is typing.Union: + # initial ordering is we make `string` the last deserialization option, because it is often them most generic + deserializers = [ + _get_deserialize_callable_from_annotation(arg, module, rf) + for arg in _sorted_annotations(annotation.__args__) # pyright: ignore + ] + + return functools.partial(_deserialize_with_union, deserializers) + + try: + if annotation._name == "Dict": # pyright: ignore + value_deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[1], module, rf # pyright: ignore + ) + + return functools.partial( + _deserialize_dict, + value_deserializer, + module, + ) + except (AttributeError, IndexError): + pass + try: + if annotation._name in ["List", "Set", "Tuple", "Sequence"]: # pyright: ignore + if len(annotation.__args__) > 1: # pyright: ignore + entry_deserializers = [ + _get_deserialize_callable_from_annotation(dt, module, rf) + for dt in annotation.__args__ # pyright: ignore + ] + return functools.partial(_deserialize_multiple_sequence, entry_deserializers, module) + deserializer = _get_deserialize_callable_from_annotation( + annotation.__args__[0], module, rf # pyright: ignore + ) + + return functools.partial(_deserialize_sequence, deserializer, module) + except (TypeError, IndexError, AttributeError, SyntaxError): + pass + + def _deserialize_default( + deserializer, + obj, + ): + if obj is None: + return obj + try: + return _deserialize_with_callable(deserializer, obj) + except Exception: + pass + return obj + + if get_deserializer(annotation, rf): + return functools.partial(_deserialize_default, get_deserializer(annotation, rf)) + + return functools.partial(_deserialize_default, annotation) + + +def _deserialize_with_callable( + deserializer: typing.Optional[typing.Callable[[typing.Any], typing.Any]], + value: typing.Any, +): # pylint: disable=too-many-return-statements + try: + if value is None or isinstance(value, _Null): + return None + if isinstance(value, ET.Element): + if deserializer is str: + return value.text or "" + if deserializer is int: + return int(value.text) if value.text else None + if deserializer is float: + return float(value.text) if value.text else None + if deserializer is bool: + return value.text == "true" if value.text else None + if deserializer is None: + return value + if deserializer in [int, float, bool]: + return deserializer(value) + if isinstance(deserializer, CaseInsensitiveEnumMeta): + try: + return deserializer(value) + except ValueError: + # for unknown value, return raw value + return value + if isinstance(deserializer, type) and issubclass(deserializer, Model): + return deserializer._deserialize(value, []) + return typing.cast(typing.Callable[[typing.Any], typing.Any], deserializer)(value) + except Exception as e: + raise DeserializationError() from e + + +def _deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + if isinstance(value, PipelineResponse): + value = value.http_response.json() + if rf is None and format: + rf = _RestField(format=format) + if not isinstance(deserializer, functools.partial): + deserializer = _get_deserialize_callable_from_annotation(deserializer, module, rf) + return _deserialize_with_callable(deserializer, value) + + +def _failsafe_deserialize( + deserializer: typing.Any, + value: typing.Any, + module: typing.Optional[str] = None, + rf: typing.Optional["_RestField"] = None, + format: typing.Optional[str] = None, +) -> typing.Any: + try: + return _deserialize(deserializer, value, module, rf, format) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +def _failsafe_deserialize_xml( + deserializer: typing.Any, + value: typing.Any, +) -> typing.Any: + try: + return _deserialize_xml(deserializer, value) + except DeserializationError: + _LOGGER.warning( + "Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True + ) + return None + + +class _RestField: + def __init__( + self, + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + is_discriminator: bool = False, + visibility: typing.Optional[typing.List[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, + ): + self._type = type + self._rest_name_input = name + self._module: typing.Optional[str] = None + self._is_discriminator = is_discriminator + self._visibility = visibility + self._is_model = False + self._default = default + self._format = format + self._is_multipart_file_input = is_multipart_file_input + self._xml = xml if xml is not None else {} + + @property + def _class_type(self) -> typing.Any: + return getattr(self._type, "args", [None])[0] + + @property + def _rest_name(self) -> str: + if self._rest_name_input is None: + raise ValueError("Rest name was never set") + return self._rest_name_input + + def __get__(self, obj: Model, type=None): # pylint: disable=redefined-builtin + # by this point, type and rest_name will have a value bc we default + # them in __new__ of the Model class + item = obj.get(self._rest_name) + if item is None: + return item + if self._is_model: + return item + return _deserialize(self._type, _serialize(item, self._format), rf=self) + + def __set__(self, obj: Model, value) -> None: + if value is None: + # we want to wipe out entries if users set attr to None + try: + obj.__delitem__(self._rest_name) + except KeyError: + pass + return + if self._is_model: + if not _is_model(value): + value = _deserialize(self._type, value) + obj.__setitem__(self._rest_name, value) + return + obj.__setitem__(self._rest_name, _serialize(value, self._format)) + + def _get_deserialize_callable_from_annotation( + self, annotation: typing.Any + ) -> typing.Optional[typing.Callable[[typing.Any], typing.Any]]: + return _get_deserialize_callable_from_annotation(annotation, self._module, self) + + +def rest_field( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[typing.List[str]] = None, + default: typing.Any = _UNSET, + format: typing.Optional[str] = None, + is_multipart_file_input: bool = False, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField( + name=name, + type=type, + visibility=visibility, + default=default, + format=format, + is_multipart_file_input=is_multipart_file_input, + xml=xml, + ) + + +def rest_discriminator( + *, + name: typing.Optional[str] = None, + type: typing.Optional[typing.Callable] = None, # pylint: disable=redefined-builtin + visibility: typing.Optional[typing.List[str]] = None, + xml: typing.Optional[typing.Dict[str, typing.Any]] = None, +) -> typing.Any: + return _RestField(name=name, type=type, is_discriminator=True, visibility=visibility, xml=xml) + + +def serialize_xml(model: Model, exclude_readonly: bool = False) -> str: + """Serialize a model to XML. + + :param Model model: The model to serialize. + :param bool exclude_readonly: Whether to exclude readonly properties. + :returns: The XML representation of the model. + :rtype: str + """ + return ET.tostring(_get_element(model, exclude_readonly), encoding="unicode") # type: ignore + + +def _get_element( + o: typing.Any, + exclude_readonly: bool = False, + parent_meta: typing.Optional[typing.Dict[str, typing.Any]] = None, + wrapped_element: typing.Optional[ET.Element] = None, +) -> typing.Union[ET.Element, typing.List[ET.Element]]: + if _is_model(o): + model_meta = getattr(o, "_xml", {}) + + # if prop is a model, then use the prop element directly, else generate a wrapper of model + if wrapped_element is None: + wrapped_element = _create_xml_element( + model_meta.get("name", o.__class__.__name__), + model_meta.get("prefix"), + model_meta.get("ns"), + ) + + readonly_props = [] + if exclude_readonly: + readonly_props = [p._rest_name for p in o._attr_to_rest_field.values() if _is_readonly(p)] + + for k, v in o.items(): + # do not serialize readonly properties + if exclude_readonly and k in readonly_props: + continue + + prop_rest_field = _get_rest_field(o._attr_to_rest_field, k) + if prop_rest_field: + prop_meta = getattr(prop_rest_field, "_xml").copy() + # use the wire name as xml name if no specific name is set + if prop_meta.get("name") is None: + prop_meta["name"] = k + else: + # additional properties will not have rest field, use the wire name as xml name + prop_meta = {"name": k} + + # if no ns for prop, use model's + if prop_meta.get("ns") is None and model_meta.get("ns"): + prop_meta["ns"] = model_meta.get("ns") + prop_meta["prefix"] = model_meta.get("prefix") + + if prop_meta.get("unwrapped", False): + # unwrapped could only set on array + wrapped_element.extend(_get_element(v, exclude_readonly, prop_meta)) + elif prop_meta.get("text", False): + # text could only set on primitive type + wrapped_element.text = _get_primitive_type_value(v) + elif prop_meta.get("attribute", False): + xml_name = prop_meta.get("name", k) + if prop_meta.get("ns"): + ET.register_namespace(prop_meta.get("prefix"), prop_meta.get("ns")) # pyright: ignore + xml_name = "{" + prop_meta.get("ns") + "}" + xml_name # pyright: ignore + # attribute should be primitive type + wrapped_element.set(xml_name, _get_primitive_type_value(v)) + else: + # other wrapped prop element + wrapped_element.append(_get_wrapped_element(v, exclude_readonly, prop_meta)) + return wrapped_element + if isinstance(o, list): + return [_get_element(x, exclude_readonly, parent_meta) for x in o] # type: ignore + if isinstance(o, dict): + result = [] + for k, v in o.items(): + result.append( + _get_wrapped_element( + v, + exclude_readonly, + { + "name": k, + "ns": parent_meta.get("ns") if parent_meta else None, + "prefix": parent_meta.get("prefix") if parent_meta else None, + }, + ) + ) + return result + + # primitive case need to create element based on parent_meta + if parent_meta: + return _get_wrapped_element( + o, + exclude_readonly, + { + "name": parent_meta.get("itemsName", parent_meta.get("name")), + "prefix": parent_meta.get("itemsPrefix", parent_meta.get("prefix")), + "ns": parent_meta.get("itemsNs", parent_meta.get("ns")), + }, + ) + + raise ValueError("Could not serialize value into xml: " + o) + + +def _get_wrapped_element( + v: typing.Any, + exclude_readonly: bool, + meta: typing.Optional[typing.Dict[str, typing.Any]], +) -> ET.Element: + wrapped_element = _create_xml_element( + meta.get("name") if meta else None, meta.get("prefix") if meta else None, meta.get("ns") if meta else None + ) + if isinstance(v, (dict, list)): + wrapped_element.extend(_get_element(v, exclude_readonly, meta)) + elif _is_model(v): + _get_element(v, exclude_readonly, meta, wrapped_element) + else: + wrapped_element.text = _get_primitive_type_value(v) + return wrapped_element + + +def _get_primitive_type_value(v) -> str: + if v is True: + return "true" + if v is False: + return "false" + if isinstance(v, _Null): + return "" + return str(v) + + +def _create_xml_element(tag, prefix=None, ns=None): + if prefix and ns: + ET.register_namespace(prefix, ns) + if ns: + return ET.Element("{" + ns + "}" + tag) + return ET.Element(tag) + + +def _deserialize_xml( + deserializer: typing.Any, + value: str, +) -> typing.Any: + element = ET.fromstring(value) # nosec + return _deserialize(deserializer, element) + + +def _convert_element(e: ET.Element): + # dict case + if len(e.attrib) > 0 or len({child.tag for child in e}) > 1: + dict_result: typing.Dict[str, typing.Any] = {} + for child in e: + if dict_result.get(child.tag) is not None: + if isinstance(dict_result[child.tag], list): + dict_result[child.tag].append(_convert_element(child)) + else: + dict_result[child.tag] = [dict_result[child.tag], _convert_element(child)] + else: + dict_result[child.tag] = _convert_element(child) + dict_result.update(e.attrib) + return dict_result + # array case + if len(e) > 0: + array_result: typing.List[typing.Any] = [] + for child in e: + array_result.append(_convert_element(child)) + return array_result + # primitive case + return e.text 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..eb86ea23c965 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) Python 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..3893305e43d5 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_version.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/_version.py @@ -2,8 +2,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. +# Code generated by Microsoft (R) Python Code Generator. # 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/__init__.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/__init__.py index 3df30ff42149..dacd3c7f2b20 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/__init__.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/__init__.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,7 +12,7 @@ if TYPE_CHECKING: from ._patch import * # pylint: disable=unused-wildcard-import -from ._monitor_management_client import MonitorManagementClient # type: ignore +from ._client import MonitorManagementClient # type: ignore try: from ._patch import __all__ as _patch_all diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_client.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_client.py new file mode 100644 index 000000000000..39b752601ba8 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_client.py @@ -0,0 +1,136 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +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 .._utils.serialization import Deserializer, Serializer +from ._configuration import MonitorManagementClientConfiguration +from .operations import AzureMonitorWorkspacesOperations, Operations, PipelineGroupsOperations + +if TYPE_CHECKING: + from azure.core.credentials_async import AsyncTokenCredential + + +class MonitorManagementClient: + """Provides operations for working with Azure Monitor. + + :ivar operations: Operations operations + :vartype operations: azure.mgmt.monitor.aio.operations.Operations + :ivar azure_monitor_workspaces: AzureMonitorWorkspacesOperations operations + :vartype azure_monitor_workspaces: + azure.mgmt.monitor.aio.operations.AzureMonitorWorkspacesOperations + :ivar pipeline_groups: PipelineGroupsOperations operations + :vartype pipeline_groups: azure.mgmt.monitor.aio.operations.PipelineGroupsOperations + :param credential: Credential used to authenticate requests to the service. Required. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. + :type subscription_id: str + :param base_url: Service host. Default value is None. + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is + "2023-10-01-preview". Note that overriding this default value may result in unsupported + behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, credential: "AsyncTokenCredential", subscription_id: str, base_url: Optional[str] = None, **kwargs: Any + ) -> None: + _endpoint = "{endpoint}" + _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, + base_url=cast(str, base_url), + credential_scopes=credential_scopes, + **kwargs + ) + + _policies = kwargs.pop("policies", None) + if _policies is None: + _policies = [ + policies.RequestIdPolicy(**kwargs), + self._config.headers_policy, + self._config.user_agent_policy, + self._config.proxy_policy, + policies.ContentDecodePolicy(**kwargs), + AsyncARMAutoResourceProviderRegistrationPolicy(), + self._config.redirect_policy, + self._config.retry_policy, + self._config.authentication_policy, + self._config.custom_hook_policy, + self._config.logging_policy, + policies.DistributedTracingPolicy(**kwargs), + policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, + self._config.http_logging_policy, + ] + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient( + base_url=cast(str, _endpoint), policies=_policies, **kwargs + ) + + self._serialize = Serializer() + self._deserialize = Deserializer() + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.azure_monitor_workspaces = AzureMonitorWorkspacesOperations( + self._client, self._config, self._serialize, self._deserialize + ) + self.pipeline_groups = PipelineGroupsOperations(self._client, self._config, self._serialize, self._deserialize) + + def send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client.send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> Self: + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details: Any) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_configuration.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_configuration.py index fcb3eaa8e9f9..c23633761b7b 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_configuration.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_configuration.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -23,13 +23,27 @@ class MonitorManagementClientConfiguration: # pylint: disable=too-many-instance Note that all parameters used to create this instance are saved as instance attributes. - :param credential: Credential needed for the client to connect to Azure. Required. + :param credential: Credential used to authenticate requests to the service. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. + :param subscription_id: The ID of the target subscription. The value must be an UUID. Required. :type subscription_id: str + :param base_url: Service host. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: The API version to use for this operation. Default value is + "2023-10-01-preview". Note that overriding this default value may result in unsupported + behavior. + :paramtype api_version: str """ - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + api_version: str = kwargs.pop("api_version", "2023-10-01-preview") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -37,6 +51,8 @@ def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **k self.credential = credential self.subscription_id = subscription_id + self.base_url = base_url + self.api_version = api_version self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) kwargs.setdefault("sdk_moniker", "mgmt-monitor/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) 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 deleted file mode 100644 index a03ff245f565..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_monitor_management_client.py +++ /dev/null @@ -1,276 +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 copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from .._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, -) - -if TYPE_CHECKING: - from azure.core.credentials_async import AsyncTokenCredential - - -class MonitorManagementClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes - """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". - :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 - ) -> None: - self._config = MonitorManagementClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - 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) - - 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 - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_patch.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_patch.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize 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..ca50d9410049 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,70 +12,18 @@ if TYPE_CHECKING: 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 ._operations import AzureMonitorWorkspacesOperations # type: ignore +from ._operations import PipelineGroupsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __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", + "AzureMonitorWorkspacesOperations", + "PipelineGroupsOperations", ] __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 deleted file mode 100644 index 060906ae0798..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_action_groups_operations.py +++ /dev/null @@ -1,1447 +0,0 @@ -# pylint: disable=too-many-lines -# 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._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, -) - -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 ActionGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`action_groups` 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, - action_group_name: str, - action_group: _models.ActionGroupResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ActionGroupResource: - """Create a new action group 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 action_group_name: The name of the action group. Required. - :type action_group_name: str - :param action_group: The action group to create or use for the update. Required. - :type action_group: ~azure.mgmt.monitor.models.ActionGroupResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ActionGroupResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActionGroupResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def create_or_update( - self, - resource_group_name: str, - action_group_name: str, - action_group: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ActionGroupResource: - """Create a new action group 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 action_group_name: The name of the action group. Required. - :type action_group_name: str - :param action_group: The action group to create or use for the update. Required. - :type action_group: 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: ActionGroupResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActionGroupResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - action_group_name: str, - action_group: Union[_models.ActionGroupResource, IO[bytes]], - **kwargs: Any - ) -> _models.ActionGroupResource: - """Create a new action group 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 action_group_name: The name of the action group. Required. - :type action_group_name: str - :param action_group: The action group to create or use for the update. Is either a - ActionGroupResource type or a IO[bytes] type. Required. - :type action_group: ~azure.mgmt.monitor.models.ActionGroupResource or IO[bytes] - :return: ActionGroupResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActionGroupResource - :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-06-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ActionGroupResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(action_group, (IOBase, bytes)): - _content = action_group - else: - _json = self._serialize.body(action_group, "ActionGroupResource") - - _request = build_create_or_update_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) - - _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("ActionGroupResource", 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, action_group_name: str, **kwargs: Any) -> _models.ActionGroupResource: - """Get an action group. - - :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 - :return: ActionGroupResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActionGroupResource - :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.ActionGroupResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - action_group_name=action_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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ActionGroupResource", 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, action_group_name: str, **kwargs: Any) -> None: - """Delete an action group. - - :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 - :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-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - action_group_name=action_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, 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, - action_group_name: str, - action_group_patch: _models.ActionGroupPatchBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ActionGroupResource: - """Updates an existing action group'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 action_group_name: The name of the action group. Required. - :type action_group_name: str - :param action_group_patch: Parameters supplied to the operation. Required. - :type action_group_patch: ~azure.mgmt.monitor.models.ActionGroupPatchBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ActionGroupResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActionGroupResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - action_group_name: str, - action_group_patch: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ActionGroupResource: - """Updates an existing action group'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 action_group_name: The name of the action group. Required. - :type action_group_name: str - :param action_group_patch: Parameters supplied to the operation. Required. - :type action_group_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: ActionGroupResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActionGroupResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - action_group_name: str, - action_group_patch: Union[_models.ActionGroupPatchBody, IO[bytes]], - **kwargs: Any - ) -> _models.ActionGroupResource: - """Updates an existing action group'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 action_group_name: The name of the action group. Required. - :type action_group_name: str - :param action_group_patch: Parameters supplied to the operation. Is either a - ActionGroupPatchBody type or a IO[bytes] type. Required. - :type action_group_patch: ~azure.mgmt.monitor.models.ActionGroupPatchBody or IO[bytes] - :return: ActionGroupResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActionGroupResource - :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-06-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ActionGroupResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(action_group_patch, (IOBase, bytes)): - _content = action_group_patch - else: - _json = self._serialize.body(action_group_patch, "ActionGroupPatchBody") - - _request = build_update_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) - - _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("ActionGroupResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - 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, - action_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_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 = 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_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 - ) -> 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 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 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_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 - ) -> 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 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 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_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 - ) -> 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 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 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_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 - ) - 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 - ) - - @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 - ) -> _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 action_group_name: The name of the action group. Required. - :type action_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_action_group_resource_level_request( - resource_group_name=resource_group_name, - action_group_name=action_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 - def list_by_subscription_id(self, **kwargs: Any) -> AsyncIterable["_models.ActionGroupResource"]: - """Get a list of all action groups in a subscription. - - :return: An iterator like instance of either ActionGroupResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.ActionGroupResource] - :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-06-01")) - cls: ClsType[_models.ActionGroupList] = 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("ActionGroupList", 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.ActionGroupResource"]: - """Get a list of all action groups 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 ActionGroupResource or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.ActionGroupResource] - :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-06-01")) - cls: ClsType[_models.ActionGroupList] = 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("ActionGroupList", 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) - - @overload - async def enable_receiver( - self, - resource_group_name: str, - action_group_name: str, - enable_request: _models.EnableRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Enable a receiver in an action group. This changes the receiver's status from Disabled to - Enabled. This operation is only supported for Email or SMS 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 enable_request: The receiver to re-enable. Required. - :type enable_request: ~azure.mgmt.monitor.models.EnableRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def enable_receiver( - self, - resource_group_name: str, - action_group_name: str, - enable_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Enable a receiver in an action group. This changes the receiver's status from Disabled to - Enabled. This operation is only supported for Email or SMS 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 enable_request: The receiver to re-enable. Required. - :type enable_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: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def enable_receiver( - self, - resource_group_name: str, - action_group_name: str, - enable_request: Union[_models.EnableRequest, IO[bytes]], - **kwargs: Any - ) -> None: - """Enable a receiver in an action group. This changes the receiver's status from Disabled to - Enabled. This operation is only supported for Email or SMS 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 enable_request: The receiver to re-enable. Is either a EnableRequest type or a IO[bytes] - type. Required. - :type enable_request: ~azure.mgmt.monitor.models.EnableRequest or IO[bytes] - :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 = 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[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(enable_request, (IOBase, bytes)): - _content = enable_request - else: - _json = self._serialize.body(enable_request, "EnableRequest") - - _request = build_enable_receiver_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) - - _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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore 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 index bcc82c3a97c9..75b9038e71c4 100644 --- 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 @@ -1,36 +1,61 @@ +# pylint: disable=too-many-lines # 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. +# Code generated by Microsoft (R) Python 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 collections.abc import MutableMapping +from io import IOBase +import json +from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, List, Optional, TypeVar, Union, cast, overload +import urllib.parse +from azure.core import AsyncPipelineClient +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._operations import build_list_request +from ..._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +from ..._utils.serialization import Deserializer, Serializer +from ...operations._operations import ( + build_azure_monitor_workspaces_create_or_update_request, + build_azure_monitor_workspaces_delete_request, + build_azure_monitor_workspaces_get_request, + build_azure_monitor_workspaces_list_by_resource_group_request, + build_azure_monitor_workspaces_list_by_subscription_request, + build_azure_monitor_workspaces_update_request, + build_operations_list_request, + build_pipeline_groups_create_or_update_request, + build_pipeline_groups_delete_request, + build_pipeline_groups_get_request, + build_pipeline_groups_list_by_resource_group_request, + build_pipeline_groups_list_by_subscription_request, + build_pipeline_groups_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]] +JSON = MutableMapping[str, Any] class Operations: @@ -43,21 +68,908 @@ class Operations: :attr:`operations` attribute. """ - models = _models + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MonitorManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of Operation + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = 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_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class AzureMonitorWorkspacesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s + :attr:`azure_monitor_workspaces` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: AsyncPipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MonitorManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async + async def get( + self, resource_group_name: str, azure_monitor_workspace_name: str, **kwargs: Any + ) -> _models.AzureMonitorWorkspace: + """Returns the specific Azure Monitor workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :return: AzureMonitorWorkspace. The AzureMonitorWorkspace is compatible with MutableMapping + :rtype: ~azure.mgmt.monitor.models.AzureMonitorWorkspace + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.AzureMonitorWorkspace] = kwargs.pop("cls", None) + + _request = build_azure_monitor_workspaces_get_request( + resource_group_name=resource_group_name, + azure_monitor_workspace_name=azure_monitor_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AzureMonitorWorkspace, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + azure_monitor_workspace_name: str, + resource: Union[_models.AzureMonitorWorkspace, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_azure_monitor_workspaces_create_or_update_request( + resource_group_name=resource_group_name, + azure_monitor_workspace_name=azure_monitor_workspace_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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]: + 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + azure_monitor_workspace_name: str, + resource: _models.AzureMonitorWorkspace, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AzureMonitorWorkspace]: + """Create or update a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.monitor.models.AzureMonitorWorkspace + :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 AzureMonitorWorkspace. The + AzureMonitorWorkspace is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.AzureMonitorWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + azure_monitor_workspace_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AzureMonitorWorkspace]: + """Create or update a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :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 AzureMonitorWorkspace. The + AzureMonitorWorkspace is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.AzureMonitorWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + azure_monitor_workspace_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.AzureMonitorWorkspace]: + """Create or update a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :param resource: Resource create parameters. Required. + :type 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: An instance of AsyncLROPoller that returns AzureMonitorWorkspace. The + AzureMonitorWorkspace is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.AzureMonitorWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + azure_monitor_workspace_name: str, + resource: Union[_models.AzureMonitorWorkspace, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.AzureMonitorWorkspace]: + """Create or update a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :param resource: Resource create parameters. Is one of the following types: + AzureMonitorWorkspace, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.monitor.models.AzureMonitorWorkspace or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns AzureMonitorWorkspace. The + AzureMonitorWorkspace is compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.AzureMonitorWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureMonitorWorkspace] = 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, + azure_monitor_workspace_name=azure_monitor_workspace_name, + resource=resource, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.AzureMonitorWorkspace, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.AzureMonitorWorkspace].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.AzureMonitorWorkspace]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + async def update( + self, + resource_group_name: str, + azure_monitor_workspace_name: str, + properties: _models.AzureMonitorWorkspaceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureMonitorWorkspace: + """Updates part of a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.monitor.models.AzureMonitorWorkspaceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureMonitorWorkspace. The AzureMonitorWorkspace is compatible with MutableMapping + :rtype: ~azure.mgmt.monitor.models.AzureMonitorWorkspace + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + azure_monitor_workspace_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureMonitorWorkspace: + """Updates part of a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :param properties: The resource properties to be updated. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureMonitorWorkspace. The AzureMonitorWorkspace is compatible with MutableMapping + :rtype: ~azure.mgmt.monitor.models.AzureMonitorWorkspace + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def update( + self, + resource_group_name: str, + azure_monitor_workspace_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureMonitorWorkspace: + """Updates part of a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :param properties: The resource properties to be updated. Required. + :type properties: 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: AzureMonitorWorkspace. The AzureMonitorWorkspace is compatible with MutableMapping + :rtype: ~azure.mgmt.monitor.models.AzureMonitorWorkspace + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + azure_monitor_workspace_name: str, + properties: Union[_models.AzureMonitorWorkspaceUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.AzureMonitorWorkspace: + """Updates part of a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :param properties: The resource properties to be updated. Is one of the following types: + AzureMonitorWorkspaceUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.monitor.models.AzureMonitorWorkspaceUpdate or JSON or IO[bytes] + :return: AzureMonitorWorkspace. The AzureMonitorWorkspace is compatible with MutableMapping + :rtype: ~azure.mgmt.monitor.models.AzureMonitorWorkspace + :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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureMonitorWorkspace] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_azure_monitor_workspaces_update_request( + resource_group_name=resource_group_name, + azure_monitor_workspace_name=azure_monitor_workspace_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AzureMonitorWorkspace, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + async def _delete_initial( + self, resource_group_name: str, azure_monitor_workspace_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 = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_azure_monitor_workspaces_delete_request( + resource_group_name=resource_group_name, + azure_monitor_workspace_name=azure_monitor_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 [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) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, azure_monitor_workspace_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + azure_monitor_workspace_name=azure_monitor_workspace_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> AsyncIterable["_models.AzureMonitorWorkspace"]: + """Lists all workspaces in the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of AzureMonitorWorkspace + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.AzureMonitorWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AzureMonitorWorkspace]] = 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_azure_monitor_workspaces_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AzureMonitorWorkspace], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.AzureMonitorWorkspace"]: + """Lists all workspaces in the specified subscription. + + :return: An iterator like instance of AzureMonitorWorkspace + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.AzureMonitorWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AzureMonitorWorkspace]] = 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_azure_monitor_workspaces_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AzureMonitorWorkspace], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + +class PipelineGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s + :attr:`pipeline_groups` attribute. + """ 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_async - async def list(self, **kwargs: Any) -> _models.OperationListResult: - """Lists all of the available operations from Microsoft.Insights provider. + async def get(self, resource_group_name: str, pipeline_group_name: str, **kwargs: Any) -> _models.PipelineGroup: + """Returns the specific pipeline group instance. - :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.OperationListResult + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :return: PipelineGroup. The PipelineGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.monitor.models.PipelineGroup :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -69,19 +981,24 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = 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) + cls: ClsType[_models.PipelineGroup] = kwargs.pop("cls", None) - _request = build_list_request( - api_version=api_version, + _request = build_pipeline_groups_get_request( + resource_group_name=resource_group_name, + pipeline_group_name=pipeline_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -89,12 +1006,768 @@ async def list(self, **kwargs: Any) -> _models.OperationListResult: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + 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) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationListResult", pipeline_response.http_response) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PipelineGroup, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + pipeline_group_name: str, + resource: Union[_models.PipelineGroup, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_pipeline_groups_create_or_update_request( + resource_group_name=resource_group_name, + pipeline_group_name=pipeline_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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]: + 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + pipeline_group_name: str, + resource: _models.PipelineGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PipelineGroup]: + """Create or update a pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.monitor.models.PipelineGroup + :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 PipelineGroup. The PipelineGroup is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + pipeline_group_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PipelineGroup]: + """Create or update a pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :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 PipelineGroup. The PipelineGroup is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_create_or_update( + self, + resource_group_name: str, + pipeline_group_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PipelineGroup]: + """Create or update a pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :param resource: Resource create parameters. Required. + :type 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: An instance of AsyncLROPoller that returns PipelineGroup. The PipelineGroup is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + pipeline_group_name: str, + resource: Union[_models.PipelineGroup, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PipelineGroup]: + """Create or update a pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :param resource: Resource create parameters. Is one of the following types: PipelineGroup, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.monitor.models.PipelineGroup or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns PipelineGroup. The PipelineGroup is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PipelineGroup] = 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, + pipeline_group_name=pipeline_group_name, + resource=resource, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PipelineGroup, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PipelineGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PipelineGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + async def _delete_initial( + self, resource_group_name: str, pipeline_group_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 = kwargs.pop("params", {}) or {} + + cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) + + _request = build_pipeline_groups_delete_request( + resource_group_name=resource_group_name, + pipeline_group_name=pipeline_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 [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) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace_async + async def begin_delete( + self, resource_group_name: str, pipeline_group_name: str, **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :return: An instance of AsyncLROPoller that returns None + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + pipeline_group_name=pipeline_group_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + async def _update_initial( + self, + resource_group_name: str, + pipeline_group_name: str, + properties: Union[_models.PipelineGroupUpdate, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_pipeline_groups_update_request( + resource_group_name=resource_group_name, + pipeline_group_name=pipeline_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + async def begin_update( + self, + resource_group_name: str, + pipeline_group_name: str, + properties: _models.PipelineGroupUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PipelineGroup]: + """Updates a pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.monitor.models.PipelineGroupUpdate + :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 PipelineGroup. The PipelineGroup is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + pipeline_group_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PipelineGroup]: + """Updates a pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :param properties: The resource properties to be updated. Required. + :type properties: JSON + :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 PipelineGroup. The PipelineGroup is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + async def begin_update( + self, + resource_group_name: str, + pipeline_group_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> AsyncLROPoller[_models.PipelineGroup]: + """Updates a pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :param properties: The resource properties to be updated. Required. + :type properties: 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 PipelineGroup. The PipelineGroup is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace_async + async def begin_update( + self, + resource_group_name: str, + pipeline_group_name: str, + properties: Union[_models.PipelineGroupUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> AsyncLROPoller[_models.PipelineGroup]: + """Updates a pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :param properties: The resource properties to be updated. Is one of the following types: + PipelineGroupUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.monitor.models.PipelineGroupUpdate or JSON or IO[bytes] + :return: An instance of AsyncLROPoller that returns PipelineGroup. The PipelineGroup is + compatible with MutableMapping + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PipelineGroup] = 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._update_initial( + resource_group_name=resource_group_name, + pipeline_group_name=pipeline_group_name, + properties=properties, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PipelineGroup, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: AsyncPollingMethod = cast( + AsyncPollingMethod, AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) + else: + polling_method = polling + if cont_token: + return AsyncLROPoller[_models.PipelineGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return AsyncLROPoller[_models.PipelineGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.PipelineGroup"]: + """Lists all workspaces in the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of PipelineGroup + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PipelineGroup]] = 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_pipeline_groups_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PipelineGroup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.PipelineGroup"]: + """Lists all workspaces in the specified subscription. + + :return: An iterator like instance of PipelineGroup + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PipelineGroup]] = 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_pipeline_groups_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + async def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PipelineGroup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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/_patch.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_patch.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize 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 deleted file mode 100644 index 6cf7788cbd27..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/aio/operations/_scheduled_query_rules_operations.py +++ /dev/null @@ -1,581 +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._scheduled_query_rules_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 ScheduledQueryRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.aio.MonitorManagementClient`'s - :attr:`scheduled_query_rules` 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, - rule_name: str, - parameters: _models.LogSearchRuleResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Creates or updates 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 - :param parameters: The parameters of the rule to create or update. Required. - :type parameters: ~azure.mgmt.monitor.models.LogSearchRuleResource - :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 - :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.LogSearchRuleResource: - """Creates or updates 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 - :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: LogSearchRuleResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def create_or_update( - self, - resource_group_name: str, - rule_name: str, - parameters: Union[_models.LogSearchRuleResource, IO[bytes]], - **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Creates or updates 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 - :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 - :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-04-16")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogSearchRuleResource] = 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, "LogSearchRuleResource") - - _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, 201]: - 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) - - 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) - - 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.LogSearchRuleResourcePatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Update 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 - :param parameters: The parameters of the rule to update. Required. - :type parameters: ~azure.mgmt.monitor.models.LogSearchRuleResourcePatch - :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 - :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.LogSearchRuleResource: - """Update 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 - :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: LogSearchRuleResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - rule_name: str, - parameters: Union[_models.LogSearchRuleResourcePatch, IO[bytes]], - **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Update 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 - :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 - :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-04-16")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogSearchRuleResource] = 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, "LogSearchRuleResourcePatch") - - _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.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 delete(self, resource_group_name: str, rule_name: str, **kwargs: Any) -> None: - """Deletes a 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: 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-04-16")) - 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.ErrorContract, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - 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..9e0b5a6627be 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -13,428 +13,134 @@ from ._patch import * # pylint: disable=unused-wildcard-import -from ._models_py3 import ( # type: ignore - Action, - ActionDetail, - ActionGroupList, - ActionGroupPatchBody, - ActionGroupResource, - ActivityLogAlertActionGroup, - ActivityLogAlertActionList, - ActivityLogAlertAllOfCondition, - ActivityLogAlertLeafCondition, - ActivityLogAlertList, - ActivityLogAlertPatchBody, - ActivityLogAlertResource, - AlertingAction, - ArmRoleReceiver, - AutomationRunbookReceiver, - AutoscaleErrorResponse, - AutoscaleErrorResponseError, - AutoscaleNotification, - AutoscaleProfile, - AutoscaleSettingResource, - AutoscaleSettingResourceCollection, - AutoscaleSettingResourcePatch, - AzNsActionGroup, - AzureAppPushReceiver, - AzureFunctionReceiver, - AzureMonitorPrivateLinkScope, - AzureMonitorPrivateLinkScopeListResult, - AzureResource, - BaselineMetadata, - Context, - Criteria, - DataContainer, - DataSource, - DataSourceConfiguration, - DiagnosticSettingsCategoryResource, - DiagnosticSettingsCategoryResourceCollection, - DiagnosticSettingsResource, - DiagnosticSettingsResourceCollection, - Dimension, - DynamicMetricCriteria, - DynamicThresholdFailingPeriods, - EmailNotification, - EmailReceiver, - EnableRequest, - Error, +from ._models import ( # type: ignore + AzureMonitorWorkspace, + AzureMonitorWorkspaceLogsApiConfig, + AzureMonitorWorkspaceLogsExporter, + AzureMonitorWorkspaceProperties, + AzureMonitorWorkspaceUpdate, + AzureMonitorWorkspaceUpdateProperties, + BatchProcessor, + CacheConfiguration, + ConcurrencyConfiguration, 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, - 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, - NotificationRequestBody, + Exporter, + ExtendedLocation, + IngestionSettings, + Metrics, + NetworkingConfiguration, + NetworkingRoute, Operation, OperationDisplay, - OperationListResult, - OperationStatus, - PerformanceCounterConfiguration, - PredictiveAutoscalePolicy, - PredictiveResponse, - PredictiveValue, + OtlpReceiver, + PersistenceConfigurations, + Pipeline, + PipelineGroup, + PipelineGroupProperties, + PipelineGroupUpdate, + PipelineGroupUpdateProperties, + PrivateEndpoint, PrivateEndpointConnection, - PrivateEndpointConnectionListResult, - PrivateEndpointProperty, - PrivateLinkResource, - PrivateLinkResourceListResult, - PrivateLinkScopesResource, - PrivateLinkServiceConnectionStateProperty, - ProxyOnlyResource, - ProxyResource, - Recurrence, - RecurrentSchedule, + PrivateEndpointConnectionProperties, + PrivateLinkServiceConnectionState, + Processor, + Receiver, + RecordMap, Resource, - ResourceAutoGenerated, - ResourceAutoGenerated2, - ResourceAutoGenerated3, - Response, - ResponseWithError, - RetentionPolicy, - ScaleAction, - ScaleCapacity, - ScaleRule, - ScaleRuleMetricDimension, - Schedule, - ScopedResource, - ScopedResourceListResult, - SenderAuthorization, - ServiceDiagnosticSettingsResource, - ServiceDiagnosticSettingsResourcePatch, - SingleBaseline, - SingleMetricBaseline, - SinkConfiguration, - SmsReceiver, - Source, - SubscriptionDiagnosticSettingsResource, - SubscriptionDiagnosticSettingsResourceCollection, - SubscriptionLogSettings, - SubscriptionProxyOnlyResource, + ResourceMap, + SchemaMap, + ScopeMap, + Service, + SyslogReceiver, SystemData, - TagsResource, - TestNotificationDetailsResponse, - TimeSeriesBaseline, - TimeSeriesElement, - TimeWindow, - TriggerCondition, - VMInsightsOnboardingStatus, - VoiceReceiver, - WebhookNotification, - WebhookReceiver, - WebtestLocationAvailabilityCriteria, - WorkspaceInfo, + TcpExporter, + TrackedResource, + UdpReceiver, ) -from ._monitor_management_client_enums import ( # type: ignore - AggregationType, - AggregationTypeEnum, - AlertSeverity, - BaselineSensitivity, - CategoryType, - ComparisonOperationType, - ConditionalOperator, +from ._enums import ( # type: ignore + ActionType, CreatedByType, - CriterionType, - DataSourceKind, - DataStatus, - DynamicThresholdOperator, - DynamicThresholdSensitivity, - Enabled, - EventLevel, - GuestDiagnosticSettingsOsType, - MetricClass, - MetricStatisticType, - MetricTriggerType, - MetricUnit, - NamespaceClassification, - Odatatype, - OnboardingStatus, - Operator, - PredictiveAutoscalePolicyScaleMode, + ExporterType, + ExtendedLocationType, + ExternalNetworkingMode, + Origin, + PipelineType, + PrivateEndpointConnectionProvisioningState, + PrivateEndpointServiceConnectionStatus, + ProcessorType, ProvisioningState, - QueryType, - ReceiverStatus, - RecurrenceFrequency, - ResultType, - ScaleDirection, - ScaleRuleMetricDimensionOperationType, - ScaleType, - SinkConfigurationKind, - TimeAggregationType, + PublicNetworkAccess, + ReceiverType, + StreamEncodingType, + SyslogProtocol, ) 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", - "ArmRoleReceiver", - "AutomationRunbookReceiver", - "AutoscaleErrorResponse", - "AutoscaleErrorResponseError", - "AutoscaleNotification", - "AutoscaleProfile", - "AutoscaleSettingResource", - "AutoscaleSettingResourceCollection", - "AutoscaleSettingResourcePatch", - "AzNsActionGroup", - "AzureAppPushReceiver", - "AzureFunctionReceiver", - "AzureMonitorPrivateLinkScope", - "AzureMonitorPrivateLinkScopeListResult", - "AzureResource", - "BaselineMetadata", - "Context", - "Criteria", - "DataContainer", - "DataSource", - "DataSourceConfiguration", - "DiagnosticSettingsCategoryResource", - "DiagnosticSettingsCategoryResourceCollection", - "DiagnosticSettingsResource", - "DiagnosticSettingsResourceCollection", - "Dimension", - "DynamicMetricCriteria", - "DynamicThresholdFailingPeriods", - "EmailNotification", - "EmailReceiver", - "EnableRequest", - "Error", + "AzureMonitorWorkspace", + "AzureMonitorWorkspaceLogsApiConfig", + "AzureMonitorWorkspaceLogsExporter", + "AzureMonitorWorkspaceProperties", + "AzureMonitorWorkspaceUpdate", + "AzureMonitorWorkspaceUpdateProperties", + "BatchProcessor", + "CacheConfiguration", + "ConcurrencyConfiguration", "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", - "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", - "NotificationRequestBody", + "Exporter", + "ExtendedLocation", + "IngestionSettings", + "Metrics", + "NetworkingConfiguration", + "NetworkingRoute", "Operation", "OperationDisplay", - "OperationListResult", - "OperationStatus", - "PerformanceCounterConfiguration", - "PredictiveAutoscalePolicy", - "PredictiveResponse", - "PredictiveValue", + "OtlpReceiver", + "PersistenceConfigurations", + "Pipeline", + "PipelineGroup", + "PipelineGroupProperties", + "PipelineGroupUpdate", + "PipelineGroupUpdateProperties", + "PrivateEndpoint", "PrivateEndpointConnection", - "PrivateEndpointConnectionListResult", - "PrivateEndpointProperty", - "PrivateLinkResource", - "PrivateLinkResourceListResult", - "PrivateLinkScopesResource", - "PrivateLinkServiceConnectionStateProperty", - "ProxyOnlyResource", - "ProxyResource", - "Recurrence", - "RecurrentSchedule", + "PrivateEndpointConnectionProperties", + "PrivateLinkServiceConnectionState", + "Processor", + "Receiver", + "RecordMap", "Resource", - "ResourceAutoGenerated", - "ResourceAutoGenerated2", - "ResourceAutoGenerated3", - "Response", - "ResponseWithError", - "RetentionPolicy", - "ScaleAction", - "ScaleCapacity", - "ScaleRule", - "ScaleRuleMetricDimension", - "Schedule", - "ScopedResource", - "ScopedResourceListResult", - "SenderAuthorization", - "ServiceDiagnosticSettingsResource", - "ServiceDiagnosticSettingsResourcePatch", - "SingleBaseline", - "SingleMetricBaseline", - "SinkConfiguration", - "SmsReceiver", - "Source", - "SubscriptionDiagnosticSettingsResource", - "SubscriptionDiagnosticSettingsResourceCollection", - "SubscriptionLogSettings", - "SubscriptionProxyOnlyResource", + "ResourceMap", + "SchemaMap", + "ScopeMap", + "Service", + "SyslogReceiver", "SystemData", - "TagsResource", - "TestNotificationDetailsResponse", - "TimeSeriesBaseline", - "TimeSeriesElement", - "TimeWindow", - "TriggerCondition", - "VMInsightsOnboardingStatus", - "VoiceReceiver", - "WebhookNotification", - "WebhookReceiver", - "WebtestLocationAvailabilityCriteria", - "WorkspaceInfo", - "AggregationType", - "AggregationTypeEnum", - "AlertSeverity", - "BaselineSensitivity", - "CategoryType", - "ComparisonOperationType", - "ConditionalOperator", + "TcpExporter", + "TrackedResource", + "UdpReceiver", + "ActionType", "CreatedByType", - "CriterionType", - "DataSourceKind", - "DataStatus", - "DynamicThresholdOperator", - "DynamicThresholdSensitivity", - "Enabled", - "EventLevel", - "GuestDiagnosticSettingsOsType", - "MetricClass", - "MetricStatisticType", - "MetricTriggerType", - "MetricUnit", - "NamespaceClassification", - "Odatatype", - "OnboardingStatus", - "Operator", - "PredictiveAutoscalePolicyScaleMode", + "ExporterType", + "ExtendedLocationType", + "ExternalNetworkingMode", + "Origin", + "PipelineType", + "PrivateEndpointConnectionProvisioningState", + "PrivateEndpointServiceConnectionStatus", + "ProcessorType", "ProvisioningState", - "QueryType", - "ReceiverStatus", - "RecurrenceFrequency", - "ResultType", - "ScaleDirection", - "ScaleRuleMetricDimensionOperationType", - "ScaleType", - "SinkConfigurationKind", - "TimeAggregationType", + "PublicNetworkAccess", + "ReceiverType", + "StreamEncodingType", + "SyslogProtocol", ] __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/_enums.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_enums.py new file mode 100644 index 000000000000..582ec03e5dae --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_enums.py @@ -0,0 +1,173 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal + only APIs. + """ + + INTERNAL = "Internal" + """Actions are for internal-only APIs.""" + + +class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The kind of entity that created the resource.""" + + USER = "User" + """The entity was created by a user.""" + APPLICATION = "Application" + """The entity was created by an application.""" + MANAGED_IDENTITY = "ManagedIdentity" + """The entity was created by a managed identity.""" + KEY = "Key" + """The entity was created by a key.""" + + +class ExporterType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The exporter type.""" + + AZURE_MONITOR_WORKSPACE_LOGS = "AzureMonitorWorkspaceLogs" + """Export logs to Azure Monitor Workspace.""" + PIPELINE_GROUP = "PipelineGroup" + """Export data to another pipeline group instance.""" + + +class ExtendedLocationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The supported ExtendedLocation types.""" + + EDGE_ZONE = "EdgeZone" + """Azure Edge Zones location type""" + CUSTOM_LOCATION = "CustomLocation" + """Azure Custom Locations type""" + + +class ExternalNetworkingMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The mode of the external networking.""" + + LOAD_BALANCER_ONLY = "LoadBalancerOnly" + """Load balancer only.""" + + +class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is "user,system". + """ + + USER = "user" + """Indicates the operation is initiated by a user.""" + SYSTEM = "system" + """Indicates the operation is initiated by a system.""" + USER_SYSTEM = "user,system" + """Indicates the operation is initiated by a user or system.""" + + +class PipelineType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The pipeline type.""" + + LOGS = "logs" + """Pipeline for logs telemetry.""" + + +class PrivateEndpointConnectionProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The current provisioning state.""" + + SUCCEEDED = "Succeeded" + """Connection has been provisioned""" + CREATING = "Creating" + """Connection is being created""" + DELETING = "Deleting" + """Connection is being deleted""" + FAILED = "Failed" + """Connection provisioning has failed""" + + +class PrivateEndpointServiceConnectionStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The private endpoint connection status.""" + + PENDING = "Pending" + """Connection waiting for approval or rejection""" + APPROVED = "Approved" + """Connection approved""" + REJECTED = "Rejected" + """Connection Rejected""" + + +class ProcessorType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The processor type.""" + + BATCH = "Batch" + """Batch processor.""" + + +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The provisioning state of a resource.""" + + SUCCEEDED = "Succeeded" + """Resource has been created.""" + FAILED = "Failed" + """Resource creation failed.""" + CANCELED = "Canceled" + """Resource creation was canceled.""" + CREATING = "Creating" + """The resource is being created.""" + DELETING = "Deleting" + """The resource is being deleted.""" + + +class PublicNetworkAccess(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """State of the public network access.""" + + ENABLED = "Enabled" + """The public network access is enabled""" + DISABLED = "Disabled" + """The public network access is disabled""" + + +class ReceiverType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The receiver type.""" + + SYSLOG = "Syslog" + """Linux syslog.""" + AMA = "Ama" + """Receives data from azure monitor agent receiver.""" + PIPELINE_GROUP = "PipelineGroup" + """Receives data from another pipeline group.""" + OTLP = "OTLP" + """Receives data from a OTLP collector.""" + UDP = "UDP" + """Receives data from an UDP collector.""" + + +class StreamEncodingType(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """Encoding types for streams.""" + + NOP = "nop" + """No encoding validation. Treats the file as a stream of raw bytes.""" + UTF8 = "utf-8" + """UTF-8 encoding.""" + UTF16_LE = "utf-16le" + """UTF-16 encoding with little-endian byte order.""" + UTF16_BE = "utf-16be" + """UTF-16 encoding with little-endian byte order.""" + ASCII = "ascii" + """ASCII encoding.""" + BIG5 = "big5" + """The Big5 Chinese character encoding.""" + + +class SyslogProtocol(str, Enum, metaclass=CaseInsensitiveEnumMeta): + """The syslog protocol to parse messages.""" + + RFC3164 = "rfc3164" + """rfc3164 protocol.""" + RFC5424 = "rfc5424" + """rfc5424 protocol.""" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_models.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_models.py new file mode 100644 index 000000000000..8541c804c263 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_models.py @@ -0,0 +1,1757 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +# pylint: disable=useless-super-delegation + +import datetime +from typing import Any, Dict, List, Mapping, Optional, TYPE_CHECKING, Union, overload + +from .._utils.model_base import Model as _Model, rest_field + +if TYPE_CHECKING: + from .. import models as _models + + +class Resource(_Model): + """Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.monitor.models.SystemData + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}.""" + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the resource.""" + type: Optional[str] = rest_field(visibility=["read"]) + """The type of the resource. E.g. \"Microsoft.Compute/virtualMachines\" or + \"Microsoft.Storage/storageAccounts\".""" + system_data: Optional["_models.SystemData"] = rest_field(name="systemData", visibility=["read"]) + """Azure Resource Manager metadata containing createdBy and modifiedBy information.""" + + +class TrackedResource(Resource): + """Tracked Resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.monitor.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + """ + + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + location: str = rest_field(visibility=["read", "create"]) + """The geo-location where the resource lives. Required.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureMonitorWorkspace(TrackedResource): + """An Azure Monitor Workspace definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.monitor.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.monitor.models.AzureMonitorWorkspaceProperties + :ivar etag: Resource entity tag (ETag). + :vartype etag: str + """ + + properties: Optional["_models.AzureMonitorWorkspaceProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + etag: Optional[str] = rest_field(visibility=["read"]) + """Resource entity tag (ETag).""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.AzureMonitorWorkspaceProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureMonitorWorkspaceLogsApiConfig(_Model): + """Azure Monitor Workspace Logs Api configurations. + + :ivar data_collection_endpoint_url: Data collection endpoint ingestion url. Required. + :vartype data_collection_endpoint_url: str + :ivar stream: Stream name in destination. Azure Monitor stream is related to the destination + table. Required. + :vartype stream: str + :ivar data_collection_rule: Data Collection Rule (DCR) immutable id. Required. + :vartype data_collection_rule: str + :ivar schema: The schema mapping for incoming data. Required. + :vartype schema: ~azure.mgmt.monitor.models.SchemaMap + """ + + data_collection_endpoint_url: str = rest_field( + name="dataCollectionEndpointUrl", visibility=["read", "create", "update", "delete", "query"] + ) + """Data collection endpoint ingestion url. Required.""" + stream: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Stream name in destination. Azure Monitor stream is related to the destination table. Required.""" + data_collection_rule: str = rest_field( + name="dataCollectionRule", visibility=["read", "create", "update", "delete", "query"] + ) + """Data Collection Rule (DCR) immutable id. Required.""" + schema: "_models.SchemaMap" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The schema mapping for incoming data. Required.""" + + @overload + def __init__( + self, + *, + data_collection_endpoint_url: str, + stream: str, + data_collection_rule: str, + schema: "_models.SchemaMap", + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureMonitorWorkspaceLogsExporter(_Model): + """Azure Monitor Workspace Logs specific configurations. + + :ivar api: API configurations for Azure Monitor workspace exporter. Required. + :vartype api: ~azure.mgmt.monitor.models.AzureMonitorWorkspaceLogsApiConfig + :ivar concurrency: Concurrency configuration for the exporter. + :vartype concurrency: ~azure.mgmt.monitor.models.ConcurrencyConfiguration + :ivar cache: Cache configurations. + :vartype cache: ~azure.mgmt.monitor.models.CacheConfiguration + """ + + api: "_models.AzureMonitorWorkspaceLogsApiConfig" = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """API configurations for Azure Monitor workspace exporter. Required.""" + concurrency: Optional["_models.ConcurrencyConfiguration"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Concurrency configuration for the exporter.""" + cache: Optional["_models.CacheConfiguration"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Cache configurations.""" + + @overload + def __init__( + self, + *, + api: "_models.AzureMonitorWorkspaceLogsApiConfig", + concurrency: Optional["_models.ConcurrencyConfiguration"] = None, + cache: Optional["_models.CacheConfiguration"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureMonitorWorkspaceProperties(_Model): + """Properties that need to be specified to create a new workspace. + + :ivar account_id: The immutable ID of the Azure Monitor workspace. This property is read-only. + :vartype account_id: str + :ivar metrics: Information about metrics for the Azure Monitor workspace. + :vartype metrics: ~azure.mgmt.monitor.models.Metrics + :ivar provisioning_state: The provisioning state of the Azure Monitor workspace. Set to + Succeeded if everything is healthy. Known values are: "Succeeded", "Failed", "Canceled", + "Creating", and "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.monitor.models.ProvisioningState + :ivar default_ingestion_settings: The Data Collection Rule and Endpoint used for ingestion by + default. + :vartype default_ingestion_settings: ~azure.mgmt.monitor.models.IngestionSettings + :ivar private_endpoint_connections: List of private endpoint connections. + :vartype private_endpoint_connections: + list[~azure.mgmt.monitor.models.PrivateEndpointConnection] + :ivar public_network_access: Gets or sets allow or disallow public network access to workspace. + Known values are: "Enabled" and "Disabled". + :vartype public_network_access: str or ~azure.mgmt.monitor.models.PublicNetworkAccess + """ + + account_id: Optional[str] = rest_field(name="accountId", visibility=["read"]) + """The immutable ID of the Azure Monitor workspace. This property is read-only.""" + metrics: Optional["_models.Metrics"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Information about metrics for the Azure Monitor workspace.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is + healthy. Known values are: \"Succeeded\", \"Failed\", \"Canceled\", \"Creating\", and + \"Deleting\".""" + default_ingestion_settings: Optional["_models.IngestionSettings"] = rest_field( + name="defaultIngestionSettings", visibility=["read"] + ) + """The Data Collection Rule and Endpoint used for ingestion by default.""" + private_endpoint_connections: Optional[List["_models.PrivateEndpointConnection"]] = rest_field( + name="privateEndpointConnections", visibility=["read"] + ) + """List of private endpoint connections.""" + public_network_access: Optional[Union[str, "_models.PublicNetworkAccess"]] = rest_field( + name="publicNetworkAccess", visibility=["read"] + ) + """Gets or sets allow or disallow public network access to workspace. Known values are: + \"Enabled\" and \"Disabled\".""" + + @overload + def __init__( + self, + *, + metrics: Optional["_models.Metrics"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureMonitorWorkspaceUpdate(_Model): + """The type used for update operations of the AzureMonitorWorkspace. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.monitor.models.AzureMonitorWorkspaceUpdateProperties + """ + + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + properties: Optional["_models.AzureMonitorWorkspaceUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.AzureMonitorWorkspaceUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class AzureMonitorWorkspaceUpdateProperties(_Model): + """The updatable properties of the AzureMonitorWorkspace. + + :ivar metrics: Information about metrics for the Azure Monitor workspace. + :vartype metrics: ~azure.mgmt.monitor.models.Metrics + """ + + metrics: Optional["_models.Metrics"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Information about metrics for the Azure Monitor workspace.""" + + @overload + def __init__( + self, + *, + metrics: Optional["_models.Metrics"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class BatchProcessor(_Model): + """Batch processor. + + :ivar batch_size: Size of the batch. + :vartype batch_size: int + :ivar timeout: Timeout in milliseconds. + :vartype timeout: int + """ + + batch_size: Optional[int] = rest_field(name="batchSize", visibility=["read", "create", "update", "delete", "query"]) + """Size of the batch.""" + timeout: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Timeout in milliseconds.""" + + @overload + def __init__( + self, + *, + batch_size: Optional[int] = None, + timeout: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class CacheConfiguration(_Model): + """Cache configurations. + + :ivar max_storage_usage: Max storage usage in megabytes. + :vartype max_storage_usage: int + :ivar retention_period: Retention period in minutes. + :vartype retention_period: int + """ + + max_storage_usage: Optional[int] = rest_field( + name="maxStorageUsage", visibility=["read", "create", "update", "delete", "query"] + ) + """Max storage usage in megabytes.""" + retention_period: Optional[int] = rest_field( + name="retentionPeriod", visibility=["read", "create", "update", "delete", "query"] + ) + """Retention period in minutes.""" + + @overload + def __init__( + self, + *, + max_storage_usage: Optional[int] = None, + retention_period: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ConcurrencyConfiguration(_Model): + """Concurrent publishing configuration. + + :ivar worker_count: Number of parallel workers processing the log queues. + :vartype worker_count: int + :ivar batch_queue_size: Size of the queue for log batches. + :vartype batch_queue_size: int + """ + + worker_count: Optional[int] = rest_field( + name="workerCount", visibility=["read", "create", "update", "delete", "query"] + ) + """Number of parallel workers processing the log queues.""" + batch_queue_size: Optional[int] = rest_field( + name="batchQueueSize", visibility=["read", "create", "update", "delete", "query"] + ) + """Size of the queue for log batches.""" + + @overload + def __init__( + self, + *, + worker_count: Optional[int] = None, + batch_queue_size: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ErrorAdditionalInfo(_Model): + """The resource management error additional info. + + :ivar type: The additional info type. + :vartype type: str + :ivar info: The additional info. + :vartype info: any + """ + + type: Optional[str] = rest_field(visibility=["read"]) + """The additional info type.""" + info: Optional[Any] = rest_field(visibility=["read"]) + """The additional info.""" + + +class ErrorDetail(_Model): + """The error detail. + + :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.ErrorDetail] + :ivar additional_info: The error additional info. + :vartype additional_info: list[~azure.mgmt.monitor.models.ErrorAdditionalInfo] + """ + + code: Optional[str] = rest_field(visibility=["read"]) + """The error code.""" + message: Optional[str] = rest_field(visibility=["read"]) + """The error message.""" + target: Optional[str] = rest_field(visibility=["read"]) + """The error target.""" + details: Optional[List["_models.ErrorDetail"]] = rest_field(visibility=["read"]) + """The error details.""" + additional_info: Optional[List["_models.ErrorAdditionalInfo"]] = rest_field( + name="additionalInfo", visibility=["read"] + ) + """The error additional info.""" + + +class ErrorResponse(_Model): + """Error response. + + :ivar error: The error object. + :vartype error: ~azure.mgmt.monitor.models.ErrorDetail + """ + + error: Optional["_models.ErrorDetail"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The error object.""" + + @overload + def __init__( + self, + *, + error: Optional["_models.ErrorDetail"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Exporter(_Model): + """Exporter Info. + + :ivar type: The type of exporter. Required. Known values are: "AzureMonitorWorkspaceLogs" and + "PipelineGroup". + :vartype type: str or ~azure.mgmt.monitor.models.ExporterType + :ivar name: The name of exporter. Required. + :vartype name: str + :ivar azure_monitor_workspace_logs: Azure Monitor Workspace Logs specific configurations. + :vartype azure_monitor_workspace_logs: + ~azure.mgmt.monitor.models.AzureMonitorWorkspaceLogsExporter + :ivar tcp: TCP based exporter. Used for pipelineGroup exporter. + :vartype tcp: ~azure.mgmt.monitor.models.TcpExporter + """ + + type: Union[str, "_models.ExporterType"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of exporter. Required. Known values are: \"AzureMonitorWorkspaceLogs\" and + \"PipelineGroup\".""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of exporter. Required.""" + azure_monitor_workspace_logs: Optional["_models.AzureMonitorWorkspaceLogsExporter"] = rest_field( + name="azureMonitorWorkspaceLogs", visibility=["read", "create", "update", "delete", "query"] + ) + """Azure Monitor Workspace Logs specific configurations.""" + tcp: Optional["_models.TcpExporter"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """TCP based exporter. Used for pipelineGroup exporter.""" + + @overload + def __init__( + self, + *, + type: Union[str, "_models.ExporterType"], + name: str, + azure_monitor_workspace_logs: Optional["_models.AzureMonitorWorkspaceLogsExporter"] = None, + tcp: Optional["_models.TcpExporter"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ExtendedLocation(_Model): + """The complex type of the extended location. + + :ivar name: The name of the extended location. Required. + :vartype name: str + :ivar type: The type of the extended location. Required. Known values are: "EdgeZone" and + "CustomLocation". + :vartype type: str or ~azure.mgmt.monitor.models.ExtendedLocationType + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the extended location. Required.""" + type: Union[str, "_models.ExtendedLocationType"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The type of the extended location. Required. Known values are: \"EdgeZone\" and + \"CustomLocation\".""" + + @overload + def __init__( + self, + *, + name: str, + type: Union[str, "_models.ExtendedLocationType"], + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class IngestionSettings(_Model): + """Settings for data ingestion. + + :ivar data_collection_rule_resource_id: The Azure resource Id of the default data collection + rule for this workspace. + :vartype data_collection_rule_resource_id: str + :ivar data_collection_endpoint_resource_id: The Azure resource Id of the default data + collection endpoint for this workspace. + :vartype data_collection_endpoint_resource_id: str + """ + + data_collection_rule_resource_id: Optional[str] = rest_field( + name="dataCollectionRuleResourceId", visibility=["read"] + ) + """The Azure resource Id of the default data collection rule for this workspace.""" + data_collection_endpoint_resource_id: Optional[str] = rest_field( + name="dataCollectionEndpointResourceId", visibility=["read"] + ) + """The Azure resource Id of the default data collection endpoint for this workspace.""" + + +class Metrics(_Model): + """Information about metrics for the workspace. + + :ivar prometheus_query_endpoint: The Prometheus query endpoint for the workspace. + :vartype prometheus_query_endpoint: str + :ivar internal_id: An internal identifier for the metrics container. Only to be used by the + system. + :vartype internal_id: str + """ + + prometheus_query_endpoint: Optional[str] = rest_field(name="prometheusQueryEndpoint", visibility=["read"]) + """The Prometheus query endpoint for the workspace.""" + internal_id: Optional[str] = rest_field(name="internalId", visibility=["read"]) + """An internal identifier for the metrics container. Only to be used by the system.""" + + +class NetworkingConfiguration(_Model): + """Networking configuration for the pipeline group instance. + + :ivar external_networking_mode: External networking mode. Required. "LoadBalancerOnly" + :vartype external_networking_mode: str or ~azure.mgmt.monitor.models.ExternalNetworkingMode + :ivar host: The address exposed on the cluster. Example: azuremonitorpipeline.contoso.com. + :vartype host: str + :ivar routes: Networking routes configuration. Required. + :vartype routes: list[~azure.mgmt.monitor.models.NetworkingRoute] + """ + + external_networking_mode: Union[str, "_models.ExternalNetworkingMode"] = rest_field( + name="externalNetworkingMode", visibility=["read", "create", "update", "delete", "query"] + ) + """External networking mode. Required. \"LoadBalancerOnly\"""" + host: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The address exposed on the cluster. Example: azuremonitorpipeline.contoso.com.""" + routes: List["_models.NetworkingRoute"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Networking routes configuration. Required.""" + + @overload + def __init__( + self, + *, + external_networking_mode: Union[str, "_models.ExternalNetworkingMode"], + routes: List["_models.NetworkingRoute"], + host: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class NetworkingRoute(_Model): + """Networking route configuration. + + :ivar receiver: The name of the previously defined receiver. Required. + :vartype receiver: str + :ivar port: The port that will be configured externally. If not specified, it will use the port + from the receiver definition. + :vartype port: int + :ivar path: Route path. + :vartype path: str + :ivar subdomain: Route subdomain. + :vartype subdomain: str + """ + + receiver: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of the previously defined receiver. Required.""" + port: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The port that will be configured externally. If not specified, it will use the port from the + receiver definition.""" + path: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Route path.""" + subdomain: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Route subdomain.""" + + @overload + def __init__( + self, + *, + receiver: str, + port: Optional[int] = None, + path: Optional[str] = None, + subdomain: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Operation(_Model): + """REST API Operation. + + :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + :vartype name: str + :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for + data-plane operations and "false" for Azure Resource Manager/control-plane operations. + :vartype is_data_action: bool + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.monitor.models.OperationDisplay + :ivar origin: The intended executor of the operation; as in Resource Based Access Control + (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", + and "user,system". + :vartype origin: str or ~azure.mgmt.monitor.models.Origin + :ivar action_type: Extensible enum. Indicates the action type. "Internal" refers to actions + that are for internal only APIs. "Internal" + :vartype action_type: str or ~azure.mgmt.monitor.models.ActionType + """ + + name: Optional[str] = rest_field(visibility=["read"]) + """The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + \"Microsoft.Compute/virtualMachines/write\", + \"Microsoft.Compute/virtualMachines/capture/action\".""" + is_data_action: Optional[bool] = rest_field(name="isDataAction", visibility=["read"]) + """Whether the operation applies to data-plane. This is \"true\" for data-plane operations and + \"false\" for Azure Resource Manager/control-plane operations.""" + display: Optional["_models.OperationDisplay"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Localized display information for this particular operation.""" + origin: Optional[Union[str, "_models.Origin"]] = rest_field(visibility=["read"]) + """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit + logs UX. Default value is \"user,system\". Known values are: \"user\", \"system\", and + \"user,system\".""" + action_type: Optional[Union[str, "_models.ActionType"]] = rest_field(name="actionType", visibility=["read"]) + """Extensible enum. Indicates the action type. \"Internal\" refers to actions that are for + internal only APIs. \"Internal\"""" + + @overload + def __init__( + self, + *, + display: Optional["_models.OperationDisplay"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class OperationDisplay(_Model): + """Localized display information for and operation. + + :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft + Monitoring Insights" or "Microsoft Compute". + :vartype provider: str + :ivar resource: The localized friendly name of the resource type related to this operation. + E.g. "Virtual Machines" or "Job Schedule Collections". + :vartype resource: str + :ivar operation: The concise, localized friendly name for the operation; suitable for + dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". + :vartype operation: str + :ivar description: The short, localized friendly description of the operation; suitable for + tool tips and detailed views. + :vartype description: str + """ + + provider: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly form of the resource provider name, e.g. \"Microsoft Monitoring + Insights\" or \"Microsoft Compute\".""" + resource: Optional[str] = rest_field(visibility=["read"]) + """The localized friendly name of the resource type related to this operation. E.g. \"Virtual + Machines\" or \"Job Schedule Collections\".""" + operation: Optional[str] = rest_field(visibility=["read"]) + """The concise, localized friendly name for the operation; suitable for dropdowns. E.g. \"Create + or Update Virtual Machine\", \"Restart Virtual Machine\".""" + description: Optional[str] = rest_field(visibility=["read"]) + """The short, localized friendly description of the operation; suitable for tool tips and detailed + views.""" + + +class OtlpReceiver(_Model): + """OTLP Receiver. + + :ivar endpoint: OTLP GRPC endpoint definition. Example: 0.0.0.0:. Required. + :vartype endpoint: str + """ + + endpoint: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """OTLP GRPC endpoint definition. Example: 0.0.0.0:. Required.""" + + @overload + def __init__( + self, + *, + endpoint: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PersistenceConfigurations(_Model): + """Persistence options to all pipelines in the instance. + + :ivar persistent_volume_name: The name of the mounted persistent volume. Required. + :vartype persistent_volume_name: str + """ + + persistent_volume_name: str = rest_field( + name="persistentVolumeName", visibility=["read", "create", "update", "delete", "query"] + ) + """The name of the mounted persistent volume. Required.""" + + @overload + def __init__( + self, + *, + persistent_volume_name: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Pipeline(_Model): + """Pipeline Info. + + :ivar name: Name of the pipeline. Required. + :vartype name: str + :ivar type: The type of pipeline. Required. "logs" + :vartype type: str or ~azure.mgmt.monitor.models.PipelineType + :ivar receivers: Reference to receivers configured for the pipeline. Required. + :vartype receivers: list[str] + :ivar processors: Reference to processors configured for the pipeline. + :vartype processors: list[str] + :ivar exporters: Reference to exporters configured for the pipeline. Required. + :vartype exporters: list[str] + """ + + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Name of the pipeline. Required.""" + type: Union[str, "_models.PipelineType"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of pipeline. Required. \"logs\"""" + receivers: List[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Reference to receivers configured for the pipeline. Required.""" + processors: Optional[List[str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Reference to processors configured for the pipeline.""" + exporters: List[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Reference to exporters configured for the pipeline. Required.""" + + @overload + def __init__( + self, + *, + name: str, + type: Union[str, "_models.PipelineType"], + receivers: List[str], + exporters: List[str], + processors: Optional[List[str]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PipelineGroup(TrackedResource): + """A pipeline group definition. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.monitor.models.SystemData + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar location: The geo-location where the resource lives. Required. + :vartype location: str + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.monitor.models.PipelineGroupProperties + :ivar extended_location: The extended location for given pipeline group. + :vartype extended_location: ~azure.mgmt.monitor.models.ExtendedLocation + """ + + properties: Optional["_models.PipelineGroupProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + extended_location: Optional["_models.ExtendedLocation"] = rest_field( + name="extendedLocation", visibility=["read", "create"] + ) + """The extended location for given pipeline group.""" + + @overload + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.PipelineGroupProperties"] = None, + extended_location: Optional["_models.ExtendedLocation"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PipelineGroupProperties(_Model): + """Properties that need to be specified to create a new pipeline group instance. + + :ivar replicas: Defines the amount of replicas of the pipeline group instance. + :vartype replicas: int + :ivar receivers: The receivers specified for a pipeline group instance. Required. + :vartype receivers: list[~azure.mgmt.monitor.models.Receiver] + :ivar processors: The processors specified for a pipeline group instance. Required. + :vartype processors: list[~azure.mgmt.monitor.models.Processor] + :ivar exporters: The exporters specified for a pipeline group instance. Required. + :vartype exporters: list[~azure.mgmt.monitor.models.Exporter] + :ivar service: The service section for a given pipeline group instance. Required. + :vartype service: ~azure.mgmt.monitor.models.Service + :ivar networking_configurations: Networking configurations for the pipeline group instance. + :vartype networking_configurations: list[~azure.mgmt.monitor.models.NetworkingConfiguration] + :ivar provisioning_state: The provisioning state of a pipeline group instance. Set to Succeeded + if everything is healthy. Known values are: "Succeeded", "Failed", "Canceled", "Creating", and + "Deleting". + :vartype provisioning_state: str or ~azure.mgmt.monitor.models.ProvisioningState + """ + + replicas: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Defines the amount of replicas of the pipeline group instance.""" + receivers: List["_models.Receiver"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The receivers specified for a pipeline group instance. Required.""" + processors: List["_models.Processor"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The processors specified for a pipeline group instance. Required.""" + exporters: List["_models.Exporter"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The exporters specified for a pipeline group instance. Required.""" + service: "_models.Service" = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The service section for a given pipeline group instance. Required.""" + networking_configurations: Optional[List["_models.NetworkingConfiguration"]] = rest_field( + name="networkingConfigurations", visibility=["read", "create", "update", "delete", "query"] + ) + """Networking configurations for the pipeline group instance.""" + provisioning_state: Optional[Union[str, "_models.ProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of a pipeline group instance. Set to Succeeded if everything is healthy. + Known values are: \"Succeeded\", \"Failed\", \"Canceled\", \"Creating\", and \"Deleting\".""" + + @overload + def __init__( + self, + *, + receivers: List["_models.Receiver"], + processors: List["_models.Processor"], + exporters: List["_models.Exporter"], + service: "_models.Service", + replicas: Optional[int] = None, + networking_configurations: Optional[List["_models.NetworkingConfiguration"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PipelineGroupUpdate(_Model): + """The type used for update operations of the PipelineGroup. + + :ivar tags: Resource tags. + :vartype tags: dict[str, str] + :ivar properties: The resource-specific properties for this resource. + :vartype properties: ~azure.mgmt.monitor.models.PipelineGroupUpdateProperties + """ + + tags: Optional[Dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource tags.""" + properties: Optional["_models.PipelineGroupUpdateProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The resource-specific properties for this resource.""" + + @overload + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + properties: Optional["_models.PipelineGroupUpdateProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PipelineGroupUpdateProperties(_Model): + """The updatable properties of the PipelineGroup. + + :ivar replicas: Defines the amount of replicas of the pipeline group instance. + :vartype replicas: int + :ivar receivers: The receivers specified for a pipeline group instance. + :vartype receivers: list[~azure.mgmt.monitor.models.Receiver] + :ivar processors: The processors specified for a pipeline group instance. + :vartype processors: list[~azure.mgmt.monitor.models.Processor] + :ivar exporters: The exporters specified for a pipeline group instance. + :vartype exporters: list[~azure.mgmt.monitor.models.Exporter] + :ivar service: The service section for a given pipeline group instance. + :vartype service: ~azure.mgmt.monitor.models.Service + :ivar networking_configurations: Networking configurations for the pipeline group instance. + :vartype networking_configurations: list[~azure.mgmt.monitor.models.NetworkingConfiguration] + """ + + replicas: Optional[int] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Defines the amount of replicas of the pipeline group instance.""" + receivers: Optional[List["_models.Receiver"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The receivers specified for a pipeline group instance.""" + processors: Optional[List["_models.Processor"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The processors specified for a pipeline group instance.""" + exporters: Optional[List["_models.Exporter"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The exporters specified for a pipeline group instance.""" + service: Optional["_models.Service"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The service section for a given pipeline group instance.""" + networking_configurations: Optional[List["_models.NetworkingConfiguration"]] = rest_field( + name="networkingConfigurations", visibility=["read", "create", "update", "delete", "query"] + ) + """Networking configurations for the pipeline group instance.""" + + @overload + def __init__( + self, + *, + replicas: Optional[int] = None, + receivers: Optional[List["_models.Receiver"]] = None, + processors: Optional[List["_models.Processor"]] = None, + exporters: Optional[List["_models.Exporter"]] = None, + service: Optional["_models.Service"] = None, + networking_configurations: Optional[List["_models.NetworkingConfiguration"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateEndpoint(_Model): + """The private endpoint resource. + + :ivar id: The resource identifier of the private endpoint. + :vartype id: str + """ + + id: Optional[str] = rest_field(visibility=["read"]) + """The resource identifier of the private endpoint.""" + + +class PrivateEndpointConnection(Resource): + """The private endpoint connection resource. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :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: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.monitor.models.SystemData + :ivar properties: The private endpoint connection properties. + :vartype properties: ~azure.mgmt.monitor.models.PrivateEndpointConnectionProperties + """ + + properties: Optional["_models.PrivateEndpointConnectionProperties"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The private endpoint connection properties.""" + + @overload + def __init__( + self, + *, + properties: Optional["_models.PrivateEndpointConnectionProperties"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateEndpointConnectionProperties(_Model): + """Properties of the private endpoint connection. + + :ivar group_ids: The group ids for the private endpoint resource. + :vartype group_ids: list[str] + :ivar private_endpoint: The private endpoint resource. + :vartype private_endpoint: ~azure.mgmt.monitor.models.PrivateEndpoint + :ivar private_link_service_connection_state: A collection of information about the state of the + connection between service consumer and provider. Required. + :vartype private_link_service_connection_state: + ~azure.mgmt.monitor.models.PrivateLinkServiceConnectionState + :ivar provisioning_state: The provisioning state of the private endpoint connection resource. + Known values are: "Succeeded", "Creating", "Deleting", and "Failed". + :vartype provisioning_state: str or + ~azure.mgmt.monitor.models.PrivateEndpointConnectionProvisioningState + """ + + group_ids: Optional[List[str]] = rest_field(name="groupIds", visibility=["read"]) + """The group ids for the private endpoint resource.""" + private_endpoint: Optional["_models.PrivateEndpoint"] = rest_field( + name="privateEndpoint", visibility=["read", "create", "update", "delete", "query"] + ) + """The private endpoint resource.""" + private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState" = rest_field( + name="privateLinkServiceConnectionState", visibility=["read", "create", "update", "delete", "query"] + ) + """A collection of information about the state of the connection between service consumer and + provider. Required.""" + provisioning_state: Optional[Union[str, "_models.PrivateEndpointConnectionProvisioningState"]] = rest_field( + name="provisioningState", visibility=["read"] + ) + """The provisioning state of the private endpoint connection resource. Known values are: + \"Succeeded\", \"Creating\", \"Deleting\", and \"Failed\".""" + + @overload + def __init__( + self, + *, + private_link_service_connection_state: "_models.PrivateLinkServiceConnectionState", + private_endpoint: Optional["_models.PrivateEndpoint"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class PrivateLinkServiceConnectionState(_Model): + """A collection of information about the state of the connection between service consumer and + provider. + + :ivar status: Indicates whether the connection has been Approved/Rejected/Removed by the owner + of the service. Known values are: "Pending", "Approved", and "Rejected". + :vartype status: str or ~azure.mgmt.monitor.models.PrivateEndpointServiceConnectionStatus + :ivar description: The reason for approval/rejection of the connection. + :vartype description: str + :ivar actions_required: A message indicating if changes on the service provider require any + updates on the consumer. + :vartype actions_required: str + """ + + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + service. Known values are: \"Pending\", \"Approved\", and \"Rejected\".""" + description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The reason for approval/rejection of the connection.""" + actions_required: Optional[str] = rest_field( + name="actionsRequired", visibility=["read", "create", "update", "delete", "query"] + ) + """A message indicating if changes on the service provider require any updates on the consumer.""" + + @overload + def __init__( + self, + *, + status: Optional[Union[str, "_models.PrivateEndpointServiceConnectionStatus"]] = None, + description: Optional[str] = None, + actions_required: Optional[str] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Processor(_Model): + """Processor Info. + + :ivar type: The type of processor. Required. "Batch" + :vartype type: str or ~azure.mgmt.monitor.models.ProcessorType + :ivar name: The name of processor. Required. + :vartype name: str + :ivar batch: Batch processor configurations. + :vartype batch: ~azure.mgmt.monitor.models.BatchProcessor + """ + + type: Union[str, "_models.ProcessorType"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of processor. Required. \"Batch\"""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of processor. Required.""" + batch: Optional["_models.BatchProcessor"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Batch processor configurations.""" + + @overload + def __init__( + self, + *, + type: Union[str, "_models.ProcessorType"], + name: str, + batch: Optional["_models.BatchProcessor"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Receiver(_Model): + """Receiver Info. + + :ivar type: The type of receiver. Required. Known values are: "Syslog", "Ama", "PipelineGroup", + "OTLP", and "UDP". + :vartype type: str or ~azure.mgmt.monitor.models.ReceiverType + :ivar name: The name of receiver. Required. + :vartype name: str + :ivar syslog: Syslog configurations. This field is mandatory for syslog type receivers. + :vartype syslog: ~azure.mgmt.monitor.models.SyslogReceiver + :ivar otlp: OTLP receiver configurations. This field is mandatory for OTLP and pipelineGroup + receivers. + :vartype otlp: ~azure.mgmt.monitor.models.OtlpReceiver + :ivar udp: UDP receiver configurations. This field is mandatory for UDP receivers. + :vartype udp: ~azure.mgmt.monitor.models.UdpReceiver + """ + + type: Union[str, "_models.ReceiverType"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The type of receiver. Required. Known values are: \"Syslog\", \"Ama\", \"PipelineGroup\", + \"OTLP\", and \"UDP\".""" + name: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """The name of receiver. Required.""" + syslog: Optional["_models.SyslogReceiver"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Syslog configurations. This field is mandatory for syslog type receivers.""" + otlp: Optional["_models.OtlpReceiver"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """OTLP receiver configurations. This field is mandatory for OTLP and pipelineGroup receivers.""" + udp: Optional["_models.UdpReceiver"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """UDP receiver configurations. This field is mandatory for UDP receivers.""" + + @overload + def __init__( + self, + *, + type: Union[str, "_models.ReceiverType"], + name: str, + syslog: Optional["_models.SyslogReceiver"] = None, + otlp: Optional["_models.OtlpReceiver"] = None, + udp: Optional["_models.UdpReceiver"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class RecordMap(_Model): + """Record map for schema in azure monitor. + + :ivar from_property: Record Map Key. Required. + :vartype from_property: str + :ivar to: Record Map Value. Required. + :vartype to: str + """ + + from_property: str = rest_field(name="from", visibility=["read", "create", "update", "delete", "query"]) + """Record Map Key. Required.""" + to: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Record Map Value. Required.""" + + @overload + def __init__( + self, + *, + from_property: str, + to: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ResourceMap(_Model): + """Resource map for schema in azure monitor. + + :ivar from_property: Resource Map Key. Required. + :vartype from_property: str + :ivar to: Resource Map Value. Required. + :vartype to: str + """ + + from_property: str = rest_field(name="from", visibility=["read", "create", "update", "delete", "query"]) + """Resource Map Key. Required.""" + to: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Resource Map Value. Required.""" + + @overload + def __init__( + self, + *, + from_property: str, + to: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SchemaMap(_Model): + """Schema map for azure monitor for logs. + + :ivar record_map: Record Map. Required. + :vartype record_map: list[~azure.mgmt.monitor.models.RecordMap] + :ivar resource_map: Resource Map captures information about the entity for which telemetry is + recorded. For example, metrics exposed by a Kubernetes container can be linked to a resource + that specifies the cluster, namespace, pod, and container name.Resource may capture an entire + hierarchy of entity identification. It may describe the host in the cloud and specific + container or an application running in the process. + :vartype resource_map: list[~azure.mgmt.monitor.models.ResourceMap] + :ivar scope_map: A scope map is a logical unit of the application code with which the emitted + telemetry can be associated. + :vartype scope_map: list[~azure.mgmt.monitor.models.ScopeMap] + """ + + record_map: List["_models.RecordMap"] = rest_field( + name="recordMap", visibility=["read", "create", "update", "delete", "query"] + ) + """Record Map. Required.""" + resource_map: Optional[List["_models.ResourceMap"]] = rest_field( + name="resourceMap", visibility=["read", "create", "update", "delete", "query"] + ) + """Resource Map captures information about the entity for which telemetry is recorded. For + example, metrics exposed by a Kubernetes container can be linked to a resource that specifies + the cluster, namespace, pod, and container name.Resource may capture an entire hierarchy of + entity identification. It may describe the host in the cloud and specific container or an + application running in the process.""" + scope_map: Optional[List["_models.ScopeMap"]] = rest_field( + name="scopeMap", visibility=["read", "create", "update", "delete", "query"] + ) + """A scope map is a logical unit of the application code with which the emitted telemetry can be + associated.""" + + @overload + def __init__( + self, + *, + record_map: List["_models.RecordMap"], + resource_map: Optional[List["_models.ResourceMap"]] = None, + scope_map: Optional[List["_models.ScopeMap"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class ScopeMap(_Model): + """Scope map for schema in azure monitor. + + :ivar from_property: Scope Map Key. Required. + :vartype from_property: str + :ivar to: Scope Map Value. Required. + :vartype to: str + """ + + from_property: str = rest_field(name="from", visibility=["read", "create", "update", "delete", "query"]) + """Scope Map Key. Required.""" + to: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Scope Map Value. Required.""" + + @overload + def __init__( + self, + *, + from_property: str, + to: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class Service(_Model): + """Service Info. + + :ivar pipelines: Pipelines belonging to a given pipeline group. Required. + :vartype pipelines: list[~azure.mgmt.monitor.models.Pipeline] + :ivar persistence: Persistence options to all pipelines in the instance. + :vartype persistence: ~azure.mgmt.monitor.models.PersistenceConfigurations + """ + + pipelines: List["_models.Pipeline"] = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Pipelines belonging to a given pipeline group. Required.""" + persistence: Optional["_models.PersistenceConfigurations"] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Persistence options to all pipelines in the instance.""" + + @overload + def __init__( + self, + *, + pipelines: List["_models.Pipeline"], + persistence: Optional["_models.PersistenceConfigurations"] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SyslogReceiver(_Model): + """Base receiver using TCP as transport protocol. + + :ivar endpoint: Syslog receiver endpoint definition. Example: 0.0.0.0:. Required. + :vartype endpoint: str + :ivar protocol: Protocol to parse syslog messages. Default rfc3164. Known values are: "rfc3164" + and "rfc5424". + :vartype protocol: str or ~azure.mgmt.monitor.models.SyslogProtocol + """ + + endpoint: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """Syslog receiver endpoint definition. Example: 0.0.0.0:. Required.""" + protocol: Optional[Union[str, "_models.SyslogProtocol"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """Protocol to parse syslog messages. Default rfc3164. Known values are: \"rfc3164\" and + \"rfc5424\".""" + + @overload + def __init__( + self, + *, + endpoint: str, + protocol: Optional[Union[str, "_models.SyslogProtocol"]] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class SystemData(_Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Known values are: + "User", "Application", "ManagedIdentity", and "Key". + :vartype created_by_type: str or ~azure.mgmt.monitor.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Known values + are: "User", "Application", "ManagedIdentity", and "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.monitor.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + created_by: Optional[str] = rest_field(name="createdBy", visibility=["read", "create", "update", "delete", "query"]) + """The identity that created the resource.""" + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="createdByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that created the resource. Known values are: \"User\", \"Application\", + \"ManagedIdentity\", and \"Key\".""" + created_at: Optional[datetime.datetime] = rest_field( + name="createdAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource creation (UTC).""" + last_modified_by: Optional[str] = rest_field( + name="lastModifiedBy", visibility=["read", "create", "update", "delete", "query"] + ) + """The identity that last modified the resource.""" + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = rest_field( + name="lastModifiedByType", visibility=["read", "create", "update", "delete", "query"] + ) + """The type of identity that last modified the resource. Known values are: \"User\", + \"Application\", \"ManagedIdentity\", and \"Key\".""" + last_modified_at: Optional[datetime.datetime] = rest_field( + name="lastModifiedAt", visibility=["read", "create", "update", "delete", "query"], format="rfc3339" + ) + """The timestamp of resource last modification (UTC).""" + + @overload + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class TcpExporter(_Model): + """Base exporter using TCP as transport protocol. + + :ivar url: TCP url to export. Required. + :vartype url: str + """ + + url: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """TCP url to export. Required.""" + + @overload + def __init__( + self, + *, + url: str, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) + + +class UdpReceiver(_Model): + """Receiver using UDP as transport protocol. + + :ivar endpoint: TCP endpoint definition. Example: 0.0.0.0:. Required. + :vartype endpoint: str + :ivar encoding: The encoding of the stream being received. Known values are: "nop", "utf-8", + "utf-16le", "utf-16be", "ascii", and "big5". + :vartype encoding: str or ~azure.mgmt.monitor.models.StreamEncodingType + :ivar read_queue_length: Max read queue length. + :vartype read_queue_length: int + """ + + endpoint: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) + """TCP endpoint definition. Example: 0.0.0.0:. Required.""" + encoding: Optional[Union[str, "_models.StreamEncodingType"]] = rest_field( + visibility=["read", "create", "update", "delete", "query"] + ) + """The encoding of the stream being received. Known values are: \"nop\", \"utf-8\", \"utf-16le\", + \"utf-16be\", \"ascii\", and \"big5\".""" + read_queue_length: Optional[int] = rest_field( + name="readQueueLength", visibility=["read", "create", "update", "delete", "query"] + ) + """Max read queue length.""" + + @overload + def __init__( + self, + *, + endpoint: str, + encoding: Optional[Union[str, "_models.StreamEncodingType"]] = None, + read_queue_length: Optional[int] = None, + ) -> None: ... + + @overload + def __init__(self, mapping: Mapping[str, Any]) -> None: + """ + :param mapping: raw JSON to initialize the model. + :type mapping: Mapping[str, Any] + """ + + def __init__(self, *args: Any, **kwargs: Any) -> None: + super().__init__(*args, **kwargs) 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 deleted file mode 100644 index 5b3309160199..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_models_py3.py +++ /dev/null @@ -1,8756 +0,0 @@ -# pylint: disable=too-many-lines -# 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, 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 - -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): - """The action detail. - - :ivar mechanism_type: The mechanism type. - :vartype mechanism_type: str - :ivar name: The name of the action. - :vartype name: str - :ivar status: The status of the action. - :vartype status: str - :ivar sub_state: The substatus of the action. - :vartype sub_state: str - :ivar send_time: The send time. - :vartype send_time: str - :ivar detail: The detail of the friendly error message. - :vartype detail: str - """ - - _attribute_map = { - "mechanism_type": {"key": "MechanismType", "type": "str"}, - "name": {"key": "Name", "type": "str"}, - "status": {"key": "Status", "type": "str"}, - "sub_state": {"key": "SubState", "type": "str"}, - "send_time": {"key": "SendTime", "type": "str"}, - "detail": {"key": "Detail", "type": "str"}, - } - - def __init__( - self, - *, - mechanism_type: Optional[str] = None, - name: Optional[str] = None, - status: Optional[str] = None, - sub_state: Optional[str] = None, - send_time: Optional[str] = None, - detail: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword mechanism_type: The mechanism type. - :paramtype mechanism_type: str - :keyword name: The name of the action. - :paramtype name: str - :keyword status: The status of the action. - :paramtype status: str - :keyword sub_state: The substatus of the action. - :paramtype sub_state: str - :keyword send_time: The send time. - :paramtype send_time: str - :keyword detail: The detail of the friendly error message. - :paramtype detail: str - """ - super().__init__(**kwargs) - self.mechanism_type = mechanism_type - self.name = name - self.status = status - self.sub_state = sub_state - self.send_time = send_time - self.detail = detail - - -class ActionGroupList(_serialization.Model): - """A list of action groups. - - :ivar value: The list of action groups. - :vartype value: list[~azure.mgmt.monitor.models.ActionGroupResource] - :ivar next_link: Provides the link to retrieve the next set of elements. - :vartype next_link: str - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ActionGroupResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ActionGroupResource"]] = None, - next_link: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword value: The list of action groups. - :paramtype value: list[~azure.mgmt.monitor.models.ActionGroupResource] - :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 ActionGroupPatchBody(_serialization.Model): - """An action group object for the body of patch operations. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :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 - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "enabled": {"key": "properties.enabled", "type": "bool"}, - } - - 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 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.enabled = enabled - - -class AzureResource(_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] - """ - - _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}"}, - } - - 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 - - -class ActionGroupResource(AzureResource): - """An action group 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 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 - enabled, then none of its receivers will receive communications. - :vartype enabled: bool - :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 = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "group_short_name": {"max_length": 12}, - } - - _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}"}, - "group_short_name": {"key": "properties.groupShortName", "type": "str"}, - "enabled": {"key": "properties.enabled", "type": "bool"}, - "email_receivers": {"key": "properties.emailReceivers", "type": "[EmailReceiver]"}, - "sms_receivers": {"key": "properties.smsReceivers", "type": "[SmsReceiver]"}, - "webhook_receivers": {"key": "properties.webhookReceivers", "type": "[WebhookReceiver]"}, - "itsm_receivers": {"key": "properties.itsmReceivers", "type": "[ItsmReceiver]"}, - "azure_app_push_receivers": {"key": "properties.azureAppPushReceivers", "type": "[AzureAppPushReceiver]"}, - "automation_runbook_receivers": { - "key": "properties.automationRunbookReceivers", - "type": "[AutomationRunbookReceiver]", - }, - "voice_receivers": {"key": "properties.voiceReceivers", "type": "[VoiceReceiver]"}, - "logic_app_receivers": {"key": "properties.logicAppReceivers", "type": "[LogicAppReceiver]"}, - "azure_function_receivers": {"key": "properties.azureFunctionReceivers", "type": "[AzureFunctionReceiver]"}, - "arm_role_receivers": {"key": "properties.armRoleReceivers", "type": "[ArmRoleReceiver]"}, - "event_hub_receivers": {"key": "properties.eventHubReceivers", "type": "[EventHubReceiver]"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - group_short_name: Optional[str] = None, - enabled: bool = True, - 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 location: Resource location. Required. - :paramtype location: str - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword group_short_name: The short name of the action group. This will be used in SMS - messages. - :paramtype group_short_name: str - :keyword enabled: Indicates whether this action group is enabled. If an action group is not - enabled, then none of its receivers will receive communications. - :paramtype enabled: bool - :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__(location=location, tags=tags, **kwargs) - self.group_short_name = group_short_name - self.enabled = enabled - 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 ActivityLogAlertActionGroup(_serialization.Model): - """A pointer to an Azure Action Group. - - All required parameters must be populated in order to send to server. - - :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] - """ - - _validation = { - "action_group_id": {"required": True}, - } - - _attribute_map = { - "action_group_id": {"key": "actionGroupId", "type": "str"}, - "webhook_properties": {"key": "webhookProperties", "type": "{str}"}, - } - - def __init__( - self, *, action_group_id: str, webhook_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] - """ - super().__init__(**kwargs) - self.action_group_id = action_group_id - self.webhook_properties = webhook_properties - - -class ActivityLogAlertActionList(_serialization.Model): - """A list of activity log alert actions. - - :ivar action_groups: The list of activity log alerts. - :vartype action_groups: list[~azure.mgmt.monitor.models.ActivityLogAlertActionGroup] - """ - - _attribute_map = { - "action_groups": {"key": "actionGroups", "type": "[ActivityLogAlertActionGroup]"}, - } - - def __init__( - self, *, action_groups: Optional[List["_models.ActivityLogAlertActionGroup"]] = None, **kwargs: Any - ) -> None: - """ - :keyword action_groups: The list of activity log alerts. - :paramtype action_groups: list[~azure.mgmt.monitor.models.ActivityLogAlertActionGroup] - """ - super().__init__(**kwargs) - self.action_groups = action_groups - - -class ActivityLogAlertAllOfCondition(_serialization.Model): - """An Activity Log alert condition that is met when all its member conditions are met. - - 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] - """ - - _validation = { - "all_of": {"required": True}, - } - - _attribute_map = { - "all_of": {"key": "allOf", "type": "[ActivityLogAlertLeafCondition]"}, - } - - def __init__(self, *, all_of: List["_models.ActivityLogAlertLeafCondition"], **kwargs: Any) -> None: - """ - :keyword all_of: The list of activity log alert conditions. Required. - :paramtype all_of: list[~azure.mgmt.monitor.models.ActivityLogAlertLeafCondition] - """ - super().__init__(**kwargs) - self.all_of = all_of - - -class ActivityLogAlertLeafCondition(_serialization.Model): - """An Activity Log alert condition that is met by comparing an activity log field and value. - - 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 - """ - - _validation = { - "field": {"required": True}, - "equals": {"required": True}, - } - - _attribute_map = { - "field": {"key": "field", "type": "str"}, - "equals": {"key": "equals", "type": "str"}, - } - - def __init__(self, *, field: str, equals: 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 - """ - super().__init__(**kwargs) - self.field = field - self.equals = equals - - -class ActivityLogAlertList(_serialization.Model): - """A list of activity log alerts. - - :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 - """ - - _attribute_map = { - "value": {"key": "value", "type": "[ActivityLogAlertResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, - *, - value: Optional[List["_models.ActivityLogAlertResource"]] = None, - next_link: 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 - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ActivityLogAlertPatchBody(_serialization.Model): - """An activity log alert object for the body of patch operations. - - :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 - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "enabled": {"key": "properties.enabled", "type": "bool"}, - } - - 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 - """ - super().__init__(**kwargs) - self.tags = tags - self.enabled = enabled - - -class Resource(_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] - """ - - _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}"}, - } - - 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 - - -class ActivityLogAlertResource(Resource): - """An activity log 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 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 - """ - - _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"}, - } - - 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 - ) -> 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 - """ - super().__init__(location=location, tags=tags, **kwargs) - self.scopes = scopes - self.enabled = enabled - self.condition = condition - self.actions = actions - self.description = description - - -class AlertingAction(Action): - """Specify action need to be taken when rule type is Alert. - - 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 - """ - - _validation = { - "odata_type": {"required": True}, - "severity": {"required": True}, - "trigger": {"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"}, - } - - 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 - ) -> 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 - """ - 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 - - -class ArmRoleReceiver(_serialization.Model): - """An arm role receiver. - - 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. - :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 = { - "name": {"key": "name", "type": "str"}, - "role_id": {"key": "roleId", "type": "str"}, - "use_common_alert_schema": {"key": "useCommonAlertSchema", "type": "bool"}, - } - - def __init__(self, *, name: str, role_id: 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. - :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.name = name - self.role_id = role_id - self.use_common_alert_schema = use_common_alert_schema - - -class AutomationRunbookReceiver(_serialization.Model): - """The Azure Automation Runbook notification receiver. - - 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 - """ - - _validation = { - "automation_account_id": {"required": True}, - "runbook_name": {"required": True}, - "webhook_resource_id": {"required": True}, - "is_global_runbook": {"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"}, - } - - 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: - """ - :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 - """ - 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 - - -class AutoscaleErrorResponse(_serialization.Model): - """Describes the format of Error response. - - 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 - """ - - _validation = { - "system_data": {"readonly": True}, - } - - _attribute_map = { - "error": {"key": "error", "type": "AutoscaleErrorResponseError"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, *, error: Optional["_models.AutoscaleErrorResponseError"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.monitor.models.AutoscaleErrorResponseError - """ - super().__init__(**kwargs) - self.error = error - self.system_data = None - - -class AutoscaleErrorResponseError(_serialization.Model): - """The error object. - - :ivar code: One of a server-defined set of error codes. - :vartype code: str - :ivar message: A human-readable representation of the error. - :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: - """ - :keyword code: One of a server-defined set of error codes. - :paramtype code: str - :keyword message: A human-readable representation of the error. - :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. - - 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] - """ - - _validation = { - "operation": {"required": True, "constant": True}, - } - - _attribute_map = { - "operation": {"key": "operation", "type": "str"}, - "email": {"key": "email", "type": "EmailNotification"}, - "webhooks": {"key": "webhooks", "type": "[WebhookNotification]"}, - } - - 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] - """ - super().__init__(**kwargs) - self.email = email - self.webhooks = webhooks - - -class AutoscaleProfile(_serialization.Model): - """Autoscale profile. - - All required parameters must be populated in order to send to server. - - :ivar name: the name of the profile. 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 - """ - - _validation = { - "name": {"required": True}, - "capacity": {"required": True}, - "rules": {"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"}, - } - - def __init__( - self, - *, - name: str, - capacity: "_models.ScaleCapacity", - rules: List["_models.ScaleRule"], - fixed_date: Optional["_models.TimeWindow"] = None, - recurrence: Optional["_models.Recurrence"] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: the name of the profile. 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 - """ - super().__init__(**kwargs) - self.name = name - self.capacity = capacity - self.rules = rules - self.fixed_date = fixed_date - self.recurrence = recurrence - - -class ResourceAutoGenerated(_serialization.Model): - """The autoscale setting 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 - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "location": {"required": True}, - "system_data": {"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}"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = 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] - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - self.tags = tags - self.system_data = None - - -class AutoscaleSettingResource(ResourceAutoGenerated): - """The autoscale setting 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 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 - """ - - _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}, - } - - _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"}, - } - - 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, - **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 - """ - 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 - - -class AutoscaleSettingResourceCollection(_serialization.Model): - """Represents a collection of autoscale setting resources. - - 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 - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[AutoscaleSettingResource]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.AutoscaleSettingResource"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :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 - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class AutoscaleSettingResourcePatch(_serialization.Model): - """The autoscale setting object for patch operations. - - :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. - :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 - """ - - _validation = { - "profiles": {"max_items": 20, "min_items": 0}, - } - - _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"}, - } - - 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 - ) -> 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. - :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 - """ - super().__init__(**kwargs) - self.name = name - self.email_address = email_address - - -class AzureFunctionReceiver(_serialization.Model): - """An azure function 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 - 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 - """ - - _validation = { - "name": {"required": True}, - "function_app_resource_id": {"required": True}, - "function_name": {"required": True}, - "http_trigger_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"}, - "use_common_alert_schema": {"key": "useCommonAlertSchema", "type": "bool"}, - } - - def __init__( - self, - *, - name: str, - function_app_resource_id: str, - function_name: str, - http_trigger_url: str, - use_common_alert_schema: bool = False, - **kwargs: Any - ) -> None: - """ - :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 - """ - 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.use_common_alert_schema = use_common_alert_schema - - -class PrivateLinkScopesResource(_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] - """ - - _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}"}, - } - - 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 - - -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 - - -class AzureMonitorPrivateLinkScopeListResult(_serialization.Model): - """Describes the list of Azure Monitor PrivateLinkScope resources. - - 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 - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[AzureMonitorPrivateLinkScope]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.AzureMonitorPrivateLinkScope"], next_link: Optional[str] = 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] - """ - super().__init__(**kwargs) - self.sensitivity = sensitivity - self.low_thresholds = low_thresholds - self.high_thresholds = high_thresholds - - -class SingleMetricBaseline(_serialization.Model): - """The baseline results of a single metric. - - All required parameters must be populated in order to send to server. - - :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] - """ - - _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]"}, - } - - 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, - **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] - """ - super().__init__(**kwargs) - self.id = id - self.type = type - self.name = name - self.timespan = timespan - self.interval = interval - self.namespace = namespace - self.baselines = baselines - - -class SinkConfiguration(_serialization.Model): - """SinkConfiguration. - - All required parameters must be populated in order to send to server. - - :ivar kind: Required. Known values are: "EventHub", "ApplicationInsights", and "LogAnalytics". - :vartype kind: str or ~azure.mgmt.monitor.models.SinkConfigurationKind - """ - - _validation = { - "kind": {"required": True}, - } - - _attribute_map = { - "kind": {"key": "kind", "type": "str"}, - } - - def __init__(self, *, kind: Union[str, "_models.SinkConfigurationKind"], **kwargs: Any) -> None: - """ - :keyword kind: Required. Known values are: "EventHub", "ApplicationInsights", and - "LogAnalytics". - :paramtype kind: str or ~azure.mgmt.monitor.models.SinkConfigurationKind - """ - super().__init__(**kwargs) - self.kind = kind - - -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 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. - :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 - """ - - _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"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword location: Location of the resource. - :paramtype location: str - """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = location - - -class SubscriptionDiagnosticSettingsResource(SubscriptionProxyOnlyResource): - """The subscription diagnostic setting 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 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 - """ - - _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"}, - "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"}, - } - - 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: - """ - :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 - """ - 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 - - -class SubscriptionDiagnosticSettingsResourceCollection(_serialization.Model): # pylint: disable=name-too-long - """Represents a collection of subscription diagnostic settings resources. - - :ivar value: The collection of subscription diagnostic settings resources. - :vartype value: list[~azure.mgmt.monitor.models.SubscriptionDiagnosticSettingsResource] - """ - - _attribute_map = { - "value": {"key": "value", "type": "[SubscriptionDiagnosticSettingsResource]"}, - } - - def __init__( - self, *, value: Optional[List["_models.SubscriptionDiagnosticSettingsResource"]] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The collection of subscription diagnostic settings resources. - :paramtype value: list[~azure.mgmt.monitor.models.SubscriptionDiagnosticSettingsResource] - """ - super().__init__(**kwargs) - self.value = value - - -class SubscriptionLogSettings(_serialization.Model): - """Part of Subscription diagnostic setting. Specifies the settings for a particular log. - - 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 - """ - - _validation = { - "enabled": {"required": True}, - } - - _attribute_map = { - "category": {"key": "category", "type": "str"}, - "enabled": {"key": "enabled", "type": "bool"}, - } - - def __init__(self, *, enabled: bool, category: Optional[str] = None, **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 - """ - super().__init__(**kwargs) - self.category = category - self.enabled = enabled - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or ~azure.mgmt.monitor.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or ~azure.mgmt.monitor.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or ~azure.mgmt.monitor.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or ~azure.mgmt.monitor.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__init__(**kwargs) - self.created_by = created_by - self.created_by_type = created_by_type - self.created_at = created_at - self.last_modified_by = last_modified_by - self.last_modified_by_type = last_modified_by_type - self.last_modified_at = last_modified_at - - -class 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. - - All required parameters must be populated in order to send to server. - - :ivar context: The context info. - :vartype context: ~azure.mgmt.monitor.models.Context - :ivar state: The overall state. Required. - :vartype state: str - :ivar completed_time: The completed time. - :vartype completed_time: str - :ivar created_time: The created time. - :vartype created_time: str - :ivar action_details: The list of action detail. - :vartype action_details: list[~azure.mgmt.monitor.models.ActionDetail] - """ - - _validation = { - "state": {"required": True}, - } - - _attribute_map = { - "context": {"key": "context", "type": "Context"}, - "state": {"key": "state", "type": "str"}, - "completed_time": {"key": "completedTime", "type": "str"}, - "created_time": {"key": "createdTime", "type": "str"}, - "action_details": {"key": "actionDetails", "type": "[ActionDetail]"}, - } - - def __init__( - self, - *, - state: str, - context: Optional["_models.Context"] = None, - completed_time: Optional[str] = None, - created_time: Optional[str] = None, - action_details: Optional[List["_models.ActionDetail"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword context: The context info. - :paramtype context: ~azure.mgmt.monitor.models.Context - :keyword state: The overall state. Required. - :paramtype state: str - :keyword completed_time: The completed time. - :paramtype completed_time: str - :keyword created_time: The created time. - :paramtype created_time: str - :keyword action_details: The list of action detail. - :paramtype action_details: list[~azure.mgmt.monitor.models.ActionDetail] - """ - super().__init__(**kwargs) - self.context = context - self.state = state - self.completed_time = completed_time - self.created_time = created_time - 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. - - All required parameters must be populated in order to send to server. - - :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 - """ - - _validation = { - "threshold_operator": {"required": True}, - "threshold": {"required": True}, - } - - _attribute_map = { - "threshold_operator": {"key": "thresholdOperator", "type": "str"}, - "threshold": {"key": "threshold", "type": "float"}, - "metric_trigger": {"key": "metricTrigger", "type": "LogMetricTrigger"}, - } - - 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 - """ - super().__init__(**kwargs) - self.threshold_operator = threshold_operator - self.threshold = threshold - self.metric_trigger = metric_trigger - - -class VMInsightsOnboardingStatus(ProxyResource): - """VM Insights onboarding status for a 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 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] - """ - - _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"}, - "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]"}, - } - - 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] - """ - super().__init__(**kwargs) - self.resource_id = resource_id - self.onboarding_status = onboarding_status - self.data_status = data_status - self.data = data - - -class VoiceReceiver(_serialization.Model): - """A voice receiver. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the voice receiver. Names must be unique across all receivers within an - action group. Required. - :vartype name: str - :ivar country_code: The country code of the voice receiver. Required. - :vartype country_code: str - :ivar phone_number: The phone number of the voice receiver. Required. - :vartype phone_number: str - """ - - _validation = { - "name": {"required": True}, - "country_code": {"required": True}, - "phone_number": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "country_code": {"key": "countryCode", "type": "str"}, - "phone_number": {"key": "phoneNumber", "type": "str"}, - } - - def __init__(self, *, name: str, country_code: str, phone_number: str, **kwargs: Any) -> None: - """ - :keyword name: The name of the voice receiver. Names must be unique across all receivers within - an action group. Required. - :paramtype name: str - :keyword country_code: The country code of the voice receiver. Required. - :paramtype country_code: str - :keyword phone_number: The phone number of the voice receiver. Required. - :paramtype phone_number: str - """ - super().__init__(**kwargs) - self.name = name - self.country_code = country_code - 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. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the webhook receiver. Names must be unique across all receivers within - an action group. Required. - :vartype name: str - :ivar service_uri: The URI where webhooks should be sent. Required. - :vartype service_uri: str - :ivar use_common_alert_schema: Indicates whether to use common alert schema. - :vartype use_common_alert_schema: bool - :ivar use_aad_auth: Indicates whether or not use AAD authentication. - :vartype use_aad_auth: bool - :ivar object_id: Indicates the webhook app object Id for aad auth. - :vartype object_id: str - :ivar identifier_uri: Indicates the identifier uri for aad auth. - :vartype identifier_uri: str - :ivar tenant_id: Indicates the tenant id for aad auth. - :vartype tenant_id: str - """ - - _validation = { - "name": {"required": True}, - "service_uri": {"required": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "service_uri": {"key": "serviceUri", "type": "str"}, - "use_common_alert_schema": {"key": "useCommonAlertSchema", "type": "bool"}, - "use_aad_auth": {"key": "useAadAuth", "type": "bool"}, - "object_id": {"key": "objectId", "type": "str"}, - "identifier_uri": {"key": "identifierUri", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - } - - def __init__( - self, - *, - name: str, - service_uri: str, - use_common_alert_schema: bool = False, - use_aad_auth: bool = False, - object_id: Optional[str] = None, - identifier_uri: Optional[str] = None, - tenant_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the webhook receiver. Names must be unique across all receivers - within an action group. Required. - :paramtype name: str - :keyword service_uri: The URI where webhooks should be sent. Required. - :paramtype service_uri: str - :keyword use_common_alert_schema: Indicates whether to use common alert schema. - :paramtype use_common_alert_schema: bool - :keyword use_aad_auth: Indicates whether or not use AAD authentication. - :paramtype use_aad_auth: bool - :keyword object_id: Indicates the webhook app object Id for aad auth. - :paramtype object_id: str - :keyword identifier_uri: Indicates the identifier uri for aad auth. - :paramtype identifier_uri: str - :keyword tenant_id: Indicates the tenant id for aad auth. - :paramtype tenant_id: str - """ - super().__init__(**kwargs) - self.name = name - self.service_uri = service_uri - self.use_common_alert_schema = use_common_alert_schema - self.use_aad_auth = use_aad_auth - 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 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 deleted file mode 100644 index 2593cb152f7d..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_monitor_management_client_enums.py +++ /dev/null @@ -1,345 +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 enum import Enum -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.""" - - METRICS = "Metrics" - LOGS = "Logs" - - -class ComparisonOperationType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """the operator that is used to compare the metric data and the threshold.""" - - 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" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class CriterionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Specifies the type of threshold criteria.""" - - STATIC_THRESHOLD_CRITERION = "StaticThresholdCriterion" - 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.""" - - WINDOWS = "Windows" - LINUX = "Linux" - - -class MetricClass(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The class of the metric.""" - - AVAILABILITY = "Availability" - TRANSACTIONS = "Transactions" - ERRORS = "Errors" - LATENCY = "Latency" - SATURATION = "Saturation" - - -class MetricStatisticType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """the metric statistic type. How the metrics from multiple instances are combined.""" - - AVERAGE = "Average" - MIN = "Min" - MAX = "Max" - SUM = "Sum" - COUNT = "Count" - - -class MetricTriggerType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Metric Trigger Evaluation Type.""" - - CONSECUTIVE = "Consecutive" - TOTAL = "Total" - - -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. - """ - - 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" - - -class ReceiverStatus(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Indicates the status of the receiver. Receivers that are not Enabled will not receive any - communications. - """ - - NOT_SPECIFIED = "NotSpecified" - ENABLED = "Enabled" - 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. - """ - - AVERAGE = "Average" - MINIMUM = "Minimum" - MAXIMUM = "Maximum" - TOTAL = "Total" - COUNT = "Count" - LAST = "Last" diff --git a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_patch.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_patch.py index 1f25eae6795f..8bcb627aa475 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_patch.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/models/_patch.py @@ -1,8 +1,10 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. + Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize """ from typing import List @@ -12,6 +14,7 @@ def patch_sdk(): """Do not remove from this file. + `patch_sdk` is a last resort escape hatch that allows you to do customizations you can't accomplish using the techniques described in https://aka.ms/azsdk/python/dpcodegen/python/customize 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..ca50d9410049 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 @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- # pylint: disable=wrong-import-position @@ -12,70 +12,18 @@ if TYPE_CHECKING: 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 ._operations import AzureMonitorWorkspacesOperations # type: ignore +from ._operations import PipelineGroupsOperations # type: ignore from ._patch import __all__ as _patch_all from ._patch import * from ._patch import patch_sdk as _patch_sdk __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", + "AzureMonitorWorkspacesOperations", + "PipelineGroupsOperations", ] __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 deleted file mode 100644 index 761c87138142..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_action_groups_operations.py +++ /dev/null @@ -1,1858 +0,0 @@ -# pylint: disable=too-many-lines -# 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_create_or_update_request( - 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")) - 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/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 - ), - "actionGroupName": _SERIALIZER.url("action_group_name", action_group_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, 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")) - 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 - ), - "actionGroupName": _SERIALIZER.url("action_group_name", action_group_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_delete_request( - 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")) - 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 - ), - "actionGroupName": _SERIALIZER.url("action_group_name", action_group_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_update_request( - 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")) - 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/actionGroups/{actionGroupName}", - ) # 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 - ), - "actionGroupName": _SERIALIZER.url("action_group_name", action_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 - 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_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")) - 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/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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "actionGroupName": _SERIALIZER.url("action_group_name", action_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 - 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_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")) - 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( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "actionGroupName": _SERIALIZER.url("action_group_name", action_group_name, "str"), - "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_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", "2022-06-01")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/actionGroups") - 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", "2022-06-01")) - 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 - ), - "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_enable_receiver_request( - 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")) - 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/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 - ), - "actionGroupName": _SERIALIZER.url("action_group_name", action_group_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="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class ActionGroupsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`action_groups` 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, - action_group_name: str, - action_group: _models.ActionGroupResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ActionGroupResource: - """Create a new action group 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 action_group_name: The name of the action group. Required. - :type action_group_name: str - :param action_group: The action group to create or use for the update. Required. - :type action_group: ~azure.mgmt.monitor.models.ActionGroupResource - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ActionGroupResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActionGroupResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def create_or_update( - self, - resource_group_name: str, - action_group_name: str, - action_group: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ActionGroupResource: - """Create a new action group 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 action_group_name: The name of the action group. Required. - :type action_group_name: str - :param action_group: The action group to create or use for the update. Required. - :type action_group: 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: ActionGroupResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActionGroupResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - action_group_name: str, - action_group: Union[_models.ActionGroupResource, IO[bytes]], - **kwargs: Any - ) -> _models.ActionGroupResource: - """Create a new action group 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 action_group_name: The name of the action group. Required. - :type action_group_name: str - :param action_group: The action group to create or use for the update. Is either a - ActionGroupResource type or a IO[bytes] type. Required. - :type action_group: ~azure.mgmt.monitor.models.ActionGroupResource or IO[bytes] - :return: ActionGroupResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActionGroupResource - :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-06-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ActionGroupResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(action_group, (IOBase, bytes)): - _content = action_group - else: - _json = self._serialize.body(action_group, "ActionGroupResource") - - _request = build_create_or_update_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) - - _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("ActionGroupResource", 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, action_group_name: str, **kwargs: Any) -> _models.ActionGroupResource: - """Get an action group. - - :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 - :return: ActionGroupResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActionGroupResource - :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.ActionGroupResource] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - action_group_name=action_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) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("ActionGroupResource", 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, action_group_name: str, **kwargs: Any - ) -> None: - """Delete an action group. - - :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 - :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-06-01")) - cls: ClsType[None] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - action_group_name=action_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, 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, - action_group_name: str, - action_group_patch: _models.ActionGroupPatchBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ActionGroupResource: - """Updates an existing action group'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 action_group_name: The name of the action group. Required. - :type action_group_name: str - :param action_group_patch: Parameters supplied to the operation. Required. - :type action_group_patch: ~azure.mgmt.monitor.models.ActionGroupPatchBody - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: ActionGroupResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActionGroupResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - action_group_name: str, - action_group_patch: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.ActionGroupResource: - """Updates an existing action group'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 action_group_name: The name of the action group. Required. - :type action_group_name: str - :param action_group_patch: Parameters supplied to the operation. Required. - :type action_group_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: ActionGroupResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActionGroupResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - action_group_name: str, - action_group_patch: Union[_models.ActionGroupPatchBody, IO[bytes]], - **kwargs: Any - ) -> _models.ActionGroupResource: - """Updates an existing action group'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 action_group_name: The name of the action group. Required. - :type action_group_name: str - :param action_group_patch: Parameters supplied to the operation. Is either a - ActionGroupPatchBody type or a IO[bytes] type. Required. - :type action_group_patch: ~azure.mgmt.monitor.models.ActionGroupPatchBody or IO[bytes] - :return: ActionGroupResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.ActionGroupResource - :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-06-01")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.ActionGroupResource] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(action_group_patch, (IOBase, bytes)): - _content = action_group_patch - else: - _json = self._serialize.body(action_group_patch, "ActionGroupPatchBody") - - _request = build_update_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) - - _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("ActionGroupResource", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _post_test_notifications_initial( - self, 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_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 = 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_post_test_notifications( - self, - notification_request: _models.NotificationRequestBody, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_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 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_post_test_notifications( - self, notification_request: IO[bytes], *, content_type: str = "application/json", **kwargs: Any - ) -> LROPoller[_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 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_post_test_notifications( - self, notification_request: Union[_models.NotificationRequestBody, IO[bytes]], **kwargs: Any - ) -> LROPoller[_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 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._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 - ) - 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_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 - ) -> _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 action_group_name: The name of the action group. Required. - :type action_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_action_group_resource_level_request( - resource_group_name=resource_group_name, - action_group_name=action_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 list_by_subscription_id(self, **kwargs: Any) -> Iterable["_models.ActionGroupResource"]: - """Get a list of all action groups in a subscription. - - :return: An iterator like instance of either ActionGroupResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.ActionGroupResource] - :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-06-01")) - cls: ClsType[_models.ActionGroupList] = 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("ActionGroupList", 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.ActionGroupResource"]: - """Get a list of all action groups 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 ActionGroupResource or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.ActionGroupResource] - :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-06-01")) - cls: ClsType[_models.ActionGroupList] = 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("ActionGroupList", 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) - - @overload - def enable_receiver( - self, - resource_group_name: str, - action_group_name: str, - enable_request: _models.EnableRequest, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Enable a receiver in an action group. This changes the receiver's status from Disabled to - Enabled. This operation is only supported for Email or SMS 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 enable_request: The receiver to re-enable. Required. - :type enable_request: ~azure.mgmt.monitor.models.EnableRequest - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def enable_receiver( - self, - resource_group_name: str, - action_group_name: str, - enable_request: IO[bytes], - *, - content_type: str = "application/json", - **kwargs: Any - ) -> None: - """Enable a receiver in an action group. This changes the receiver's status from Disabled to - Enabled. This operation is only supported for Email or SMS 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 enable_request: The receiver to re-enable. Required. - :type enable_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: None or the result of cls(response) - :rtype: None - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def enable_receiver( # pylint: disable=inconsistent-return-statements - self, - resource_group_name: str, - action_group_name: str, - enable_request: Union[_models.EnableRequest, IO[bytes]], - **kwargs: Any - ) -> None: - """Enable a receiver in an action group. This changes the receiver's status from Disabled to - Enabled. This operation is only supported for Email or SMS 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 enable_request: The receiver to re-enable. Is either a EnableRequest type or a IO[bytes] - type. Required. - :type enable_request: ~azure.mgmt.monitor.models.EnableRequest or IO[bytes] - :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 = 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[None] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(enable_request, (IOBase, bytes)): - _content = enable_request - else: - _json = self._serialize.body(enable_request, "EnableRequest") - - _request = build_enable_receiver_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) - - _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) - - if cls: - return cls(pipeline_response, None, {}) # type: ignore 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 index e9472e6fc565..fc47401e94ab 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_operations.py @@ -1,50 +1,411 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # 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. +# Code generated by Microsoft (R) Python 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 collections.abc import MutableMapping +from io import IOBase +import json +from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Optional, TypeVar, Union, cast, overload +import urllib.parse +from azure.core import PipelineClient 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 +from .._configuration import MonitorManagementClientConfiguration +from .._utils.model_base import SdkJSONEncoder, _deserialize, _failsafe_deserialize +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]] +JSON = MutableMapping[str, Any] _SERIALIZER = Serializer() _SERIALIZER.client_side_validation = False -def build_list_request(**kwargs: Any) -> HttpRequest: +def build_operations_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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.Insights/operations") + _url = "/providers/Microsoft.Monitor/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) + + +def build_azure_monitor_workspaces_get_request( # pylint: disable=name-too-long + resource_group_name: str, azure_monitor_workspace_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "azureMonitorWorkspaceName": _SERIALIZER.url( + "azure_monitor_workspace_name", azure_monitor_workspace_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_azure_monitor_workspaces_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, azure_monitor_workspace_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "azureMonitorWorkspaceName": _SERIALIZER.url( + "azure_monitor_workspace_name", azure_monitor_workspace_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_azure_monitor_workspaces_update_request( # pylint: disable=name-too-long + resource_group_name: str, azure_monitor_workspace_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "azureMonitorWorkspaceName": _SERIALIZER.url( + "azure_monitor_workspace_name", azure_monitor_workspace_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_azure_monitor_workspaces_delete_request( # pylint: disable=name-too-long + resource_group_name: str, azure_monitor_workspace_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts/{azureMonitorWorkspaceName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "azureMonitorWorkspaceName": _SERIALIZER.url( + "azure_monitor_workspace_name", azure_monitor_workspace_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_azure_monitor_workspaces_list_by_resource_group_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", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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) + + +def build_azure_monitor_workspaces_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Monitor/accounts" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_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_pipeline_groups_get_request( + resource_group_name: str, pipeline_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/pipelineGroups/{pipelineGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "pipelineGroupName": _SERIALIZER.url("pipeline_group_name", pipeline_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) + + +def build_pipeline_groups_create_or_update_request( # pylint: disable=name-too-long + resource_group_name: str, pipeline_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/pipelineGroups/{pipelineGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "pipelineGroupName": _SERIALIZER.url("pipeline_group_name", pipeline_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 + 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_pipeline_groups_delete_request( + resource_group_name: str, pipeline_group_name: str, subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/pipelineGroups/{pipelineGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "pipelineGroupName": _SERIALIZER.url("pipeline_group_name", pipeline_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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) + + +def build_pipeline_groups_update_request( + resource_group_name: str, pipeline_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 {}) + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/pipelineGroups/{pipelineGroupName}" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, "str"), + "pipelineGroupName": _SERIALIZER.url("pipeline_group_name", pipeline_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 + 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_pipeline_groups_list_by_resource_group_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", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = ( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/pipelineGroups" + ) + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_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) + + +def build_pipeline_groups_list_by_subscription_request( # pylint: disable=name-too-long + subscription_id: str, **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-01-preview")) + accept = _headers.pop("Accept", "application/json") + + # Construct URL + _url = "/subscriptions/{subscriptionId}/providers/Microsoft.Monitor/pipelineGroups" + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str"), + } + + _url: str = _url.format(**path_format_arguments) # type: ignore # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") @@ -65,21 +426,128 @@ class Operations: :attr:`operations` attribute. """ - models = _models + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MonitorManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: + """List the operations for the provider. + + :return: An iterator like instance of Operation + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.Operation] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.Operation]] = 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_operations_list_request( + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.Operation], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class AzureMonitorWorkspacesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.monitor.MonitorManagementClient`'s + :attr:`azure_monitor_workspaces` attribute. + """ - def __init__(self, *args, **kwargs): + 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: 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(self, **kwargs: Any) -> _models.OperationListResult: - """Lists all of the available operations from Microsoft.Insights provider. + def get( + self, resource_group_name: str, azure_monitor_workspace_name: str, **kwargs: Any + ) -> _models.AzureMonitorWorkspace: + """Returns the specific Azure Monitor workspace. - :return: OperationListResult or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.OperationListResult + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :return: AzureMonitorWorkspace. The AzureMonitorWorkspace is compatible with MutableMapping + :rtype: ~azure.mgmt.monitor.models.AzureMonitorWorkspace :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping = { @@ -91,19 +559,24 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: error_map.update(kwargs.pop("error_map", {}) or {}) _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + _params = 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) + cls: ClsType[_models.AzureMonitorWorkspace] = kwargs.pop("cls", None) - _request = build_list_request( - api_version=api_version, + _request = build_azure_monitor_workspaces_get_request( + resource_group_name=resource_group_name, + azure_monitor_workspace_name=azure_monitor_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, headers=_headers, params=_params, ) - _request.url = self._client.format_url(_request.url) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) - _stream = False + _stream = kwargs.pop("stream", False) pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access _request, stream=_stream, **kwargs ) @@ -111,12 +584,1542 @@ def list(self, **kwargs: Any) -> _models.OperationListResult: response = pipeline_response.http_response if response.status_code not in [200]: + if _stream: + 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) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - deserialized = self._deserialize("OperationListResult", pipeline_response.http_response) + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AzureMonitorWorkspace, response.json()) if cls: return cls(pipeline_response, deserialized, {}) # type: ignore return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + azure_monitor_workspace_name: str, + resource: Union[_models.AzureMonitorWorkspace, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_azure_monitor_workspaces_create_or_update_request( + resource_group_name=resource_group_name, + azure_monitor_workspace_name=azure_monitor_workspace_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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]: + 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + azure_monitor_workspace_name: str, + resource: _models.AzureMonitorWorkspace, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AzureMonitorWorkspace]: + """Create or update a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.monitor.models.AzureMonitorWorkspace + :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 AzureMonitorWorkspace. The AzureMonitorWorkspace + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.AzureMonitorWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + azure_monitor_workspace_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AzureMonitorWorkspace]: + """Create or update a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :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 AzureMonitorWorkspace. The AzureMonitorWorkspace + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.AzureMonitorWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + azure_monitor_workspace_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.AzureMonitorWorkspace]: + """Create or update a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :param resource: Resource create parameters. Required. + :type 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: An instance of LROPoller that returns AzureMonitorWorkspace. The AzureMonitorWorkspace + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.AzureMonitorWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + azure_monitor_workspace_name: str, + resource: Union[_models.AzureMonitorWorkspace, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.AzureMonitorWorkspace]: + """Create or update a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :param resource: Resource create parameters. Is one of the following types: + AzureMonitorWorkspace, JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.monitor.models.AzureMonitorWorkspace or JSON or IO[bytes] + :return: An instance of LROPoller that returns AzureMonitorWorkspace. The AzureMonitorWorkspace + is compatible with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.AzureMonitorWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureMonitorWorkspace] = 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, + azure_monitor_workspace_name=azure_monitor_workspace_name, + resource=resource, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.AzureMonitorWorkspace, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.AzureMonitorWorkspace].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.AzureMonitorWorkspace]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @overload + def update( + self, + resource_group_name: str, + azure_monitor_workspace_name: str, + properties: _models.AzureMonitorWorkspaceUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureMonitorWorkspace: + """Updates part of a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.monitor.models.AzureMonitorWorkspaceUpdate + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureMonitorWorkspace. The AzureMonitorWorkspace is compatible with MutableMapping + :rtype: ~azure.mgmt.monitor.models.AzureMonitorWorkspace + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + azure_monitor_workspace_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureMonitorWorkspace: + """Updates part of a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :param properties: The resource properties to be updated. Required. + :type properties: JSON + :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. + Default value is "application/json". + :paramtype content_type: str + :return: AzureMonitorWorkspace. The AzureMonitorWorkspace is compatible with MutableMapping + :rtype: ~azure.mgmt.monitor.models.AzureMonitorWorkspace + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def update( + self, + resource_group_name: str, + azure_monitor_workspace_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> _models.AzureMonitorWorkspace: + """Updates part of a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :param properties: The resource properties to be updated. Required. + :type properties: 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: AzureMonitorWorkspace. The AzureMonitorWorkspace is compatible with MutableMapping + :rtype: ~azure.mgmt.monitor.models.AzureMonitorWorkspace + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def update( + self, + resource_group_name: str, + azure_monitor_workspace_name: str, + properties: Union[_models.AzureMonitorWorkspaceUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> _models.AzureMonitorWorkspace: + """Updates part of a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :param properties: The resource properties to be updated. Is one of the following types: + AzureMonitorWorkspaceUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.monitor.models.AzureMonitorWorkspaceUpdate or JSON or IO[bytes] + :return: AzureMonitorWorkspace. The AzureMonitorWorkspace is compatible with MutableMapping + :rtype: ~azure.mgmt.monitor.models.AzureMonitorWorkspace + :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 = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.AzureMonitorWorkspace] = kwargs.pop("cls", None) + + content_type = content_type or "application/json" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_azure_monitor_workspaces_update_request( + resource_group_name=resource_group_name, + azure_monitor_workspace_name=azure_monitor_workspace_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.AzureMonitorWorkspace, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _delete_initial( + self, resource_group_name: str, azure_monitor_workspace_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 = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_azure_monitor_workspaces_delete_request( + resource_group_name=resource_group_name, + azure_monitor_workspace_name=azure_monitor_workspace_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 [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) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete( + self, resource_group_name: str, azure_monitor_workspace_name: str, **kwargs: Any + ) -> LROPoller[None]: + """Delete a workspace. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param azure_monitor_workspace_name: The name of the Azure Monitor workspace. The name is case + insensitive. Required. + :type azure_monitor_workspace_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + azure_monitor_workspace_name=azure_monitor_workspace_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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_resource_group( + self, resource_group_name: str, **kwargs: Any + ) -> Iterable["_models.AzureMonitorWorkspace"]: + """Lists all workspaces in the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of AzureMonitorWorkspace + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.AzureMonitorWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AzureMonitorWorkspace]] = 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_azure_monitor_workspaces_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AzureMonitorWorkspace], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.AzureMonitorWorkspace"]: + """Lists all workspaces in the specified subscription. + + :return: An iterator like instance of AzureMonitorWorkspace + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.AzureMonitorWorkspace] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.AzureMonitorWorkspace]] = 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_azure_monitor_workspaces_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.AzureMonitorWorkspace], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + +class PipelineGroupsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. + + Instead, you should access the following operations through + :class:`~azure.mgmt.monitor.MonitorManagementClient`'s + :attr:`pipeline_groups` attribute. + """ + + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client: PipelineClient = input_args.pop(0) if input_args else kwargs.pop("client") + self._config: MonitorManagementClientConfiguration = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize: Serializer = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace + def get(self, resource_group_name: str, pipeline_group_name: str, **kwargs: Any) -> _models.PipelineGroup: + """Returns the specific pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :return: PipelineGroup. The PipelineGroup is compatible with MutableMapping + :rtype: ~azure.mgmt.monitor.models.PipelineGroup + :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 = kwargs.pop("params", {}) or {} + + cls: ClsType[_models.PipelineGroup] = kwargs.pop("cls", None) + + _request = build_pipeline_groups_get_request( + resource_group_name=resource_group_name, + pipeline_group_name=pipeline_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _stream = kwargs.pop("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]: + if _stream: + 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if _stream: + deserialized = response.iter_bytes() + else: + deserialized = _deserialize(_models.PipelineGroup, response.json()) + + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + + return deserialized # type: ignore + + def _create_or_update_initial( + self, + resource_group_name: str, + pipeline_group_name: str, + resource: Union[_models.PipelineGroup, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(resource, (IOBase, bytes)): + _content = resource + else: + _content = json.dumps(resource, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_pipeline_groups_create_or_update_request( + resource_group_name=resource_group_name, + pipeline_group_name=pipeline_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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]: + 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + response_headers = {} + if response.status_code == 201: + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + pipeline_group_name: str, + resource: _models.PipelineGroup, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PipelineGroup]: + """Create or update a pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :param resource: Resource create parameters. Required. + :type resource: ~azure.mgmt.monitor.models.PipelineGroup + :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 PipelineGroup. The PipelineGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + pipeline_group_name: str, + resource: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PipelineGroup]: + """Create or update a pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :param resource: Resource create parameters. Required. + :type resource: JSON + :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 PipelineGroup. The PipelineGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_create_or_update( + self, + resource_group_name: str, + pipeline_group_name: str, + resource: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PipelineGroup]: + """Create or update a pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :param resource: Resource create parameters. Required. + :type 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: An instance of LROPoller that returns PipelineGroup. The PipelineGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + pipeline_group_name: str, + resource: Union[_models.PipelineGroup, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PipelineGroup]: + """Create or update a pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :param resource: Resource create parameters. Is one of the following types: PipelineGroup, + JSON, IO[bytes] Required. + :type resource: ~azure.mgmt.monitor.models.PipelineGroup or JSON or IO[bytes] + :return: An instance of LROPoller that returns PipelineGroup. The PipelineGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PipelineGroup] = 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, + pipeline_group_name=pipeline_group_name, + resource=resource, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PipelineGroup, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PipelineGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PipelineGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + def _delete_initial(self, resource_group_name: str, pipeline_group_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 = kwargs.pop("params", {}) or {} + + cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) + + _request = build_pipeline_groups_delete_request( + resource_group_name=resource_group_name, + pipeline_group_name=pipeline_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 [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) + error = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @distributed_trace + def begin_delete(self, resource_group_name: str, pipeline_group_name: str, **kwargs: Any) -> LROPoller[None]: + """Delete a pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :return: An instance of LROPoller that returns None + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + 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, + pipeline_group_name=pipeline_group_name, + 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 + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **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 + + def _update_initial( + self, + resource_group_name: str, + pipeline_group_name: str, + properties: Union[_models.PipelineGroupUpdate, JSON, 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 = kwargs.pop("params", {}) or {} + + 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" + _content = None + if isinstance(properties, (IOBase, bytes)): + _content = properties + else: + _content = json.dumps(properties, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore + + _request = build_pipeline_groups_update_request( + resource_group_name=resource_group_name, + pipeline_group_name=pipeline_group_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + api_version=self._config.api_version, + content=_content, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + _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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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")) + response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) + + deserialized = response.iter_bytes() + + if cls: + return cls(pipeline_response, deserialized, response_headers) # type: ignore + + return deserialized # type: ignore + + @overload + def begin_update( + self, + resource_group_name: str, + pipeline_group_name: str, + properties: _models.PipelineGroupUpdate, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PipelineGroup]: + """Updates a pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :param properties: The resource properties to be updated. Required. + :type properties: ~azure.mgmt.monitor.models.PipelineGroupUpdate + :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 PipelineGroup. The PipelineGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + pipeline_group_name: str, + properties: JSON, + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PipelineGroup]: + """Updates a pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :param properties: The resource properties to be updated. Required. + :type properties: JSON + :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 PipelineGroup. The PipelineGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @overload + def begin_update( + self, + resource_group_name: str, + pipeline_group_name: str, + properties: IO[bytes], + *, + content_type: str = "application/json", + **kwargs: Any + ) -> LROPoller[_models.PipelineGroup]: + """Updates a pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :param properties: The resource properties to be updated. Required. + :type properties: 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 PipelineGroup. The PipelineGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + + @distributed_trace + def begin_update( + self, + resource_group_name: str, + pipeline_group_name: str, + properties: Union[_models.PipelineGroupUpdate, JSON, IO[bytes]], + **kwargs: Any + ) -> LROPoller[_models.PipelineGroup]: + """Updates a pipeline group instance. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :param pipeline_group_name: The name of pipeline group. The name is case insensitive. Required. + :type pipeline_group_name: str + :param properties: The resource properties to be updated. Is one of the following types: + PipelineGroupUpdate, JSON, IO[bytes] Required. + :type properties: ~azure.mgmt.monitor.models.PipelineGroupUpdate or JSON or IO[bytes] + :return: An instance of LROPoller that returns PipelineGroup. The PipelineGroup is compatible + with MutableMapping + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = kwargs.pop("params", {}) or {} + + content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) + cls: ClsType[_models.PipelineGroup] = 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._update_initial( + resource_group_name=resource_group_name, + pipeline_group_name=pipeline_group_name, + properties=properties, + 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): + response = pipeline_response.http_response + deserialized = _deserialize(_models.PipelineGroup, response.json()) + if cls: + return cls(pipeline_response, deserialized, {}) # type: ignore + return deserialized + + path_format_arguments = { + "endpoint": self._serialize.url("self._config.base_url", self._config.base_url, "str", skip_quote=True), + } + + if polling is True: + polling_method: PollingMethod = cast( + PollingMethod, ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + ) + elif polling is False: + polling_method = cast(PollingMethod, NoPolling()) + else: + polling_method = polling + if cont_token: + return LROPoller[_models.PipelineGroup].from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output, + ) + return LROPoller[_models.PipelineGroup]( + self._client, raw_result, get_long_running_output, polling_method # type: ignore + ) + + @distributed_trace + def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.PipelineGroup"]: + """Lists all workspaces in the specified resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + Required. + :type resource_group_name: str + :return: An iterator like instance of PipelineGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PipelineGroup]] = 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_pipeline_groups_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PipelineGroup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged(get_next, extract_data) + + @distributed_trace + def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.PipelineGroup"]: + """Lists all workspaces in the specified subscription. + + :return: An iterator like instance of PipelineGroup + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.monitor.models.PipelineGroup] + :raises ~azure.core.exceptions.HttpResponseError: + """ + _headers = kwargs.pop("headers", {}) or {} + _params = kwargs.pop("params", {}) or {} + + cls: ClsType[List[_models.PipelineGroup]] = 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_pipeline_groups_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=self._config.api_version, + headers=_headers, + params=_params, + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + else: + # make call to next link with the client's api-version + _parsed_next_link = urllib.parse.urlparse(next_link) + _next_request_params = case_insensitive_dict( + { + key: [urllib.parse.quote(v) for v in value] + for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() + } + ) + _next_request_params["api-version"] = self._config.api_version + _request = HttpRequest( + "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params + ) + path_format_arguments = { + "endpoint": self._serialize.url( + "self._config.base_url", self._config.base_url, "str", skip_quote=True + ), + } + _request.url = self._client.format_url(_request.url, **path_format_arguments) + + return _request + + def extract_data(pipeline_response): + deserialized = pipeline_response.http_response.json() + list_of_elem = _deserialize(List[_models.PipelineGroup], deserialized.get("value", [])) + if cls: + list_of_elem = cls(list_of_elem) # type: ignore + return deserialized.get("nextLink") 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 = _failsafe_deserialize(_models.ErrorResponse, response.json()) + 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/_patch.py b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_patch.py index f7dd32510333..8bcb627aa475 100644 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_patch.py +++ b/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_patch.py @@ -1,7 +1,8 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ +# 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. +# -------------------------------------------------------------------------- """Customize generated code here. Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize 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 deleted file mode 100644 index 349f83a477c8..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/azure/mgmt/monitor/operations/_scheduled_query_rules_operations.py +++ /dev/null @@ -1,772 +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, 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)) - 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 - 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_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")) - 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 - 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) - - -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")) - 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 - 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-04-16")) - 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 - 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="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_subscription_request( - subscription_id: str, *, filter: 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-04-16")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules" - ) - 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") - 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) - - -def build_list_by_resource_group_request( - resource_group_name: str, subscription_id: str, *, filter: 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-04-16")) - 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 - 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") - 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) - - -class ScheduledQueryRulesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.monitor.MonitorManagementClient`'s - :attr:`scheduled_query_rules` 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, - rule_name: str, - parameters: _models.LogSearchRuleResource, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Creates or updates 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 - :param parameters: The parameters of the rule to create or update. Required. - :type parameters: ~azure.mgmt.monitor.models.LogSearchRuleResource - :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 - :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.LogSearchRuleResource: - """Creates or updates 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 - :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: LogSearchRuleResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def create_or_update( - self, - resource_group_name: str, - rule_name: str, - parameters: Union[_models.LogSearchRuleResource, IO[bytes]], - **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Creates or updates 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 - :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 - :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-04-16")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogSearchRuleResource] = 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, "LogSearchRuleResource") - - _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, 201]: - 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) - - 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) - - 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.LogSearchRuleResourcePatch, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Update 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 - :param parameters: The parameters of the rule to update. Required. - :type parameters: ~azure.mgmt.monitor.models.LogSearchRuleResourcePatch - :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 - :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.LogSearchRuleResource: - """Update 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 - :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: LogSearchRuleResource or the result of cls(response) - :rtype: ~azure.mgmt.monitor.models.LogSearchRuleResource - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - rule_name: str, - parameters: Union[_models.LogSearchRuleResourcePatch, IO[bytes]], - **kwargs: Any - ) -> _models.LogSearchRuleResource: - """Update 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 - :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 - :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-04-16")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.LogSearchRuleResource] = 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, "LogSearchRuleResourcePatch") - - _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.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 delete( # pylint: disable=inconsistent-return-statements - self, resource_group_name: str, rule_name: str, **kwargs: Any - ) -> None: - """Deletes a 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: 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-04-16")) - 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.ErrorContract, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - 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/get_metric_error.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/azure_monitor_workspace_create.py similarity index 73% rename from sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_error.py rename to sdk/monitor/azure-mgmt-monitor/generated_samples/azure_monitor_workspace_create.py index 58a03ac908e4..dae2c927de7c 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric_error.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/azure_monitor_workspace_create.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-monitor # USAGE - python get_metric_error.py + python azure_monitor_workspace_create.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -30,12 +30,14 @@ def main(): 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", - ) + response = client.azure_monitor_workspaces.begin_create_or_update( + resource_group_name="myResourceGroup", + azure_monitor_workspace_name="myAzureMonitorWorkspace", + resource={"location": "eastus", "properties": {}}, + ).result() print(response) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetricError.json +# x-ms-original-file: 2023-10-01-preview/AzureMonitorWorkspaceCreate.json if __name__ == "__main__": main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/azure_monitor_workspace_delete.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/azure_monitor_workspace_delete.py new file mode 100644 index 000000000000..c30175e649a4 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/azure_monitor_workspace_delete.py @@ -0,0 +1,41 @@ +# 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) Python 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 azure_monitor_workspace_delete.py + + Before run the sample, please set the values of the client ID, tenant ID and client secret + of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, + AZURE_CLIENT_SECRET. For more info about how to get the value, please see: + https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal +""" + + +def main(): + client = MonitorManagementClient( + credential=DefaultAzureCredential(), + subscription_id="SUBSCRIPTION_ID", + ) + + client.azure_monitor_workspaces.begin_delete( + resource_group_name="myResourceGroup", + azure_monitor_workspace_name="myAzureMonitorWorkspace", + ).result() + + +# x-ms-original-file: 2023-10-01-preview/AzureMonitorWorkspaceDelete.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/azure_monitor_workspace_get.py similarity index 75% rename from sdk/monitor/azure-mgmt-monitor/generated_samples/get_onboarding_status_subscription.py rename to sdk/monitor/azure-mgmt-monitor/generated_samples/azure_monitor_workspace_get.py index 9ddfd67d7199..cf28c168b166 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_onboarding_status_subscription.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/azure_monitor_workspace_get.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-monitor # USAGE - python get_onboarding_status_subscription.py + python azure_monitor_workspace_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, @@ -30,12 +30,13 @@ def main(): subscription_id="SUBSCRIPTION_ID", ) - response = client.vm_insights.get_onboarding_status( - resource_uri="subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87", + response = client.azure_monitor_workspaces.get( + resource_group_name="myResourceGroup", + azure_monitor_workspace_name="myAzureMonitorWorkspace", ) print(response) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSubscription.json +# x-ms-original-file: 2023-10-01-preview/AzureMonitorWorkspaceGet.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/azure_monitor_workspace_update.py similarity index 74% rename from sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric.py rename to sdk/monitor/azure-mgmt-monitor/generated_samples/azure_monitor_workspace_update.py index 7a161d9c275e..38eb8ff49bd0 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_metric.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/azure_monitor_workspace_update.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-monitor # USAGE - python get_metric.py + python azure_monitor_workspace_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, @@ -30,12 +30,14 @@ def main(): 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", + response = client.azure_monitor_workspaces.update( + resource_group_name="myResourceGroup", + azure_monitor_workspace_name="myAzureMonitorWorkspace", + properties={"tags": {"tag1": "A", "tag2": "B", "tag3": "C"}}, ) print(response) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetric.json +# x-ms-original-file: 2023-10-01-preview/AzureMonitorWorkspaceUpdate.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/azure_monitor_workspaces_list_by_resource_group.py similarity index 75% rename from sdk/monitor/azure-mgmt-monitor/generated_samples/get_tenant_activity_logs_no_params.py rename to sdk/monitor/azure-mgmt-monitor/generated_samples/azure_monitor_workspaces_list_by_resource_group.py index 155e748e8126..2077bf14eae4 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_tenant_activity_logs_no_params.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/azure_monitor_workspaces_list_by_resource_group.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-monitor # USAGE - python get_tenant_activity_logs_no_params.py + python azure_monitor_workspaces_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, @@ -27,14 +27,16 @@ def main(): client = MonitorManagementClient( credential=DefaultAzureCredential(), - subscription_id="089bd33f-d4ec-47fe-8ba5-0753aa5c5b33", + subscription_id="SUBSCRIPTION_ID", ) - response = client.tenant_activity_logs.list() + response = client.azure_monitor_workspaces.list_by_resource_group( + resource_group_name="myResourceGroup", + ) for item in response: print(item) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsNoParams.json +# x-ms-original-file: 2023-10-01-preview/AzureMonitorWorkspacesListByResourceGroup.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/azure_monitor_workspaces_list_by_subscription.py similarity index 78% rename from sdk/monitor/azure-mgmt-monitor/generated_samples/list_log_profile.py rename to sdk/monitor/azure-mgmt-monitor/generated_samples/azure_monitor_workspaces_list_by_subscription.py index 918d53f6c249..a41cbe62c00c 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_log_profile.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/azure_monitor_workspaces_list_by_subscription.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-monitor # USAGE - python list_log_profile.py + python azure_monitor_workspaces_list_by_subscription.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -27,14 +27,14 @@ def main(): client = MonitorManagementClient( credential=DefaultAzureCredential(), - subscription_id="df602c9c-7aa0-407d-a6fb-eb20c8bd1192", + subscription_id="SUBSCRIPTION_ID", ) - response = client.log_profiles.list() + response = client.azure_monitor_workspaces.list_by_subscription() for item in response: print(item) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listLogProfile.json +# x-ms-original-file: 2023-10-01-preview/AzureMonitorWorkspacesListBySubscription.json if __name__ == "__main__": main() 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 deleted file mode 100644 index 5fe194e611c9..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_action_group.py +++ /dev/null @@ -1,129 +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_action_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="187f412d-1758-44d9-b052-169e2564721d", - ) - - response = client.action_groups.create_or_update( - resource_group_name="Default-NotificationRules", - action_group_name="SampleActionGroup", - action_group={ - "location": "Global", - "properties": { - "armRoleReceivers": [ - { - "name": "Sample armRole", - "roleId": "8e3af657-a8ff-443c-a75c-2fe8c4bcb635", - "useCommonAlertSchema": True, - } - ], - "automationRunbookReceivers": [ - { - "automationAccountId": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest", - "isGlobalRunbook": False, - "name": "testRunbook", - "runbookName": "Sample runbook", - "serviceUri": "", - "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}, - ], - "enabled": True, - "eventHubReceivers": [ - { - "eventHubName": "testEventHub", - "eventHubNameSpace": "testEventHubNameSpace", - "name": "Sample eventHub", - "subscriptionId": "187f412d-1758-44d9-b052-169e2564721d", - "tenantId": "68a4459a-ccb8-493c-b9da-dd30457d1b84", - } - ], - "groupShortName": "sample", - "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, - }, - ], - }, - "tags": {}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/createOrUpdateActionGroup.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_activity_log_alert.py deleted file mode 100644 index de36a187ac94..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/create_or_update_activity_log_alert.py +++ /dev/null @@ -1,62 +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_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.create_or_update( - resource_group_name="Default-ActivityLogAlerts", - activity_log_alert_name="SampleActivityLogAlert", - activity_log_alert={ - "location": "Global", - "properties": { - "actions": { - "actionGroups": [ - { - "actionGroupId": "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/Default-ActionGroups/providers/microsoft.insights/actionGroups/SampleActionGroup", - "webhookProperties": {"sampleWebhookProperty": "samplePropertyValue"}, - } - ] - }, - "condition": { - "allOf": [{"equals": "Administrative", "field": "Category"}, {"equals": "Error", "field": "Level"}] - }, - "description": "Sample activity log alert description", - "enabled": True, - "scopes": ["subscriptions/187f412d-1758-44d9-b052-169e2564721d"], - }, - "tags": {}, - }, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2017-04-01/examples/createOrUpdateActivityLogAlert.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_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_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_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_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 deleted file mode 100644 index 1c3a53ed9bee..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_action_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 delete_action_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="187f412d-1758-44d9-b052-169e2564721d", - ) - - client.action_groups.delete( - resource_group_name="Default-NotificationRules", - action_group_name="SampleActionGroup", - ) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/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_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_rules.py deleted file mode 100644 index 5a5d67f2fde6..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_scheduled_query_rules.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_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", - ) - - client.scheduled_query_rules.delete( - resource_group_name="Rac46PostSwapRG", - rule_name="logalertfoo", - ) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/deleteScheduledQueryRules.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 deleted file mode 100644 index a044431cdb5e..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/enable_receiver.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 enable_receiver.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.action_groups.enable_receiver( - resource_group_name="Default-NotificationRules", - action_group_name="SampleActionGroup", - enable_request={"receiverName": "John Doe's mobile"}, - ) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/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 deleted file mode 100644 index 3552f016760b..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_action_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_action_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="187f412d-1758-44d9-b052-169e2564721d", - ) - - response = client.action_groups.get( - resource_group_name="Default-NotificationRules", - action_group_name="SampleActionGroup", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/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_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_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_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_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_rules.py deleted file mode 100644 index e82413761470..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_scheduled_query_rules.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_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.get( - resource_group_name="Rac46PostSwapRG", - rule_name="logalertfoo", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/getScheduledQueryRules.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_filtered_and_selected.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/get_tenant_activity_logs_filtered_and_selected.py deleted file mode 100644 index a4b1aa57da7d..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_tenant_activity_logs_filtered_and_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_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.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/GetTenantActivityLogsFilteredAndSelected.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 deleted file mode 100644 index ffd519f62f4b..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_test_notifications_at_action_group_resource_level.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_test_notifications_at_action_group_resource_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="11111111-1111-1111-1111-111111111111", - ) - - response = client.action_groups.get_test_notifications_at_action_group_resource_level( - resource_group_name="TestRgName", - action_group_name="TestAgName", - notification_id="11000222191287", - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/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 deleted file mode 100644 index bb0384104296..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_action_groups.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_action_groups.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.list_by_resource_group( - resource_group_name="Default-NotificationRules", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/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_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.py deleted file mode 100644 index 5b0cda029648..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/list_scheduled_query_rules.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_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="14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7", - ) - - response = client.scheduled_query_rules.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-04-16/examples/listScheduledQueryRules.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/operations_list.py similarity index 83% rename from sdk/monitor/azure-mgmt-monitor/generated_samples/operation_list.py rename to sdk/monitor/azure-mgmt-monitor/generated_samples/operations_list.py index a3b6b066d8c1..6a2054c29554 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/operation_list.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/operations_list.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-monitor # USAGE - python operation_list.py + python operations_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, @@ -31,9 +31,10 @@ def main(): ) response = client.operations.list() - print(response) + for item in response: + print(item) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/OperationList.json +# x-ms-original-file: 2023-10-01-preview/OperationsList.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 deleted file mode 100644 index a33358e56d15..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_action_group.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_action_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="187f412d-1758-44d9-b052-169e2564721d", - ) - - 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"}}, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/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_rules.py deleted file mode 100644 index b9456f3ffd1b..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/patch_scheduled_query_rules.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_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="subid", - ) - - response = client.scheduled_query_rules.update( - resource_group_name="my-resource-group", - rule_name="logalertfoo", - parameters={"properties": {"enabled": "true"}}, - ) - print(response) - - -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/patchScheduledQueryRules.json -if __name__ == "__main__": - main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_create_syslogs.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_create_syslogs.py new file mode 100644 index 000000000000..ac6f4a3d3fcb --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_create_syslogs.py @@ -0,0 +1,87 @@ +# 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) Python 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 pipeline_group_create_syslogs.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.pipeline_groups.begin_create_or_update( + resource_group_name="myResourceGroup", + pipeline_group_name="plGroup1", + resource={ + "extendedLocation": { + "name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/myTestCustomLocation", + "type": "CustomLocation", + }, + "location": "eastus2", + "properties": { + "exporters": [ + { + "azureMonitorWorkspaceLogs": { + "api": { + "dataCollectionEndpointUrl": "https://logs-myingestion-eb0s.eastus-1.ingest.monitor.azure.com", + "dataCollectionRule": "dcr-00000000000000000000000000000000", + "schema": { + "recordMap": [ + {"from": "body", "to": "Body"}, + {"from": "severity_text", "to": "SeverityText"}, + {"from": "time_unix_nano", "to": "TimeGenerated"}, + ] + }, + "stream": "Custom-MyTableRawData_CL", + }, + "concurrency": {"batchQueueSize": 100, "workerCount": 4}, + }, + "name": "my-workspace-logs-exporter1", + "type": "AzureMonitorWorkspaceLogs", + } + ], + "processors": [{"name": "batch-processor1", "type": "Batch"}], + "receivers": [{"name": "syslog-receiver1", "syslog": {"endpoint": "0.0.0.0:514"}, "type": "Syslog"}], + "service": { + "pipelines": [ + { + "exporters": ["my-workspace-logs-exporter1"], + "name": "MyPipelineForLogs1", + "processors": ["batch-processor1"], + "receivers": ["syslog-receiver1"], + "type": "logs", + } + ] + }, + }, + "tags": {"tag1": "A", "tag2": "B"}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2023-10-01-preview/PipelineGroupCreateSyslogs.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_create_syslogs_with_cache.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_create_syslogs_with_cache.py new file mode 100644 index 000000000000..5fcbc9aa7396 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_create_syslogs_with_cache.py @@ -0,0 +1,88 @@ +# 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) Python 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 pipeline_group_create_syslogs_with_cache.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.pipeline_groups.begin_create_or_update( + resource_group_name="myResourceGroup", + pipeline_group_name="plGroup1", + resource={ + "extendedLocation": { + "name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/myTestCustomLocation", + "type": "CustomLocation", + }, + "location": "eastus2", + "properties": { + "exporters": [ + { + "azureMonitorWorkspaceLogs": { + "api": { + "dataCollectionEndpointUrl": "https://logs-myingestion-eb0s.eastus-1.ingest.monitor.azure.com", + "dataCollectionRule": "dcr-00000000000000000000000000000000", + "schema": { + "recordMap": [ + {"from": "body", "to": "Body"}, + {"from": "severity_text", "to": "SeverityText"}, + {"from": "time_unix_nano", "to": "TimeGenerated"}, + ] + }, + "stream": "Custom-MyTableRawData_CL", + }, + "cache": {"maxStorageUsage": 100, "retentionPeriod": 10}, + "concurrency": {"batchQueueSize": 100, "workerCount": 4}, + }, + "name": "my-workspace-logs-exporter1", + "type": "AzureMonitorWorkspaceLogs", + } + ], + "processors": [{"name": "batch-processor1", "type": "Batch"}], + "receivers": [{"name": "syslog-receiver1", "syslog": {"endpoint": "0.0.0.0:514"}, "type": "Syslog"}], + "service": { + "pipelines": [ + { + "exporters": ["my-workspace-logs-exporter1"], + "name": "MyPipelineForLogs1", + "processors": ["batch-processor1"], + "receivers": ["syslog-receiver1"], + "type": "logs", + } + ] + }, + }, + "tags": {"tag1": "A", "tag2": "B"}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2023-10-01-preview/PipelineGroupCreateSyslogsWithCache.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_create_syslogs_with_networking.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_create_syslogs_with_networking.py new file mode 100644 index 000000000000..ffac3d3fcd43 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_create_syslogs_with_networking.py @@ -0,0 +1,94 @@ +# 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) Python 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 pipeline_group_create_syslogs_with_networking.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.pipeline_groups.begin_create_or_update( + resource_group_name="myResourceGroup", + pipeline_group_name="plGroup1", + resource={ + "extendedLocation": { + "name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/myTestCustomLocation", + "type": "CustomLocation", + }, + "location": "eastus2", + "properties": { + "exporters": [ + { + "azureMonitorWorkspaceLogs": { + "api": { + "dataCollectionEndpointUrl": "https://logs-myingestion-eb0s.eastus-1.ingest.monitor.azure.com", + "dataCollectionRule": "dcr-00000000000000000000000000000000", + "schema": { + "recordMap": [ + {"from": "body", "to": "Body"}, + {"from": "severity_text", "to": "SeverityText"}, + {"from": "time_unix_nano", "to": "TimeGenerated"}, + ] + }, + "stream": "Custom-MyTableRawData_CL", + }, + "concurrency": {"batchQueueSize": 100, "workerCount": 4}, + }, + "name": "my-workspace-logs-exporter1", + "type": "AzureMonitorWorkspaceLogs", + } + ], + "networkingConfigurations": [ + { + "externalNetworkingMode": "LoadBalancerOnly", + "host": "azuremonitorpipeline.contoso.com", + "routes": [{"receiver": "syslog-receiver1"}], + } + ], + "processors": [], + "receivers": [{"name": "syslog-receiver1", "syslog": {"endpoint": "0.0.0.0:514"}, "type": "Syslog"}], + "service": { + "pipelines": [ + { + "exporters": ["my-workspace-logs-exporter1"], + "name": "MyPipelineForLogs1", + "processors": [], + "receivers": ["syslog-receiver1"], + "type": "logs", + } + ] + }, + }, + "tags": {"tag1": "A", "tag2": "B"}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2023-10-01-preview/PipelineGroupCreateSyslogsWithNetworking.json +if __name__ == "__main__": + main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_create_udp.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_create_udp.py new file mode 100644 index 000000000000..49872a83e1ad --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_create_udp.py @@ -0,0 +1,89 @@ +# 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) Python 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 pipeline_group_create_udp.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.pipeline_groups.begin_create_or_update( + resource_group_name="myResourceGroup", + pipeline_group_name="plGroup1", + resource={ + "extendedLocation": { + "name": "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.extendedlocation/customlocations/myTestCustomLocation", + "type": "CustomLocation", + }, + "location": "eastus2", + "properties": { + "exporters": [ + { + "azureMonitorWorkspaceLogs": { + "api": { + "dataCollectionEndpointUrl": "https://logs-myingestion-eb0s.eastus-1.ingest.monitor.azure.com", + "dataCollectionRule": "dcr-00000000000000000000000000000000", + "schema": { + "recordMap": [ + {"from": "body", "to": "Body"}, + {"from": "severity_text", "to": "SeverityText"}, + {"from": "time_unix_nano", "to": "TimeGenerated"}, + ] + }, + "stream": "Custom-MyTableRawData_CL", + }, + "concurrency": {"batchQueueSize": 100, "workerCount": 4}, + }, + "name": "my-workspace-logs-exporter1", + "type": "AzureMonitorWorkspaceLogs", + } + ], + "processors": [], + "receivers": [ + {"name": "udp-receiver1", "type": "UDP", "udp": {"encoding": "utf-8", "endpoint": "0.0.0.0:518"}} + ], + "service": { + "pipelines": [ + { + "exporters": ["my-workspace-logs-exporter1"], + "name": "MyPipelineForLogs1", + "processors": [], + "receivers": ["udp-receiver1"], + "type": "logs", + } + ] + }, + }, + "tags": {"tag1": "A", "tag2": "B"}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2023-10-01-preview/PipelineGroupCreateUdp.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/pipeline_group_delete.py similarity index 75% rename from sdk/monitor/azure-mgmt-monitor/generated_samples/delete_log_profile.py rename to sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_delete.py index 03d4cab69a5c..c5ed1b0e64ff 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/delete_log_profile.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_delete.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-monitor # USAGE - python delete_log_profile.py + python pipeline_group_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, @@ -27,14 +27,15 @@ def main(): client = MonitorManagementClient( credential=DefaultAzureCredential(), - subscription_id="b67f7fec-69fc-4974-9099-a26bd6ffeda3", + subscription_id="SUBSCRIPTION_ID", ) - client.log_profiles.delete( - log_profile_name="Rac46PostSwapRG", - ) + client.pipeline_groups.begin_delete( + resource_group_name="myResourceGroup", + pipeline_group_name="plGroup1", + ).result() -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/deleteLogProfile.json +# x-ms-original-file: 2023-10-01-preview/PipelineGroupDelete.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/pipeline_group_get.py similarity index 76% rename from sdk/monitor/azure-mgmt-monitor/generated_samples/get_log_profile.py rename to sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_get.py index 5efa4df692fa..7106c3a4f703 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_log_profile.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_get.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-monitor # USAGE - python get_log_profile.py + python pipeline_group_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, @@ -27,15 +27,16 @@ def main(): client = MonitorManagementClient( credential=DefaultAzureCredential(), - subscription_id="df602c9c-7aa0-407d-a6fb-eb20c8bd1192", + subscription_id="SUBSCRIPTION_ID", ) - response = client.log_profiles.get( - log_profile_name="default", + response = client.pipeline_groups.get( + resource_group_name="myResourceGroup", + pipeline_group_name="plGroup1", ) print(response) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getLogProfile.json +# x-ms-original-file: 2023-10-01-preview/PipelineGroupGet.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/pipeline_group_list_by_resource_group.py similarity index 76% rename from sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scopes_list.py rename to sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_list_by_resource_group.py index 525b277cc1dd..6d75bab6d968 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/private_link_scopes_list.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_list_by_resource_group.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-monitor # USAGE - python private_link_scopes_list.py + python pipeline_group_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, @@ -27,14 +27,16 @@ def main(): client = MonitorManagementClient( credential=DefaultAzureCredential(), - subscription_id="86dc51d3-92ed-4d7e-947a-775ea79b4919", + subscription_id="SUBSCRIPTION_ID", ) - response = client.private_link_scopes.list() + response = client.pipeline_groups.list_by_resource_group( + resource_group_name="myResourceGroup", + ) for item in response: print(item) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-preview/examples/PrivateLinkScopesList.json +# x-ms-original-file: 2023-10-01-preview/PipelineGroupListByResourceGroup.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/pipeline_group_list_by_subscription.py similarity index 81% rename from sdk/monitor/azure-mgmt-monitor/generated_samples/get_event_categories.py rename to sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_list_by_subscription.py index ca18b30119fb..1aa0a945d872 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/get_event_categories.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_list_by_subscription.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- @@ -15,7 +15,7 @@ pip install azure-identity pip install azure-mgmt-monitor # USAGE - python get_event_categories.py + python pipeline_group_list_by_subscription.py Before run the sample, please set the values of the client ID, tenant ID and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, @@ -30,11 +30,11 @@ def main(): subscription_id="SUBSCRIPTION_ID", ) - response = client.event_categories.list() + response = client.pipeline_groups.list_by_subscription() for item in response: print(item) -# x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetEventCategories.json +# x-ms-original-file: 2023-10-01-preview/PipelineGroupListBySubscription.json if __name__ == "__main__": main() diff --git a/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_update.py b/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_update.py new file mode 100644 index 000000000000..2a96620c964a --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_samples/pipeline_group_update.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) Python 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 pipeline_group_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="SUBSCRIPTION_ID", + ) + + response = client.pipeline_groups.begin_update( + resource_group_name="myResourceGroup", + pipeline_group_name="plGroup1", + properties={ + "properties": { + "exporters": [ + { + "azureMonitorWorkspaceLogs": { + "api": { + "dataCollectionEndpointUrl": "https://logs-myingestion-eb0s.eastus-1.ingest.monitor.azure.com", + "dataCollectionRule": "dcr-00000000000000000000000000000000", + "schema": { + "recordMap": [ + {"from": "body", "to": "Body"}, + {"from": "severity_text", "to": "SeverityText"}, + {"from": "time_unix_nano", "to": "TimeGenerated"}, + ] + }, + "stream": "Custom-MyTableRawData_CL", + }, + "concurrency": {"batchQueueSize": 100, "workerCount": 4}, + }, + "name": "my-workspace-logs-exporter1", + "type": "AzureMonitorWorkspaceLogs", + } + ], + "processors": [], + "receivers": [{"name": "syslog-receiver1", "syslog": {"endpoint": "0.0.0.0:514"}, "type": "Syslog"}], + "replicas": 3, + "service": { + "pipelines": [ + { + "exporters": ["my-workspace-logs-exporter1"], + "name": "MyPipelineForLogs1", + "processors": [], + "receivers": ["syslog-receiver1"], + "type": "logs", + } + ] + }, + }, + "tags": {"tag1": "A", "tag2": "B"}, + }, + ).result() + print(response) + + +# x-ms-original-file: 2023-10-01-preview/PipelineGroupUpdate.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 deleted file mode 100644 index dd3e23cee1e2..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_samples/post_test_notifications_at_action_group_resource_level.py +++ /dev/null @@ -1,129 +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_action_group_resource_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="11111111-1111-1111-1111-111111111111", - ) - - response = client.action_groups.begin_create_notifications_at_action_group_resource_level( - resource_group_name="TestRgName", - action_group_name="TestAgName", - 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/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_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/conftest.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/conftest.py index f4702001bc6c..1eab7230596c 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/conftest.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_tests/conftest.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import os 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 deleted file mode 100644 index 027e937ff2a8..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_action_groups_operations.py +++ /dev/null @@ -1,429 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementActionGroupsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_action_groups_create_or_update(self, resource_group): - response = self.client.action_groups.create_or_update( - resource_group_name=resource_group.name, - action_group_name="str", - action_group={ - "location": "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} - ], - "enabled": True, - "eventHubReceivers": [ - { - "eventHubName": "str", - "eventHubNameSpace": "str", - "name": "str", - "subscriptionId": "str", - "tenantId": "str", - "useCommonAlertSchema": False, - } - ], - "groupShortName": "str", - "id": "str", - "itsmReceivers": [ - { - "connectionId": "str", - "name": "str", - "region": "str", - "ticketConfiguration": "str", - "workspaceId": "str", - } - ], - "logicAppReceivers": [ - {"callbackUrl": "str", "name": "str", "resourceId": "str", "useCommonAlertSchema": False} - ], - "name": "str", - "smsReceivers": [{"countryCode": "str", "name": "str", "phoneNumber": "str", "status": "str"}], - "tags": {"str": "str"}, - "type": "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", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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", - ) - - # please add some check logic here by yourself - # ... - - @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( - 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": [ - { - "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": [ - { - "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": [ - { - "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", - "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": [ - { - "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_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): - response = self.client.action_groups.get_test_notifications_at_action_group_resource_level( - resource_group_name=resource_group.name, - action_group_name="str", - 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_list_by_subscription_id(self, resource_group): - response = self.client.action_groups.list_by_subscription_id( - api_version="2022-06-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_action_groups_enable_receiver(self, resource_group): - response = self.client.action_groups.enable_receiver( - resource_group_name=resource_group.name, - action_group_name="str", - enable_request={"receiverName": "str"}, - api_version="2022-06-01", - ) - - # 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 deleted file mode 100644 index cd9fa1d74457..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_action_groups_operations_async.py +++ /dev/null @@ -1,436 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementActionGroupsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_action_groups_create_or_update(self, resource_group): - response = await self.client.action_groups.create_or_update( - resource_group_name=resource_group.name, - action_group_name="str", - action_group={ - "location": "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} - ], - "enabled": True, - "eventHubReceivers": [ - { - "eventHubName": "str", - "eventHubNameSpace": "str", - "name": "str", - "subscriptionId": "str", - "tenantId": "str", - "useCommonAlertSchema": False, - } - ], - "groupShortName": "str", - "id": "str", - "itsmReceivers": [ - { - "connectionId": "str", - "name": "str", - "region": "str", - "ticketConfiguration": "str", - "workspaceId": "str", - } - ], - "logicAppReceivers": [ - {"callbackUrl": "str", "name": "str", "resourceId": "str", "useCommonAlertSchema": False} - ], - "name": "str", - "smsReceivers": [{"countryCode": "str", "name": "str", "phoneNumber": "str", "status": "str"}], - "tags": {"str": "str"}, - "type": "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", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - 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", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - 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", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - 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", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_action_groups_begin_post_test_notifications(self, resource_group): - response = await ( - await self.client.action_groups.begin_post_test_notifications( - 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": [ - { - "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_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": [ - { - "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_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", - "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": [ - { - "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_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): - response = await self.client.action_groups.get_test_notifications_at_action_group_resource_level( - resource_group_name=resource_group.name, - action_group_name="str", - 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_list_by_subscription_id(self, resource_group): - response = self.client.action_groups.list_by_subscription_id( - api_version="2022-06-01", - ) - 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_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", - ) - 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_action_groups_enable_receiver(self, resource_group): - response = await self.client.action_groups.enable_receiver( - resource_group_name=resource_group.name, - action_group_name="str", - enable_request={"receiverName": "str"}, - api_version="2022-06-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_activity_log_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_activity_log_alerts_operations.py deleted file mode 100644 index 310598d7c98c..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_activity_log_alerts_operations.py +++ /dev/null @@ -1,101 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementActivityLogAlertsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_activity_log_alerts_create_or_update(self, resource_group): - response = self.client.activity_log_alerts.create_or_update( - resource_group_name=resource_group.name, - activity_log_alert_name="str", - activity_log_alert={ - "location": "str", - "actions": {"actionGroups": [{"actionGroupId": "str", "webhookProperties": {"str": "str"}}]}, - "condition": {"allOf": [{"equals": "str", "field": "str"}]}, - "description": "str", - "enabled": True, - "id": "str", - "name": "str", - "scopes": ["str"], - "tags": {"str": "str"}, - "type": "str", - }, - api_version="2017-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_activity_log_alerts_get(self, resource_group): - response = self.client.activity_log_alerts.get( - resource_group_name=resource_group.name, - activity_log_alert_name="str", - api_version="2017-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_activity_log_alerts_delete(self, resource_group): - response = self.client.activity_log_alerts.delete( - resource_group_name=resource_group.name, - activity_log_alert_name="str", - api_version="2017-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_activity_log_alerts_update(self, resource_group): - response = self.client.activity_log_alerts.update( - resource_group_name=resource_group.name, - activity_log_alert_name="str", - activity_log_alert_patch={"enabled": True, "tags": {"str": "str"}}, - api_version="2017-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_activity_log_alerts_list_by_subscription_id(self, resource_group): - response = self.client.activity_log_alerts.list_by_subscription_id( - api_version="2017-04-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_activity_log_alerts_list_by_resource_group(self, resource_group): - response = self.client.activity_log_alerts.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2017-04-01", - ) - 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_activity_log_alerts_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_activity_log_alerts_operations_async.py deleted file mode 100644 index 63b7a7c70437..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_activity_log_alerts_operations_async.py +++ /dev/null @@ -1,102 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementActivityLogAlertsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_activity_log_alerts_create_or_update(self, resource_group): - response = await self.client.activity_log_alerts.create_or_update( - resource_group_name=resource_group.name, - activity_log_alert_name="str", - activity_log_alert={ - "location": "str", - "actions": {"actionGroups": [{"actionGroupId": "str", "webhookProperties": {"str": "str"}}]}, - "condition": {"allOf": [{"equals": "str", "field": "str"}]}, - "description": "str", - "enabled": True, - "id": "str", - "name": "str", - "scopes": ["str"], - "tags": {"str": "str"}, - "type": "str", - }, - api_version="2017-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_activity_log_alerts_get(self, resource_group): - response = await self.client.activity_log_alerts.get( - resource_group_name=resource_group.name, - activity_log_alert_name="str", - api_version="2017-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_activity_log_alerts_delete(self, resource_group): - response = await self.client.activity_log_alerts.delete( - resource_group_name=resource_group.name, - activity_log_alert_name="str", - api_version="2017-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_activity_log_alerts_update(self, resource_group): - response = await self.client.activity_log_alerts.update( - resource_group_name=resource_group.name, - activity_log_alert_name="str", - activity_log_alert_patch={"enabled": True, "tags": {"str": "str"}}, - api_version="2017-04-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_activity_log_alerts_list_by_subscription_id(self, resource_group): - response = self.client.activity_log_alerts.list_by_subscription_id( - api_version="2017-04-01", - ) - 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_activity_log_alerts_list_by_resource_group(self, resource_group): - response = self.client.activity_log_alerts.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2017-04-01", - ) - result = [r async 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_activity_logs_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_activity_logs_operations.py deleted file mode 100644 index e494aaae7faf..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_activity_logs_operations.py +++ /dev/null @@ -1,30 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementActivityLogsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_activity_logs_list(self, resource_group): - response = self.client.activity_logs.list( - filter="str", - api_version="2015-04-01", - ) - 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_activity_logs_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_activity_logs_operations_async.py deleted file mode 100644 index 03d872b77d5b..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_activity_logs_operations_async.py +++ /dev/null @@ -1,31 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementActivityLogsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_activity_logs_list(self, resource_group): - response = self.client.activity_logs.list( - filter="str", - api_version="2015-04-01", - ) - result = [r async 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_alert_rule_incidents_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_alert_rule_incidents_operations.py deleted file mode 100644 index 77474a284f71..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_alert_rule_incidents_operations.py +++ /dev/null @@ -1,44 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementAlertRuleIncidentsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_alert_rule_incidents_get(self, resource_group): - response = self.client.alert_rule_incidents.get( - resource_group_name=resource_group.name, - rule_name="str", - incident_name="str", - api_version="2016-03-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_alert_rule_incidents_list_by_alert_rule(self, resource_group): - response = self.client.alert_rule_incidents.list_by_alert_rule( - resource_group_name=resource_group.name, - rule_name="str", - api_version="2016-03-01", - ) - 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_alert_rule_incidents_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_alert_rule_incidents_operations_async.py deleted file mode 100644 index 3595db0b33e6..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_alert_rule_incidents_operations_async.py +++ /dev/null @@ -1,45 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementAlertRuleIncidentsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_alert_rule_incidents_get(self, resource_group): - response = await self.client.alert_rule_incidents.get( - resource_group_name=resource_group.name, - rule_name="str", - incident_name="str", - api_version="2016-03-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_alert_rule_incidents_list_by_alert_rule(self, resource_group): - response = self.client.alert_rule_incidents.list_by_alert_rule( - resource_group_name=resource_group.name, - rule_name="str", - api_version="2016-03-01", - ) - result = [r async 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_autoscale_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_autoscale_settings_operations.py deleted file mode 100644 index cdfa617c31fa..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_autoscale_settings_operations.py +++ /dev/null @@ -1,207 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementAutoscaleSettingsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_autoscale_settings_list_by_resource_group(self, resource_group): - response = self.client.autoscale_settings.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2022-10-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_autoscale_settings_create_or_update(self, resource_group): - response = self.client.autoscale_settings.create_or_update( - resource_group_name=resource_group.name, - autoscale_setting_name="str", - parameters={ - "location": "str", - "profiles": [ - { - "capacity": {"default": "str", "maximum": "str", "minimum": "str"}, - "name": "str", - "rules": [ - { - "metricTrigger": { - "metricName": "str", - "metricResourceUri": "str", - "operator": "str", - "statistic": "str", - "threshold": 0.0, - "timeAggregation": "str", - "timeGrain": "1 day, 0:00:00", - "timeWindow": "1 day, 0:00:00", - "dimensions": [{"DimensionName": "str", "Operator": "str", "Values": ["str"]}], - "dividePerInstance": bool, - "metricNamespace": "str", - "metricResourceLocation": "str", - }, - "scaleAction": { - "cooldown": "1 day, 0:00:00", - "direction": "str", - "type": "str", - "value": "1", - }, - } - ], - "fixedDate": {"end": "2020-02-20 00:00:00", "start": "2020-02-20 00:00:00", "timeZone": "str"}, - "recurrence": { - "frequency": "str", - "schedule": {"days": ["str"], "hours": [0], "minutes": [0], "timeZone": "str"}, - }, - } - ], - "enabled": False, - "id": "str", - "name": "str", - "notifications": [ - { - "operation": "Scale", - "email": { - "customEmails": ["str"], - "sendToSubscriptionAdministrator": False, - "sendToSubscriptionCoAdministrators": False, - }, - "webhooks": [{"properties": {"str": "str"}, "serviceUri": "str"}], - } - ], - "predictiveAutoscalePolicy": {"scaleMode": "str", "scaleLookAheadTime": "1 day, 0:00:00"}, - "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"}, - "targetResourceLocation": "str", - "targetResourceUri": "str", - "type": "str", - }, - api_version="2022-10-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_autoscale_settings_delete(self, resource_group): - response = self.client.autoscale_settings.delete( - resource_group_name=resource_group.name, - autoscale_setting_name="str", - api_version="2022-10-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_autoscale_settings_get(self, resource_group): - response = self.client.autoscale_settings.get( - resource_group_name=resource_group.name, - autoscale_setting_name="str", - api_version="2022-10-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_autoscale_settings_update(self, resource_group): - response = self.client.autoscale_settings.update( - resource_group_name=resource_group.name, - autoscale_setting_name="str", - autoscale_setting_resource={ - "enabled": False, - "name": "str", - "notifications": [ - { - "operation": "Scale", - "email": { - "customEmails": ["str"], - "sendToSubscriptionAdministrator": False, - "sendToSubscriptionCoAdministrators": False, - }, - "webhooks": [{"properties": {"str": "str"}, "serviceUri": "str"}], - } - ], - "predictiveAutoscalePolicy": {"scaleMode": "str", "scaleLookAheadTime": "1 day, 0:00:00"}, - "profiles": [ - { - "capacity": {"default": "str", "maximum": "str", "minimum": "str"}, - "name": "str", - "rules": [ - { - "metricTrigger": { - "metricName": "str", - "metricResourceUri": "str", - "operator": "str", - "statistic": "str", - "threshold": 0.0, - "timeAggregation": "str", - "timeGrain": "1 day, 0:00:00", - "timeWindow": "1 day, 0:00:00", - "dimensions": [{"DimensionName": "str", "Operator": "str", "Values": ["str"]}], - "dividePerInstance": bool, - "metricNamespace": "str", - "metricResourceLocation": "str", - }, - "scaleAction": { - "cooldown": "1 day, 0:00:00", - "direction": "str", - "type": "str", - "value": "1", - }, - } - ], - "fixedDate": {"end": "2020-02-20 00:00:00", "start": "2020-02-20 00:00:00", "timeZone": "str"}, - "recurrence": { - "frequency": "str", - "schedule": {"days": ["str"], "hours": [0], "minutes": [0], "timeZone": "str"}, - }, - } - ], - "tags": {"str": "str"}, - "targetResourceLocation": "str", - "targetResourceUri": "str", - }, - api_version="2022-10-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_autoscale_settings_list_by_subscription(self, resource_group): - response = self.client.autoscale_settings.list_by_subscription( - api_version="2022-10-01", - ) - 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_autoscale_settings_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_autoscale_settings_operations_async.py deleted file mode 100644 index 28ed9f6ec3be..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_autoscale_settings_operations_async.py +++ /dev/null @@ -1,208 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementAutoscaleSettingsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_autoscale_settings_list_by_resource_group(self, resource_group): - response = self.client.autoscale_settings.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2022-10-01", - ) - 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_autoscale_settings_create_or_update(self, resource_group): - response = await self.client.autoscale_settings.create_or_update( - resource_group_name=resource_group.name, - autoscale_setting_name="str", - parameters={ - "location": "str", - "profiles": [ - { - "capacity": {"default": "str", "maximum": "str", "minimum": "str"}, - "name": "str", - "rules": [ - { - "metricTrigger": { - "metricName": "str", - "metricResourceUri": "str", - "operator": "str", - "statistic": "str", - "threshold": 0.0, - "timeAggregation": "str", - "timeGrain": "1 day, 0:00:00", - "timeWindow": "1 day, 0:00:00", - "dimensions": [{"DimensionName": "str", "Operator": "str", "Values": ["str"]}], - "dividePerInstance": bool, - "metricNamespace": "str", - "metricResourceLocation": "str", - }, - "scaleAction": { - "cooldown": "1 day, 0:00:00", - "direction": "str", - "type": "str", - "value": "1", - }, - } - ], - "fixedDate": {"end": "2020-02-20 00:00:00", "start": "2020-02-20 00:00:00", "timeZone": "str"}, - "recurrence": { - "frequency": "str", - "schedule": {"days": ["str"], "hours": [0], "minutes": [0], "timeZone": "str"}, - }, - } - ], - "enabled": False, - "id": "str", - "name": "str", - "notifications": [ - { - "operation": "Scale", - "email": { - "customEmails": ["str"], - "sendToSubscriptionAdministrator": False, - "sendToSubscriptionCoAdministrators": False, - }, - "webhooks": [{"properties": {"str": "str"}, "serviceUri": "str"}], - } - ], - "predictiveAutoscalePolicy": {"scaleMode": "str", "scaleLookAheadTime": "1 day, 0:00:00"}, - "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"}, - "targetResourceLocation": "str", - "targetResourceUri": "str", - "type": "str", - }, - api_version="2022-10-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_autoscale_settings_delete(self, resource_group): - response = await self.client.autoscale_settings.delete( - resource_group_name=resource_group.name, - autoscale_setting_name="str", - api_version="2022-10-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_autoscale_settings_get(self, resource_group): - response = await self.client.autoscale_settings.get( - resource_group_name=resource_group.name, - autoscale_setting_name="str", - api_version="2022-10-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_autoscale_settings_update(self, resource_group): - response = await self.client.autoscale_settings.update( - resource_group_name=resource_group.name, - autoscale_setting_name="str", - autoscale_setting_resource={ - "enabled": False, - "name": "str", - "notifications": [ - { - "operation": "Scale", - "email": { - "customEmails": ["str"], - "sendToSubscriptionAdministrator": False, - "sendToSubscriptionCoAdministrators": False, - }, - "webhooks": [{"properties": {"str": "str"}, "serviceUri": "str"}], - } - ], - "predictiveAutoscalePolicy": {"scaleMode": "str", "scaleLookAheadTime": "1 day, 0:00:00"}, - "profiles": [ - { - "capacity": {"default": "str", "maximum": "str", "minimum": "str"}, - "name": "str", - "rules": [ - { - "metricTrigger": { - "metricName": "str", - "metricResourceUri": "str", - "operator": "str", - "statistic": "str", - "threshold": 0.0, - "timeAggregation": "str", - "timeGrain": "1 day, 0:00:00", - "timeWindow": "1 day, 0:00:00", - "dimensions": [{"DimensionName": "str", "Operator": "str", "Values": ["str"]}], - "dividePerInstance": bool, - "metricNamespace": "str", - "metricResourceLocation": "str", - }, - "scaleAction": { - "cooldown": "1 day, 0:00:00", - "direction": "str", - "type": "str", - "value": "1", - }, - } - ], - "fixedDate": {"end": "2020-02-20 00:00:00", "start": "2020-02-20 00:00:00", "timeZone": "str"}, - "recurrence": { - "frequency": "str", - "schedule": {"days": ["str"], "hours": [0], "minutes": [0], "timeZone": "str"}, - }, - } - ], - "tags": {"str": "str"}, - "targetResourceLocation": "str", - "targetResourceUri": "str", - }, - api_version="2022-10-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_autoscale_settings_list_by_subscription(self, resource_group): - response = self.client.autoscale_settings.list_by_subscription( - api_version="2022-10-01", - ) - result = [r async 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_azure_monitor_workspaces_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_azure_monitor_workspaces_operations.py new file mode 100644 index 000000000000..787d55d420cf --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_azure_monitor_workspaces_operations.py @@ -0,0 +1,136 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.monitor import MonitorManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMonitorManagementAzureMonitorWorkspacesOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MonitorManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_azure_monitor_workspaces_get(self, resource_group): + response = self.client.azure_monitor_workspaces.get( + resource_group_name=resource_group.name, + azure_monitor_workspace_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_azure_monitor_workspaces_begin_create_or_update(self, resource_group): + response = self.client.azure_monitor_workspaces.begin_create_or_update( + resource_group_name=resource_group.name, + azure_monitor_workspace_name="str", + resource={ + "location": "str", + "etag": "str", + "id": "str", + "name": "str", + "properties": { + "accountId": "str", + "defaultIngestionSettings": { + "dataCollectionEndpointResourceId": "str", + "dataCollectionRuleResourceId": "str", + }, + "metrics": {"internalId": "str", "prometheusQueryEndpoint": "str"}, + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + }, + "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"}, + "type": "str", + }, + ).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_azure_monitor_workspaces_update(self, resource_group): + response = self.client.azure_monitor_workspaces.update( + resource_group_name=resource_group.name, + azure_monitor_workspace_name="str", + properties={ + "properties": {"metrics": {"internalId": "str", "prometheusQueryEndpoint": "str"}}, + "tags": {"str": "str"}, + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_azure_monitor_workspaces_begin_delete(self, resource_group): + response = self.client.azure_monitor_workspaces.begin_delete( + resource_group_name=resource_group.name, + azure_monitor_workspace_name="str", + ).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_azure_monitor_workspaces_list_by_resource_group(self, resource_group): + response = self.client.azure_monitor_workspaces.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_azure_monitor_workspaces_list_by_subscription(self, resource_group): + response = self.client.azure_monitor_workspaces.list_by_subscription() + 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_azure_monitor_workspaces_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_azure_monitor_workspaces_operations_async.py new file mode 100644 index 000000000000..96bf0298a39d --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_azure_monitor_workspaces_operations_async.py @@ -0,0 +1,141 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.monitor.aio import MonitorManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMonitorManagementAzureMonitorWorkspacesOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_azure_monitor_workspaces_get(self, resource_group): + response = await self.client.azure_monitor_workspaces.get( + resource_group_name=resource_group.name, + azure_monitor_workspace_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_azure_monitor_workspaces_begin_create_or_update(self, resource_group): + response = await ( + await self.client.azure_monitor_workspaces.begin_create_or_update( + resource_group_name=resource_group.name, + azure_monitor_workspace_name="str", + resource={ + "location": "str", + "etag": "str", + "id": "str", + "name": "str", + "properties": { + "accountId": "str", + "defaultIngestionSettings": { + "dataCollectionEndpointResourceId": "str", + "dataCollectionRuleResourceId": "str", + }, + "metrics": {"internalId": "str", "prometheusQueryEndpoint": "str"}, + "privateEndpointConnections": [ + { + "id": "str", + "name": "str", + "properties": { + "privateLinkServiceConnectionState": { + "actionsRequired": "str", + "description": "str", + "status": "str", + }, + "groupIds": ["str"], + "privateEndpoint": {"id": "str"}, + "provisioningState": "str", + }, + "systemData": { + "createdAt": "2020-02-20 00:00:00", + "createdBy": "str", + "createdByType": "str", + "lastModifiedAt": "2020-02-20 00:00:00", + "lastModifiedBy": "str", + "lastModifiedByType": "str", + }, + "type": "str", + } + ], + "provisioningState": "str", + "publicNetworkAccess": "str", + }, + "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"}, + "type": "str", + }, + ) + ).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_azure_monitor_workspaces_update(self, resource_group): + response = await self.client.azure_monitor_workspaces.update( + resource_group_name=resource_group.name, + azure_monitor_workspace_name="str", + properties={ + "properties": {"metrics": {"internalId": "str", "prometheusQueryEndpoint": "str"}}, + "tags": {"str": "str"}, + }, + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_azure_monitor_workspaces_begin_delete(self, resource_group): + response = await ( + await self.client.azure_monitor_workspaces.begin_delete( + resource_group_name=resource_group.name, + azure_monitor_workspace_name="str", + ) + ).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_azure_monitor_workspaces_list_by_resource_group(self, resource_group): + response = self.client.azure_monitor_workspaces.list_by_resource_group( + resource_group_name=resource_group.name, + ) + 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_azure_monitor_workspaces_list_by_subscription(self, resource_group): + response = self.client.azure_monitor_workspaces.list_by_subscription() + result = [r async 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_baselines_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_baselines_operations.py deleted file mode 100644 index db21cd6027f3..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_baselines_operations.py +++ /dev/null @@ -1,30 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementBaselinesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_baselines_list(self, resource_group): - response = self.client.baselines.list( - resource_uri="str", - api_version="2019-03-01", - ) - 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_baselines_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_baselines_operations_async.py deleted file mode 100644 index e2bb475e34be..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_baselines_operations_async.py +++ /dev/null @@ -1,31 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementBaselinesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_baselines_list(self, resource_group): - response = self.client.baselines.list( - resource_uri="str", - api_version="2019-03-01", - ) - result = [r async 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_diagnostic_settings_category_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_diagnostic_settings_category_operations.py deleted file mode 100644 index 75ead649d6a7..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_diagnostic_settings_category_operations.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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementDiagnosticSettingsCategoryOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_diagnostic_settings_category_get(self, resource_group): - response = self.client.diagnostic_settings_category.get( - resource_uri="str", - name="str", - api_version="2017-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_diagnostic_settings_category_list(self, resource_group): - response = self.client.diagnostic_settings_category.list( - resource_uri="str", - api_version="2017-05-01-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_diagnostic_settings_category_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_diagnostic_settings_category_operations_async.py deleted file mode 100644 index 79e1544528f8..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_diagnostic_settings_category_operations_async.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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementDiagnosticSettingsCategoryOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_diagnostic_settings_category_get(self, resource_group): - response = await self.client.diagnostic_settings_category.get( - resource_uri="str", - name="str", - api_version="2017-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_diagnostic_settings_category_list(self, resource_group): - response = await self.client.diagnostic_settings_category.list( - resource_uri="str", - api_version="2017-05-01-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_diagnostic_settings_operations.py deleted file mode 100644 index a85a9f0cf0e1..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_diagnostic_settings_operations.py +++ /dev/null @@ -1,102 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementDiagnosticSettingsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_diagnostic_settings_get(self, resource_group): - response = self.client.diagnostic_settings.get( - resource_uri="str", - name="str", - api_version="2021-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_diagnostic_settings_create_or_update(self, resource_group): - response = self.client.diagnostic_settings.create_or_update( - resource_uri="str", - name="str", - parameters={ - "eventHubAuthorizationRuleId": "str", - "eventHubName": "str", - "id": "str", - "logAnalyticsDestinationType": "str", - "logs": [ - { - "enabled": bool, - "category": "str", - "categoryGroup": "str", - "retentionPolicy": {"days": 0, "enabled": bool}, - } - ], - "marketplacePartnerId": "str", - "metrics": [ - { - "enabled": bool, - "category": "str", - "retentionPolicy": {"days": 0, "enabled": bool}, - "timeGrain": "1 day, 0:00:00", - } - ], - "name": "str", - "serviceBusRuleId": "str", - "storageAccountId": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - "workspaceId": "str", - }, - api_version="2021-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_diagnostic_settings_delete(self, resource_group): - response = self.client.diagnostic_settings.delete( - resource_uri="str", - name="str", - api_version="2021-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_diagnostic_settings_list(self, resource_group): - response = self.client.diagnostic_settings.list( - resource_uri="str", - api_version="2021-05-01-preview", - ) - 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_diagnostic_settings_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_diagnostic_settings_operations_async.py deleted file mode 100644 index ceb6bd720913..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_diagnostic_settings_operations_async.py +++ /dev/null @@ -1,103 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementDiagnosticSettingsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_diagnostic_settings_get(self, resource_group): - response = await self.client.diagnostic_settings.get( - resource_uri="str", - name="str", - api_version="2021-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_diagnostic_settings_create_or_update(self, resource_group): - response = await self.client.diagnostic_settings.create_or_update( - resource_uri="str", - name="str", - parameters={ - "eventHubAuthorizationRuleId": "str", - "eventHubName": "str", - "id": "str", - "logAnalyticsDestinationType": "str", - "logs": [ - { - "enabled": bool, - "category": "str", - "categoryGroup": "str", - "retentionPolicy": {"days": 0, "enabled": bool}, - } - ], - "marketplacePartnerId": "str", - "metrics": [ - { - "enabled": bool, - "category": "str", - "retentionPolicy": {"days": 0, "enabled": bool}, - "timeGrain": "1 day, 0:00:00", - } - ], - "name": "str", - "serviceBusRuleId": "str", - "storageAccountId": "str", - "systemData": { - "createdAt": "2020-02-20 00:00:00", - "createdBy": "str", - "createdByType": "str", - "lastModifiedAt": "2020-02-20 00:00:00", - "lastModifiedBy": "str", - "lastModifiedByType": "str", - }, - "type": "str", - "workspaceId": "str", - }, - api_version="2021-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_diagnostic_settings_delete(self, resource_group): - response = await self.client.diagnostic_settings.delete( - resource_uri="str", - name="str", - api_version="2021-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_diagnostic_settings_list(self, resource_group): - response = self.client.diagnostic_settings.list( - resource_uri="str", - api_version="2021-05-01-preview", - ) - result = [r async 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_event_categories_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_event_categories_operations.py deleted file mode 100644 index b9b0820c2f97..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_event_categories_operations.py +++ /dev/null @@ -1,29 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementEventCategoriesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_event_categories_list(self, resource_group): - response = self.client.event_categories.list( - api_version="2015-04-01", - ) - 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_event_categories_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_event_categories_operations_async.py deleted file mode 100644 index 310b695b90ce..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_event_categories_operations_async.py +++ /dev/null @@ -1,30 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementEventCategoriesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_event_categories_list(self, resource_group): - response = self.client.event_categories.list( - api_version="2015-04-01", - ) - result = [r async 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_guest_diagnostics_settings_association_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_guest_diagnostics_settings_association_operations.py deleted file mode 100644 index 7ade293a9e2f..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_guest_diagnostics_settings_association_operations.py +++ /dev/null @@ -1,97 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementGuestDiagnosticsSettingsAssociationOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_guest_diagnostics_settings_association_create_or_update(self, resource_group): - response = self.client.guest_diagnostics_settings_association.create_or_update( - resource_uri="str", - association_name="str", - diagnostic_settings_association={ - "guestDiagnosticSettingsName": "str", - "location": "str", - "id": "str", - "name": "str", - "tags": {"str": "str"}, - "type": "str", - }, - api_version="2018-06-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_guest_diagnostics_settings_association_get(self, resource_group): - response = self.client.guest_diagnostics_settings_association.get( - resource_uri="str", - association_name="str", - api_version="2018-06-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_guest_diagnostics_settings_association_delete(self, resource_group): - response = self.client.guest_diagnostics_settings_association.delete( - resource_uri="str", - association_name="str", - api_version="2018-06-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_guest_diagnostics_settings_association_update(self, resource_group): - response = self.client.guest_diagnostics_settings_association.update( - resource_uri="str", - association_name="str", - parameters={"guestDiagnosticSettingsName": "str", "tags": {"str": "str"}}, - api_version="2018-06-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_guest_diagnostics_settings_association_list(self, resource_group): - response = self.client.guest_diagnostics_settings_association.list( - api_version="2018-06-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_guest_diagnostics_settings_association_list_by_resource_group(self, resource_group): - response = self.client.guest_diagnostics_settings_association.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2018-06-01-preview", - ) - 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_guest_diagnostics_settings_association_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_guest_diagnostics_settings_association_operations_async.py deleted file mode 100644 index 4ab46cc303c1..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_guest_diagnostics_settings_association_operations_async.py +++ /dev/null @@ -1,98 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementGuestDiagnosticsSettingsAssociationOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_guest_diagnostics_settings_association_create_or_update(self, resource_group): - response = await self.client.guest_diagnostics_settings_association.create_or_update( - resource_uri="str", - association_name="str", - diagnostic_settings_association={ - "guestDiagnosticSettingsName": "str", - "location": "str", - "id": "str", - "name": "str", - "tags": {"str": "str"}, - "type": "str", - }, - api_version="2018-06-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_guest_diagnostics_settings_association_get(self, resource_group): - response = await self.client.guest_diagnostics_settings_association.get( - resource_uri="str", - association_name="str", - api_version="2018-06-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_guest_diagnostics_settings_association_delete(self, resource_group): - response = await self.client.guest_diagnostics_settings_association.delete( - resource_uri="str", - association_name="str", - api_version="2018-06-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_guest_diagnostics_settings_association_update(self, resource_group): - response = await self.client.guest_diagnostics_settings_association.update( - resource_uri="str", - association_name="str", - parameters={"guestDiagnosticSettingsName": "str", "tags": {"str": "str"}}, - api_version="2018-06-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_guest_diagnostics_settings_association_list(self, resource_group): - response = self.client.guest_diagnostics_settings_association.list( - api_version="2018-06-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_guest_diagnostics_settings_association_list_by_resource_group(self, resource_group): - response = self.client.guest_diagnostics_settings_association.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2018-06-01-preview", - ) - result = [r async 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_guest_diagnostics_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_guest_diagnostics_settings_operations.py deleted file mode 100644 index 360fad5da1d0..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_guest_diagnostics_settings_operations.py +++ /dev/null @@ -1,124 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementGuestDiagnosticsSettingsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_guest_diagnostics_settings_create_or_update(self, resource_group): - response = self.client.guest_diagnostics_settings.create_or_update( - resource_group_name=resource_group.name, - diagnostic_settings_name="str", - diagnostic_settings={ - "location": "str", - "dataSources": [ - { - "configuration": { - "eventLogs": [{"logName": "str", "filter": "str"}], - "perfCounters": [{"name": "str", "samplingPeriod": "str", "instance": "str"}], - "providers": [{"events": [{"id": 0, "name": "str", "filter": "str"}], "id": "str"}], - }, - "kind": "str", - "sinks": [{"kind": "str"}], - } - ], - "id": "str", - "name": "str", - "osType": "str", - "proxySetting": "str", - "tags": {"str": "str"}, - "type": "str", - }, - api_version="2018-06-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_guest_diagnostics_settings_get(self, resource_group): - response = self.client.guest_diagnostics_settings.get( - resource_group_name=resource_group.name, - diagnostic_settings_name="str", - api_version="2018-06-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_guest_diagnostics_settings_update(self, resource_group): - response = self.client.guest_diagnostics_settings.update( - resource_group_name=resource_group.name, - diagnostic_settings_name="str", - parameters={ - "dataSources": [ - { - "configuration": { - "eventLogs": [{"logName": "str", "filter": "str"}], - "perfCounters": [{"name": "str", "samplingPeriod": "str", "instance": "str"}], - "providers": [{"events": [{"id": 0, "name": "str", "filter": "str"}], "id": "str"}], - }, - "kind": "str", - "sinks": [{"kind": "str"}], - } - ], - "osType": "str", - "proxySetting": "str", - "tags": {"str": "str"}, - }, - api_version="2018-06-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_guest_diagnostics_settings_delete(self, resource_group): - response = self.client.guest_diagnostics_settings.delete( - resource_group_name=resource_group.name, - diagnostic_settings_name="str", - api_version="2018-06-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_guest_diagnostics_settings_list(self, resource_group): - response = self.client.guest_diagnostics_settings.list( - api_version="2018-06-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_guest_diagnostics_settings_list_by_resource_group(self, resource_group): - response = self.client.guest_diagnostics_settings.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2018-06-01-preview", - ) - 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_guest_diagnostics_settings_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_guest_diagnostics_settings_operations_async.py deleted file mode 100644 index 7aa81f48cf9a..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_guest_diagnostics_settings_operations_async.py +++ /dev/null @@ -1,125 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementGuestDiagnosticsSettingsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_guest_diagnostics_settings_create_or_update(self, resource_group): - response = await self.client.guest_diagnostics_settings.create_or_update( - resource_group_name=resource_group.name, - diagnostic_settings_name="str", - diagnostic_settings={ - "location": "str", - "dataSources": [ - { - "configuration": { - "eventLogs": [{"logName": "str", "filter": "str"}], - "perfCounters": [{"name": "str", "samplingPeriod": "str", "instance": "str"}], - "providers": [{"events": [{"id": 0, "name": "str", "filter": "str"}], "id": "str"}], - }, - "kind": "str", - "sinks": [{"kind": "str"}], - } - ], - "id": "str", - "name": "str", - "osType": "str", - "proxySetting": "str", - "tags": {"str": "str"}, - "type": "str", - }, - api_version="2018-06-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_guest_diagnostics_settings_get(self, resource_group): - response = await self.client.guest_diagnostics_settings.get( - resource_group_name=resource_group.name, - diagnostic_settings_name="str", - api_version="2018-06-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_guest_diagnostics_settings_update(self, resource_group): - response = await self.client.guest_diagnostics_settings.update( - resource_group_name=resource_group.name, - diagnostic_settings_name="str", - parameters={ - "dataSources": [ - { - "configuration": { - "eventLogs": [{"logName": "str", "filter": "str"}], - "perfCounters": [{"name": "str", "samplingPeriod": "str", "instance": "str"}], - "providers": [{"events": [{"id": 0, "name": "str", "filter": "str"}], "id": "str"}], - }, - "kind": "str", - "sinks": [{"kind": "str"}], - } - ], - "osType": "str", - "proxySetting": "str", - "tags": {"str": "str"}, - }, - api_version="2018-06-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_guest_diagnostics_settings_delete(self, resource_group): - response = await self.client.guest_diagnostics_settings.delete( - resource_group_name=resource_group.name, - diagnostic_settings_name="str", - api_version="2018-06-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_guest_diagnostics_settings_list(self, resource_group): - response = self.client.guest_diagnostics_settings.list( - api_version="2018-06-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_guest_diagnostics_settings_list_by_resource_group(self, resource_group): - response = self.client.guest_diagnostics_settings.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2018-06-01-preview", - ) - result = [r async 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_log_profiles_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_log_profiles_operations.py deleted file mode 100644 index 7c1fa57d49be..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_log_profiles_operations.py +++ /dev/null @@ -1,93 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementLogProfilesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_log_profiles_delete(self, resource_group): - response = self.client.log_profiles.delete( - log_profile_name="str", - api_version="2016-03-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_log_profiles_get(self, resource_group): - response = self.client.log_profiles.get( - log_profile_name="str", - api_version="2016-03-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_log_profiles_create_or_update(self, resource_group): - response = self.client.log_profiles.create_or_update( - log_profile_name="str", - parameters={ - "categories": ["str"], - "location": "str", - "locations": ["str"], - "retentionPolicy": {"days": 0, "enabled": bool}, - "id": "str", - "name": "str", - "serviceBusRuleId": "str", - "storageAccountId": "str", - "tags": {"str": "str"}, - "type": "str", - }, - api_version="2016-03-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_log_profiles_update(self, resource_group): - response = self.client.log_profiles.update( - log_profile_name="str", - log_profiles_resource={ - "categories": ["str"], - "locations": ["str"], - "retentionPolicy": {"days": 0, "enabled": bool}, - "serviceBusRuleId": "str", - "storageAccountId": "str", - "tags": {"str": "str"}, - }, - api_version="2016-03-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_log_profiles_list(self, resource_group): - response = self.client.log_profiles.list( - api_version="2016-03-01", - ) - 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_log_profiles_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_log_profiles_operations_async.py deleted file mode 100644 index 8e32c7c01df1..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_log_profiles_operations_async.py +++ /dev/null @@ -1,94 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementLogProfilesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_log_profiles_delete(self, resource_group): - response = await self.client.log_profiles.delete( - log_profile_name="str", - api_version="2016-03-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_log_profiles_get(self, resource_group): - response = await self.client.log_profiles.get( - log_profile_name="str", - api_version="2016-03-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_log_profiles_create_or_update(self, resource_group): - response = await self.client.log_profiles.create_or_update( - log_profile_name="str", - parameters={ - "categories": ["str"], - "location": "str", - "locations": ["str"], - "retentionPolicy": {"days": 0, "enabled": bool}, - "id": "str", - "name": "str", - "serviceBusRuleId": "str", - "storageAccountId": "str", - "tags": {"str": "str"}, - "type": "str", - }, - api_version="2016-03-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_log_profiles_update(self, resource_group): - response = await self.client.log_profiles.update( - log_profile_name="str", - log_profiles_resource={ - "categories": ["str"], - "locations": ["str"], - "retentionPolicy": {"days": 0, "enabled": bool}, - "serviceBusRuleId": "str", - "storageAccountId": "str", - "tags": {"str": "str"}, - }, - api_version="2016-03-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_log_profiles_list(self, resource_group): - response = self.client.log_profiles.list( - api_version="2016-03-01", - ) - result = [r async 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_metric_alerts_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_alerts_operations.py deleted file mode 100644 index de291b7df7ae..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_alerts_operations.py +++ /dev/null @@ -1,124 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementMetricAlertsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_metric_alerts_list_by_subscription(self, resource_group): - response = self.client.metric_alerts.list_by_subscription( - api_version="2018-03-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_metric_alerts_list_by_resource_group(self, resource_group): - response = self.client.metric_alerts.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2018-03-01", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_metric_alerts_get(self, resource_group): - response = self.client.metric_alerts.get( - resource_group_name=resource_group.name, - rule_name="str", - api_version="2018-03-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_metric_alerts_create_or_update(self, resource_group): - response = self.client.metric_alerts.create_or_update( - resource_group_name=resource_group.name, - rule_name="str", - parameters={ - "criteria": "metric_alert_criteria", - "enabled": bool, - "evaluationFrequency": "1 day, 0:00:00", - "location": "str", - "scopes": ["str"], - "severity": 0, - "windowSize": "1 day, 0:00:00", - "actions": [{"actionGroupId": "str", "webHookProperties": {"str": "str"}}], - "autoMitigate": bool, - "description": "str", - "id": "str", - "isMigrated": bool, - "lastUpdatedTime": "2020-02-20 00:00:00", - "name": "str", - "tags": {"str": "str"}, - "targetResourceRegion": "str", - "targetResourceType": "str", - "type": "str", - }, - api_version="2018-03-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_metric_alerts_update(self, resource_group): - response = self.client.metric_alerts.update( - resource_group_name=resource_group.name, - rule_name="str", - parameters={ - "actions": [{"actionGroupId": "str", "webHookProperties": {"str": "str"}}], - "autoMitigate": bool, - "criteria": "metric_alert_criteria", - "description": "str", - "enabled": bool, - "evaluationFrequency": "1 day, 0:00:00", - "isMigrated": bool, - "lastUpdatedTime": "2020-02-20 00:00:00", - "scopes": ["str"], - "severity": 0, - "tags": {"str": "str"}, - "targetResourceRegion": "str", - "targetResourceType": "str", - "windowSize": "1 day, 0:00:00", - }, - api_version="2018-03-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_metric_alerts_delete(self, resource_group): - response = self.client.metric_alerts.delete( - resource_group_name=resource_group.name, - rule_name="str", - api_version="2018-03-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_alerts_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_alerts_operations_async.py deleted file mode 100644 index e0f957e1041f..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_alerts_operations_async.py +++ /dev/null @@ -1,125 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementMetricAlertsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_metric_alerts_list_by_subscription(self, resource_group): - response = self.client.metric_alerts.list_by_subscription( - api_version="2018-03-01", - ) - 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_metric_alerts_list_by_resource_group(self, resource_group): - response = self.client.metric_alerts.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2018-03-01", - ) - 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_metric_alerts_get(self, resource_group): - response = await self.client.metric_alerts.get( - resource_group_name=resource_group.name, - rule_name="str", - api_version="2018-03-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_metric_alerts_create_or_update(self, resource_group): - response = await self.client.metric_alerts.create_or_update( - resource_group_name=resource_group.name, - rule_name="str", - parameters={ - "criteria": "metric_alert_criteria", - "enabled": bool, - "evaluationFrequency": "1 day, 0:00:00", - "location": "str", - "scopes": ["str"], - "severity": 0, - "windowSize": "1 day, 0:00:00", - "actions": [{"actionGroupId": "str", "webHookProperties": {"str": "str"}}], - "autoMitigate": bool, - "description": "str", - "id": "str", - "isMigrated": bool, - "lastUpdatedTime": "2020-02-20 00:00:00", - "name": "str", - "tags": {"str": "str"}, - "targetResourceRegion": "str", - "targetResourceType": "str", - "type": "str", - }, - api_version="2018-03-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_metric_alerts_update(self, resource_group): - response = await self.client.metric_alerts.update( - resource_group_name=resource_group.name, - rule_name="str", - parameters={ - "actions": [{"actionGroupId": "str", "webHookProperties": {"str": "str"}}], - "autoMitigate": bool, - "criteria": "metric_alert_criteria", - "description": "str", - "enabled": bool, - "evaluationFrequency": "1 day, 0:00:00", - "isMigrated": bool, - "lastUpdatedTime": "2020-02-20 00:00:00", - "scopes": ["str"], - "severity": 0, - "tags": {"str": "str"}, - "targetResourceRegion": "str", - "targetResourceType": "str", - "windowSize": "1 day, 0:00:00", - }, - api_version="2018-03-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_metric_alerts_delete(self, resource_group): - response = await self.client.metric_alerts.delete( - resource_group_name=resource_group.name, - rule_name="str", - api_version="2018-03-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_alerts_status_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_alerts_status_operations.py deleted file mode 100644 index f78f4b27cce2..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_alerts_status_operations.py +++ /dev/null @@ -1,44 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementMetricAlertsStatusOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_metric_alerts_status_list(self, resource_group): - response = self.client.metric_alerts_status.list( - resource_group_name=resource_group.name, - rule_name="str", - api_version="2018-03-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_metric_alerts_status_list_by_name(self, resource_group): - response = self.client.metric_alerts_status.list_by_name( - resource_group_name=resource_group.name, - rule_name="str", - status_name="str", - api_version="2018-03-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_alerts_status_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_alerts_status_operations_async.py deleted file mode 100644 index 8a50034e0af9..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_alerts_status_operations_async.py +++ /dev/null @@ -1,45 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementMetricAlertsStatusOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_metric_alerts_status_list(self, resource_group): - response = await self.client.metric_alerts_status.list( - resource_group_name=resource_group.name, - rule_name="str", - api_version="2018-03-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_metric_alerts_status_list_by_name(self, resource_group): - response = await self.client.metric_alerts_status.list_by_name( - resource_group_name=resource_group.name, - rule_name="str", - status_name="str", - api_version="2018-03-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_definitions_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_definitions_operations.py deleted file mode 100644 index f73783566506..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_definitions_operations.py +++ /dev/null @@ -1,30 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementMetricDefinitionsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_metric_definitions_list(self, resource_group): - response = self.client.metric_definitions.list( - resource_uri="str", - api_version="2018-01-01", - ) - 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_metric_definitions_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_definitions_operations_async.py deleted file mode 100644 index ff377c68e2c9..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_definitions_operations_async.py +++ /dev/null @@ -1,31 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementMetricDefinitionsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_metric_definitions_list(self, resource_group): - response = self.client.metric_definitions.list( - resource_uri="str", - api_version="2018-01-01", - ) - result = [r async 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_metric_namespaces_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_namespaces_operations.py deleted file mode 100644 index b14504ef4801..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_namespaces_operations.py +++ /dev/null @@ -1,30 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementMetricNamespacesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_metric_namespaces_list(self, resource_group): - response = self.client.metric_namespaces.list( - resource_uri="str", - api_version="2017-12-01-preview", - ) - 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_metric_namespaces_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_namespaces_operations_async.py deleted file mode 100644 index 06a79a2b15b8..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metric_namespaces_operations_async.py +++ /dev/null @@ -1,31 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementMetricNamespacesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_metric_namespaces_list(self, resource_group): - response = self.client.metric_namespaces.list( - resource_uri="str", - api_version="2017-12-01-preview", - ) - result = [r async 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_metrics_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metrics_operations.py deleted file mode 100644 index 7ae33c67fdab..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metrics_operations.py +++ /dev/null @@ -1,30 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementMetricsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_metrics_list(self, resource_group): - response = self.client.metrics.list( - resource_uri="str", - api_version="2018-01-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metrics_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metrics_operations_async.py deleted file mode 100644 index 453e3386fff5..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_metrics_operations_async.py +++ /dev/null @@ -1,31 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementMetricsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_metrics_list(self, resource_group): - response = await self.client.metrics.list( - resource_uri="str", - api_version="2018-01-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_operations.py index 1c34d8a88767..c85cee94a3c8 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_operations.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_operations.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -21,9 +21,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy def test_operations_list(self, resource_group): - response = self.client.operations.list( - api_version="2015-04-01", - ) - + response = self.client.operations.list() + 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_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_operations_async.py index 6f6b529ecec2..141efde6edc2 100644 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_operations_async.py +++ b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_operations_async.py @@ -2,7 +2,7 @@ # -------------------------------------------------------------------------- # 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. +# Code generated by Microsoft (R) Python Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- import pytest @@ -22,9 +22,7 @@ def setup_method(self, method): @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async async def test_operations_list(self, resource_group): - response = await self.client.operations.list( - api_version="2015-04-01", - ) - + response = self.client.operations.list() + result = [r async 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_pipeline_groups_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_pipeline_groups_operations.py new file mode 100644 index 000000000000..cdccdbcc25c9 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_pipeline_groups_operations.py @@ -0,0 +1,207 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.monitor import MonitorManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMonitorManagementPipelineGroupsOperations(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MonitorManagementClient) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_pipeline_groups_get(self, resource_group): + response = self.client.pipeline_groups.get( + resource_group_name=resource_group.name, + pipeline_group_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_pipeline_groups_begin_create_or_update(self, resource_group): + response = self.client.pipeline_groups.begin_create_or_update( + resource_group_name=resource_group.name, + pipeline_group_name="str", + resource={ + "location": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "name": "str", + "properties": { + "exporters": [ + { + "name": "str", + "type": "str", + "azureMonitorWorkspaceLogs": { + "api": { + "dataCollectionEndpointUrl": "str", + "dataCollectionRule": "str", + "schema": { + "recordMap": [{"from": "str", "to": "str"}], + "resourceMap": [{"from": "str", "to": "str"}], + "scopeMap": [{"from": "str", "to": "str"}], + }, + "stream": "str", + }, + "cache": {"maxStorageUsage": 0, "retentionPeriod": 0}, + "concurrency": {"batchQueueSize": 0, "workerCount": 0}, + }, + "tcp": {"url": "str"}, + } + ], + "processors": [{"name": "str", "type": "str", "batch": {"batchSize": 0, "timeout": 0}}], + "receivers": [ + { + "name": "str", + "type": "str", + "otlp": {"endpoint": "str"}, + "syslog": {"endpoint": "str", "protocol": "str"}, + "udp": {"endpoint": "str", "encoding": "str", "readQueueLength": 0}, + } + ], + "service": { + "pipelines": [ + { + "exporters": ["str"], + "name": "str", + "receivers": ["str"], + "type": "str", + "processors": ["str"], + } + ], + "persistence": {"persistentVolumeName": "str"}, + }, + "networkingConfigurations": [ + { + "externalNetworkingMode": "str", + "routes": [{"receiver": "str", "path": "str", "port": 0, "subdomain": "str"}], + "host": "str", + } + ], + "provisioningState": "str", + "replicas": 0, + }, + "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"}, + "type": "str", + }, + ).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_pipeline_groups_begin_delete(self, resource_group): + response = self.client.pipeline_groups.begin_delete( + resource_group_name=resource_group.name, + pipeline_group_name="str", + ).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_pipeline_groups_begin_update(self, resource_group): + response = self.client.pipeline_groups.begin_update( + resource_group_name=resource_group.name, + pipeline_group_name="str", + properties={ + "properties": { + "exporters": [ + { + "name": "str", + "type": "str", + "azureMonitorWorkspaceLogs": { + "api": { + "dataCollectionEndpointUrl": "str", + "dataCollectionRule": "str", + "schema": { + "recordMap": [{"from": "str", "to": "str"}], + "resourceMap": [{"from": "str", "to": "str"}], + "scopeMap": [{"from": "str", "to": "str"}], + }, + "stream": "str", + }, + "cache": {"maxStorageUsage": 0, "retentionPeriod": 0}, + "concurrency": {"batchQueueSize": 0, "workerCount": 0}, + }, + "tcp": {"url": "str"}, + } + ], + "networkingConfigurations": [ + { + "externalNetworkingMode": "str", + "routes": [{"receiver": "str", "path": "str", "port": 0, "subdomain": "str"}], + "host": "str", + } + ], + "processors": [{"name": "str", "type": "str", "batch": {"batchSize": 0, "timeout": 0}}], + "receivers": [ + { + "name": "str", + "type": "str", + "otlp": {"endpoint": "str"}, + "syslog": {"endpoint": "str", "protocol": "str"}, + "udp": {"endpoint": "str", "encoding": "str", "readQueueLength": 0}, + } + ], + "replicas": 0, + "service": { + "pipelines": [ + { + "exporters": ["str"], + "name": "str", + "receivers": ["str"], + "type": "str", + "processors": ["str"], + } + ], + "persistence": {"persistentVolumeName": "str"}, + }, + }, + "tags": {"str": "str"}, + }, + ).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_pipeline_groups_list_by_resource_group(self, resource_group): + response = self.client.pipeline_groups.list_by_resource_group( + resource_group_name=resource_group.name, + ) + result = [r for r in response] + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy + def test_pipeline_groups_list_by_subscription(self, resource_group): + response = self.client.pipeline_groups.list_by_subscription() + 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_pipeline_groups_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_pipeline_groups_operations_async.py new file mode 100644 index 000000000000..d36ab0c9100d --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_pipeline_groups_operations_async.py @@ -0,0 +1,214 @@ +# 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) Python Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +import pytest +from azure.mgmt.monitor.aio import MonitorManagementClient + +from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer +from devtools_testutils.aio import recorded_by_proxy_async + +AZURE_LOCATION = "eastus" + + +@pytest.mark.skip("you may need to update the auto-generated test case before run it") +class TestMonitorManagementPipelineGroupsOperationsAsync(AzureMgmtRecordedTestCase): + def setup_method(self, method): + self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_pipeline_groups_get(self, resource_group): + response = await self.client.pipeline_groups.get( + resource_group_name=resource_group.name, + pipeline_group_name="str", + ) + + # please add some check logic here by yourself + # ... + + @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) + @recorded_by_proxy_async + async def test_pipeline_groups_begin_create_or_update(self, resource_group): + response = await ( + await self.client.pipeline_groups.begin_create_or_update( + resource_group_name=resource_group.name, + pipeline_group_name="str", + resource={ + "location": "str", + "extendedLocation": {"name": "str", "type": "str"}, + "id": "str", + "name": "str", + "properties": { + "exporters": [ + { + "name": "str", + "type": "str", + "azureMonitorWorkspaceLogs": { + "api": { + "dataCollectionEndpointUrl": "str", + "dataCollectionRule": "str", + "schema": { + "recordMap": [{"from": "str", "to": "str"}], + "resourceMap": [{"from": "str", "to": "str"}], + "scopeMap": [{"from": "str", "to": "str"}], + }, + "stream": "str", + }, + "cache": {"maxStorageUsage": 0, "retentionPeriod": 0}, + "concurrency": {"batchQueueSize": 0, "workerCount": 0}, + }, + "tcp": {"url": "str"}, + } + ], + "processors": [{"name": "str", "type": "str", "batch": {"batchSize": 0, "timeout": 0}}], + "receivers": [ + { + "name": "str", + "type": "str", + "otlp": {"endpoint": "str"}, + "syslog": {"endpoint": "str", "protocol": "str"}, + "udp": {"endpoint": "str", "encoding": "str", "readQueueLength": 0}, + } + ], + "service": { + "pipelines": [ + { + "exporters": ["str"], + "name": "str", + "receivers": ["str"], + "type": "str", + "processors": ["str"], + } + ], + "persistence": {"persistentVolumeName": "str"}, + }, + "networkingConfigurations": [ + { + "externalNetworkingMode": "str", + "routes": [{"receiver": "str", "path": "str", "port": 0, "subdomain": "str"}], + "host": "str", + } + ], + "provisioningState": "str", + "replicas": 0, + }, + "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"}, + "type": "str", + }, + ) + ).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_pipeline_groups_begin_delete(self, resource_group): + response = await ( + await self.client.pipeline_groups.begin_delete( + resource_group_name=resource_group.name, + pipeline_group_name="str", + ) + ).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_pipeline_groups_begin_update(self, resource_group): + response = await ( + await self.client.pipeline_groups.begin_update( + resource_group_name=resource_group.name, + pipeline_group_name="str", + properties={ + "properties": { + "exporters": [ + { + "name": "str", + "type": "str", + "azureMonitorWorkspaceLogs": { + "api": { + "dataCollectionEndpointUrl": "str", + "dataCollectionRule": "str", + "schema": { + "recordMap": [{"from": "str", "to": "str"}], + "resourceMap": [{"from": "str", "to": "str"}], + "scopeMap": [{"from": "str", "to": "str"}], + }, + "stream": "str", + }, + "cache": {"maxStorageUsage": 0, "retentionPeriod": 0}, + "concurrency": {"batchQueueSize": 0, "workerCount": 0}, + }, + "tcp": {"url": "str"}, + } + ], + "networkingConfigurations": [ + { + "externalNetworkingMode": "str", + "routes": [{"receiver": "str", "path": "str", "port": 0, "subdomain": "str"}], + "host": "str", + } + ], + "processors": [{"name": "str", "type": "str", "batch": {"batchSize": 0, "timeout": 0}}], + "receivers": [ + { + "name": "str", + "type": "str", + "otlp": {"endpoint": "str"}, + "syslog": {"endpoint": "str", "protocol": "str"}, + "udp": {"endpoint": "str", "encoding": "str", "readQueueLength": 0}, + } + ], + "replicas": 0, + "service": { + "pipelines": [ + { + "exporters": ["str"], + "name": "str", + "receivers": ["str"], + "type": "str", + "processors": ["str"], + } + ], + "persistence": {"persistentVolumeName": "str"}, + }, + }, + "tags": {"str": "str"}, + }, + ) + ).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_pipeline_groups_list_by_resource_group(self, resource_group): + response = self.client.pipeline_groups.list_by_resource_group( + resource_group_name=resource_group.name, + ) + 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_pipeline_groups_list_by_subscription(self, resource_group): + response = self.client.pipeline_groups.list_by_subscription() + result = [r async 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_predictive_metric_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_predictive_metric_operations.py deleted file mode 100644 index a8f91611e34d..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_predictive_metric_operations.py +++ /dev/null @@ -1,36 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementPredictiveMetricOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_predictive_metric_get(self, resource_group): - response = self.client.predictive_metric.get( - resource_group_name=resource_group.name, - autoscale_setting_name="str", - timespan="str", - interval="1 day, 0:00:00", - metric_namespace="str", - metric_name="str", - aggregation="str", - api_version="2022-10-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_predictive_metric_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_predictive_metric_operations_async.py deleted file mode 100644 index 65ff15ea8093..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_predictive_metric_operations_async.py +++ /dev/null @@ -1,37 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementPredictiveMetricOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_predictive_metric_get(self, resource_group): - response = await self.client.predictive_metric.get( - resource_group_name=resource_group.name, - autoscale_setting_name="str", - timespan="str", - interval="1 day, 0:00:00", - metric_namespace="str", - metric_name="str", - aggregation="str", - api_version="2022-10-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_endpoint_connections_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_endpoint_connections_operations.py deleted file mode 100644 index 4639cff8e8f4..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_endpoint_connections_operations.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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementPrivateEndpointConnectionsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_endpoint_connections_get(self, resource_group): - response = self.client.private_endpoint_connections.get( - resource_group_name=resource_group.name, - scope_name="str", - private_endpoint_connection_name="str", - api_version="2019-10-17-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_endpoint_connections_begin_create_or_update(self, resource_group): - response = self.client.private_endpoint_connections.begin_create_or_update( - resource_group_name=resource_group.name, - scope_name="str", - private_endpoint_connection_name="str", - parameters={ - "id": "str", - "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": {"description": "str", "status": "str", "actionsRequired": "str"}, - "provisioningState": "str", - "type": "str", - }, - api_version="2019-10-17-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_private_endpoint_connections_begin_delete(self, resource_group): - response = self.client.private_endpoint_connections.begin_delete( - resource_group_name=resource_group.name, - scope_name="str", - private_endpoint_connection_name="str", - api_version="2019-10-17-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_private_endpoint_connections_list_by_private_link_scope(self, resource_group): - response = self.client.private_endpoint_connections.list_by_private_link_scope( - resource_group_name=resource_group.name, - scope_name="str", - api_version="2019-10-17-preview", - ) - 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_private_endpoint_connections_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_endpoint_connections_operations_async.py deleted file mode 100644 index 2adbd509ee57..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_endpoint_connections_operations_async.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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementPrivateEndpointConnectionsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_private_endpoint_connections_get(self, resource_group): - response = await self.client.private_endpoint_connections.get( - resource_group_name=resource_group.name, - scope_name="str", - private_endpoint_connection_name="str", - api_version="2019-10-17-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_private_endpoint_connections_begin_create_or_update(self, resource_group): - response = await ( - await self.client.private_endpoint_connections.begin_create_or_update( - resource_group_name=resource_group.name, - scope_name="str", - private_endpoint_connection_name="str", - parameters={ - "id": "str", - "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "description": "str", - "status": "str", - "actionsRequired": "str", - }, - "provisioningState": "str", - "type": "str", - }, - api_version="2019-10-17-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_private_endpoint_connections_begin_delete(self, resource_group): - response = await ( - await self.client.private_endpoint_connections.begin_delete( - resource_group_name=resource_group.name, - scope_name="str", - private_endpoint_connection_name="str", - api_version="2019-10-17-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_private_endpoint_connections_list_by_private_link_scope(self, resource_group): - response = self.client.private_endpoint_connections.list_by_private_link_scope( - resource_group_name=resource_group.name, - scope_name="str", - api_version="2019-10-17-preview", - ) - result = [r async 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_private_link_resources_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_resources_operations.py deleted file mode 100644 index d8c100246ddc..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_resources_operations.py +++ /dev/null @@ -1,44 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementPrivateLinkResourcesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_link_resources_list_by_private_link_scope(self, resource_group): - response = self.client.private_link_resources.list_by_private_link_scope( - resource_group_name=resource_group.name, - scope_name="str", - api_version="2019-10-17-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_link_resources_get(self, resource_group): - response = self.client.private_link_resources.get( - resource_group_name=resource_group.name, - scope_name="str", - group_name="str", - api_version="2019-10-17-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_resources_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_resources_operations_async.py deleted file mode 100644 index 933444f017e3..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_resources_operations_async.py +++ /dev/null @@ -1,45 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementPrivateLinkResourcesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_private_link_resources_list_by_private_link_scope(self, resource_group): - response = self.client.private_link_resources.list_by_private_link_scope( - resource_group_name=resource_group.name, - scope_name="str", - api_version="2019-10-17-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_private_link_resources_get(self, resource_group): - response = await self.client.private_link_resources.get( - resource_group_name=resource_group.name, - scope_name="str", - group_name="str", - api_version="2019-10-17-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_scope_operation_status_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_scope_operation_status_operations.py deleted file mode 100644 index 22c51ec518d5..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_scope_operation_status_operations.py +++ /dev/null @@ -1,31 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementPrivateLinkScopeOperationStatusOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_link_scope_operation_status_get(self, resource_group): - response = self.client.private_link_scope_operation_status.get( - async_operation_id="str", - resource_group_name=resource_group.name, - api_version="2019-10-17-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_scope_operation_status_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_scope_operation_status_operations_async.py deleted file mode 100644 index 95e05e4bbe88..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_scope_operation_status_operations_async.py +++ /dev/null @@ -1,32 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementPrivateLinkScopeOperationStatusOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_private_link_scope_operation_status_get(self, resource_group): - response = await self.client.private_link_scope_operation_status.get( - async_operation_id="str", - resource_group_name=resource_group.name, - api_version="2019-10-17-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_scoped_resources_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_scoped_resources_operations.py deleted file mode 100644 index 714967b1bb1f..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_scoped_resources_operations.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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementPrivateLinkScopedResourcesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_link_scoped_resources_get(self, resource_group): - response = self.client.private_link_scoped_resources.get( - resource_group_name=resource_group.name, - scope_name="str", - name="str", - api_version="2019-10-17-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_link_scoped_resources_begin_create_or_update(self, resource_group): - response = self.client.private_link_scoped_resources.begin_create_or_update( - resource_group_name=resource_group.name, - scope_name="str", - name="str", - parameters={ - "id": "str", - "linkedResourceId": "str", - "name": "str", - "provisioningState": "str", - "type": "str", - }, - api_version="2019-10-17-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_private_link_scoped_resources_begin_delete(self, resource_group): - response = self.client.private_link_scoped_resources.begin_delete( - resource_group_name=resource_group.name, - scope_name="str", - name="str", - api_version="2019-10-17-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_private_link_scoped_resources_list_by_private_link_scope(self, resource_group): - response = self.client.private_link_scoped_resources.list_by_private_link_scope( - resource_group_name=resource_group.name, - scope_name="str", - api_version="2019-10-17-preview", - ) - 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_private_link_scoped_resources_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_scoped_resources_operations_async.py deleted file mode 100644 index b5fdc2ead95c..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_scoped_resources_operations_async.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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementPrivateLinkScopedResourcesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_private_link_scoped_resources_get(self, resource_group): - response = await self.client.private_link_scoped_resources.get( - resource_group_name=resource_group.name, - scope_name="str", - name="str", - api_version="2019-10-17-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_private_link_scoped_resources_begin_create_or_update(self, resource_group): - response = await ( - await self.client.private_link_scoped_resources.begin_create_or_update( - resource_group_name=resource_group.name, - scope_name="str", - name="str", - parameters={ - "id": "str", - "linkedResourceId": "str", - "name": "str", - "provisioningState": "str", - "type": "str", - }, - api_version="2019-10-17-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_private_link_scoped_resources_begin_delete(self, resource_group): - response = await ( - await self.client.private_link_scoped_resources.begin_delete( - resource_group_name=resource_group.name, - scope_name="str", - name="str", - api_version="2019-10-17-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_private_link_scoped_resources_list_by_private_link_scope(self, resource_group): - response = self.client.private_link_scoped_resources.list_by_private_link_scope( - resource_group_name=resource_group.name, - scope_name="str", - api_version="2019-10-17-preview", - ) - result = [r async 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_private_link_scopes_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_scopes_operations.py deleted file mode 100644 index dd8bf4a08a3b..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_scopes_operations.py +++ /dev/null @@ -1,111 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementPrivateLinkScopesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_link_scopes_list(self, resource_group): - response = self.client.private_link_scopes.list( - api_version="2019-10-17-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_link_scopes_list_by_resource_group(self, resource_group): - response = self.client.private_link_scopes.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2019-10-17-preview", - ) - result = [r for r in response] - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_link_scopes_begin_delete(self, resource_group): - response = self.client.private_link_scopes.begin_delete( - resource_group_name=resource_group.name, - scope_name="str", - api_version="2019-10-17-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_private_link_scopes_get(self, resource_group): - response = self.client.private_link_scopes.get( - resource_group_name=resource_group.name, - scope_name="str", - api_version="2019-10-17-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_link_scopes_create_or_update(self, resource_group): - response = self.client.private_link_scopes.create_or_update( - resource_group_name=resource_group.name, - scope_name="str", - azure_monitor_private_link_scope_payload={ - "location": "str", - "id": "str", - "name": "str", - "privateEndpointConnections": [ - { - "id": "str", - "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "description": "str", - "status": "str", - "actionsRequired": "str", - }, - "provisioningState": "str", - "type": "str", - } - ], - "provisioningState": "str", - "tags": {"str": "str"}, - "type": "str", - }, - api_version="2019-10-17-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_private_link_scopes_update_tags(self, resource_group): - response = self.client.private_link_scopes.update_tags( - resource_group_name=resource_group.name, - scope_name="str", - private_link_scope_tags={"tags": {"str": "str"}}, - api_version="2019-10-17-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_scopes_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_scopes_operations_async.py deleted file mode 100644 index 8a8eeea7b041..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_private_link_scopes_operations_async.py +++ /dev/null @@ -1,114 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementPrivateLinkScopesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_private_link_scopes_list(self, resource_group): - response = self.client.private_link_scopes.list( - api_version="2019-10-17-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_private_link_scopes_list_by_resource_group(self, resource_group): - response = self.client.private_link_scopes.list_by_resource_group( - resource_group_name=resource_group.name, - api_version="2019-10-17-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_private_link_scopes_begin_delete(self, resource_group): - response = await ( - await self.client.private_link_scopes.begin_delete( - resource_group_name=resource_group.name, - scope_name="str", - api_version="2019-10-17-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_private_link_scopes_get(self, resource_group): - response = await self.client.private_link_scopes.get( - resource_group_name=resource_group.name, - scope_name="str", - api_version="2019-10-17-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_private_link_scopes_create_or_update(self, resource_group): - response = await self.client.private_link_scopes.create_or_update( - resource_group_name=resource_group.name, - scope_name="str", - azure_monitor_private_link_scope_payload={ - "location": "str", - "id": "str", - "name": "str", - "privateEndpointConnections": [ - { - "id": "str", - "name": "str", - "privateEndpoint": {"id": "str"}, - "privateLinkServiceConnectionState": { - "description": "str", - "status": "str", - "actionsRequired": "str", - }, - "provisioningState": "str", - "type": "str", - } - ], - "provisioningState": "str", - "tags": {"str": "str"}, - "type": "str", - }, - api_version="2019-10-17-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_private_link_scopes_update_tags(self, resource_group): - response = await self.client.private_link_scopes.update_tags( - resource_group_name=resource_group.name, - scope_name="str", - private_link_scope_tags={"tags": {"str": "str"}}, - api_version="2019-10-17-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 deleted file mode 100644 index 6ed67b5b0870..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_scheduled_query_rules_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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementScheduledQueryRulesOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_scheduled_query_rules_create_or_update(self, resource_group): - response = self.client.scheduled_query_rules.create_or_update( - 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, - "createdWithApiVersion": "str", - "description": "str", - "displayName": "str", - "enabled": "str", - "etag": "str", - "id": "str", - "isLegacyLogAnalyticsRule": bool, - "kind": "str", - "lastUpdatedTime": "2020-02-20 00:00:00", - "name": "str", - "provisioningState": "str", - "schedule": {"frequencyInMinutes": 0, "timeWindowInMinutes": 0}, - "tags": {"str": "str"}, - "type": "str", - }, - 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", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - 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", - ) - - # 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 deleted file mode 100644 index 99684931e260..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_scheduled_query_rules_operations_async.py +++ /dev/null @@ -1,110 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementScheduledQueryRulesOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_scheduled_query_rules_create_or_update(self, resource_group): - response = await self.client.scheduled_query_rules.create_or_update( - 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, - "createdWithApiVersion": "str", - "description": "str", - "displayName": "str", - "enabled": "str", - "etag": "str", - "id": "str", - "isLegacyLogAnalyticsRule": bool, - "kind": "str", - "lastUpdatedTime": "2020-02-20 00:00:00", - "name": "str", - "provisioningState": "str", - "schedule": {"frequencyInMinutes": 0, "timeWindowInMinutes": 0}, - "tags": {"str": "str"}, - "type": "str", - }, - 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", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - 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", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - 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", - ) - - # 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/generated_tests/test_monitor_management_service_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_service_diagnostic_settings_operations.py deleted file mode 100644 index bf56fdc05982..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_service_diagnostic_settings_operations.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. -# -------------------------------------------------------------------------- -import pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementServiceDiagnosticSettingsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_service_diagnostic_settings_get(self, resource_group): - response = self.client.service_diagnostic_settings.get( - resource_uri="str", - api_version="2016-09-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_service_diagnostic_settings_create_or_update(self, resource_group): - response = self.client.service_diagnostic_settings.create_or_update( - resource_uri="str", - parameters={ - "location": "str", - "eventHubAuthorizationRuleId": "str", - "id": "str", - "logs": [{"enabled": bool, "category": "str", "retentionPolicy": {"days": 0, "enabled": bool}}], - "metrics": [ - {"enabled": bool, "timeGrain": "1 day, 0:00:00", "retentionPolicy": {"days": 0, "enabled": bool}} - ], - "name": "str", - "serviceBusRuleId": "str", - "storageAccountId": "str", - "tags": {"str": "str"}, - "type": "str", - "workspaceId": "str", - }, - api_version="2016-09-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_service_diagnostic_settings_update(self, resource_group): - response = self.client.service_diagnostic_settings.update( - resource_uri="str", - service_diagnostic_settings_resource={ - "eventHubAuthorizationRuleId": "str", - "logs": [{"enabled": bool, "category": "str", "retentionPolicy": {"days": 0, "enabled": bool}}], - "metrics": [ - {"enabled": bool, "timeGrain": "1 day, 0:00:00", "retentionPolicy": {"days": 0, "enabled": bool}} - ], - "serviceBusRuleId": "str", - "storageAccountId": "str", - "tags": {"str": "str"}, - "workspaceId": "str", - }, - api_version="2016-09-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_service_diagnostic_settings_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_service_diagnostic_settings_operations_async.py deleted file mode 100644 index 14099512d600..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_service_diagnostic_settings_operations_async.py +++ /dev/null @@ -1,79 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementServiceDiagnosticSettingsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_service_diagnostic_settings_get(self, resource_group): - response = await self.client.service_diagnostic_settings.get( - resource_uri="str", - api_version="2016-09-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_service_diagnostic_settings_create_or_update(self, resource_group): - response = await self.client.service_diagnostic_settings.create_or_update( - resource_uri="str", - parameters={ - "location": "str", - "eventHubAuthorizationRuleId": "str", - "id": "str", - "logs": [{"enabled": bool, "category": "str", "retentionPolicy": {"days": 0, "enabled": bool}}], - "metrics": [ - {"enabled": bool, "timeGrain": "1 day, 0:00:00", "retentionPolicy": {"days": 0, "enabled": bool}} - ], - "name": "str", - "serviceBusRuleId": "str", - "storageAccountId": "str", - "tags": {"str": "str"}, - "type": "str", - "workspaceId": "str", - }, - api_version="2016-09-01", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_service_diagnostic_settings_update(self, resource_group): - response = await self.client.service_diagnostic_settings.update( - resource_uri="str", - service_diagnostic_settings_resource={ - "eventHubAuthorizationRuleId": "str", - "logs": [{"enabled": bool, "category": "str", "retentionPolicy": {"days": 0, "enabled": bool}}], - "metrics": [ - {"enabled": bool, "timeGrain": "1 day, 0:00:00", "retentionPolicy": {"days": 0, "enabled": bool}} - ], - "serviceBusRuleId": "str", - "storageAccountId": "str", - "tags": {"str": "str"}, - "workspaceId": "str", - }, - api_version="2016-09-01", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_subscription_diagnostic_settings_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_subscription_diagnostic_settings_operations.py deleted file mode 100644 index 3e5d4ecde7d0..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_subscription_diagnostic_settings_operations.py +++ /dev/null @@ -1,74 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementSubscriptionDiagnosticSettingsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_subscription_diagnostic_settings_get(self, resource_group): - response = self.client.subscription_diagnostic_settings.get( - name="str", - api_version="2017-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_subscription_diagnostic_settings_create_or_update(self, resource_group): - response = self.client.subscription_diagnostic_settings.create_or_update( - name="str", - parameters={ - "eventHubAuthorizationRuleId": "str", - "eventHubName": "str", - "id": "str", - "location": "str", - "logs": [{"enabled": bool, "category": "str"}], - "name": "str", - "serviceBusRuleId": "str", - "storageAccountId": "str", - "type": "str", - "workspaceId": "str", - }, - api_version="2017-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_subscription_diagnostic_settings_delete(self, resource_group): - response = self.client.subscription_diagnostic_settings.delete( - name="str", - api_version="2017-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_subscription_diagnostic_settings_list(self, resource_group): - response = self.client.subscription_diagnostic_settings.list( - api_version="2017-05-01-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_subscription_diagnostic_settings_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_subscription_diagnostic_settings_operations_async.py deleted file mode 100644 index 1fad324037c0..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_subscription_diagnostic_settings_operations_async.py +++ /dev/null @@ -1,75 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementSubscriptionDiagnosticSettingsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_subscription_diagnostic_settings_get(self, resource_group): - response = await self.client.subscription_diagnostic_settings.get( - name="str", - api_version="2017-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_subscription_diagnostic_settings_create_or_update(self, resource_group): - response = await self.client.subscription_diagnostic_settings.create_or_update( - name="str", - parameters={ - "eventHubAuthorizationRuleId": "str", - "eventHubName": "str", - "id": "str", - "location": "str", - "logs": [{"enabled": bool, "category": "str"}], - "name": "str", - "serviceBusRuleId": "str", - "storageAccountId": "str", - "type": "str", - "workspaceId": "str", - }, - api_version="2017-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_subscription_diagnostic_settings_delete(self, resource_group): - response = await self.client.subscription_diagnostic_settings.delete( - name="str", - api_version="2017-05-01-preview", - ) - - # please add some check logic here by yourself - # ... - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_subscription_diagnostic_settings_list(self, resource_group): - response = await self.client.subscription_diagnostic_settings.list( - api_version="2017-05-01-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_tenant_activity_logs_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_tenant_activity_logs_operations.py deleted file mode 100644 index 4d66f76cda26..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_tenant_activity_logs_operations.py +++ /dev/null @@ -1,29 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementTenantActivityLogsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_tenant_activity_logs_list(self, resource_group): - response = self.client.tenant_activity_logs.list( - api_version="2015-04-01", - ) - 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_tenant_activity_logs_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_tenant_activity_logs_operations_async.py deleted file mode 100644 index e9910738a488..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_tenant_activity_logs_operations_async.py +++ /dev/null @@ -1,30 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementTenantActivityLogsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_tenant_activity_logs_list(self, resource_group): - response = self.client.tenant_activity_logs.list( - api_version="2015-04-01", - ) - result = [r async 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_vm_insights_operations.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_vm_insights_operations.py deleted file mode 100644 index ccad80f86711..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_vm_insights_operations.py +++ /dev/null @@ -1,30 +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 pytest -from azure.mgmt.monitor import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer, recorded_by_proxy - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementVMInsightsOperations(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy - def test_vm_insights_get_onboarding_status(self, resource_group): - response = self.client.vm_insights.get_onboarding_status( - resource_uri="str", - api_version="2018-11-27-preview", - ) - - # please add some check logic here by yourself - # ... diff --git a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_vm_insights_operations_async.py b/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_vm_insights_operations_async.py deleted file mode 100644 index a421dcb95cfd..000000000000 --- a/sdk/monitor/azure-mgmt-monitor/generated_tests/test_monitor_management_vm_insights_operations_async.py +++ /dev/null @@ -1,31 +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 pytest -from azure.mgmt.monitor.aio import MonitorManagementClient - -from devtools_testutils import AzureMgmtRecordedTestCase, RandomNameResourceGroupPreparer -from devtools_testutils.aio import recorded_by_proxy_async - -AZURE_LOCATION = "eastus" - - -@pytest.mark.skip("you may need to update the auto-generated test case before run it") -class TestMonitorManagementVMInsightsOperationsAsync(AzureMgmtRecordedTestCase): - def setup_method(self, method): - self.client = self.create_mgmt_client(MonitorManagementClient, is_async=True) - - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) - @recorded_by_proxy_async - async def test_vm_insights_get_onboarding_status(self, resource_group): - response = await self.client.vm_insights.get_onboarding_status( - resource_uri="str", - api_version="2018-11-27-preview", - ) - - # 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", ) diff --git a/sdk/monitor/azure-mgmt-monitor/tests/disable_test_cli_mgmt_monitor.py b/sdk/monitor/azure-mgmt-monitor/tests/disable_test_cli_mgmt_monitor.py index 030ca9b7504d..2bef7ba6c824 100644 --- a/sdk/monitor/azure-mgmt-monitor/tests/disable_test_cli_mgmt_monitor.py +++ b/sdk/monitor/azure-mgmt-monitor/tests/disable_test_cli_mgmt_monitor.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression,too-many-lines # coding: utf-8 # ------------------------------------------------------------------------- diff --git a/sdk/monitor/azure-mgmt-monitor/tests/disable_test_cli_mgmt_monitor_async.py b/sdk/monitor/azure-mgmt-monitor/tests/disable_test_cli_mgmt_monitor_async.py index 03e4c26fabf5..2ecddd644534 100644 --- a/sdk/monitor/azure-mgmt-monitor/tests/disable_test_cli_mgmt_monitor_async.py +++ b/sdk/monitor/azure-mgmt-monitor/tests/disable_test_cli_mgmt_monitor_async.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding: utf-8 # ------------------------------------------------------------------------- diff --git a/sdk/monitor/azure-mgmt-monitor/tests/test_mgmt_monitor_test.py b/sdk/monitor/azure-mgmt-monitor/tests/test_mgmt_monitor_test.py index c870b6358551..5839ab194781 100644 --- a/sdk/monitor/azure-mgmt-monitor/tests/test_mgmt_monitor_test.py +++ b/sdk/monitor/azure-mgmt-monitor/tests/test_mgmt_monitor_test.py @@ -1,3 +1,4 @@ +# pylint: disable=line-too-long,useless-suppression # coding: utf-8 # ------------------------------------------------------------------------- @@ -14,6 +15,7 @@ AZURE_LOCATION = "eastus" + @pytest.mark.live_test_only class TestMgmtMonitor(AzureMgmtRecordedTestCase): diff --git a/sdk/monitor/azure-mgmt-monitor/tsp-location.yaml b/sdk/monitor/azure-mgmt-monitor/tsp-location.yaml new file mode 100644 index 000000000000..2ea7d5ff7162 --- /dev/null +++ b/sdk/monitor/azure-mgmt-monitor/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/monitor/Microsoft.Monitor.Management +commit: 079f70d6f2b754db6b736e117196104efd2dd496 +repo: Azure/azure-rest-api-specs +additionalDirectories: