From 3cc467ff1dd821a42856a4902f43d0ef2870828b Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 9 Feb 2023 04:30:34 +0000 Subject: [PATCH] CodeGen from PR 22328 in Azure/azure-rest-api-specs Update all variations of "MonitoringAccount" to "AzureMonitorWorkspaces" (#22328) --- eng/versioning/version_client.txt | 1 + .../CHANGELOG.md | 5 + .../README.md | 105 + .../SAMPLE.md | 5149 +++++++++++++++++ .../pom.xml | 55 + .../monitor/generated/MonitorManager.java | 771 +++ .../generated/fluent/ActionGroupsClient.java | 481 ++ .../fluent/ActivityLogAlertsClient.java | 191 + .../generated/fluent/ActivityLogsClient.java | 68 + .../fluent/AlertRuleIncidentsClient.java | 72 + .../generated/fluent/AlertRulesClient.java | 177 + .../fluent/AutoscaleSettingsClient.java | 185 + .../fluent/AzureMonitorWorkspacesClient.java | 185 + .../generated/fluent/BaselinesClient.java | 70 + .../fluent/DataCollectionEndpointsClient.java | 178 + .../DataCollectionRuleAssociationsClient.java | 185 + .../fluent/DataCollectionRulesClient.java | 175 + .../DiagnosticSettingsCategoriesClient.java | 69 + .../DiagnosticSettingsOperationsClient.java | 126 + .../fluent/EventCategoriesClient.java | 42 + .../generated/fluent/LogProfilesClient.java | 143 + .../generated/fluent/MetricAlertsClient.java | 178 + .../fluent/MetricAlertsStatusClient.java | 72 + .../fluent/MetricDefinitionsClient.java | 40 + .../fluent/MetricNamespacesClient.java | 40 + .../fluent/MetricsOperationsClient.java | 74 + .../generated/fluent/MonitorClient.java | 256 + .../fluent/MonitorOperationsClient.java | 38 + .../generated/fluent/OperationsClient.java | 36 + .../fluent/PredictiveMetricsClient.java | 71 + .../PrivateEndpointConnectionsClient.java | 214 + .../fluent/PrivateLinkResourcesClient.java | 75 + ...PrivateLinkScopeOperationStatusClient.java | 43 + .../PrivateLinkScopedResourcesClient.java | 200 + .../fluent/PrivateLinkScopesClient.java | 220 + .../fluent/ScheduledQueryRulesClient.java | 183 + .../fluent/TenantActivityLogsClient.java | 68 + .../generated/fluent/VMInsightsClient.java | 41 + .../generated/fluent/models/ActionGroup.java | 423 ++ .../fluent/models/ActionGroupPatch.java | 53 + .../models/ActionGroupResourceInner.java | 376 ++ .../models/ActivityLogAlertResourceInner.java | 182 + .../generated/fluent/models/AlertRule.java | 250 + .../models/AlertRulePatchProperties.java | 53 + .../fluent/models/AlertRuleProperties.java | 187 + .../fluent/models/AlertRuleResourceInner.java | 244 + .../fluent/models/AutoscaleSetting.java | 235 + .../models/AutoscaleSettingResourceInner.java | 256 + .../AzureMonitorPrivateLinkScopeInner.java | 127 + ...zureMonitorPrivateLinkScopeProperties.java | 101 + .../AzureMonitorWorkspaceResourceInner.java | 129 + ...ureMonitorWorkspaceResourceProperties.java | 26 + .../DataCollectionEndpointResourceInner.java | 247 + ...aCollectionEndpointResourceProperties.java | 66 + ...RuleAssociationProxyOnlyResourceInner.java | 166 + ...ssociationProxyOnlyResourceProperties.java | 49 + .../DataCollectionRuleResourceInner.java | 292 + .../DataCollectionRuleResourceProperties.java | 75 + .../fluent/models/DiagnosticSettings.java | 289 + .../models/DiagnosticSettingsCategory.java | 78 + ...agnosticSettingsCategoryResourceInner.java | 107 + .../DiagnosticSettingsResourceInner.java | 287 + .../fluent/models/EventDataInner.java | 446 ++ .../fluent/models/IncidentInner.java | 101 + .../fluent/models/LocalizableStringInner.java | 84 + .../fluent/models/LogProfileProperties.java | 191 + .../models/LogProfileResourceInner.java | 193 + .../fluent/models/MetadataValueInner.java | 79 + .../fluent/models/MetricAlertProperties.java | 390 ++ .../models/MetricAlertPropertiesPatch.java | 366 ++ .../models/MetricAlertResourceInner.java | 354 ++ .../MetricAlertStatusCollectionInner.java | 55 + .../models/MetricBaselinesProperties.java | 164 + .../fluent/models/MetricDefinitionInner.java | 378 ++ .../generated/fluent/models/MetricInner.java | 266 + .../fluent/models/MetricNamespaceInner.java | 159 + .../models/OperationAutoGeneratedInner.java | 127 + .../models/OperationListResultInner.java | 84 + .../fluent/models/OperationStatusInner.java | 182 + .../models/PredictiveResponseInner.java | 170 + .../PrivateEndpointConnectionInner.java | 104 + ...vateEndpointConnectionListResultInner.java | 54 + .../PrivateEndpointConnectionProperties.java | 112 + .../models/PrivateLinkResourceInner.java | 85 + .../PrivateLinkResourceListResultInner.java | 54 + .../models/PrivateLinkResourceProperties.java | 81 + .../fluent/models/ResponseInner.java | 207 + .../models/ScheduledQueryRuleProperties.java | 572 ++ .../ScheduledQueryRuleResourceInner.java | 618 ++ .../fluent/models/ScopedResourceInner.java | 91 + .../models/ScopedResourceProperties.java | 65 + .../models/SingleMetricBaselineInner.java | 246 + .../TestNotificationDetailsResponseInner.java | 172 + .../VMInsightsOnboardingStatusInner.java | 147 + .../VMInsightsOnboardingStatusProperties.java | 166 + .../models/WorkspaceInfoProperties.java | 59 + .../generated/fluent/models/package-info.java | 6 + .../generated/fluent/package-info.java | 6 + .../ActionGroupResourceImpl.java | 399 ++ .../ActionGroupsClientImpl.java | 2592 +++++++++ .../implementation/ActionGroupsImpl.java | 343 ++ .../ActivityLogAlertResourceImpl.java | 240 + .../ActivityLogAlertsClientImpl.java | 1282 ++++ .../implementation/ActivityLogAlertsImpl.java | 182 + .../ActivityLogsClientImpl.java | 441 ++ .../implementation/ActivityLogsImpl.java | 45 + .../AlertRuleIncidentsClientImpl.java | 417 ++ .../AlertRuleIncidentsImpl.java | 72 + .../implementation/AlertRuleResourceImpl.java | 290 + .../implementation/AlertRulesClientImpl.java | 1038 ++++ .../implementation/AlertRulesImpl.java | 171 + .../AutoscaleSettingResourceImpl.java | 300 + .../AutoscaleSettingsClientImpl.java | 1266 ++++ .../implementation/AutoscaleSettingsImpl.java | 182 + .../AzureMonitorPrivateLinkScopeImpl.java | 220 + .../AzureMonitorWorkspaceResourceImpl.java | 213 + .../AzureMonitorWorkspacesClientImpl.java | 1295 +++++ .../AzureMonitorWorkspacesImpl.java | 177 + .../implementation/BaselinesClientImpl.java | 458 ++ .../implementation/BaselinesImpl.java | 70 + .../DataCollectionEndpointResourceImpl.java | 256 + .../DataCollectionEndpointsClientImpl.java | 1264 ++++ .../DataCollectionEndpointsImpl.java | 190 + ...nRuleAssociationProxyOnlyResourceImpl.java | 147 + ...aCollectionRuleAssociationsClientImpl.java | 1289 +++++ .../DataCollectionRuleAssociationsImpl.java | 251 + .../DataCollectionRuleResourceImpl.java | 283 + .../DataCollectionRulesClientImpl.java | 1251 ++++ .../DataCollectionRulesImpl.java | 182 + ...iagnosticSettingsCategoriesClientImpl.java | 326 ++ .../DiagnosticSettingsCategoriesImpl.java | 72 + ...iagnosticSettingsCategoryResourceImpl.java | 62 + ...iagnosticSettingsOperationsClientImpl.java | 594 ++ .../DiagnosticSettingsOperationsImpl.java | 187 + .../DiagnosticSettingsResourceImpl.java | 233 + .../EventCategoriesClientImpl.java | 192 + .../implementation/EventCategoriesImpl.java | 45 + .../implementation/EventDataImpl.java | 177 + .../implementation/IncidentImpl.java | 48 + .../implementation/LocalizableStringImpl.java | 36 + .../LogProfileResourceImpl.java | 242 + .../implementation/LogProfilesClientImpl.java | 783 +++ .../implementation/LogProfilesImpl.java | 125 + .../implementation/MetadataValueImpl.java | 43 + .../MetricAlertResourceImpl.java | 357 ++ .../MetricAlertStatusCollectionImpl.java | 41 + .../MetricAlertsClientImpl.java | 1036 ++++ .../implementation/MetricAlertsImpl.java | 171 + .../MetricAlertsStatusClientImpl.java | 390 ++ .../MetricAlertsStatusImpl.java | 86 + .../implementation/MetricDefinitionImpl.java | 114 + .../MetricDefinitionsClientImpl.java | 218 + .../implementation/MetricDefinitionsImpl.java | 46 + .../generated/implementation/MetricImpl.java | 75 + .../implementation/MetricNamespaceImpl.java | 50 + .../MetricNamespacesClientImpl.java | 217 + .../implementation/MetricNamespacesImpl.java | 45 + .../MetricsOperationsClientImpl.java | 356 ++ .../implementation/MetricsOperationsImpl.java | 86 + .../implementation/MonitorClientBuilder.java | 144 + .../implementation/MonitorClientImpl.java | 697 +++ .../MonitorOperationsClientImpl.java | 277 + .../implementation/MonitorOperationsImpl.java | 46 + .../OperationAutoGeneratedImpl.java | 52 + .../OperationListResultImpl.java | 45 + .../implementation/OperationStatusImpl.java | 54 + .../implementation/OperationsClientImpl.java | 148 + .../implementation/OperationsImpl.java | 58 + .../PredictiveMetricsClientImpl.java | 353 ++ .../implementation/PredictiveMetricsImpl.java | 96 + .../PredictiveResponseImpl.java | 58 + .../PrivateEndpointConnectionImpl.java | 159 + ...ivateEndpointConnectionListResultImpl.java | 48 + .../PrivateEndpointConnectionsClientImpl.java | 1048 ++++ .../PrivateEndpointConnectionsImpl.java | 229 + .../PrivateLinkResourceImpl.java | 65 + .../PrivateLinkResourceListResultImpl.java | 48 + .../PrivateLinkResourcesClientImpl.java | 397 ++ .../PrivateLinkResourcesImpl.java | 88 + ...ateLinkScopeOperationStatusClientImpl.java | 223 + .../PrivateLinkScopeOperationStatusImpl.java | 61 + .../PrivateLinkScopedResourcesClientImpl.java | 1103 ++++ .../PrivateLinkScopedResourcesImpl.java | 203 + .../PrivateLinkScopesClientImpl.java | 1381 +++++ .../implementation/PrivateLinkScopesImpl.java | 180 + .../implementation/ResponseModelImpl.java | 65 + .../ScheduledQueryRuleResourceImpl.java | 484 ++ .../ScheduledQueryRulesClientImpl.java | 1245 ++++ .../ScheduledQueryRulesImpl.java | 181 + .../implementation/ScopedResourceImpl.java | 144 + .../SingleMetricBaselineImpl.java | 66 + .../TenantActivityLogsClientImpl.java | 430 ++ .../TenantActivityLogsImpl.java | 46 + .../TestNotificationDetailsResponseImpl.java | 58 + .../generated/implementation/Utils.java | 204 + .../implementation/VMInsightsClientImpl.java | 173 + .../implementation/VMInsightsImpl.java | 59 + .../VMInsightsOnboardingStatusImpl.java | 67 + .../implementation/package-info.java | 6 + .../monitor/generated/models/AccessMode.java | 47 + .../generated/models/AccessModeSettings.java | 135 + .../models/AccessModeSettingsExclusion.java | 112 + .../generated/models/ActionDetail.java | 180 + .../generated/models/ActionGroupList.java | 81 + .../models/ActionGroupPatchBody.java | 97 + .../generated/models/ActionGroupResource.java | 513 ++ .../generated/models/ActionGroups.java | 345 ++ .../monitor/generated/models/ActionList.java | 54 + .../monitor/generated/models/ActionType.java | 44 + .../monitor/generated/models/Actions.java | 80 + .../models/ActivityLogAlertActionGroup.java | 91 + .../ActivityLogAlertAllOfCondition.java | 62 + .../models/ActivityLogAlertLeafCondition.java | 90 + .../models/ActivityLogAlertResource.java | 312 + .../generated/models/ActivityLogAlerts.java | 163 + .../generated/models/ActivityLogs.java | 63 + .../generated/models/AggregationType.java | 63 + .../generated/models/AggregationTypeEnum.java | 56 + .../generated/models/AlertRuleIncidents.java | 64 + .../models/AlertRuleLeafCondition.java | 121 + .../generated/models/AlertRuleList.java | 81 + .../models/AlertRulePatchObject.java | 97 + .../generated/models/AlertRuleResource.java | 425 ++ .../models/AlertRuleResourceCollection.java | 55 + .../models/AlertRuleResourcePatch.java | 248 + .../monitor/generated/models/AlertRules.java | 158 + .../generated/models/AlertSeverity.java | 59 + .../generated/models/ArmRoleReceiver.java | 117 + .../models/AutomationRunbookReceiver.java | 229 + .../models/AutoscaleNotification.java | 110 + .../generated/models/AutoscaleProfile.java | 190 + .../models/AutoscaleSettingResource.java | 431 ++ .../AutoscaleSettingResourceCollection.java | 89 + .../models/AutoscaleSettingResourcePatch.java | 243 + .../generated/models/AutoscaleSettings.java | 159 + .../models/AzureAppPushReceiver.java | 93 + .../models/AzureFunctionReceiver.java | 182 + .../AzureMonitorMetricsDestination.java | 53 + .../models/AzureMonitorPrivateLinkScope.java | 243 + ...zureMonitorPrivateLinkScopeListResult.java | 92 + .../models/AzureMonitorWorkspace.java | 91 + ...itorWorkspaceDefaultIngestionSettings.java | 25 + .../models/AzureMonitorWorkspaceMetrics.java | 25 + .../models/AzureMonitorWorkspaceResource.java | 244 + ...zureMonitorWorkspaceResourceForUpdate.java | 53 + ...ureMonitorWorkspaceResourceListResult.java | 89 + .../models/AzureMonitorWorkspaces.java | 159 + .../generated/models/BaselineMetadata.java | 89 + .../generated/models/BaselineSensitivity.java | 50 + .../monitor/generated/models/Baselines.java | 64 + .../generated/models/CategoryType.java | 51 + .../generated/models/ColumnDefinition.java | 76 + .../models/ComparisonOperationType.java | 63 + .../monitor/generated/models/Condition.java | 278 + .../models/ConditionFailingPeriods.java | 87 + .../generated/models/ConditionOperator.java | 60 + .../ConfigurationAccessEndpointSpec.java | 39 + .../monitor/generated/models/Context.java | 76 + .../generated/models/CriterionType.java | 47 + .../models/DataCollectionEndpoint.java | 181 + ...CollectionEndpointConfigurationAccess.java | 25 + .../DataCollectionEndpointLogsIngestion.java | 25 + .../DataCollectionEndpointNetworkAcls.java | 33 + .../DataCollectionEndpointResource.java | 334 ++ ...aCollectionEndpointResourceListResult.java | 89 + .../models/DataCollectionEndpoints.java | 159 + .../generated/models/DataCollectionRule.java | 257 + .../models/DataCollectionRuleAssociation.java | 137 + ...DataCollectionRuleAssociationMetadata.java | 25 + ...ctionRuleAssociationProxyOnlyResource.java | 193 + ...ssociationProxyOnlyResourceListResult.java | 92 + .../DataCollectionRuleAssociations.java | 192 + .../models/DataCollectionRuleDataSources.java | 71 + .../DataCollectionRuleDestinations.java | 41 + .../models/DataCollectionRuleMetadata.java | 25 + .../models/DataCollectionRuleResource.java | 369 ++ .../DataCollectionRuleResourceListResult.java | 89 + .../generated/models/DataCollectionRules.java | 159 + .../generated/models/DataContainer.java | 60 + .../monitor/generated/models/DataFlow.java | 131 + .../generated/models/DataSourcesSpec.java | 199 + .../monitor/generated/models/DataStatus.java | 50 + .../generated/models/DestinationsSpec.java | 83 + .../DestinationsSpecAzureMonitorMetrics.java | 32 + .../models/DiagnosticSettingsCategories.java | 62 + .../DiagnosticSettingsCategoryResource.java | 62 + ...ticSettingsCategoryResourceCollection.java | 55 + .../models/DiagnosticSettingsOperations.java | 139 + .../models/DiagnosticSettingsResource.java | 437 ++ .../DiagnosticSettingsResourceCollection.java | 55 + .../monitor/generated/models/Dimension.java | 120 + .../generated/models/DimensionOperator.java | 47 + .../models/DynamicMetricCriteria.java | 208 + .../DynamicThresholdFailingPeriods.java | 81 + .../models/DynamicThresholdOperator.java | 50 + .../models/DynamicThresholdSensitivity.java | 53 + .../generated/models/EmailNotification.java | 109 + .../generated/models/EmailReceiver.java | 132 + .../generated/models/EnableRequest.java | 58 + .../generated/models/EventCategories.java | 37 + .../models/EventCategoryCollection.java | 65 + .../monitor/generated/models/EventData.java | 203 + .../generated/models/EventDataCollection.java | 88 + .../generated/models/EventHubReceiver.java | 206 + .../monitor/generated/models/EventLevel.java | 60 + .../generated/models/ExtensionDataSource.java | 174 + .../generated/models/HttpRequestInfo.java | 128 + .../monitor/generated/models/Identity.java | 132 + .../generated/models/IdentityType.java | 54 + .../generated/models/IisLogsDataSource.java | 114 + .../monitor/generated/models/Incident.java | 54 + .../generated/models/IncidentListResult.java | 55 + .../generated/models/IngestionSettings.java | 56 + .../generated/models/ItsmReceiver.java | 193 + .../monitor/generated/models/Kind.java | 47 + .../models/KnownColumnDefinitionType.java | 62 + ...taCollectionEndpointProvisioningState.java | 57 + ...ownDataCollectionEndpointResourceKind.java | 48 + ...ctionRuleAssociationProvisioningState.java | 57 + ...wnDataCollectionRuleProvisioningState.java | 57 + .../KnownDataCollectionRuleResourceKind.java | 48 + .../models/KnownDataFlowStreams.java | 56 + .../KnownExtensionDataSourceStreams.java | 57 + ...extSettingsRecordStartTimestampFormat.java | 77 + .../models/KnownLogFilesDataSourceFormat.java | 44 + .../KnownPerfCounterDataSourceStreams.java | 48 + .../KnownPublicNetworkAccessOptions.java | 47 + .../KnownSyslogDataSourceFacilityNames.java | 104 + .../KnownSyslogDataSourceLogLevels.java | 68 + .../models/KnownSyslogDataSourceStreams.java | 44 + ...KnownWindowsEventLogDataSourceStreams.java | 49 + .../generated/models/LocalizableString.java | 31 + .../LocationThresholdRuleCondition.java | 93 + .../models/LogAnalyticsDestination.java | 94 + .../generated/models/LogFileSettings.java | 53 + .../generated/models/LogFileSettingsText.java | 33 + .../generated/models/LogFileTextSettings.java | 60 + .../generated/models/LogFilesDataSource.java | 182 + .../models/LogFilesDataSourceSettings.java | 32 + .../models/LogProfileCollection.java | 62 + .../generated/models/LogProfileResource.java | 354 ++ .../models/LogProfileResourcePatch.java | 198 + .../monitor/generated/models/LogProfiles.java | 130 + .../monitor/generated/models/LogSettings.java | 139 + .../generated/models/LogicAppReceiver.java | 148 + .../models/LogsIngestionEndpointSpec.java | 39 + .../ManagementEventAggregationCondition.java | 106 + .../models/ManagementEventRuleCondition.java | 72 + .../monitor/generated/models/Metadata.java | 39 + .../generated/models/MetadataValue.java | 31 + .../monitor/generated/models/Metric.java | 74 + .../generated/models/MetricAlertAction.java | 82 + .../generated/models/MetricAlertCriteria.java | 82 + ...ultipleResourceMultipleMetricCriteria.java | 60 + .../generated/models/MetricAlertResource.java | 572 ++ .../models/MetricAlertResourceCollection.java | 55 + .../models/MetricAlertResourcePatch.java | 358 ++ ...tSingleResourceMultipleMetricCriteria.java | 60 + .../generated/models/MetricAlertStatus.java | 131 + .../models/MetricAlertStatusCollection.java | 25 + .../models/MetricAlertStatusProperties.java | 106 + .../generated/models/MetricAlerts.java | 158 + .../generated/models/MetricAlertsStatus.java | 64 + .../generated/models/MetricAvailability.java | 84 + .../models/MetricBaselinesResponse.java | 55 + .../monitor/generated/models/MetricClass.java | 56 + .../generated/models/MetricCriteria.java | 133 + .../generated/models/MetricDefinition.java | 110 + .../models/MetricDefinitionCollection.java | 63 + .../generated/models/MetricDefinitions.java | 35 + .../generated/models/MetricDimension.java | 121 + .../generated/models/MetricNamespace.java | 52 + .../models/MetricNamespaceCollection.java | 62 + .../generated/models/MetricNamespaceName.java | 50 + .../generated/models/MetricNamespaces.java | 35 + .../generated/models/MetricSettings.java | 137 + .../models/MetricSingleDimension.java | 89 + .../generated/models/MetricStatisticType.java | 60 + .../generated/models/MetricTrigger.java | 396 ++ .../monitor/generated/models/MetricUnit.java | 80 + .../monitor/generated/models/MetricValue.java | 192 + .../monitor/generated/models/Metrics.java | 54 + .../generated/models/MetricsOperations.java | 68 + .../generated/models/MonitorOperations.java | 33 + .../generated/models/MultiMetricCriteria.java | 258 + .../models/NamespaceClassification.java | 50 + .../generated/models/NetworkRuleSet.java | 52 + .../models/NotificationRequestBody.java | 393 ++ .../monitor/generated/models/Odatatype.java | 53 + .../generated/models/OnboardingStatus.java | 53 + .../monitor/generated/models/Operation.java | 79 + .../models/OperationAutoGenerated.java | 56 + .../generated/models/OperationDisplay.java | 102 + .../models/OperationDisplayAutoGenerated.java | 91 + .../generated/models/OperationListResult.java | 32 + .../OperationListResultAutoGenerated.java | 62 + .../generated/models/OperationStatus.java | 61 + .../monitor/generated/models/Operations.java | 31 + .../monitor/generated/models/Operator.java | 56 + .../monitor/generated/models/Origin.java | 53 + .../models/PerfCounterDataSource.java | 147 + .../models/PredictiveAutoscalePolicy.java | 89 + .../PredictiveAutoscalePolicyScaleMode.java | 54 + .../generated/models/PredictiveMetrics.java | 66 + .../generated/models/PredictiveResponse.java | 58 + .../generated/models/PredictiveValue.java | 85 + .../generated/models/PrivateEndpoint.java | 39 + .../models/PrivateEndpointConnection.java | 200 + .../PrivateEndpointConnectionListResult.java | 26 + ...teEndpointConnectionProvisioningState.java | 54 + .../models/PrivateEndpointConnections.java | 142 + ...rivateEndpointServiceConnectionStatus.java | 51 + .../generated/models/PrivateLinkResource.java | 60 + .../models/PrivateLinkResourceListResult.java | 26 + .../models/PrivateLinkResources.java | 67 + .../PrivateLinkScopeOperationStatus.java | 38 + .../models/PrivateLinkScopedResources.java | 143 + .../generated/models/PrivateLinkScopes.java | 160 + .../PrivateLinkServiceConnectionState.java | 106 + .../generated/models/ProvisioningState.java | 56 + .../generated/models/PublicNetworkAccess.java | 50 + .../generated/models/ReceiverStatus.java | 54 + .../monitor/generated/models/Recurrence.java | 97 + .../generated/models/RecurrenceFrequency.java | 73 + .../generated/models/RecurrentSchedule.java | 229 + .../generated/models/ResourceForUpdate.java | 53 + .../generated/models/ResponseModel.java | 65 + .../monitor/generated/models/ResultType.java | 51 + .../generated/models/RetentionPolicy.java | 78 + .../monitor/generated/models/RuleAction.java | 40 + .../generated/models/RuleCondition.java | 76 + .../generated/models/RuleDataSource.java | 151 + .../generated/models/RuleEmailAction.java | 91 + .../RuleManagementEventClaimsDataSource.java | 50 + .../models/RuleManagementEventDataSource.java | 301 + .../models/RuleMetricDataSource.java | 84 + .../models/RuleResolveConfiguration.java | 80 + .../generated/models/RuleWebhookAction.java | 91 + .../monitor/generated/models/ScaleAction.java | 155 + .../generated/models/ScaleCapacity.java | 126 + .../generated/models/ScaleDirection.java | 54 + .../monitor/generated/models/ScaleRule.java | 93 + .../models/ScaleRuleMetricDimension.java | 126 + ...ScaleRuleMetricDimensionOperationType.java | 51 + .../monitor/generated/models/ScaleType.java | 57 + .../models/ScheduledQueryRuleCriteria.java | 54 + .../models/ScheduledQueryRuleResource.java | 865 +++ .../ScheduledQueryRuleResourceCollection.java | 70 + .../ScheduledQueryRuleResourcePatch.java | 554 ++ .../generated/models/ScheduledQueryRules.java | 162 + .../generated/models/ScopedResource.java | 171 + .../models/ScopedResourceListResult.java | 59 + .../generated/models/SenderAuthorization.java | 105 + .../generated/models/SingleBaseline.java | 121 + .../models/SingleMetricBaseline.java | 72 + .../monitor/generated/models/SmsReceiver.java | 137 + .../generated/models/StreamDeclaration.java | 54 + .../generated/models/SyslogDataSource.java | 138 + .../generated/models/TagsResource.java | 56 + .../generated/models/TenantActivityLogs.java | 63 + .../TestNotificationDetailsResponse.java | 54 + .../models/ThresholdRuleCondition.java | 156 + .../generated/models/TimeAggregation.java | 56 + .../models/TimeAggregationOperator.java | 60 + .../generated/models/TimeAggregationType.java | 63 + .../generated/models/TimeSeriesBaseline.java | 182 + .../generated/models/TimeSeriesElement.java | 87 + .../monitor/generated/models/TimeWindow.java | 187 + .../models/UserIdentityProperties.java | 54 + .../monitor/generated/models/VMInsights.java | 36 + .../models/VMInsightsOnboardingStatus.java | 71 + .../generated/models/VoiceReceiver.java | 122 + .../generated/models/WebhookNotification.java | 79 + .../generated/models/WebhookReceiver.java | 221 + .../WebtestLocationAvailabilityCriteria.java | 123 + .../models/WindowsEventLogDataSource.java | 113 + .../generated/models/WorkspaceInfo.java | 135 + .../generated/models/package-info.java | 6 + .../monitor/generated/package-info.java | 6 + .../src/main/java/module-info.java | 19 + ...ionsAtActionGroupResourceLevelSamples.java | 156 + ...ificationsAtResourceGroupLevelSamples.java | 155 + .../ActionGroupsCreateOrUpdateSamples.java | 164 + .../generated/ActionGroupsDeleteSamples.java | 23 + .../ActionGroupsEnableReceiverSamples.java | 28 + ...ActionGroupsGetByResourceGroupSamples.java | 23 + ...ionsAtActionGroupResourceLevelSamples.java | 24 + ...ificationsAtResourceGroupLevelSamples.java | 24 + ...tionGroupsGetTestNotificationsSamples.java | 21 + ...ctionGroupsListByResourceGroupSamples.java | 21 + .../generated/ActionGroupsListSamples.java | 21 + ...ionGroupsPostTestNotificationsSamples.java | 154 + .../generated/ActionGroupsUpdateSamples.java | 41 + ...ctivityLogAlertsCreateOrUpdateSamples.java | 153 + .../ActivityLogAlertsDeleteSamples.java | 24 + ...ityLogAlertsGetByResourceGroupSamples.java | 23 + ...tyLogAlertsListByResourceGroupSamples.java | 20 + .../ActivityLogAlertsListSamples.java | 21 + .../ActivityLogAlertsUpdateSamples.java | 41 + .../generated/ActivityLogsListSamples.java | 45 + .../AlertRuleIncidentsGetSamples.java | 22 + ...rtRuleIncidentsListByAlertRuleSamples.java | 20 + .../AlertRulesCreateOrUpdateSamples.java | 61 + .../generated/AlertRulesDeleteSamples.java | 22 + .../AlertRulesGetByResourceGroupSamples.java | 22 + .../AlertRulesListByResourceGroupSamples.java | 20 + .../generated/AlertRulesListSamples.java | 20 + .../generated/AlertRulesUpdateSamples.java | 64 + ...utoscaleSettingsCreateOrUpdateSamples.java | 190 + .../AutoscaleSettingsDeleteSamples.java | 22 + ...caleSettingsGetByResourceGroupSamples.java | 22 + ...aleSettingsListByResourceGroupSamples.java | 20 + .../AutoscaleSettingsListSamples.java | 20 + .../AutoscaleSettingsUpdateSamples.java | 192 + .../AzureMonitorWorkspacesCreateSamples.java | 25 + .../AzureMonitorWorkspacesDeleteSamples.java | 23 + ...orWorkspacesGetByResourceGroupSamples.java | 23 + ...rWorkspacesListByResourceGroupSamples.java | 21 + .../AzureMonitorWorkspacesListSamples.java | 21 + .../AzureMonitorWorkspacesUpdateSamples.java | 41 + .../generated/BaselinesListSamples.java | 34 + .../DataCollectionEndpointsCreateSamples.java | 32 + .../DataCollectionEndpointsDeleteSamples.java | 24 + ...ionEndpointsGetByResourceGroupSamples.java | 23 + ...onEndpointsListByResourceGroupSamples.java | 21 + .../DataCollectionEndpointsListSamples.java | 21 + .../DataCollectionEndpointsUpdateSamples.java | 42 + ...llectionRuleAssociationsCreateSamples.java | 27 + ...llectionRuleAssociationsDeleteSamples.java | 25 + ...aCollectionRuleAssociationsGetSamples.java | 25 + ...nsListByDataCollectionEndpointSamples.java | 24 + ...RuleAssociationsListByResourceSamples.java | 25 + ...tionRuleAssociationsListByRuleSamples.java | 23 + .../DataCollectionRulesCreateSamples.java | 122 + .../DataCollectionRulesDeleteSamples.java | 22 + ...lectionRulesGetByResourceGroupSamples.java | 22 + ...ectionRulesListByResourceGroupSamples.java | 21 + .../DataCollectionRulesListSamples.java | 21 + .../DataCollectionRulesUpdateSamples.java | 40 + .../DiagnosticSettingsCategoryGetSamples.java | 25 + ...DiagnosticSettingsCategoryListSamples.java | 24 + ...ettingsOperationCreateOrUpdateSamples.java | 95 + ...gnosticSettingsOperationDeleteSamples.java | 25 + ...DiagnosticSettingsOperationGetSamples.java | 43 + ...iagnosticSettingsOperationListSamples.java | 41 + .../generated/EventCategoriesListSamples.java | 20 + .../LogProfilesCreateOrUpdateSamples.java | 47 + .../generated/LogProfilesDeleteSamples.java | 20 + .../generated/LogProfilesGetSamples.java | 20 + .../generated/LogProfilesListSamples.java | 20 + .../generated/LogProfilesUpdateSamples.java | 48 + .../MetricAlertsCreateOrUpdateSamples.java | 448 ++ .../generated/MetricAlertsDeleteSamples.java | 22 + ...MetricAlertsGetByResourceGroupSamples.java | 116 + ...etricAlertsListByResourceGroupSamples.java | 20 + .../generated/MetricAlertsListSamples.java | 20 + .../MetricAlertsStatusListByNameSamples.java | 26 + .../MetricAlertsStatusListSamples.java | 20 + .../generated/MetricAlertsUpdateSamples.java | 79 + .../MetricDefinitionsListSamples.java | 62 + .../MetricNamespacesListSamples.java | 26 + .../MetricsOperationListSamples.java | 85 + .../MonitorOperationsListSamples.java | 20 + .../generated/OperationsListSamples.java | 21 + .../generated/PredictiveMetricGetSamples.java | 32 + ...pointConnectionsCreateOrUpdateSamples.java | 32 + ...ivateEndpointConnectionsDeleteSamples.java | 27 + .../PrivateEndpointConnectionsGetSamples.java | 27 + ...nectionsListByPrivateLinkScopeSamples.java | 24 + .../PrivateLinkResourcesGetSamples.java | 23 + ...esourcesListByPrivateLinkScopeSamples.java | 24 + ...rationStatusGetByResourceGroupSamples.java | 23 + ...kScopedResourcesCreateOrUpdateSamples.java | 33 + ...ivateLinkScopedResourcesDeleteSamples.java | 23 + .../PrivateLinkScopedResourcesGetSamples.java | 24 + ...esourcesListByPrivateLinkScopeSamples.java | 23 + ...rivateLinkScopesCreateOrUpdateSamples.java | 70 + .../PrivateLinkScopesDeleteSamples.java | 22 + ...teLinkScopesGetByResourceGroupSamples.java | 23 + ...eLinkScopesListByResourceGroupSamples.java | 21 + .../PrivateLinkScopesListSamples.java | 20 + .../PrivateLinkScopesUpdateTagsSamples.java | 42 + ...eduledQueryRulesCreateOrUpdateSamples.java | 217 + .../ScheduledQueryRulesDeleteSamples.java | 22 + ...edQueryRulesGetByResourceGroupSamples.java | 23 + ...dQueryRulesListByResourceGroupSamples.java | 21 + .../ScheduledQueryRulesListSamples.java | 21 + .../ScheduledQueryRulesUpdateSamples.java | 28 + .../TenantActivityLogsListSamples.java | 77 + .../VMInsightsGetOnboardingStatusSamples.java | 92 + sdk/monitor/ci.yml | 41 +- sdk/monitor/pom.xml | 11 +- 592 files changed, 90871 insertions(+), 22 deletions(-) create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/CHANGELOG.md create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/README.md create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/SAMPLE.md create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/pom.xml create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/MonitorManager.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ActionGroupsClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ActivityLogAlertsClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ActivityLogsClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/AlertRuleIncidentsClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/AlertRulesClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/AutoscaleSettingsClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/AzureMonitorWorkspacesClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/BaselinesClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DataCollectionEndpointsClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DataCollectionRuleAssociationsClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DataCollectionRulesClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DiagnosticSettingsCategoriesClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DiagnosticSettingsOperationsClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/EventCategoriesClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/LogProfilesClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricAlertsClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricAlertsStatusClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricDefinitionsClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricNamespacesClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricsOperationsClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MonitorClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MonitorOperationsClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/OperationsClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PredictiveMetricsClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateEndpointConnectionsClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkResourcesClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkScopeOperationStatusClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkScopedResourcesClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkScopesClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ScheduledQueryRulesClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/TenantActivityLogsClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/VMInsightsClient.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroup.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroupPatch.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroupResourceInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActivityLogAlertResourceInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRule.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRulePatchProperties.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRuleProperties.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRuleResourceInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AutoscaleSetting.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AutoscaleSettingResourceInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorPrivateLinkScopeInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorPrivateLinkScopeProperties.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorWorkspaceResourceInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorWorkspaceResourceProperties.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionEndpointResourceInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionEndpointResourceProperties.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleAssociationProxyOnlyResourceInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleAssociationProxyOnlyResourceProperties.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleResourceInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleResourceProperties.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettings.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsCategory.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsCategoryResourceInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsResourceInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/EventDataInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/IncidentInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LocalizableStringInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogProfileProperties.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogProfileResourceInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetadataValueInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertProperties.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertPropertiesPatch.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertResourceInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertStatusCollectionInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricBaselinesProperties.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricDefinitionInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricNamespaceInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/OperationAutoGeneratedInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/OperationListResultInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/OperationStatusInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PredictiveResponseInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateEndpointConnectionInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateEndpointConnectionListResultInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateEndpointConnectionProperties.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateLinkResourceInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateLinkResourceListResultInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateLinkResourceProperties.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ResponseInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScheduledQueryRuleProperties.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScheduledQueryRuleResourceInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScopedResourceInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScopedResourceProperties.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/SingleMetricBaselineInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/TestNotificationDetailsResponseInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/VMInsightsOnboardingStatusInner.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/VMInsightsOnboardingStatusProperties.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/WorkspaceInfoProperties.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/package-info.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/package-info.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActionGroupResourceImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActionGroupsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActionGroupsImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogAlertResourceImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogAlertsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogAlertsImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogsImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRuleIncidentsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRuleIncidentsImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRuleResourceImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRulesClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRulesImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AutoscaleSettingResourceImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AutoscaleSettingsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AutoscaleSettingsImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AzureMonitorPrivateLinkScopeImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AzureMonitorWorkspaceResourceImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AzureMonitorWorkspacesClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AzureMonitorWorkspacesImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/BaselinesClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/BaselinesImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointResourceImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointsImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationProxyOnlyResourceImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationsImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleResourceImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRulesClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRulesImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoriesClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoriesImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoryResourceImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsOperationsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsOperationsImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsResourceImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/EventCategoriesClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/EventCategoriesImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/EventDataImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/IncidentImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LocalizableStringImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LogProfileResourceImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LogProfilesClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LogProfilesImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetadataValueImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertResourceImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertStatusCollectionImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsStatusClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsStatusImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricDefinitionImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricDefinitionsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricDefinitionsImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricNamespaceImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricNamespacesClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricNamespacesImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricsOperationsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricsOperationsImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorClientBuilder.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorOperationsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorOperationsImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationAutoGeneratedImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationListResultImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationStatusImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationsImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PredictiveMetricsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PredictiveMetricsImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PredictiveResponseImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionListResultImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionsImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourceImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourceListResultImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourcesClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourcesImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopeOperationStatusClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopeOperationStatusImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopedResourcesClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopedResourcesImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopesClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopesImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ResponseModelImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScheduledQueryRuleResourceImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScheduledQueryRulesClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScheduledQueryRulesImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScopedResourceImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/SingleMetricBaselineImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActivityLogsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActivityLogsImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TestNotificationDetailsResponseImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/Utils.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/VMInsightsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/VMInsightsImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/VMInsightsOnboardingStatusImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/package-info.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AccessMode.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AccessModeSettings.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AccessModeSettingsExclusion.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionDetail.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupList.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupPatchBody.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroups.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionList.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionType.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Actions.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertActionGroup.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertAllOfCondition.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertLeafCondition.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlerts.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogs.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AggregationType.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AggregationTypeEnum.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleIncidents.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleLeafCondition.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleList.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRulePatchObject.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleResourceCollection.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleResourcePatch.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRules.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertSeverity.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ArmRoleReceiver.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutomationRunbookReceiver.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleNotification.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleProfile.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettingResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettingResourceCollection.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettingResourcePatch.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettings.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureAppPushReceiver.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureFunctionReceiver.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorMetricsDestination.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorPrivateLinkScope.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorPrivateLinkScopeListResult.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspace.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceDefaultIngestionSettings.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceMetrics.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceResourceForUpdate.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceResourceListResult.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaces.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/BaselineMetadata.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/BaselineSensitivity.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Baselines.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/CategoryType.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ColumnDefinition.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ComparisonOperationType.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Condition.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ConditionFailingPeriods.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ConditionOperator.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ConfigurationAccessEndpointSpec.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Context.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/CriterionType.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpoint.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointConfigurationAccess.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointLogsIngestion.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointNetworkAcls.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointResourceListResult.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpoints.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRule.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociation.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationMetadata.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationProxyOnlyResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationProxyOnlyResourceListResult.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociations.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleDataSources.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleDestinations.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleMetadata.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleResourceListResult.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRules.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataContainer.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataFlow.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataSourcesSpec.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataStatus.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DestinationsSpec.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DestinationsSpecAzureMonitorMetrics.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsCategories.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsCategoryResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsCategoryResourceCollection.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsOperations.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsResourceCollection.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Dimension.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DimensionOperator.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicMetricCriteria.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicThresholdFailingPeriods.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicThresholdOperator.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicThresholdSensitivity.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EmailNotification.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EmailReceiver.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EnableRequest.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventCategories.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventCategoryCollection.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventData.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventDataCollection.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventHubReceiver.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventLevel.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ExtensionDataSource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/HttpRequestInfo.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Identity.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IdentityType.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IisLogsDataSource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Incident.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IncidentListResult.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IngestionSettings.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ItsmReceiver.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Kind.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownColumnDefinitionType.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionEndpointProvisioningState.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionEndpointResourceKind.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionRuleAssociationProvisioningState.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionRuleProvisioningState.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionRuleResourceKind.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataFlowStreams.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownExtensionDataSourceStreams.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownLogFileTextSettingsRecordStartTimestampFormat.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownLogFilesDataSourceFormat.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownPerfCounterDataSourceStreams.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownPublicNetworkAccessOptions.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownSyslogDataSourceFacilityNames.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownSyslogDataSourceLogLevels.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownSyslogDataSourceStreams.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownWindowsEventLogDataSourceStreams.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LocalizableString.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LocationThresholdRuleCondition.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogAnalyticsDestination.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFileSettings.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFileSettingsText.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFileTextSettings.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFilesDataSource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFilesDataSourceSettings.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfileCollection.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfileResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfileResourcePatch.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfiles.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogSettings.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogicAppReceiver.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogsIngestionEndpointSpec.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ManagementEventAggregationCondition.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ManagementEventRuleCondition.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Metadata.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetadataValue.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Metric.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertAction.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertCriteria.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertMultipleResourceMultipleMetricCriteria.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertResourceCollection.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertResourcePatch.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertSingleResourceMultipleMetricCriteria.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertStatus.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertStatusCollection.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertStatusProperties.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlerts.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertsStatus.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAvailability.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricBaselinesResponse.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricClass.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricCriteria.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDefinition.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDefinitionCollection.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDefinitions.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDimension.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespace.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespaceCollection.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespaceName.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespaces.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricSettings.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricSingleDimension.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricStatisticType.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricTrigger.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricUnit.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricValue.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Metrics.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricsOperations.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MonitorOperations.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MultiMetricCriteria.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/NamespaceClassification.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/NetworkRuleSet.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/NotificationRequestBody.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Odatatype.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OnboardingStatus.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Operation.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationAutoGenerated.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationDisplay.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationDisplayAutoGenerated.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationListResult.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationListResultAutoGenerated.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationStatus.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Operations.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Operator.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Origin.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PerfCounterDataSource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveAutoscalePolicy.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveAutoscalePolicyScaleMode.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveMetrics.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveResponse.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveValue.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpoint.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnection.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnectionListResult.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnectionProvisioningState.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnections.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointServiceConnectionStatus.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkResourceListResult.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkResources.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkScopeOperationStatus.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkScopedResources.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkScopes.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkServiceConnectionState.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ProvisioningState.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PublicNetworkAccess.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ReceiverStatus.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Recurrence.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RecurrenceFrequency.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RecurrentSchedule.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResourceForUpdate.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResponseModel.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResultType.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RetentionPolicy.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleAction.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleCondition.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleDataSource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleEmailAction.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleManagementEventClaimsDataSource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleManagementEventDataSource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleMetricDataSource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleResolveConfiguration.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleWebhookAction.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleAction.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleCapacity.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleDirection.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleRule.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleRuleMetricDimension.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleRuleMetricDimensionOperationType.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleType.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRuleCriteria.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRuleResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRuleResourceCollection.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRuleResourcePatch.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRules.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScopedResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScopedResourceListResult.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SenderAuthorization.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SingleBaseline.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SingleMetricBaseline.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SmsReceiver.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/StreamDeclaration.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SyslogDataSource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TagsResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TenantActivityLogs.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TestNotificationDetailsResponse.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ThresholdRuleCondition.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeAggregation.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeAggregationOperator.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeAggregationType.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeSeriesBaseline.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeSeriesElement.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeWindow.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/UserIdentityProperties.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/VMInsights.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/VMInsightsOnboardingStatus.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/VoiceReceiver.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebhookNotification.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebhookReceiver.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebtestLocationAvailabilityCriteria.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WindowsEventLogDataSource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WorkspaceInfo.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/package-info.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/package-info.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/module-info.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsCreateNotificationsAtActionGroupResourceLevelSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsCreateNotificationsAtResourceGroupLevelSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsCreateOrUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsDeleteSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsEnableReceiverSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetTestNotificationsAtActionGroupResourceLevelSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetTestNotificationsAtResourceGroupLevelSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetTestNotificationsSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsListByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsPostTestNotificationsSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsCreateOrUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsDeleteSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsGetByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsListByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogsListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRuleIncidentsGetSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRuleIncidentsListByAlertRuleSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesCreateOrUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesDeleteSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesGetByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesListByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsCreateOrUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsDeleteSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsGetByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsListByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesCreateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesDeleteSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesGetByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesListByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/BaselinesListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsCreateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsDeleteSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsGetByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsListByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsCreateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsDeleteSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsGetSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsListByDataCollectionEndpointSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsListByResourceSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsListByRuleSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesCreateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesDeleteSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesGetByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesListByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsCategoryGetSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsCategoryListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationCreateOrUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationDeleteSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationGetSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/EventCategoriesListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesCreateOrUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesDeleteSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesGetSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsCreateOrUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsDeleteSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsGetByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsListByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsStatusListByNameSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsStatusListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricDefinitionsListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricNamespacesListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricsOperationListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MonitorOperationsListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/OperationsListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PredictiveMetricGetSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsDeleteSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsGetSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsListByPrivateLinkScopeSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkResourcesGetSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkResourcesListByPrivateLinkScopeSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopeOperationStatusGetByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesCreateOrUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesDeleteSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesGetSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesListByPrivateLinkScopeSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesCreateOrUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesDeleteSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesGetByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesListByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesUpdateTagsSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesCreateOrUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesDeleteSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesGetByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesListByResourceGroupSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesUpdateSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActivityLogsListSamples.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/VMInsightsGetOnboardingStatusSamples.java diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 26dedaf2adf0d..7682596649071 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -394,6 +394,7 @@ com.azure.resourcemanager:azure-resourcemanager-billingbenefits;1.0.0-beta.1;1.0 com.azure.resourcemanager:azure-resourcemanager-providerhub;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-reservations;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-storagemover;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-monitor-generated;1.0.0-beta.1;1.0.0-beta.1 com.azure.tools:azure-sdk-archetype;1.0.0;1.2.0-beta.1 com.azure.tools:azure-sdk-build-tool;1.0.0-beta.1;1.0.0-beta.2 diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/CHANGELOG.md b/sdk/monitor/azure-resourcemanager-monitor-generated/CHANGELOG.md new file mode 100644 index 0000000000000..854568ac66776 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2023-02-09) + +- Azure Resource Manager Monitor client library for Java. This package contains Microsoft Azure SDK for Monitor Management SDK. Monitor Management Client. Package tag package-preview-2022-08. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/README.md b/sdk/monitor/azure-resourcemanager-monitor-generated/README.md new file mode 100644 index 0000000000000..cab8be03f13ad --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/README.md @@ -0,0 +1,105 @@ +# Azure Resource Manager Monitor client library for Java + +Azure Resource Manager Monitor client library for Java. + +This package contains Microsoft Azure SDK for Monitor Management SDK. Monitor Management Client. Package tag package-preview-2022-08. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## We'd love to hear your feedback + +We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better. + +If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together. + +Thank you in advance for your collaboration. We really appreciate your time! + +## Documentation + +Various documentation is available to help you get started + +- [API reference documentation][docs] + +## Getting started + +### Prerequisites + +- [Java Development Kit (JDK)][jdk] with version 8 or above +- [Azure Subscription][azure_subscription] + +### Adding the package to your product + +[//]: # ({x-version-update-start;com.azure.resourcemanager:azure-resourcemanager-monitor-generated;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-monitor-generated + 1.0.0-beta.1 + +``` +[//]: # ({x-version-update-end}) + +### Include the recommended packages + +Azure Management Libraries require a `TokenCredential` implementation for authentication and an `HttpClient` implementation for HTTP client. + +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. + +### Authentication + +By default, Azure Active Directory 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. +- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate. + +In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. + +With above configuration, `azure` client can be authenticated using the following code: + +```java +AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); +TokenCredential credential = new DefaultAzureCredentialBuilder() + .authorityHost(profile.getEnvironment().getActiveDirectoryEndpoint()) + .build(); +MonitorManager manager = MonitorManager + .authenticate(credential, profile); +``` + +The sample code assumes global Azure. Please change `AzureEnvironment.AZURE` variable if otherwise. + +See [Authentication][authenticate] for more options. + +## Key concepts + +See [API design][design] for general introduction on design and key concepts on Azure Management Libraries. + +## Examples + +[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/monitor/azure-resourcemanager-monitor-generated/SAMPLE.md) + + +## Troubleshooting + +## Next steps + +## Contributing + +For details on contributing to this repository, see the [contributing guide][cg]. + +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. + + +[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS +[docs]: https://azure.github.io/azure-sdk-for-java/ +[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[azure_subscription]: https://azure.microsoft.com/free/ +[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/SAMPLE.md b/sdk/monitor/azure-resourcemanager-monitor-generated/SAMPLE.md new file mode 100644 index 0000000000000..7c098dc424594 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/SAMPLE.md @@ -0,0 +1,5149 @@ +# Code snippets and samples + + +## ActionGroups + +- [CreateNotificationsAtActionGroupResourceLevel](#actiongroups_createnotificationsatactiongroupresourcelevel) +- [CreateNotificationsAtResourceGroupLevel](#actiongroups_createnotificationsatresourcegrouplevel) +- [CreateOrUpdate](#actiongroups_createorupdate) +- [Delete](#actiongroups_delete) +- [EnableReceiver](#actiongroups_enablereceiver) +- [GetByResourceGroup](#actiongroups_getbyresourcegroup) +- [GetTestNotifications](#actiongroups_gettestnotifications) +- [GetTestNotificationsAtActionGroupResourceLevel](#actiongroups_gettestnotificationsatactiongroupresourcelevel) +- [GetTestNotificationsAtResourceGroupLevel](#actiongroups_gettestnotificationsatresourcegrouplevel) +- [List](#actiongroups_list) +- [ListByResourceGroup](#actiongroups_listbyresourcegroup) +- [PostTestNotifications](#actiongroups_posttestnotifications) +- [Update](#actiongroups_update) + +## ActivityLogAlerts + +- [CreateOrUpdate](#activitylogalerts_createorupdate) +- [Delete](#activitylogalerts_delete) +- [GetByResourceGroup](#activitylogalerts_getbyresourcegroup) +- [List](#activitylogalerts_list) +- [ListByResourceGroup](#activitylogalerts_listbyresourcegroup) +- [Update](#activitylogalerts_update) + +## ActivityLogs + +- [List](#activitylogs_list) + +## AlertRuleIncidents + +- [Get](#alertruleincidents_get) +- [ListByAlertRule](#alertruleincidents_listbyalertrule) + +## AlertRules + +- [CreateOrUpdate](#alertrules_createorupdate) +- [Delete](#alertrules_delete) +- [GetByResourceGroup](#alertrules_getbyresourcegroup) +- [List](#alertrules_list) +- [ListByResourceGroup](#alertrules_listbyresourcegroup) +- [Update](#alertrules_update) + +## AutoscaleSettings + +- [CreateOrUpdate](#autoscalesettings_createorupdate) +- [Delete](#autoscalesettings_delete) +- [GetByResourceGroup](#autoscalesettings_getbyresourcegroup) +- [List](#autoscalesettings_list) +- [ListByResourceGroup](#autoscalesettings_listbyresourcegroup) +- [Update](#autoscalesettings_update) + +## AzureMonitorWorkspaces + +- [Create](#azuremonitorworkspaces_create) +- [Delete](#azuremonitorworkspaces_delete) +- [GetByResourceGroup](#azuremonitorworkspaces_getbyresourcegroup) +- [List](#azuremonitorworkspaces_list) +- [ListByResourceGroup](#azuremonitorworkspaces_listbyresourcegroup) +- [Update](#azuremonitorworkspaces_update) + +## Baselines + +- [List](#baselines_list) + +## DataCollectionEndpoints + +- [Create](#datacollectionendpoints_create) +- [Delete](#datacollectionendpoints_delete) +- [GetByResourceGroup](#datacollectionendpoints_getbyresourcegroup) +- [List](#datacollectionendpoints_list) +- [ListByResourceGroup](#datacollectionendpoints_listbyresourcegroup) +- [Update](#datacollectionendpoints_update) + +## DataCollectionRuleAssociations + +- [Create](#datacollectionruleassociations_create) +- [Delete](#datacollectionruleassociations_delete) +- [Get](#datacollectionruleassociations_get) +- [ListByDataCollectionEndpoint](#datacollectionruleassociations_listbydatacollectionendpoint) +- [ListByResource](#datacollectionruleassociations_listbyresource) +- [ListByRule](#datacollectionruleassociations_listbyrule) + +## DataCollectionRules + +- [Create](#datacollectionrules_create) +- [Delete](#datacollectionrules_delete) +- [GetByResourceGroup](#datacollectionrules_getbyresourcegroup) +- [List](#datacollectionrules_list) +- [ListByResourceGroup](#datacollectionrules_listbyresourcegroup) +- [Update](#datacollectionrules_update) + +## DiagnosticSettingsCategory + +- [Get](#diagnosticsettingscategory_get) +- [List](#diagnosticsettingscategory_list) + +## DiagnosticSettingsOperation + +- [CreateOrUpdate](#diagnosticsettingsoperation_createorupdate) +- [Delete](#diagnosticsettingsoperation_delete) +- [Get](#diagnosticsettingsoperation_get) +- [List](#diagnosticsettingsoperation_list) + +## EventCategories + +- [List](#eventcategories_list) + +## LogProfiles + +- [CreateOrUpdate](#logprofiles_createorupdate) +- [Delete](#logprofiles_delete) +- [Get](#logprofiles_get) +- [List](#logprofiles_list) +- [Update](#logprofiles_update) + +## MetricAlerts + +- [CreateOrUpdate](#metricalerts_createorupdate) +- [Delete](#metricalerts_delete) +- [GetByResourceGroup](#metricalerts_getbyresourcegroup) +- [List](#metricalerts_list) +- [ListByResourceGroup](#metricalerts_listbyresourcegroup) +- [Update](#metricalerts_update) + +## MetricAlertsStatus + +- [List](#metricalertsstatus_list) +- [ListByName](#metricalertsstatus_listbyname) + +## MetricDefinitions + +- [List](#metricdefinitions_list) + +## MetricNamespaces + +- [List](#metricnamespaces_list) + +## MetricsOperation + +- [List](#metricsoperation_list) + +## MonitorOperations + +- [List](#monitoroperations_list) + +## Operations + +- [List](#operations_list) + +## PredictiveMetric + +- [Get](#predictivemetric_get) + +## PrivateEndpointConnections + +- [CreateOrUpdate](#privateendpointconnections_createorupdate) +- [Delete](#privateendpointconnections_delete) +- [Get](#privateendpointconnections_get) +- [ListByPrivateLinkScope](#privateendpointconnections_listbyprivatelinkscope) + +## PrivateLinkResources + +- [Get](#privatelinkresources_get) +- [ListByPrivateLinkScope](#privatelinkresources_listbyprivatelinkscope) + +## PrivateLinkScopeOperationStatus + +- [GetByResourceGroup](#privatelinkscopeoperationstatus_getbyresourcegroup) + +## PrivateLinkScopedResources + +- [CreateOrUpdate](#privatelinkscopedresources_createorupdate) +- [Delete](#privatelinkscopedresources_delete) +- [Get](#privatelinkscopedresources_get) +- [ListByPrivateLinkScope](#privatelinkscopedresources_listbyprivatelinkscope) + +## PrivateLinkScopes + +- [CreateOrUpdate](#privatelinkscopes_createorupdate) +- [Delete](#privatelinkscopes_delete) +- [GetByResourceGroup](#privatelinkscopes_getbyresourcegroup) +- [List](#privatelinkscopes_list) +- [ListByResourceGroup](#privatelinkscopes_listbyresourcegroup) +- [UpdateTags](#privatelinkscopes_updatetags) + +## ScheduledQueryRules + +- [CreateOrUpdate](#scheduledqueryrules_createorupdate) +- [Delete](#scheduledqueryrules_delete) +- [GetByResourceGroup](#scheduledqueryrules_getbyresourcegroup) +- [List](#scheduledqueryrules_list) +- [ListByResourceGroup](#scheduledqueryrules_listbyresourcegroup) +- [Update](#scheduledqueryrules_update) + +## TenantActivityLogs + +- [List](#tenantactivitylogs_list) + +## VMInsights + +- [GetOnboardingStatus](#vminsights_getonboardingstatus) +### ActionGroups_CreateNotificationsAtActionGroupResourceLevel + +```java +import com.azure.resourcemanager.monitor.generated.models.ArmRoleReceiver; +import com.azure.resourcemanager.monitor.generated.models.AutomationRunbookReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureAppPushReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureFunctionReceiver; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +import com.azure.resourcemanager.monitor.generated.models.EventHubReceiver; +import com.azure.resourcemanager.monitor.generated.models.ItsmReceiver; +import com.azure.resourcemanager.monitor.generated.models.LogicAppReceiver; +import com.azure.resourcemanager.monitor.generated.models.NotificationRequestBody; +import com.azure.resourcemanager.monitor.generated.models.SmsReceiver; +import com.azure.resourcemanager.monitor.generated.models.VoiceReceiver; +import com.azure.resourcemanager.monitor.generated.models.WebhookReceiver; +import java.util.Arrays; + +/** Samples for ActionGroups CreateNotificationsAtActionGroupResourceLevel. */ +public final class ActionGroupsCreateNotificationsAtActionGroupResourceLevelSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/postTestNotificationsAtActionGroupResourceLevel.json + */ + /** + * Sample code: Create notifications at resource group level. + * + * @param manager Entry point to MonitorManager. + */ + public static void createNotificationsAtResourceGroupLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .actionGroups() + .createNotificationsAtActionGroupResourceLevel( + "TestRgName", + "TestAgName", + new NotificationRequestBody() + .withAlertType("budget") + .withEmailReceivers( + Arrays + .asList( + new EmailReceiver() + .withName("John Doe's email") + .withEmailAddress("johndoe@email.com") + .withUseCommonAlertSchema(false), + new EmailReceiver() + .withName("Jane Smith's email") + .withEmailAddress("janesmith@email.com") + .withUseCommonAlertSchema(true))) + .withSmsReceivers( + Arrays + .asList( + new SmsReceiver() + .withName("John Doe's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"), + new SmsReceiver() + .withName("Jane Smith's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("0987654321"))) + .withWebhookReceivers( + Arrays + .asList( + new WebhookReceiver() + .withName("Sample webhook 1") + .withServiceUri("http://www.example.com/webhook1") + .withUseCommonAlertSchema(true), + new WebhookReceiver() + .withName("Sample webhook 2") + .withServiceUri("http://www.example.com/webhook2") + .withUseCommonAlertSchema(true) + .withUseAadAuth(true) + .withObjectId("d3bb868c-fe44-452c-aa26-769a6538c808") + .withIdentifierUri("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84"))) + .withItsmReceivers( + Arrays + .asList( + new ItsmReceiver() + .withName("Sample itsm") + .withWorkspaceId( + "5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c") + .withConnectionId("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1") + .withTicketConfiguration( + "{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}") + .withRegion("westcentralus"))) + .withAzureAppPushReceivers( + Arrays + .asList( + new AzureAppPushReceiver() + .withName("Sample azureAppPush") + .withEmailAddress("johndoe@email.com"))) + .withAutomationRunbookReceivers( + Arrays + .asList( + new AutomationRunbookReceiver() + .withAutomationAccountId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest") + .withRunbookName("Sample runbook") + .withWebhookResourceId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084") + .withIsGlobalRunbook(false) + .withName("testRunbook") + .withServiceUri("http://test.me") + .withUseCommonAlertSchema(true))) + .withVoiceReceivers( + Arrays + .asList( + new VoiceReceiver() + .withName("Sample voice") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"))) + .withLogicAppReceivers( + Arrays + .asList( + new LogicAppReceiver() + .withName("Sample logicApp") + .withResourceId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp") + .withCallbackUrl( + "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") + .withUseCommonAlertSchema(false))) + .withAzureFunctionReceivers( + Arrays + .asList( + new AzureFunctionReceiver() + .withName("Sample azureFunction") + .withFunctionAppResourceId( + "/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp") + .withFunctionName("HttpTriggerCSharp1") + .withHttpTriggerUrl("http://test.me") + .withUseCommonAlertSchema(true))) + .withArmRoleReceivers( + Arrays + .asList( + new ArmRoleReceiver() + .withName("ArmRole-Common") + .withRoleId("11111111-1111-1111-1111-111111111111") + .withUseCommonAlertSchema(true), + new ArmRoleReceiver() + .withName("ArmRole-nonCommon") + .withRoleId("11111111-1111-1111-1111-111111111111") + .withUseCommonAlertSchema(false))) + .withEventHubReceivers( + Arrays + .asList( + new EventHubReceiver() + .withName("Sample eventHub") + .withEventHubNameSpace("testEventHubNameSpace") + .withEventHubName("testEventHub") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84") + .withSubscriptionId("187f412d-1758-44d9-b052-169e2564721d"))), + com.azure.core.util.Context.NONE); + } +} +``` + +### ActionGroups_CreateNotificationsAtResourceGroupLevel + +```java +import com.azure.resourcemanager.monitor.generated.models.ArmRoleReceiver; +import com.azure.resourcemanager.monitor.generated.models.AutomationRunbookReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureAppPushReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureFunctionReceiver; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +import com.azure.resourcemanager.monitor.generated.models.EventHubReceiver; +import com.azure.resourcemanager.monitor.generated.models.ItsmReceiver; +import com.azure.resourcemanager.monitor.generated.models.LogicAppReceiver; +import com.azure.resourcemanager.monitor.generated.models.NotificationRequestBody; +import com.azure.resourcemanager.monitor.generated.models.SmsReceiver; +import com.azure.resourcemanager.monitor.generated.models.VoiceReceiver; +import com.azure.resourcemanager.monitor.generated.models.WebhookReceiver; +import java.util.Arrays; + +/** Samples for ActionGroups CreateNotificationsAtResourceGroupLevel. */ +public final class ActionGroupsCreateNotificationsAtResourceGroupLevelSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/postTestNotificationsAtResourceGroupLevel.json + */ + /** + * Sample code: Create notifications at resource group level. + * + * @param manager Entry point to MonitorManager. + */ + public static void createNotificationsAtResourceGroupLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .actionGroups() + .createNotificationsAtResourceGroupLevel( + "Default-TestNotifications", + new NotificationRequestBody() + .withAlertType("budget") + .withEmailReceivers( + Arrays + .asList( + new EmailReceiver() + .withName("John Doe's email") + .withEmailAddress("johndoe@email.com") + .withUseCommonAlertSchema(false), + new EmailReceiver() + .withName("Jane Smith's email") + .withEmailAddress("janesmith@email.com") + .withUseCommonAlertSchema(true))) + .withSmsReceivers( + Arrays + .asList( + new SmsReceiver() + .withName("John Doe's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"), + new SmsReceiver() + .withName("Jane Smith's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("0987654321"))) + .withWebhookReceivers( + Arrays + .asList( + new WebhookReceiver() + .withName("Sample webhook 1") + .withServiceUri("http://www.example.com/webhook1") + .withUseCommonAlertSchema(true), + new WebhookReceiver() + .withName("Sample webhook 2") + .withServiceUri("http://www.example.com/webhook2") + .withUseCommonAlertSchema(true) + .withUseAadAuth(true) + .withObjectId("d3bb868c-fe44-452c-aa26-769a6538c808") + .withIdentifierUri("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84"))) + .withItsmReceivers( + Arrays + .asList( + new ItsmReceiver() + .withName("Sample itsm") + .withWorkspaceId( + "5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c") + .withConnectionId("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1") + .withTicketConfiguration( + "{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}") + .withRegion("westcentralus"))) + .withAzureAppPushReceivers( + Arrays + .asList( + new AzureAppPushReceiver() + .withName("Sample azureAppPush") + .withEmailAddress("johndoe@email.com"))) + .withAutomationRunbookReceivers( + Arrays + .asList( + new AutomationRunbookReceiver() + .withAutomationAccountId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest") + .withRunbookName("Sample runbook") + .withWebhookResourceId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084") + .withIsGlobalRunbook(false) + .withName("testRunbook") + .withServiceUri("http://test.me") + .withUseCommonAlertSchema(true))) + .withVoiceReceivers( + Arrays + .asList( + new VoiceReceiver() + .withName("Sample voice") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"))) + .withLogicAppReceivers( + Arrays + .asList( + new LogicAppReceiver() + .withName("Sample logicApp") + .withResourceId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp") + .withCallbackUrl( + "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") + .withUseCommonAlertSchema(false))) + .withAzureFunctionReceivers( + Arrays + .asList( + new AzureFunctionReceiver() + .withName("Sample azureFunction") + .withFunctionAppResourceId( + "/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp") + .withFunctionName("HttpTriggerCSharp1") + .withHttpTriggerUrl("http://test.me") + .withUseCommonAlertSchema(true))) + .withArmRoleReceivers( + Arrays + .asList( + new ArmRoleReceiver() + .withName("ArmRole-Common") + .withRoleId("11111111-1111-1111-1111-111111111111") + .withUseCommonAlertSchema(true), + new ArmRoleReceiver() + .withName("ArmRole-nonCommon") + .withRoleId("11111111-1111-1111-1111-111111111111") + .withUseCommonAlertSchema(false))) + .withEventHubReceivers( + Arrays + .asList( + new EventHubReceiver() + .withName("Sample eventHub") + .withEventHubNameSpace("testEventHubNameSpace") + .withEventHubName("testEventHub") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84") + .withSubscriptionId("187f412d-1758-44d9-b052-169e2564721d"))), + com.azure.core.util.Context.NONE); + } +} +``` + +### ActionGroups_CreateOrUpdate + +```java +import com.azure.resourcemanager.monitor.generated.models.ArmRoleReceiver; +import com.azure.resourcemanager.monitor.generated.models.AutomationRunbookReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureAppPushReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureFunctionReceiver; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +import com.azure.resourcemanager.monitor.generated.models.EventHubReceiver; +import com.azure.resourcemanager.monitor.generated.models.ItsmReceiver; +import com.azure.resourcemanager.monitor.generated.models.LogicAppReceiver; +import com.azure.resourcemanager.monitor.generated.models.SmsReceiver; +import com.azure.resourcemanager.monitor.generated.models.VoiceReceiver; +import com.azure.resourcemanager.monitor.generated.models.WebhookReceiver; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ActionGroups CreateOrUpdate. */ +public final class ActionGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/createOrUpdateActionGroup.json + */ + /** + * Sample code: Create or update an action group. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnActionGroup(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .actionGroups() + .define("SampleActionGroup") + .withRegion("Global") + .withExistingResourceGroup("Default-NotificationRules") + .withTags(mapOf()) + .withGroupShortName("sample") + .withEnabled(true) + .withEmailReceivers( + Arrays + .asList( + new EmailReceiver() + .withName("John Doe's email") + .withEmailAddress("johndoe@email.com") + .withUseCommonAlertSchema(false), + new EmailReceiver() + .withName("Jane Smith's email") + .withEmailAddress("janesmith@email.com") + .withUseCommonAlertSchema(true))) + .withSmsReceivers( + Arrays + .asList( + new SmsReceiver() + .withName("John Doe's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"), + new SmsReceiver() + .withName("Jane Smith's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("0987654321"))) + .withWebhookReceivers( + Arrays + .asList( + new WebhookReceiver() + .withName("Sample webhook 1") + .withServiceUri("http://www.example.com/webhook1") + .withUseCommonAlertSchema(true), + new WebhookReceiver() + .withName("Sample webhook 2") + .withServiceUri("http://www.example.com/webhook2") + .withUseCommonAlertSchema(true) + .withUseAadAuth(true) + .withObjectId("d3bb868c-fe44-452c-aa26-769a6538c808") + .withIdentifierUri("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84"))) + .withItsmReceivers( + Arrays + .asList( + new ItsmReceiver() + .withName("Sample itsm") + .withWorkspaceId( + "5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c") + .withConnectionId("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1") + .withTicketConfiguration( + "{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}") + .withRegion("westcentralus"))) + .withAzureAppPushReceivers( + Arrays + .asList( + new AzureAppPushReceiver() + .withName("Sample azureAppPush") + .withEmailAddress("johndoe@email.com"))) + .withAutomationRunbookReceivers( + Arrays + .asList( + new AutomationRunbookReceiver() + .withAutomationAccountId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest") + .withRunbookName("Sample runbook") + .withWebhookResourceId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084") + .withIsGlobalRunbook(false) + .withName("testRunbook") + .withServiceUri("") + .withUseCommonAlertSchema(true))) + .withVoiceReceivers( + Arrays + .asList( + new VoiceReceiver() + .withName("Sample voice") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"))) + .withLogicAppReceivers( + Arrays + .asList( + new LogicAppReceiver() + .withName("Sample logicApp") + .withResourceId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp") + .withCallbackUrl( + "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") + .withUseCommonAlertSchema(false))) + .withAzureFunctionReceivers( + Arrays + .asList( + new AzureFunctionReceiver() + .withName("Sample azureFunction") + .withFunctionAppResourceId( + "/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp") + .withFunctionName("HttpTriggerCSharp1") + .withHttpTriggerUrl("http://test.me") + .withUseCommonAlertSchema(true))) + .withArmRoleReceivers( + Arrays + .asList( + new ArmRoleReceiver() + .withName("Sample armRole") + .withRoleId("8e3af657-a8ff-443c-a75c-2fe8c4bcb635") + .withUseCommonAlertSchema(true))) + .withEventHubReceivers( + Arrays + .asList( + new EventHubReceiver() + .withName("Sample eventHub") + .withEventHubNameSpace("testEventHubNameSpace") + .withEventHubName("testEventHub") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84") + .withSubscriptionId("187f412d-1758-44d9-b052-169e2564721d"))) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ActionGroups_Delete + +```java +/** Samples for ActionGroups Delete. */ +public final class ActionGroupsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/deleteActionGroup.json + */ + /** + * Sample code: Delete an action group. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteAnActionGroup(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .actionGroups() + .deleteByResourceGroupWithResponse( + "Default-NotificationRules", "SampleActionGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### ActionGroups_EnableReceiver + +```java +import com.azure.resourcemanager.monitor.generated.models.EnableRequest; + +/** Samples for ActionGroups EnableReceiver. */ +public final class ActionGroupsEnableReceiverSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/enableReceiver.json + */ + /** + * Sample code: Enable the receiver. + * + * @param manager Entry point to MonitorManager. + */ + public static void enableTheReceiver(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .actionGroups() + .enableReceiverWithResponse( + "Default-NotificationRules", + "SampleActionGroup", + new EnableRequest().withReceiverName("John Doe's mobile"), + com.azure.core.util.Context.NONE); + } +} +``` + +### ActionGroups_GetByResourceGroup + +```java +/** Samples for ActionGroups GetByResourceGroup. */ +public final class ActionGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/getActionGroup.json + */ + /** + * Sample code: Get an action group. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnActionGroup(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .actionGroups() + .getByResourceGroupWithResponse( + "Default-NotificationRules", "SampleActionGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### ActionGroups_GetTestNotifications + +```java +/** Samples for ActionGroups GetTestNotifications. */ +public final class ActionGroupsGetTestNotificationsSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/getTestNotifications.json + */ + /** + * Sample code: Get notification details at subscription level. + * + * @param manager Entry point to MonitorManager. + */ + public static void getNotificationDetailsAtSubscriptionLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.actionGroups().getTestNotificationsWithResponse("11000222191287", com.azure.core.util.Context.NONE); + } +} +``` + +### ActionGroups_GetTestNotificationsAtActionGroupResourceLevel + +```java +/** Samples for ActionGroups GetTestNotificationsAtActionGroupResourceLevel. */ +public final class ActionGroupsGetTestNotificationsAtActionGroupResourceLevelSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/getTestNotificationsAtActionGroupResourceLevel.json + */ + /** + * Sample code: Get notification details at resource group level. + * + * @param manager Entry point to MonitorManager. + */ + public static void getNotificationDetailsAtResourceGroupLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .actionGroups() + .getTestNotificationsAtActionGroupResourceLevelWithResponse( + "TestRgName", "TestAgName", "11000222191287", com.azure.core.util.Context.NONE); + } +} +``` + +### ActionGroups_GetTestNotificationsAtResourceGroupLevel + +```java +/** Samples for ActionGroups GetTestNotificationsAtResourceGroupLevel. */ +public final class ActionGroupsGetTestNotificationsAtResourceGroupLevelSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/getTestNotificationsAtResourceGroupLevel.json + */ + /** + * Sample code: Get notification details at resource group level. + * + * @param manager Entry point to MonitorManager. + */ + public static void getNotificationDetailsAtResourceGroupLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .actionGroups() + .getTestNotificationsAtResourceGroupLevelWithResponse( + "Default-TestNotifications", "11000222191287", com.azure.core.util.Context.NONE); + } +} +``` + +### ActionGroups_List + +```java +/** Samples for ActionGroups List. */ +public final class ActionGroupsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/listActionGroups.json + */ + /** + * Sample code: List action groups at subscription level. + * + * @param manager Entry point to MonitorManager. + */ + public static void listActionGroupsAtSubscriptionLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.actionGroups().list(com.azure.core.util.Context.NONE); + } +} +``` + +### ActionGroups_ListByResourceGroup + +```java +/** Samples for ActionGroups ListByResourceGroup. */ +public final class ActionGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/listActionGroups.json + */ + /** + * Sample code: List action groups at resource group level. + * + * @param manager Entry point to MonitorManager. + */ + public static void listActionGroupsAtResourceGroupLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.actionGroups().listByResourceGroup("Default-NotificationRules", com.azure.core.util.Context.NONE); + } +} +``` + +### ActionGroups_PostTestNotifications + +```java +import com.azure.resourcemanager.monitor.generated.models.ArmRoleReceiver; +import com.azure.resourcemanager.monitor.generated.models.AutomationRunbookReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureAppPushReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureFunctionReceiver; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +import com.azure.resourcemanager.monitor.generated.models.EventHubReceiver; +import com.azure.resourcemanager.monitor.generated.models.ItsmReceiver; +import com.azure.resourcemanager.monitor.generated.models.LogicAppReceiver; +import com.azure.resourcemanager.monitor.generated.models.NotificationRequestBody; +import com.azure.resourcemanager.monitor.generated.models.SmsReceiver; +import com.azure.resourcemanager.monitor.generated.models.VoiceReceiver; +import com.azure.resourcemanager.monitor.generated.models.WebhookReceiver; +import java.util.Arrays; + +/** Samples for ActionGroups PostTestNotifications. */ +public final class ActionGroupsPostTestNotificationsSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/postTestNotifications.json + */ + /** + * Sample code: Create notifications at subscription level. + * + * @param manager Entry point to MonitorManager. + */ + public static void createNotificationsAtSubscriptionLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .actionGroups() + .postTestNotifications( + new NotificationRequestBody() + .withAlertType("budget") + .withEmailReceivers( + Arrays + .asList( + new EmailReceiver() + .withName("John Doe's email") + .withEmailAddress("johndoe@email.com") + .withUseCommonAlertSchema(false), + new EmailReceiver() + .withName("Jane Smith's email") + .withEmailAddress("janesmith@email.com") + .withUseCommonAlertSchema(true))) + .withSmsReceivers( + Arrays + .asList( + new SmsReceiver() + .withName("John Doe's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"), + new SmsReceiver() + .withName("Jane Smith's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("0987654321"))) + .withWebhookReceivers( + Arrays + .asList( + new WebhookReceiver() + .withName("Sample webhook 1") + .withServiceUri("http://www.example.com/webhook1") + .withUseCommonAlertSchema(true), + new WebhookReceiver() + .withName("Sample webhook 2") + .withServiceUri("http://www.example.com/webhook2") + .withUseCommonAlertSchema(true) + .withUseAadAuth(true) + .withObjectId("d3bb868c-fe44-452c-aa26-769a6538c808") + .withIdentifierUri("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84"))) + .withItsmReceivers( + Arrays + .asList( + new ItsmReceiver() + .withName("Sample itsm") + .withWorkspaceId( + "5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c") + .withConnectionId("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1") + .withTicketConfiguration( + "{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}") + .withRegion("westcentralus"))) + .withAzureAppPushReceivers( + Arrays + .asList( + new AzureAppPushReceiver() + .withName("Sample azureAppPush") + .withEmailAddress("johndoe@email.com"))) + .withAutomationRunbookReceivers( + Arrays + .asList( + new AutomationRunbookReceiver() + .withAutomationAccountId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest") + .withRunbookName("Sample runbook") + .withWebhookResourceId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084") + .withIsGlobalRunbook(false) + .withName("testRunbook") + .withServiceUri("http://test.me") + .withUseCommonAlertSchema(true))) + .withVoiceReceivers( + Arrays + .asList( + new VoiceReceiver() + .withName("Sample voice") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"))) + .withLogicAppReceivers( + Arrays + .asList( + new LogicAppReceiver() + .withName("Sample logicApp") + .withResourceId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp") + .withCallbackUrl( + "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") + .withUseCommonAlertSchema(false))) + .withAzureFunctionReceivers( + Arrays + .asList( + new AzureFunctionReceiver() + .withName("Sample azureFunction") + .withFunctionAppResourceId( + "/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp") + .withFunctionName("HttpTriggerCSharp1") + .withHttpTriggerUrl("http://test.me") + .withUseCommonAlertSchema(true))) + .withArmRoleReceivers( + Arrays + .asList( + new ArmRoleReceiver() + .withName("ArmRole-Common") + .withRoleId("11111111-1111-1111-1111-111111111111") + .withUseCommonAlertSchema(true), + new ArmRoleReceiver() + .withName("ArmRole-nonCommon") + .withRoleId("11111111-1111-1111-1111-111111111111") + .withUseCommonAlertSchema(false))) + .withEventHubReceivers( + Arrays + .asList( + new EventHubReceiver() + .withName("Sample eventHub") + .withEventHubNameSpace("testEventHubNameSpace") + .withEventHubName("testEventHub") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84") + .withSubscriptionId("187f412d-1758-44d9-b052-169e2564721d"))), + com.azure.core.util.Context.NONE); + } +} +``` + +### ActionGroups_Update + +```java +import com.azure.resourcemanager.monitor.generated.models.ActionGroupResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ActionGroups Update. */ +public final class ActionGroupsUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/patchActionGroup.json + */ + /** + * Sample code: Patch an action group. + * + * @param manager Entry point to MonitorManager. + */ + public static void patchAnActionGroup(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + ActionGroupResource resource = + manager + .actionGroups() + .getByResourceGroupWithResponse( + "Default-NotificationRules", "SampleActionGroup", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key1", "value1", "key2", "value2")).withEnabled(false).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ActivityLogAlerts_CreateOrUpdate + +```java +import com.azure.resourcemanager.monitor.generated.models.ActionList; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertActionGroup; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertAllOfCondition; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertLeafCondition; +import com.azure.resourcemanager.monitor.generated.models.AlertRuleLeafCondition; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ActivityLogAlerts CreateOrUpdate. */ +public final class ActivityLogAlertsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_CreateOrUpdateRuleWithContainsAny.json + */ + /** + * Sample code: Create or update an Activity Log Alert rule with 'containsAny'. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnActivityLogAlertRuleWithContainsAny( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .activityLogAlerts() + .define("SampleActivityLogAlertRuleWithContainsAny") + .withRegion("Global") + .withExistingResourceGroup("MyResourceGroup") + .withTags(mapOf()) + .withScopes(Arrays.asList("subscriptions/187f412d-1758-44d9-b052-169e2564721d")) + .withCondition( + new ActivityLogAlertAllOfCondition() + .withAllOf( + Arrays + .asList( + new ActivityLogAlertLeafCondition().withField("category").withEquals("ServiceHealth"), + new ActivityLogAlertLeafCondition() + .withField("properties.impactedServices[*].ImpactedRegions[*].RegionName") + .withContainsAny(Arrays.asList("North Europe", "West Europe"))))) + .withActions( + new ActionList() + .withActionGroups( + Arrays + .asList( + new ActivityLogAlertActionGroup() + .withActionGroupId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup") + .withWebhookProperties(mapOf("sampleWebhookProperty", "SamplePropertyValue"))))) + .withEnabled(true) + .withDescription("Description of sample Activity Log Alert rule with 'containsAny'.") + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_CreateOrUpdateRuleWithAnyOfCondition.json + */ + /** + * Sample code: Create or update an Activity Log Alert rule with 'anyOf' condition. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnActivityLogAlertRuleWithAnyOfCondition( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .activityLogAlerts() + .define("SampleActivityLogAlertRuleWithAnyOfCondition") + .withRegion("Global") + .withExistingResourceGroup("MyResourceGroup") + .withTags(mapOf()) + .withScopes(Arrays.asList("subscriptions/187f412d-1758-44d9-b052-169e2564721d")) + .withCondition( + new ActivityLogAlertAllOfCondition() + .withAllOf( + Arrays + .asList( + new ActivityLogAlertLeafCondition().withField("category").withEquals("ServiceHealth"), + new ActivityLogAlertLeafCondition() + .withAnyOf( + Arrays + .asList( + new AlertRuleLeafCondition() + .withField("properties.incidentType") + .withEquals("Incident"), + new AlertRuleLeafCondition() + .withField("properties.incidentType") + .withEquals("Maintenance")))))) + .withActions( + new ActionList() + .withActionGroups( + Arrays + .asList( + new ActivityLogAlertActionGroup() + .withActionGroupId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup") + .withWebhookProperties(mapOf("sampleWebhookProperty", "SamplePropertyValue"))))) + .withEnabled(true) + .withDescription("Description of sample Activity Log Alert rule with 'anyOf' condition.") + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_CreateOrUpdate.json + */ + /** + * Sample code: Create or update an Activity Log Alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnActivityLogAlertRule( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .activityLogAlerts() + .define("SampleActivityLogAlertRule") + .withRegion("Global") + .withExistingResourceGroup("MyResourceGroup") + .withTags(mapOf()) + .withScopes(Arrays.asList("/subscriptions/187f412d-1758-44d9-b052-169e2564721d")) + .withCondition( + new ActivityLogAlertAllOfCondition() + .withAllOf( + Arrays + .asList( + new ActivityLogAlertLeafCondition().withField("category").withEquals("Administrative"), + new ActivityLogAlertLeafCondition().withField("level").withEquals("Error")))) + .withActions( + new ActionList() + .withActionGroups( + Arrays + .asList( + new ActivityLogAlertActionGroup() + .withActionGroupId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup") + .withWebhookProperties(mapOf("sampleWebhookProperty", "SamplePropertyValue"))))) + .withEnabled(true) + .withDescription("Description of sample Activity Log Alert rule.") + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ActivityLogAlerts_Delete + +```java +/** Samples for ActivityLogAlerts Delete. */ +public final class ActivityLogAlertsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Delete.json + */ + /** + * Sample code: Delete an Activity Log Alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteAnActivityLogAlertRule( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .activityLogAlerts() + .deleteByResourceGroupWithResponse( + "MyResourceGroup", "SampleActivityLogAlertRule", com.azure.core.util.Context.NONE); + } +} +``` + +### ActivityLogAlerts_GetByResourceGroup + +```java +/** Samples for ActivityLogAlerts GetByResourceGroup. */ +public final class ActivityLogAlertsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Get.json + */ + /** + * Sample code: Get an Activity Log Alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnActivityLogAlertRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .activityLogAlerts() + .getByResourceGroupWithResponse( + "MyResourceGroup", "SampleActivityLogAlertRule", com.azure.core.util.Context.NONE); + } +} +``` + +### ActivityLogAlerts_List + +```java +/** Samples for ActivityLogAlerts List. */ +public final class ActivityLogAlertsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_ListBySubscriptionId.json + */ + /** + * Sample code: Get list of all Activity Log Alert rules under a subscription. + * + * @param manager Entry point to MonitorManager. + */ + public static void getListOfAllActivityLogAlertRulesUnderASubscription( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.activityLogAlerts().list(com.azure.core.util.Context.NONE); + } +} +``` + +### ActivityLogAlerts_ListByResourceGroup + +```java +/** Samples for ActivityLogAlerts ListByResourceGroup. */ +public final class ActivityLogAlertsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_ListByResourceGroupName.json + */ + /** + * Sample code: List activity log alerts. + * + * @param manager Entry point to MonitorManager. + */ + public static void listActivityLogAlerts(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.activityLogAlerts().listByResourceGroup("MyResourceGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### ActivityLogAlerts_Update + +```java +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ActivityLogAlerts Update. */ +public final class ActivityLogAlertsUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Update.json + */ + /** + * Sample code: Patch an Activity Log Alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void patchAnActivityLogAlertRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + ActivityLogAlertResource resource = + manager + .activityLogAlerts() + .getByResourceGroupWithResponse( + "MyResourceGroup", "SampleActivityLogAlertRule", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key1", "value1", "key2", "value2")).withEnabled(false).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ActivityLogs_List + +```java +/** Samples for ActivityLogs List. */ +public final class ActivityLogsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetActivityLogsFilteredAndSelected.json + */ + /** + * Sample code: Get Activity Logs with filter and select. + * + * @param manager Entry point to MonitorManager. + */ + public static void getActivityLogsWithFilterAndSelect( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .activityLogs() + .list( + "eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and" + + " resourceGroupName eq 'MSSupportGroup'", + "eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetActivityLogsFiltered.json + */ + /** + * Sample code: Get Activity Logs with filter. + * + * @param manager Entry point to MonitorManager. + */ + public static void getActivityLogsWithFilter(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .activityLogs() + .list( + "eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and" + + " resourceGroupName eq 'MSSupportGroup'", + null, + com.azure.core.util.Context.NONE); + } +} +``` + +### AlertRuleIncidents_Get + +```java +/** Samples for AlertRuleIncidents Get. */ +public final class AlertRuleIncidentsGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getAlertRuleIncident.json + */ + /** + * Sample code: Get a single alert rule incident. + * + * @param manager Entry point to MonitorManager. + */ + public static void getASingleAlertRuleIncident(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .alertRuleIncidents() + .getWithResponse("Rac46PostSwapRG", "myRuleName", "Website_started", com.azure.core.util.Context.NONE); + } +} +``` + +### AlertRuleIncidents_ListByAlertRule + +```java +/** Samples for AlertRuleIncidents ListByAlertRule. */ +public final class AlertRuleIncidentsListByAlertRuleSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listAlertRuleIncidents.json + */ + /** + * Sample code: List alert rule incidents. + * + * @param manager Entry point to MonitorManager. + */ + public static void listAlertRuleIncidents(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.alertRuleIncidents().listByAlertRule("Rac46PostSwapRG", "myRuleName", com.azure.core.util.Context.NONE); + } +} +``` + +### AlertRules_CreateOrUpdate + +```java +import com.azure.resourcemanager.monitor.generated.models.ConditionOperator; +import com.azure.resourcemanager.monitor.generated.models.RuleMetricDataSource; +import com.azure.resourcemanager.monitor.generated.models.ThresholdRuleCondition; +import com.azure.resourcemanager.monitor.generated.models.TimeAggregationOperator; +import java.time.Duration; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AlertRules CreateOrUpdate. */ +public final class AlertRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/createOrUpdateAlertRule.json + */ + /** + * Sample code: Create or update an alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnAlertRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .alertRules() + .define("chiricutin") + .withRegion("West US") + .withExistingResourceGroup("Rac46PostSwapRG") + .withNamePropertiesName("chiricutin") + .withIsEnabled(true) + .withCondition( + new ThresholdRuleCondition() + .withDataSource( + new RuleMetricDataSource() + .withResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest") + .withMetricName("Requests")) + .withOperator(ConditionOperator.GREATER_THAN) + .withThreshold(3.0) + .withWindowSize(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationOperator.TOTAL)) + .withTags(mapOf()) + .withDescription("Pura Vida") + .withActions(Arrays.asList()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### AlertRules_Delete + +```java +/** Samples for AlertRules Delete. */ +public final class AlertRulesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/deleteAlertRule.json + */ + /** + * Sample code: Delete an alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteAnAlertRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .alertRules() + .deleteByResourceGroupWithResponse("Rac46PostSwapRG", "chiricutin", com.azure.core.util.Context.NONE); + } +} +``` + +### AlertRules_GetByResourceGroup + +```java +/** Samples for AlertRules GetByResourceGroup. */ +public final class AlertRulesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getAlertRule.json + */ + /** + * Sample code: Get an alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnAlertRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .alertRules() + .getByResourceGroupWithResponse("Rac46PostSwapRG", "chiricutin", com.azure.core.util.Context.NONE); + } +} +``` + +### AlertRules_List + +```java +/** Samples for AlertRules List. */ +public final class AlertRulesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listAlertRuleBySubscription.json + */ + /** + * Sample code: List alert rules. + * + * @param manager Entry point to MonitorManager. + */ + public static void listAlertRules(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.alertRules().list(com.azure.core.util.Context.NONE); + } +} +``` + +### AlertRules_ListByResourceGroup + +```java +/** Samples for AlertRules ListByResourceGroup. */ +public final class AlertRulesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listAlertRule.json + */ + /** + * Sample code: List alert rules. + * + * @param manager Entry point to MonitorManager. + */ + public static void listAlertRules(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.alertRules().listByResourceGroup("Rac46PostSwapRG", com.azure.core.util.Context.NONE); + } +} +``` + +### AlertRules_Update + +```java +import com.azure.resourcemanager.monitor.generated.models.AlertRuleResource; +import com.azure.resourcemanager.monitor.generated.models.ConditionOperator; +import com.azure.resourcemanager.monitor.generated.models.RuleMetricDataSource; +import com.azure.resourcemanager.monitor.generated.models.ThresholdRuleCondition; +import com.azure.resourcemanager.monitor.generated.models.TimeAggregationOperator; +import java.time.Duration; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AlertRules Update. */ +public final class AlertRulesUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/patchAlertRule.json + */ + /** + * Sample code: Patch an alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void patchAnAlertRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + AlertRuleResource resource = + manager + .alertRules() + .getByResourceGroupWithResponse("Rac46PostSwapRG", "chiricutin", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("$type", "Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary")) + .withName("chiricutin") + .withDescription("Pura Vida") + .withIsEnabled(true) + .withCondition( + new ThresholdRuleCondition() + .withDataSource( + new RuleMetricDataSource() + .withResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest") + .withMetricName("Requests")) + .withOperator(ConditionOperator.GREATER_THAN) + .withThreshold(3.0) + .withWindowSize(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationOperator.TOTAL)) + .withActions(Arrays.asList()) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### AutoscaleSettings_CreateOrUpdate + +```java +import com.azure.resourcemanager.monitor.generated.models.AutoscaleNotification; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleProfile; +import com.azure.resourcemanager.monitor.generated.models.ComparisonOperationType; +import com.azure.resourcemanager.monitor.generated.models.EmailNotification; +import com.azure.resourcemanager.monitor.generated.models.MetricStatisticType; +import com.azure.resourcemanager.monitor.generated.models.MetricTrigger; +import com.azure.resourcemanager.monitor.generated.models.PredictiveAutoscalePolicy; +import com.azure.resourcemanager.monitor.generated.models.PredictiveAutoscalePolicyScaleMode; +import com.azure.resourcemanager.monitor.generated.models.Recurrence; +import com.azure.resourcemanager.monitor.generated.models.RecurrenceFrequency; +import com.azure.resourcemanager.monitor.generated.models.RecurrentSchedule; +import com.azure.resourcemanager.monitor.generated.models.ScaleAction; +import com.azure.resourcemanager.monitor.generated.models.ScaleCapacity; +import com.azure.resourcemanager.monitor.generated.models.ScaleDirection; +import com.azure.resourcemanager.monitor.generated.models.ScaleRule; +import com.azure.resourcemanager.monitor.generated.models.ScaleType; +import com.azure.resourcemanager.monitor.generated.models.TimeAggregationType; +import com.azure.resourcemanager.monitor.generated.models.TimeWindow; +import com.azure.resourcemanager.monitor.generated.models.WebhookNotification; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AutoscaleSettings CreateOrUpdate. */ +public final class AutoscaleSettingsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/createOrUpdateAutoscaleSetting.json + */ + /** + * Sample code: Create or update an autoscale setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnAutoscaleSetting( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .autoscaleSettings() + .define("MySetting") + .withRegion("West US") + .withExistingResourceGroup("TestingMetricsScaleSet") + .withProfiles( + Arrays + .asList( + new AutoscaleProfile() + .withName("adios") + .withCapacity( + new ScaleCapacity().withMinimum("1").withMaximum("10").withDefaultProperty("1")) + .withRules( + Arrays + .asList( + new ScaleRule() + .withMetricTrigger( + new MetricTrigger() + .withMetricName("Percentage CPU") + .withMetricResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .withTimeGrain(Duration.parse("PT1M")) + .withStatistic(MetricStatisticType.AVERAGE) + .withTimeWindow(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationType.AVERAGE) + .withOperator(ComparisonOperationType.GREATER_THAN) + .withThreshold(10.0) + .withDividePerInstance(false)) + .withScaleAction( + new ScaleAction() + .withDirection(ScaleDirection.INCREASE) + .withType(ScaleType.CHANGE_COUNT) + .withValue("1") + .withCooldown(Duration.parse("PT5M"))), + new ScaleRule() + .withMetricTrigger( + new MetricTrigger() + .withMetricName("Percentage CPU") + .withMetricResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .withTimeGrain(Duration.parse("PT2M")) + .withStatistic(MetricStatisticType.AVERAGE) + .withTimeWindow(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationType.AVERAGE) + .withOperator(ComparisonOperationType.GREATER_THAN) + .withThreshold(15.0) + .withDividePerInstance(false)) + .withScaleAction( + new ScaleAction() + .withDirection(ScaleDirection.DECREASE) + .withType(ScaleType.CHANGE_COUNT) + .withValue("2") + .withCooldown(Duration.parse("PT6M"))))) + .withFixedDate( + new TimeWindow() + .withTimeZone("UTC") + .withStart(OffsetDateTime.parse("2015-03-05T14:00:00Z")) + .withEnd(OffsetDateTime.parse("2015-03-05T14:30:00Z"))), + new AutoscaleProfile() + .withName("saludos") + .withCapacity( + new ScaleCapacity().withMinimum("1").withMaximum("10").withDefaultProperty("1")) + .withRules( + Arrays + .asList( + new ScaleRule() + .withMetricTrigger( + new MetricTrigger() + .withMetricName("Percentage CPU") + .withMetricResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .withTimeGrain(Duration.parse("PT1M")) + .withStatistic(MetricStatisticType.AVERAGE) + .withTimeWindow(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationType.AVERAGE) + .withOperator(ComparisonOperationType.GREATER_THAN) + .withThreshold(10.0) + .withDividePerInstance(false)) + .withScaleAction( + new ScaleAction() + .withDirection(ScaleDirection.INCREASE) + .withType(ScaleType.CHANGE_COUNT) + .withValue("1") + .withCooldown(Duration.parse("PT5M"))), + new ScaleRule() + .withMetricTrigger( + new MetricTrigger() + .withMetricName("Percentage CPU") + .withMetricResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .withTimeGrain(Duration.parse("PT2M")) + .withStatistic(MetricStatisticType.AVERAGE) + .withTimeWindow(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationType.AVERAGE) + .withOperator(ComparisonOperationType.GREATER_THAN) + .withThreshold(15.0) + .withDividePerInstance(false)) + .withScaleAction( + new ScaleAction() + .withDirection(ScaleDirection.DECREASE) + .withType(ScaleType.CHANGE_COUNT) + .withValue("2") + .withCooldown(Duration.parse("PT6M"))))) + .withRecurrence( + new Recurrence() + .withFrequency(RecurrenceFrequency.WEEK) + .withSchedule( + new RecurrentSchedule() + .withTimeZone("UTC") + .withDays(Arrays.asList("1")) + .withHours(Arrays.asList(5)) + .withMinutes(Arrays.asList(15)))))) + .withTags(mapOf("key1", "value1", "key2", "value2")) + .withNotifications( + Arrays + .asList( + new AutoscaleNotification() + .withEmail( + new EmailNotification() + .withSendToSubscriptionAdministrator(true) + .withSendToSubscriptionCoAdministrators(true) + .withCustomEmails(Arrays.asList("gu@ms.com", "ge@ns.net"))) + .withWebhooks( + Arrays + .asList( + new WebhookNotification() + .withServiceUri("http://myservice.com") + .withProperties(mapOf()))))) + .withEnabled(true) + .withPredictiveAutoscalePolicy( + new PredictiveAutoscalePolicy().withScaleMode(PredictiveAutoscalePolicyScaleMode.ENABLED)) + .withTargetResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### AutoscaleSettings_Delete + +```java +/** Samples for AutoscaleSettings Delete. */ +public final class AutoscaleSettingsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/deleteAutoscaleSetting.json + */ + /** + * Sample code: Delete an autoscale setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteAnAutoscaleSetting(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .autoscaleSettings() + .deleteByResourceGroupWithResponse("TestingMetricsScaleSet", "MySetting", com.azure.core.util.Context.NONE); + } +} +``` + +### AutoscaleSettings_GetByResourceGroup + +```java +/** Samples for AutoscaleSettings GetByResourceGroup. */ +public final class AutoscaleSettingsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/getAutoscaleSetting.json + */ + /** + * Sample code: Get an autoscale setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnAutoscaleSetting(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .autoscaleSettings() + .getByResourceGroupWithResponse("TestingMetricsScaleSet", "MySetting", com.azure.core.util.Context.NONE); + } +} +``` + +### AutoscaleSettings_List + +```java +/** Samples for AutoscaleSettings List. */ +public final class AutoscaleSettingsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/listAutoscaleSettingBySubscription.json + */ + /** + * Sample code: List autoscale settings by subs. + * + * @param manager Entry point to MonitorManager. + */ + public static void listAutoscaleSettingsBySubs(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.autoscaleSettings().list(com.azure.core.util.Context.NONE); + } +} +``` + +### AutoscaleSettings_ListByResourceGroup + +```java +/** Samples for AutoscaleSettings ListByResourceGroup. */ +public final class AutoscaleSettingsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/listAutoscaleSetting.json + */ + /** + * Sample code: List autoscale settings. + * + * @param manager Entry point to MonitorManager. + */ + public static void listAutoscaleSettings(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.autoscaleSettings().listByResourceGroup("TestingMetricsScaleSet", com.azure.core.util.Context.NONE); + } +} +``` + +### AutoscaleSettings_Update + +```java +import com.azure.resourcemanager.monitor.generated.models.AutoscaleNotification; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleProfile; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleSettingResource; +import com.azure.resourcemanager.monitor.generated.models.ComparisonOperationType; +import com.azure.resourcemanager.monitor.generated.models.EmailNotification; +import com.azure.resourcemanager.monitor.generated.models.MetricStatisticType; +import com.azure.resourcemanager.monitor.generated.models.MetricTrigger; +import com.azure.resourcemanager.monitor.generated.models.PredictiveAutoscalePolicy; +import com.azure.resourcemanager.monitor.generated.models.PredictiveAutoscalePolicyScaleMode; +import com.azure.resourcemanager.monitor.generated.models.Recurrence; +import com.azure.resourcemanager.monitor.generated.models.RecurrenceFrequency; +import com.azure.resourcemanager.monitor.generated.models.RecurrentSchedule; +import com.azure.resourcemanager.monitor.generated.models.ScaleAction; +import com.azure.resourcemanager.monitor.generated.models.ScaleCapacity; +import com.azure.resourcemanager.monitor.generated.models.ScaleDirection; +import com.azure.resourcemanager.monitor.generated.models.ScaleRule; +import com.azure.resourcemanager.monitor.generated.models.ScaleType; +import com.azure.resourcemanager.monitor.generated.models.TimeAggregationType; +import com.azure.resourcemanager.monitor.generated.models.TimeWindow; +import com.azure.resourcemanager.monitor.generated.models.WebhookNotification; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AutoscaleSettings Update. */ +public final class AutoscaleSettingsUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/patchAutoscaleSetting.json + */ + /** + * Sample code: Patch an autoscale setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void patchAnAutoscaleSetting(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + AutoscaleSettingResource resource = + manager + .autoscaleSettings() + .getByResourceGroupWithResponse("TestingMetricsScaleSet", "MySetting", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key1", "value1")) + .withProfiles( + Arrays + .asList( + new AutoscaleProfile() + .withName("adios") + .withCapacity( + new ScaleCapacity().withMinimum("1").withMaximum("10").withDefaultProperty("1")) + .withRules( + Arrays + .asList( + new ScaleRule() + .withMetricTrigger( + new MetricTrigger() + .withMetricName("Percentage CPU") + .withMetricResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .withTimeGrain(Duration.parse("PT1M")) + .withStatistic(MetricStatisticType.AVERAGE) + .withTimeWindow(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationType.AVERAGE) + .withOperator(ComparisonOperationType.GREATER_THAN) + .withThreshold(10.0) + .withDividePerInstance(false)) + .withScaleAction( + new ScaleAction() + .withDirection(ScaleDirection.INCREASE) + .withType(ScaleType.CHANGE_COUNT) + .withValue("1") + .withCooldown(Duration.parse("PT5M"))), + new ScaleRule() + .withMetricTrigger( + new MetricTrigger() + .withMetricName("Percentage CPU") + .withMetricResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .withTimeGrain(Duration.parse("PT2M")) + .withStatistic(MetricStatisticType.AVERAGE) + .withTimeWindow(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationType.AVERAGE) + .withOperator(ComparisonOperationType.GREATER_THAN) + .withThreshold(15.0) + .withDividePerInstance(false)) + .withScaleAction( + new ScaleAction() + .withDirection(ScaleDirection.DECREASE) + .withType(ScaleType.CHANGE_COUNT) + .withValue("2") + .withCooldown(Duration.parse("PT6M"))))) + .withFixedDate( + new TimeWindow() + .withTimeZone("UTC") + .withStart(OffsetDateTime.parse("2015-03-05T14:00:00Z")) + .withEnd(OffsetDateTime.parse("2015-03-05T14:30:00Z"))), + new AutoscaleProfile() + .withName("saludos") + .withCapacity( + new ScaleCapacity().withMinimum("1").withMaximum("10").withDefaultProperty("1")) + .withRules( + Arrays + .asList( + new ScaleRule() + .withMetricTrigger( + new MetricTrigger() + .withMetricName("Percentage CPU") + .withMetricResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .withTimeGrain(Duration.parse("PT1M")) + .withStatistic(MetricStatisticType.AVERAGE) + .withTimeWindow(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationType.AVERAGE) + .withOperator(ComparisonOperationType.GREATER_THAN) + .withThreshold(10.0) + .withDividePerInstance(false)) + .withScaleAction( + new ScaleAction() + .withDirection(ScaleDirection.INCREASE) + .withType(ScaleType.CHANGE_COUNT) + .withValue("1") + .withCooldown(Duration.parse("PT5M"))), + new ScaleRule() + .withMetricTrigger( + new MetricTrigger() + .withMetricName("Percentage CPU") + .withMetricResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .withTimeGrain(Duration.parse("PT2M")) + .withStatistic(MetricStatisticType.AVERAGE) + .withTimeWindow(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationType.AVERAGE) + .withOperator(ComparisonOperationType.GREATER_THAN) + .withThreshold(15.0) + .withDividePerInstance(false)) + .withScaleAction( + new ScaleAction() + .withDirection(ScaleDirection.DECREASE) + .withType(ScaleType.CHANGE_COUNT) + .withValue("2") + .withCooldown(Duration.parse("PT6M"))))) + .withRecurrence( + new Recurrence() + .withFrequency(RecurrenceFrequency.WEEK) + .withSchedule( + new RecurrentSchedule() + .withTimeZone("UTC") + .withDays(Arrays.asList("1")) + .withHours(Arrays.asList(5)) + .withMinutes(Arrays.asList(15)))))) + .withNotifications( + Arrays + .asList( + new AutoscaleNotification() + .withEmail( + new EmailNotification() + .withSendToSubscriptionAdministrator(true) + .withSendToSubscriptionCoAdministrators(true) + .withCustomEmails(Arrays.asList("gu@ms.com", "ge@ns.net"))) + .withWebhooks( + Arrays + .asList( + new WebhookNotification() + .withServiceUri("http://myservice.com") + .withProperties(mapOf()))))) + .withEnabled(true) + .withPredictiveAutoscalePolicy( + new PredictiveAutoscalePolicy().withScaleMode(PredictiveAutoscalePolicyScaleMode.ENABLED)) + .withTargetResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### AzureMonitorWorkspaces_Create + +```java +/** Samples for AzureMonitorWorkspaces Create. */ +public final class AzureMonitorWorkspacesCreateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesCreate.json + */ + /** + * Sample code: Create or update workspace. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateWorkspace(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .azureMonitorWorkspaces() + .define("myAzureMonitorWorkspace") + .withRegion("eastus") + .withExistingResourceGroup("myResourceGroup") + .create(); + } +} +``` + +### AzureMonitorWorkspaces_Delete + +```java +/** Samples for AzureMonitorWorkspaces Delete. */ +public final class AzureMonitorWorkspacesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesDelete.json + */ + /** + * Sample code: Delete workspace. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteWorkspace(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .azureMonitorWorkspaces() + .deleteByResourceGroupWithResponse( + "myResourceGroup", "myAzureMonitorWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### AzureMonitorWorkspaces_GetByResourceGroup + +```java +/** Samples for AzureMonitorWorkspaces GetByResourceGroup. */ +public final class AzureMonitorWorkspacesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesGet.json + */ + /** + * Sample code: Get workspace. + * + * @param manager Entry point to MonitorManager. + */ + public static void getWorkspace(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .azureMonitorWorkspaces() + .getByResourceGroupWithResponse( + "myResourceGroup", "myAzureMonitorWorkspace", com.azure.core.util.Context.NONE); + } +} +``` + +### AzureMonitorWorkspaces_List + +```java +/** Samples for AzureMonitorWorkspaces List. */ +public final class AzureMonitorWorkspacesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesListBySubscription.json + */ + /** + * Sample code: List workspaces by subscription. + * + * @param manager Entry point to MonitorManager. + */ + public static void listWorkspacesBySubscription( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.azureMonitorWorkspaces().list(com.azure.core.util.Context.NONE); + } +} +``` + +### AzureMonitorWorkspaces_ListByResourceGroup + +```java +/** Samples for AzureMonitorWorkspaces ListByResourceGroup. */ +public final class AzureMonitorWorkspacesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesListByResourceGroup.json + */ + /** + * Sample code: List monitor workspaces by resource group. + * + * @param manager Entry point to MonitorManager. + */ + public static void listMonitorWorkspacesByResourceGroup( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.azureMonitorWorkspaces().listByResourceGroup("myResourceGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### AzureMonitorWorkspaces_Update + +```java +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorWorkspaceResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AzureMonitorWorkspaces Update. */ +public final class AzureMonitorWorkspacesUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesUpdate.json + */ + /** + * Sample code: Update workspace. + * + * @param manager Entry point to MonitorManager. + */ + public static void updateWorkspace(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + AzureMonitorWorkspaceResource resource = + manager + .azureMonitorWorkspaces() + .getByResourceGroupWithResponse( + "myResourceGroup", "myAzureMonitorWorkspace", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tag1", "A", "tag2", "B", "tag3", "C")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### Baselines_List + +```java +import java.time.Duration; + +/** Samples for Baselines List. */ +public final class BaselinesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2019-03-01/examples/metricBaselines.json + */ + /** + * Sample code: Get metric baselines. + * + * @param manager Entry point to MonitorManager. + */ + public static void getMetricBaselines(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .baselines() + .list( + "subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1", + null, + null, + "2019-03-12T11:00:00.000Z/2019-03-12T12:00:00.000Z", + Duration.parse("PT1H"), + "average", + "Low,Medium", + null, + null, + com.azure.core.util.Context.NONE); + } +} +``` + +### DataCollectionEndpoints_Create + +```java +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointNetworkAcls; +import com.azure.resourcemanager.monitor.generated.models.KnownPublicNetworkAccessOptions; + +/** Samples for DataCollectionEndpoints Create. */ +public final class DataCollectionEndpointsCreateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionEndpointsCreate.json + */ + /** + * Sample code: Create or update data collection endpoint. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateDataCollectionEndpoint( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionEndpoints() + .define("myCollectionEndpoint") + .withRegion("eastus") + .withExistingResourceGroup("myResourceGroup") + .withNetworkAcls( + new DataCollectionEndpointNetworkAcls() + .withPublicNetworkAccess(KnownPublicNetworkAccessOptions.ENABLED)) + .create(); + } +} +``` + +### DataCollectionEndpoints_Delete + +```java +/** Samples for DataCollectionEndpoints Delete. */ +public final class DataCollectionEndpointsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionEndpointsDelete.json + */ + /** + * Sample code: Delete data collection endpoint. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteDataCollectionEndpoint( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionEndpoints() + .deleteByResourceGroupWithResponse( + "myResourceGroup", "myCollectionEndpoint", com.azure.core.util.Context.NONE); + } +} +``` + +### DataCollectionEndpoints_GetByResourceGroup + +```java +/** Samples for DataCollectionEndpoints GetByResourceGroup. */ +public final class DataCollectionEndpointsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionEndpointsGet.json + */ + /** + * Sample code: Get data collection endpoint. + * + * @param manager Entry point to MonitorManager. + */ + public static void getDataCollectionEndpoint(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionEndpoints() + .getByResourceGroupWithResponse( + "myResourceGroup", "myCollectionEndpoint", com.azure.core.util.Context.NONE); + } +} +``` + +### DataCollectionEndpoints_List + +```java +/** Samples for DataCollectionEndpoints List. */ +public final class DataCollectionEndpointsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionEndpointsListBySubscription.json + */ + /** + * Sample code: List data collection endpoints by subscription. + * + * @param manager Entry point to MonitorManager. + */ + public static void listDataCollectionEndpointsBySubscription( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.dataCollectionEndpoints().list(com.azure.core.util.Context.NONE); + } +} +``` + +### DataCollectionEndpoints_ListByResourceGroup + +```java +/** Samples for DataCollectionEndpoints ListByResourceGroup. */ +public final class DataCollectionEndpointsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionEndpointsListByResourceGroup.json + */ + /** + * Sample code: List data collection endpoints by resource group. + * + * @param manager Entry point to MonitorManager. + */ + public static void listDataCollectionEndpointsByResourceGroup( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.dataCollectionEndpoints().listByResourceGroup("myResourceGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### DataCollectionEndpoints_Update + +```java +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DataCollectionEndpoints Update. */ +public final class DataCollectionEndpointsUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionEndpointsUpdate.json + */ + /** + * Sample code: Update data collection endpoint. + * + * @param manager Entry point to MonitorManager. + */ + public static void updateDataCollectionEndpoint( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + DataCollectionEndpointResource resource = + manager + .dataCollectionEndpoints() + .getByResourceGroupWithResponse( + "myResourceGroup", "myCollectionEndpoint", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tag1", "A", "tag2", "B", "tag3", "C")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### DataCollectionRuleAssociations_Create + +```java +/** Samples for DataCollectionRuleAssociations Create. */ +public final class DataCollectionRuleAssociationsCreateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRuleAssociationsCreate.json + */ + /** + * Sample code: Create or update association. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAssociation(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionRuleAssociations() + .define("myAssociation") + .withExistingResourceUri( + "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm") + .withDataCollectionRuleId( + "/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule") + .create(); + } +} +``` + +### DataCollectionRuleAssociations_Delete + +```java +/** Samples for DataCollectionRuleAssociations Delete. */ +public final class DataCollectionRuleAssociationsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRuleAssociationsDelete.json + */ + /** + * Sample code: Delete association. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteAssociation(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionRuleAssociations() + .deleteByResourceGroupWithResponse( + "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", + "myAssociation", + com.azure.core.util.Context.NONE); + } +} +``` + +### DataCollectionRuleAssociations_Get + +```java +/** Samples for DataCollectionRuleAssociations Get. */ +public final class DataCollectionRuleAssociationsGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRuleAssociationsGet.json + */ + /** + * Sample code: Get association. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAssociation(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionRuleAssociations() + .getWithResponse( + "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", + "myAssociation", + com.azure.core.util.Context.NONE); + } +} +``` + +### DataCollectionRuleAssociations_ListByDataCollectionEndpoint + +```java +/** Samples for DataCollectionRuleAssociations ListByDataCollectionEndpoint. */ +public final class DataCollectionRuleAssociationsListByDataCollectionEndpointSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRuleAssociationsListByDataCollectionEndpoint.json + */ + /** + * Sample code: List associations for specified data collection endpoint. + * + * @param manager Entry point to MonitorManager. + */ + public static void listAssociationsForSpecifiedDataCollectionEndpoint( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionRuleAssociations() + .listByDataCollectionEndpoint( + "myResourceGroup", "myDataCollectionEndpointName", com.azure.core.util.Context.NONE); + } +} +``` + +### DataCollectionRuleAssociations_ListByResource + +```java +/** Samples for DataCollectionRuleAssociations ListByResource. */ +public final class DataCollectionRuleAssociationsListByResourceSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRuleAssociationsListByResource.json + */ + /** + * Sample code: List associations for specified resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void listAssociationsForSpecifiedResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionRuleAssociations() + .listByResource( + "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", + com.azure.core.util.Context.NONE); + } +} +``` + +### DataCollectionRuleAssociations_ListByRule + +```java +/** Samples for DataCollectionRuleAssociations ListByRule. */ +public final class DataCollectionRuleAssociationsListByRuleSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRuleAssociationsListByRule.json + */ + /** + * Sample code: List associations for specified data collection rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void listAssociationsForSpecifiedDataCollectionRule( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionRuleAssociations() + .listByRule("myResourceGroup", "myCollectionRule", com.azure.core.util.Context.NONE); + } +} +``` + +### DataCollectionRules_Create + +```java +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleDataSources; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleDestinations; +import com.azure.resourcemanager.monitor.generated.models.DataFlow; +import com.azure.resourcemanager.monitor.generated.models.KnownDataFlowStreams; +import com.azure.resourcemanager.monitor.generated.models.KnownPerfCounterDataSourceStreams; +import com.azure.resourcemanager.monitor.generated.models.KnownSyslogDataSourceFacilityNames; +import com.azure.resourcemanager.monitor.generated.models.KnownSyslogDataSourceLogLevels; +import com.azure.resourcemanager.monitor.generated.models.KnownSyslogDataSourceStreams; +import com.azure.resourcemanager.monitor.generated.models.KnownWindowsEventLogDataSourceStreams; +import com.azure.resourcemanager.monitor.generated.models.LogAnalyticsDestination; +import com.azure.resourcemanager.monitor.generated.models.PerfCounterDataSource; +import com.azure.resourcemanager.monitor.generated.models.SyslogDataSource; +import com.azure.resourcemanager.monitor.generated.models.WindowsEventLogDataSource; +import java.util.Arrays; + +/** Samples for DataCollectionRules Create. */ +public final class DataCollectionRulesCreateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRulesCreate.json + */ + /** + * Sample code: Create or update data collection rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateDataCollectionRule( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionRules() + .define("myCollectionRule") + .withRegion("eastus") + .withExistingResourceGroup("myResourceGroup") + .withDataSources( + new DataCollectionRuleDataSources() + .withPerformanceCounters( + Arrays + .asList( + new PerfCounterDataSource() + .withStreams(Arrays.asList(KnownPerfCounterDataSourceStreams.MICROSOFT_PERF)) + .withSamplingFrequencyInSeconds(15) + .withCounterSpecifiers( + Arrays + .asList( + "\\Processor(_Total)\\% Processor Time", + "\\Memory\\Committed Bytes", + "\\LogicalDisk(_Total)\\Free Megabytes", + "\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")) + .withName("cloudTeamCoreCounters"), + new PerfCounterDataSource() + .withStreams(Arrays.asList(KnownPerfCounterDataSourceStreams.MICROSOFT_PERF)) + .withSamplingFrequencyInSeconds(30) + .withCounterSpecifiers(Arrays.asList("\\Process(_Total)\\Thread Count")) + .withName("appTeamExtraCounters"))) + .withWindowsEventLogs( + Arrays + .asList( + new WindowsEventLogDataSource() + .withStreams( + Arrays.asList(KnownWindowsEventLogDataSourceStreams.MICROSOFT_WINDOWS_EVENT)) + .withXPathQueries(Arrays.asList("Security!")) + .withName("cloudSecurityTeamEvents"), + new WindowsEventLogDataSource() + .withStreams( + Arrays.asList(KnownWindowsEventLogDataSourceStreams.MICROSOFT_WINDOWS_EVENT)) + .withXPathQueries( + Arrays + .asList( + "System![System[(Level = 1 or Level = 2 or Level = 3)]]", + "Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")) + .withName("appTeam1AppEvents"))) + .withSyslog( + Arrays + .asList( + new SyslogDataSource() + .withStreams(Arrays.asList(KnownSyslogDataSourceStreams.MICROSOFT_SYSLOG)) + .withFacilityNames(Arrays.asList(KnownSyslogDataSourceFacilityNames.CRON)) + .withLogLevels( + Arrays + .asList( + KnownSyslogDataSourceLogLevels.DEBUG, + KnownSyslogDataSourceLogLevels.CRITICAL, + KnownSyslogDataSourceLogLevels.EMERGENCY)) + .withName("cronSyslog"), + new SyslogDataSource() + .withStreams(Arrays.asList(KnownSyslogDataSourceStreams.MICROSOFT_SYSLOG)) + .withFacilityNames(Arrays.asList(KnownSyslogDataSourceFacilityNames.SYSLOG)) + .withLogLevels( + Arrays + .asList( + KnownSyslogDataSourceLogLevels.ALERT, + KnownSyslogDataSourceLogLevels.CRITICAL, + KnownSyslogDataSourceLogLevels.EMERGENCY)) + .withName("syslogBase")))) + .withDestinations( + new DataCollectionRuleDestinations() + .withLogAnalytics( + Arrays + .asList( + new LogAnalyticsDestination() + .withWorkspaceResourceId( + "/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace") + .withName("centralWorkspace")))) + .withDataFlows( + Arrays + .asList( + new DataFlow() + .withStreams( + Arrays + .asList( + KnownDataFlowStreams.MICROSOFT_PERF, + KnownDataFlowStreams.MICROSOFT_SYSLOG, + KnownDataFlowStreams.MICROSOFT_WINDOWS_EVENT)) + .withDestinations(Arrays.asList("centralWorkspace")))) + .create(); + } +} +``` + +### DataCollectionRules_Delete + +```java +/** Samples for DataCollectionRules Delete. */ +public final class DataCollectionRulesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRulesDelete.json + */ + /** + * Sample code: Delete data collection rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteDataCollectionRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionRules() + .deleteByResourceGroupWithResponse("myResourceGroup", "myCollectionRule", com.azure.core.util.Context.NONE); + } +} +``` + +### DataCollectionRules_GetByResourceGroup + +```java +/** Samples for DataCollectionRules GetByResourceGroup. */ +public final class DataCollectionRulesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRulesGet.json + */ + /** + * Sample code: Get data collection rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void getDataCollectionRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionRules() + .getByResourceGroupWithResponse("myResourceGroup", "myCollectionRule", com.azure.core.util.Context.NONE); + } +} +``` + +### DataCollectionRules_List + +```java +/** Samples for DataCollectionRules List. */ +public final class DataCollectionRulesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRulesListBySubscription.json + */ + /** + * Sample code: List data collection rules by subscription. + * + * @param manager Entry point to MonitorManager. + */ + public static void listDataCollectionRulesBySubscription( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.dataCollectionRules().list(com.azure.core.util.Context.NONE); + } +} +``` + +### DataCollectionRules_ListByResourceGroup + +```java +/** Samples for DataCollectionRules ListByResourceGroup. */ +public final class DataCollectionRulesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRulesListByResourceGroup.json + */ + /** + * Sample code: List data collection rules by resource group. + * + * @param manager Entry point to MonitorManager. + */ + public static void listDataCollectionRulesByResourceGroup( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.dataCollectionRules().listByResourceGroup("myResourceGroup", com.azure.core.util.Context.NONE); + } +} +``` + +### DataCollectionRules_Update + +```java +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DataCollectionRules Update. */ +public final class DataCollectionRulesUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRulesUpdate.json + */ + /** + * Sample code: Update data collection rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void updateDataCollectionRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + DataCollectionRuleResource resource = + manager + .dataCollectionRules() + .getByResourceGroupWithResponse("myResourceGroup", "myCollectionRule", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tag1", "A", "tag2", "B", "tag3", "C")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### DiagnosticSettingsCategory_Get + +```java +/** Samples for DiagnosticSettingsCategory Get. */ +public final class DiagnosticSettingsCategoryGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSettingsCategory.json + */ + /** + * Sample code: Gets the diagnostic setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsTheDiagnosticSetting(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .diagnosticSettingsCategories() + .getWithResponse( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + "WorkflowRuntime", + com.azure.core.util.Context.NONE); + } +} +``` + +### DiagnosticSettingsCategory_List + +```java +/** Samples for DiagnosticSettingsCategory List. */ +public final class DiagnosticSettingsCategoryListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettingsCategories.json + */ + /** + * Sample code: Gets the diagnostic setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsTheDiagnosticSetting(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .diagnosticSettingsCategories() + .list( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + com.azure.core.util.Context.NONE); + } +} +``` + +### DiagnosticSettingsOperation_CreateOrUpdate + +```java +import com.azure.resourcemanager.monitor.generated.models.LogSettings; +import com.azure.resourcemanager.monitor.generated.models.MetricSettings; +import com.azure.resourcemanager.monitor.generated.models.RetentionPolicy; +import java.util.Arrays; + +/** Samples for DiagnosticSettingsOperation CreateOrUpdate. */ +public final class DiagnosticSettingsOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/createOrUpdateDiagnosticSetting.json + */ + /** + * Sample code: Creates or Updates the diagnostic setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void createsOrUpdatesTheDiagnosticSetting( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .diagnosticSettingsOperations() + .define("mysetting") + .withExistingResourceUri( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6") + .withStorageAccountId( + "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1") + .withEventHubAuthorizationRuleId( + "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule") + .withEventHubName("myeventhub") + .withMetrics( + Arrays + .asList( + new MetricSettings() + .withCategory("WorkflowMetrics") + .withEnabled(true) + .withRetentionPolicy(new RetentionPolicy().withEnabled(false).withDays(0)))) + .withLogs( + Arrays + .asList( + new LogSettings() + .withCategoryGroup("allLogs") + .withEnabled(true) + .withRetentionPolicy(new RetentionPolicy().withEnabled(false).withDays(0)))) + .withWorkspaceId("") + .withMarketplacePartnerId( + "/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1") + .withLogAnalyticsDestinationType("Dedicated") + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/createOrUpdateDiagnosticSettingCategory.json + */ + /** + * Sample code: Creates or Updates the diagnostic setting for category. + * + * @param manager Entry point to MonitorManager. + */ + public static void createsOrUpdatesTheDiagnosticSettingForCategory( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .diagnosticSettingsOperations() + .define("mysetting") + .withExistingResourceUri( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6") + .withStorageAccountId( + "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1") + .withEventHubAuthorizationRuleId( + "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule") + .withEventHubName("myeventhub") + .withMetrics( + Arrays + .asList( + new MetricSettings() + .withCategory("WorkflowMetrics") + .withEnabled(true) + .withRetentionPolicy(new RetentionPolicy().withEnabled(false).withDays(0)))) + .withLogs( + Arrays + .asList( + new LogSettings() + .withCategory("WorkflowRuntime") + .withEnabled(true) + .withRetentionPolicy(new RetentionPolicy().withEnabled(false).withDays(0)))) + .withWorkspaceId("") + .withMarketplacePartnerId( + "/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1") + .withLogAnalyticsDestinationType("Dedicated") + .create(); + } +} +``` + +### DiagnosticSettingsOperation_Delete + +```java +/** Samples for DiagnosticSettingsOperation Delete. */ +public final class DiagnosticSettingsOperationDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/deleteDiagnosticSetting.json + */ + /** + * Sample code: Deletes the diagnostic setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void deletesTheDiagnosticSetting(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .diagnosticSettingsOperations() + .deleteByResourceGroupWithResponse( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + "mysetting", + com.azure.core.util.Context.NONE); + } +} +``` + +### DiagnosticSettingsOperation_Get + +```java +/** Samples for DiagnosticSettingsOperation Get. */ +public final class DiagnosticSettingsOperationGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSetting.json + */ + /** + * Sample code: Gets the diagnostic setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsTheDiagnosticSetting(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .diagnosticSettingsOperations() + .getWithResponse( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + "mysetting", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSettingCategory.json + */ + /** + * Sample code: Gets the diagnostic setting for category. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsTheDiagnosticSettingForCategory( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .diagnosticSettingsOperations() + .getWithResponse( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + "mysetting", + com.azure.core.util.Context.NONE); + } +} +``` + +### DiagnosticSettingsOperation_List + +```java +/** Samples for DiagnosticSettingsOperation List. */ +public final class DiagnosticSettingsOperationListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettings.json + */ + /** + * Sample code: Gets the diagnostic setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsTheDiagnosticSetting(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .diagnosticSettingsOperations() + .list( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettingsCategory.json + */ + /** + * Sample code: Gets the diagnostic setting for category. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsTheDiagnosticSettingForCategory( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .diagnosticSettingsOperations() + .list( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + com.azure.core.util.Context.NONE); + } +} +``` + +### EventCategories_List + +```java +/** Samples for EventCategories List. */ +public final class EventCategoriesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetEventCategories.json + */ + /** + * Sample code: Get event categories. + * + * @param manager Entry point to MonitorManager. + */ + public static void getEventCategories(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.eventCategories().list(com.azure.core.util.Context.NONE); + } +} +``` + +### LogProfiles_CreateOrUpdate + +```java +import com.azure.resourcemanager.monitor.generated.models.RetentionPolicy; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for LogProfiles CreateOrUpdate. */ +public final class LogProfilesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/createOrUpdateLogProfile.json + */ + /** + * Sample code: Create or update a log profile. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateALogProfile(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .logProfiles() + .define("Rac46PostSwapRG") + .withRegion("") + .withLocations(Arrays.asList("global")) + .withCategories(Arrays.asList("Write", "Delete", "Action")) + .withRetentionPolicy(new RetentionPolicy().withEnabled(true).withDays(3)) + .withTags(mapOf()) + .withStorageAccountId( + "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162") + .withServiceBusRuleId("") + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### LogProfiles_Delete + +```java +/** Samples for LogProfiles Delete. */ +public final class LogProfilesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/deleteLogProfile.json + */ + /** + * Sample code: Delete log profile. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteLogProfile(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.logProfiles().deleteWithResponse("Rac46PostSwapRG", com.azure.core.util.Context.NONE); + } +} +``` + +### LogProfiles_Get + +```java +/** Samples for LogProfiles Get. */ +public final class LogProfilesGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getLogProfile.json + */ + /** + * Sample code: Get log profile. + * + * @param manager Entry point to MonitorManager. + */ + public static void getLogProfile(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.logProfiles().getWithResponse("default", com.azure.core.util.Context.NONE); + } +} +``` + +### LogProfiles_List + +```java +/** Samples for LogProfiles List. */ +public final class LogProfilesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listLogProfile.json + */ + /** + * Sample code: List log profiles. + * + * @param manager Entry point to MonitorManager. + */ + public static void listLogProfiles(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.logProfiles().list(com.azure.core.util.Context.NONE); + } +} +``` + +### LogProfiles_Update + +```java +import com.azure.resourcemanager.monitor.generated.models.LogProfileResource; +import com.azure.resourcemanager.monitor.generated.models.RetentionPolicy; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for LogProfiles Update. */ +public final class LogProfilesUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/patchLogProfile.json + */ + /** + * Sample code: Patch a log profile. + * + * @param manager Entry point to MonitorManager. + */ + public static void patchALogProfile(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + LogProfileResource resource = + manager.logProfiles().getWithResponse("Rac46PostSwapRG", com.azure.core.util.Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("key1", "value1")) + .withStorageAccountId( + "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162") + .withServiceBusRuleId("") + .withLocations(Arrays.asList("global")) + .withCategories(Arrays.asList("Write", "Delete", "Action")) + .withRetentionPolicy(new RetentionPolicy().withEnabled(true).withDays(3)) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### MetricAlerts_CreateOrUpdate + +```java +import com.azure.resourcemanager.monitor.generated.models.AggregationTypeEnum; +import com.azure.resourcemanager.monitor.generated.models.DynamicMetricCriteria; +import com.azure.resourcemanager.monitor.generated.models.DynamicThresholdFailingPeriods; +import com.azure.resourcemanager.monitor.generated.models.DynamicThresholdOperator; +import com.azure.resourcemanager.monitor.generated.models.DynamicThresholdSensitivity; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertAction; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertMultipleResourceMultipleMetricCriteria; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertSingleResourceMultipleMetricCriteria; +import com.azure.resourcemanager.monitor.generated.models.MetricCriteria; +import com.azure.resourcemanager.monitor.generated.models.MetricDimension; +import com.azure.resourcemanager.monitor.generated.models.Operator; +import com.azure.resourcemanager.monitor.generated.models.WebtestLocationAvailabilityCriteria; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for MetricAlerts CreateOrUpdate. */ +public final class MetricAlertsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertSubscription.json + */ + /** + * Sample code: Create or update an alert rule on Subscription. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnAlertRuleOnSubscription( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .define("MetricAlertAtSubscriptionLevel") + .withRegion("global") + .withExistingResourceGroup("gigtest") + .withSeverity(3) + .withEnabled(true) + .withScopes(Arrays.asList("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7")) + .withEvaluationFrequency(Duration.parse("PT1M")) + .withWindowSize(Duration.parse("PT15M")) + .withCriteria( + new MetricAlertMultipleResourceMultipleMetricCriteria() + .withAllOf( + Arrays + .asList( + new MetricCriteria() + .withName("High_CPU_80") + .withMetricName("Percentage CPU") + .withMetricNamespace("microsoft.compute/virtualmachines") + .withTimeAggregation(AggregationTypeEnum.AVERAGE) + .withDimensions(Arrays.asList()) + .withOperator(Operator.GREATER_THAN) + .withThreshold(80.5)))) + .withTags(mapOf()) + .withDescription("This is the description of the rule1") + .withTargetResourceType("Microsoft.Compute/virtualMachines") + .withTargetResourceRegion("southcentralus") + .withAutoMitigate(true) + .withActions( + Arrays + .asList( + new MetricAlertAction() + .withActionGroupId( + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2") + .withWebhookProperties(mapOf("key11", "value11", "key12", "value12")))) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertResourceGroup.json + */ + /** + * Sample code: Create or update an alert rule on Resource group(s). + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnAlertRuleOnResourceGroupS( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .define("MetricAlertAtResourceGroupLevel") + .withRegion("global") + .withExistingResourceGroup("gigtest1") + .withSeverity(3) + .withEnabled(true) + .withScopes( + Arrays + .asList( + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1", + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2")) + .withEvaluationFrequency(Duration.parse("PT1M")) + .withWindowSize(Duration.parse("PT15M")) + .withCriteria( + new MetricAlertMultipleResourceMultipleMetricCriteria() + .withAllOf( + Arrays + .asList( + new MetricCriteria() + .withName("High_CPU_80") + .withMetricName("Percentage CPU") + .withMetricNamespace("microsoft.compute/virtualmachines") + .withTimeAggregation(AggregationTypeEnum.AVERAGE) + .withDimensions(Arrays.asList()) + .withOperator(Operator.GREATER_THAN) + .withThreshold(80.5)))) + .withTags(mapOf()) + .withDescription("This is the description of the rule1") + .withTargetResourceType("Microsoft.Compute/virtualMachines") + .withTargetResourceRegion("southcentralus") + .withAutoMitigate(true) + .withActions( + Arrays + .asList( + new MetricAlertAction() + .withActionGroupId( + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2") + .withWebhookProperties(mapOf("key11", "value11", "key12", "value12")))) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertWithDimensions.json + */ + /** + * Sample code: Create or update an alert rules with dimensions. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnAlertRulesWithDimensions( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .define("MetricAlertOnMultipleDimensions") + .withRegion("global") + .withExistingResourceGroup("gigtest") + .withSeverity(3) + .withEnabled(true) + .withScopes( + Arrays + .asList( + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.KeyVault/vaults/keyVaultResource")) + .withEvaluationFrequency(Duration.parse("PT1H")) + .withWindowSize(Duration.parse("P1D")) + .withCriteria( + new MetricAlertMultipleResourceMultipleMetricCriteria() + .withAllOf( + Arrays + .asList( + new MetricCriteria() + .withName("Metric1") + .withMetricName("Availability") + .withMetricNamespace("Microsoft.KeyVault/vaults") + .withTimeAggregation(AggregationTypeEnum.AVERAGE) + .withDimensions( + Arrays + .asList( + new MetricDimension() + .withName("ActivityName") + .withOperator("Include") + .withValues(Arrays.asList("*")), + new MetricDimension() + .withName("StatusCode") + .withOperator("Include") + .withValues(Arrays.asList("200")))) + .withOperator(Operator.GREATER_THAN) + .withThreshold(55.0)))) + .withTags(mapOf()) + .withDescription("This is the description of the rule1") + .withAutoMitigate(true) + .withActions( + Arrays + .asList( + new MetricAlertAction() + .withActionGroupId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2") + .withWebhookProperties(mapOf("key11", "value11", "key12", "value12")))) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateWebTestMetricAlert.json + */ + /** + * Sample code: Create or update a web test alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAWebTestAlertRule( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .define("webtest-name-example") + .withRegion("global") + .withExistingResourceGroup("rg-example") + .withSeverity(4) + .withEnabled(true) + .withScopes( + Arrays + .asList( + "/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")) + .withEvaluationFrequency(Duration.parse("PT1M")) + .withWindowSize(Duration.parse("PT15M")) + .withCriteria( + new WebtestLocationAvailabilityCriteria() + .withWebTestId( + "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example") + .withComponentId( + "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example") + .withFailedLocationCount(2f)) + .withTags( + mapOf( + "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")) + .withDescription("Automatically created alert rule for availability test \"component-example\" a") + .withActions(Arrays.asList()) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateDynamicMetricAlertSingleResource.json + */ + /** + * Sample code: Create or update a dynamic alert rule for Single Resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateADynamicAlertRuleForSingleResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .define("chiricutin") + .withRegion("global") + .withExistingResourceGroup("gigtest") + .withSeverity(3) + .withEnabled(true) + .withScopes( + Arrays + .asList( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")) + .withEvaluationFrequency(Duration.parse("PT1M")) + .withWindowSize(Duration.parse("PT15M")) + .withCriteria( + new MetricAlertMultipleResourceMultipleMetricCriteria() + .withAllOf( + Arrays + .asList( + new DynamicMetricCriteria() + .withName("High_CPU_80") + .withMetricName("Percentage CPU") + .withMetricNamespace("microsoft.compute/virtualmachines") + .withTimeAggregation(AggregationTypeEnum.AVERAGE) + .withDimensions(Arrays.asList()) + .withOperator(DynamicThresholdOperator.GREATER_OR_LESS_THAN) + .withAlertSensitivity(DynamicThresholdSensitivity.MEDIUM) + .withFailingPeriods( + new DynamicThresholdFailingPeriods() + .withNumberOfEvaluationPeriods(4f) + .withMinFailingPeriodsToAlert(4f)) + .withIgnoreDataBefore(OffsetDateTime.parse("2019-04-04T21:00:00.000Z"))))) + .withTags(mapOf()) + .withDescription("This is the description of the rule1") + .withAutoMitigate(true) + .withActions( + Arrays + .asList( + new MetricAlertAction() + .withActionGroupId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2") + .withWebhookProperties(mapOf("key11", "value11", "key12", "value12")))) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertSingleResource.json + */ + /** + * Sample code: Create or update an alert rule for Single Resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnAlertRuleForSingleResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .define("chiricutin") + .withRegion("global") + .withExistingResourceGroup("gigtest") + .withSeverity(3) + .withEnabled(true) + .withScopes( + Arrays + .asList( + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")) + .withEvaluationFrequency(Duration.parse("Pt1m")) + .withWindowSize(Duration.parse("Pt15m")) + .withCriteria( + new MetricAlertSingleResourceMultipleMetricCriteria() + .withAllOf( + Arrays + .asList( + new MetricCriteria() + .withName("High_CPU_80") + .withMetricName("\\Processor(_Total)\\% Processor Time") + .withTimeAggregation(AggregationTypeEnum.AVERAGE) + .withDimensions(Arrays.asList()) + .withOperator(Operator.GREATER_THAN) + .withThreshold(80.5)))) + .withTags(mapOf()) + .withDescription("This is the description of the rule1") + .withAutoMitigate(true) + .withActions( + Arrays + .asList( + new MetricAlertAction() + .withActionGroupId( + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2") + .withWebhookProperties(mapOf("key11", "value11", "key12", "value12")))) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertMultipleResource.json + */ + /** + * Sample code: Create or update an alert rule for Multiple Resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnAlertRuleForMultipleResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .define("MetricAlertOnMultipleResources") + .withRegion("global") + .withExistingResourceGroup("gigtest") + .withSeverity(3) + .withEnabled(true) + .withScopes( + Arrays + .asList( + "/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")) + .withEvaluationFrequency(Duration.parse("PT1M")) + .withWindowSize(Duration.parse("PT15M")) + .withCriteria( + new MetricAlertMultipleResourceMultipleMetricCriteria() + .withAllOf( + Arrays + .asList( + new MetricCriteria() + .withName("High_CPU_80") + .withMetricName("Percentage CPU") + .withMetricNamespace("microsoft.compute/virtualmachines") + .withTimeAggregation(AggregationTypeEnum.AVERAGE) + .withDimensions(Arrays.asList()) + .withOperator(Operator.GREATER_THAN) + .withThreshold(80.5)))) + .withTags(mapOf()) + .withDescription("This is the description of the rule1") + .withTargetResourceType("Microsoft.Compute/virtualMachines") + .withTargetResourceRegion("southcentralus") + .withAutoMitigate(true) + .withActions( + Arrays + .asList( + new MetricAlertAction() + .withActionGroupId( + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2") + .withWebhookProperties(mapOf("key11", "value11", "key12", "value12")))) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateDynamicMetricAlertMultipleResource.json + */ + /** + * Sample code: Create or update a dynamic alert rule for Multiple Resources. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateADynamicAlertRuleForMultipleResources( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .define("MetricAlertOnMultipleResources") + .withRegion("global") + .withExistingResourceGroup("gigtest") + .withSeverity(3) + .withEnabled(true) + .withScopes( + Arrays + .asList( + "/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")) + .withEvaluationFrequency(Duration.parse("PT1M")) + .withWindowSize(Duration.parse("PT15M")) + .withCriteria( + new MetricAlertMultipleResourceMultipleMetricCriteria() + .withAllOf( + Arrays + .asList( + new DynamicMetricCriteria() + .withName("High_CPU_80") + .withMetricName("Percentage CPU") + .withMetricNamespace("microsoft.compute/virtualmachines") + .withTimeAggregation(AggregationTypeEnum.AVERAGE) + .withDimensions(Arrays.asList()) + .withOperator(DynamicThresholdOperator.GREATER_OR_LESS_THAN) + .withAlertSensitivity(DynamicThresholdSensitivity.MEDIUM) + .withFailingPeriods( + new DynamicThresholdFailingPeriods() + .withNumberOfEvaluationPeriods(4f) + .withMinFailingPeriodsToAlert(4f))))) + .withTags(mapOf()) + .withDescription("This is the description of the rule1") + .withTargetResourceType("Microsoft.Compute/virtualMachines") + .withTargetResourceRegion("southcentralus") + .withAutoMitigate(true) + .withActions( + Arrays + .asList( + new MetricAlertAction() + .withActionGroupId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2") + .withWebhookProperties(mapOf("key11", "value11", "key12", "value12")))) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### MetricAlerts_Delete + +```java +/** Samples for MetricAlerts Delete. */ +public final class MetricAlertsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/deleteMetricAlert.json + */ + /** + * Sample code: Delete an alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteAnAlertRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .deleteByResourceGroupWithResponse("gigtest", "chiricutin", com.azure.core.util.Context.NONE); + } +} +``` + +### MetricAlerts_GetByResourceGroup + +```java +/** Samples for MetricAlerts GetByResourceGroup. */ +public final class MetricAlertsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertResourceGroup.json + */ + /** + * Sample code: Get an alert rule on resource group(s). + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnAlertRuleOnResourceGroupS( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .getByResourceGroupWithResponse( + "gigtest1", "MetricAlertAtResourceGroupLevel", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getDynamicMetricAlertMultipleResource.json + */ + /** + * Sample code: Get a dynamic alert rule for multiple resources. + * + * @param manager Entry point to MonitorManager. + */ + public static void getADynamicAlertRuleForMultipleResources( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .getByResourceGroupWithResponse( + "gigtest", "MetricAlertOnMultipleResources", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getWebTestMetricAlert.json + */ + /** + * Sample code: Get a web test alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAWebTestAlertRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .getByResourceGroupWithResponse("rg-example", "webtest-name-example", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertSingleResource.json + */ + /** + * Sample code: Get an alert rule for single resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnAlertRuleForSingleResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .getByResourceGroupWithResponse("gigtest", "chiricutin", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertSubscription.json + */ + /** + * Sample code: Get an alert rule on subscription. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnAlertRuleOnSubscription( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .getByResourceGroupWithResponse( + "gigtest", "MetricAlertAtSubscriptionLevel", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getDynamicMetricAlertSingleResource.json + */ + /** + * Sample code: Get a dynamic alert rule for single resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void getADynamicAlertRuleForSingleResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .getByResourceGroupWithResponse("gigtest", "chiricutin", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertMultipleResource.json + */ + /** + * Sample code: Get an alert rule for multiple resources. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnAlertRuleForMultipleResources( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .getByResourceGroupWithResponse( + "gigtest", "MetricAlertOnMultipleResources", com.azure.core.util.Context.NONE); + } +} +``` + +### MetricAlerts_List + +```java +/** Samples for MetricAlerts List. */ +public final class MetricAlertsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/listMetricAlert.json + */ + /** + * Sample code: List metric alert rules. + * + * @param manager Entry point to MonitorManager. + */ + public static void listMetricAlertRules(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.metricAlerts().list(com.azure.core.util.Context.NONE); + } +} +``` + +### MetricAlerts_ListByResourceGroup + +```java +/** Samples for MetricAlerts ListByResourceGroup. */ +public final class MetricAlertsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/listMetricAlert.json + */ + /** + * Sample code: List metric alert rules. + * + * @param manager Entry point to MonitorManager. + */ + public static void listMetricAlertRules(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.metricAlerts().listByResourceGroup("gigtest", com.azure.core.util.Context.NONE); + } +} +``` + +### MetricAlerts_Update + +```java +import com.azure.resourcemanager.monitor.generated.models.AggregationTypeEnum; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertAction; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertResource; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertSingleResourceMultipleMetricCriteria; +import com.azure.resourcemanager.monitor.generated.models.MetricCriteria; +import com.azure.resourcemanager.monitor.generated.models.Operator; +import java.time.Duration; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for MetricAlerts Update. */ +public final class MetricAlertsUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/UpdateMetricAlert.json + */ + /** + * Sample code: Create or update an alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnAlertRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + MetricAlertResource resource = + manager + .metricAlerts() + .getByResourceGroupWithResponse("gigtest", "chiricutin", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf()) + .withDescription("This is the description of the rule1") + .withSeverity(3) + .withEnabled(true) + .withScopes( + Arrays + .asList( + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")) + .withEvaluationFrequency(Duration.parse("Pt1m")) + .withWindowSize(Duration.parse("Pt15m")) + .withCriteria( + new MetricAlertSingleResourceMultipleMetricCriteria() + .withAllOf( + Arrays + .asList( + new MetricCriteria() + .withName("High_CPU_80") + .withMetricName("\\Processor(_Total)\\% Processor Time") + .withTimeAggregation(AggregationTypeEnum.AVERAGE) + .withDimensions(Arrays.asList()) + .withOperator(Operator.GREATER_THAN) + .withThreshold(80.5)))) + .withAutoMitigate(true) + .withActions( + Arrays + .asList( + new MetricAlertAction() + .withActionGroupId( + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2") + .withWebhookProperties(mapOf("key11", "value11", "key12", "value12")))) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### MetricAlertsStatus_List + +```java +/** Samples for MetricAlertsStatus List. */ +public final class MetricAlertsStatusListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertStatus.json + */ + /** + * Sample code: Get an alert rule status. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnAlertRuleStatus(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.metricAlertsStatus().listWithResponse("gigtest", "chiricutin", com.azure.core.util.Context.NONE); + } +} +``` + +### MetricAlertsStatus_ListByName + +```java +/** Samples for MetricAlertsStatus ListByName. */ +public final class MetricAlertsStatusListByNameSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertStatusByName.json + */ + /** + * Sample code: Get an alert rule status. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnAlertRuleStatus(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlertsStatus() + .listByNameWithResponse( + "EastUs", + "custom1", + "cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l", + com.azure.core.util.Context.NONE); + } +} +``` + +### MetricDefinitions_List + +```java +/** Samples for MetricDefinitions List. */ +public final class MetricDefinitionsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetricDefinitions.json + */ + /** + * Sample code: Get Metric Definitions without filter. + * + * @param manager Entry point to MonitorManager. + */ + public static void getMetricDefinitionsWithoutFilter( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricDefinitions() + .list( + "subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricDefinitions", + "Microsoft.Web/sites", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetricDefinitionsApplicationInsights.json + */ + /** + * Sample code: Get Application Insights Metric Definitions without filter. + * + * @param manager Entry point to MonitorManager. + */ + public static void getApplicationInsightsMetricDefinitionsWithoutFilter( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricDefinitions() + .list( + "subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions", + "microsoft.insights/components", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetricDefinitionsMetricClass.json + */ + /** + * Sample code: Get StorageCache Metric Definitions with metric class. + * + * @param manager Entry point to MonitorManager. + */ + public static void getStorageCacheMetricDefinitionsWithMetricClass( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricDefinitions() + .list( + "subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache", + "microsoft.storagecache/caches", + com.azure.core.util.Context.NONE); + } +} +``` + +### MetricNamespaces_List + +```java +/** Samples for MetricNamespaces List. */ +public final class MetricNamespacesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/examples/GetMetricNamespaces.json + */ + /** + * Sample code: Get Metric Namespaces without filter. + * + * @param manager Entry point to MonitorManager. + */ + public static void getMetricNamespacesWithoutFilter( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricNamespaces() + .list( + "subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill", + "2020-08-31T15:53:00Z", + com.azure.core.util.Context.NONE); + } +} +``` + +### MetricsOperation_List + +```java +import java.time.Duration; + +/** Samples for MetricsOperation List. */ +public final class MetricsOperationListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetric.json + */ + /** + * Sample code: Get Metric for data. + * + * @param manager Entry point to MonitorManager. + */ + public static void getMetricForData(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricsOperations() + .listWithResponse( + "subscriptions/b324c52b-4073-4807-93af-e07d289c093e/resourceGroups/test/providers/Microsoft.Storage/storageAccounts/larryshoebox/blobServices/default", + "2017-04-14T02:20:00Z/2017-04-14T04:20:00Z", + Duration.parse("PT1M"), + null, + "Average,count", + 3, + "Average asc", + "BlobType eq '*'", + null, + "Microsoft.Storage/storageAccounts/blobServices", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetricMetadata.json + */ + /** + * Sample code: Get Metric for metadata. + * + * @param manager Entry point to MonitorManager. + */ + public static void getMetricForMetadata(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricsOperations() + .listWithResponse( + "subscriptions/b324c52b-4073-4807-93af-e07d289c093e/resourceGroups/test/providers/Microsoft.Storage/storageAccounts/larryshoebox/blobServices/default", + "2017-04-14T02:20:00Z/2017-04-14T04:20:00Z", + Duration.parse("PT1M"), + null, + "Average,count", + 3, + "Average asc", + "BlobType eq '*'", + null, + "Microsoft.Storage/storageAccounts/blobServices", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetricError.json + */ + /** + * Sample code: Get Metric with error. + * + * @param manager Entry point to MonitorManager. + */ + public static void getMetricWithError(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricsOperations() + .listWithResponse( + "subscriptions/ac41e21f-afd6-4a79-8070-f01eba278f97/resourceGroups/todking/providers/Microsoft.DocumentDb/databaseAccounts/tk-cosmos-mongo", + "2021-06-07T21:51:00Z/2021-06-08T01:51:00Z", + Duration.parse("FULL"), + "MongoRequestsCount,MongoRequests", + "average", + null, + null, + null, + null, + "microsoft.documentdb/databaseaccounts", + com.azure.core.util.Context.NONE); + } +} +``` + +### MonitorOperations_List + +```java +/** Samples for MonitorOperations List. */ +public final class MonitorOperationsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/OperationsGet.json + */ + /** + * Sample code: Get operations list. + * + * @param manager Entry point to MonitorManager. + */ + public static void getOperationsList(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.monitorOperations().list(com.azure.core.util.Context.NONE); + } +} +``` + +### Operations_List + +```java +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/OperationList.json + */ + /** + * Sample code: Get a list of operations for a resource provider. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAListOfOperationsForAResourceProvider( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.operations().listWithResponse(com.azure.core.util.Context.NONE); + } +} +``` + +### PredictiveMetric_Get + +```java +import java.time.Duration; + +/** Samples for PredictiveMetric Get. */ +public final class PredictiveMetricGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/GetPredictiveMetric.json + */ + /** + * Sample code: Get Metric for data. + * + * @param manager Entry point to MonitorManager. + */ + public static void getMetricForData(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .predictiveMetrics() + .getWithResponse( + "myRG", + "vmss1-Autoscale-775", + "2021-10-14T22:00:00.000Z/2021-10-16T22:00:00.000Z", + Duration.parse("PT1H"), + "Microsoft.Compute/virtualMachineScaleSets", + "PercentageCPU", + "Total", + com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_CreateOrUpdate + +```java +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkServiceConnectionState; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to MonitorManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingPrivateLinkScope("MyResourceGroup", "MyPrivateLinkScope") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("Approved by johndoe@contoso.com")) + .create(); + } +} +``` + +### PrivateEndpointConnections_Delete + +```java +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to MonitorManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateEndpointConnections() + .delete( + "MyResourceGroup", + "MyPrivateLinkScope", + "private-endpoint-connection-name", + com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Get + +```java +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateEndpointConnections() + .getWithResponse( + "MyResourceGroup", + "MyPrivateLinkScope", + "private-endpoint-connection-name", + com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateEndpointConnections_ListByPrivateLinkScope + +```java +/** Samples for PrivateEndpointConnections ListByPrivateLinkScope. */ +public final class PrivateEndpointConnectionsListByPrivateLinkScopeSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionList.json + */ + /** + * Sample code: Gets list of private endpoint connections on a private link scope. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsListOfPrivateEndpointConnectionsOnAPrivateLinkScope( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateEndpointConnections() + .listByPrivateLinkScopeWithResponse( + "MyResourceGroup", "MyPrivateLinkScope", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinkResources_Get + +```java +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopePrivateLinkResourceGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkResources() + .getWithResponse("MyResourceGroup", "MyPrivateLinkScope", "azuremonitor", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinkResources_ListByPrivateLinkScope + +```java +/** Samples for PrivateLinkResources ListByPrivateLinkScope. */ +public final class PrivateLinkResourcesListByPrivateLinkScopeSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopePrivateLinkResourceListGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkResources() + .listByPrivateLinkScopeWithResponse( + "MyResourceGroup", "MyPrivateLinkScope", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinkScopeOperationStatus_GetByResourceGroup + +```java +/** Samples for PrivateLinkScopeOperationStatus GetByResourceGroup. */ +public final class PrivateLinkScopeOperationStatusGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/privateLinkScopeOperationStatuses.json + */ + /** + * Sample code: Get specific operation status. + * + * @param manager Entry point to MonitorManager. + */ + public static void getSpecificOperationStatus(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkScopeOperationStatus() + .getByResourceGroupWithResponse( + "MyResourceGroup", "713192d7-503f-477a-9cfe-4efc3ee2bd11", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinkScopedResources_CreateOrUpdate + +```java +import com.azure.resourcemanager.monitor.generated.models.ScopedResource; + +/** Samples for PrivateLinkScopedResources CreateOrUpdate. */ +public final class PrivateLinkScopedResourcesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceUpdate.json + */ + /** + * Sample code: Update a scoped resource in a private link scope. + * + * @param manager Entry point to MonitorManager. + */ + public static void updateAScopedResourceInAPrivateLinkScope( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + ScopedResource resource = + manager + .privateLinkScopedResources() + .getWithResponse( + "MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withLinkedResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/my-component") + .apply(); + } +} +``` + +### PrivateLinkScopedResources_Delete + +```java +/** Samples for PrivateLinkScopedResources Delete. */ +public final class PrivateLinkScopedResourcesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceDelete.json + */ + /** + * Sample code: Deletes a scoped resource with a given name. + * + * @param manager Entry point to MonitorManager. + */ + public static void deletesAScopedResourceWithAGivenName( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkScopedResources() + .delete("MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinkScopedResources_Get + +```java +/** Samples for PrivateLinkScopedResources Get. */ +public final class PrivateLinkScopedResourcesGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceGet.json + */ + /** + * Sample code: Gets private link scoped resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsPrivateLinkScopedResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkScopedResources() + .getWithResponse( + "MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinkScopedResources_ListByPrivateLinkScope + +```java +/** Samples for PrivateLinkScopedResources ListByPrivateLinkScope. */ +public final class PrivateLinkScopedResourcesListByPrivateLinkScopeSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceList.json + */ + /** + * Sample code: Gets list of scoped resources in a private link scope. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsListOfScopedResourcesInAPrivateLinkScope( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkScopedResources() + .listByPrivateLinkScope("MyResourceGroup", "MyPrivateLinkScope", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinkScopes_CreateOrUpdate + +```java +import com.azure.resourcemanager.monitor.generated.models.AccessMode; +import com.azure.resourcemanager.monitor.generated.models.AccessModeSettings; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for PrivateLinkScopes CreateOrUpdate. */ +public final class PrivateLinkScopesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesCreate.json + */ + /** + * Sample code: PrivateLinkScopeCreate. + * + * @param manager Entry point to MonitorManager. + */ + public static void privateLinkScopeCreate(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkScopes() + .define("my-privatelinkscope") + .withRegion("Global") + .withExistingResourceGroup("my-resource-group") + .withAccessModeSettings( + new AccessModeSettings() + .withQueryAccessMode(AccessMode.OPEN) + .withIngestionAccessMode(AccessMode.OPEN) + .withExclusions(Arrays.asList())) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesUpdate.json + */ + /** + * Sample code: PrivateLinkScopeUpdate. + * + * @param manager Entry point to MonitorManager. + */ + public static void privateLinkScopeUpdate(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkScopes() + .define("my-privatelinkscope") + .withRegion("Global") + .withExistingResourceGroup("my-resource-group") + .withAccessModeSettings( + new AccessModeSettings() + .withQueryAccessMode(AccessMode.OPEN) + .withIngestionAccessMode(AccessMode.OPEN) + .withExclusions(Arrays.asList())) + .withTags(mapOf("Tag1", "Value1")) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### PrivateLinkScopes_Delete + +```java +/** Samples for PrivateLinkScopes Delete. */ +public final class PrivateLinkScopesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesDelete.json + */ + /** + * Sample code: PrivateLinkScopesDelete. + * + * @param manager Entry point to MonitorManager. + */ + public static void privateLinkScopesDelete(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkScopes() + .delete("my-resource-group", "my-privatelinkscope", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinkScopes_GetByResourceGroup + +```java +/** Samples for PrivateLinkScopes GetByResourceGroup. */ +public final class PrivateLinkScopesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesGet.json + */ + /** + * Sample code: PrivateLinkScopeGet. + * + * @param manager Entry point to MonitorManager. + */ + public static void privateLinkScopeGet(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkScopes() + .getByResourceGroupWithResponse( + "my-resource-group", "my-privatelinkscope", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinkScopes_List + +```java +/** Samples for PrivateLinkScopes List. */ +public final class PrivateLinkScopesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesList.json + */ + /** + * Sample code: PrivateLinkScopesList.json. + * + * @param manager Entry point to MonitorManager. + */ + public static void privateLinkScopesListJson(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.privateLinkScopes().list(com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinkScopes_ListByResourceGroup + +```java +/** Samples for PrivateLinkScopes ListByResourceGroup. */ +public final class PrivateLinkScopesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesListByResourceGroup.json + */ + /** + * Sample code: PrivateLinkScopeListByResourceGroup. + * + * @param manager Entry point to MonitorManager. + */ + public static void privateLinkScopeListByResourceGroup( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.privateLinkScopes().listByResourceGroup("my-resource-group", com.azure.core.util.Context.NONE); + } +} +``` + +### PrivateLinkScopes_UpdateTags + +```java +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorPrivateLinkScope; +import java.util.HashMap; +import java.util.Map; + +/** Samples for PrivateLinkScopes UpdateTags. */ +public final class PrivateLinkScopesUpdateTagsSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesUpdateTagsOnly.json + */ + /** + * Sample code: PrivateLinkScopeUpdateTagsOnly. + * + * @param manager Entry point to MonitorManager. + */ + public static void privateLinkScopeUpdateTagsOnly( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + AzureMonitorPrivateLinkScope resource = + manager + .privateLinkScopes() + .getByResourceGroupWithResponse( + "my-resource-group", "my-privatelinkscope", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("Tag1", "Value1", "Tag2", "Value2")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ScheduledQueryRules_CreateOrUpdate + +```java +import com.azure.resourcemanager.monitor.generated.models.Actions; +import com.azure.resourcemanager.monitor.generated.models.AlertSeverity; +import com.azure.resourcemanager.monitor.generated.models.Condition; +import com.azure.resourcemanager.monitor.generated.models.ConditionFailingPeriods; +import com.azure.resourcemanager.monitor.generated.models.ConditionOperator; +import com.azure.resourcemanager.monitor.generated.models.Dimension; +import com.azure.resourcemanager.monitor.generated.models.DimensionOperator; +import com.azure.resourcemanager.monitor.generated.models.RuleResolveConfiguration; +import com.azure.resourcemanager.monitor.generated.models.ScheduledQueryRuleCriteria; +import com.azure.resourcemanager.monitor.generated.models.TimeAggregation; +import java.time.Duration; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ScheduledQueryRules CreateOrUpdate. */ +public final class ScheduledQueryRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/createOrUpdateScheduledQueryRuleSubscription.json + */ + /** + * Sample code: Create or update a scheduled query rule on Subscription. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAScheduledQueryRuleOnSubscription( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .scheduledQueryRules() + .define("perf") + .withRegion("eastus") + .withExistingResourceGroup("QueryResourceGroupName") + .withDescription("Performance rule") + .withSeverity(AlertSeverity.FOUR) + .withEnabled(true) + .withScopes(Arrays.asList("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")) + .withEvaluationFrequency(Duration.parse("PT5M")) + .withWindowSize(Duration.parse("PT10M")) + .withTargetResourceTypes(Arrays.asList("Microsoft.Compute/virtualMachines")) + .withCriteria( + new ScheduledQueryRuleCriteria() + .withAllOf( + Arrays + .asList( + new Condition() + .withQuery("Perf | where ObjectName == \"Processor\"") + .withTimeAggregation(TimeAggregation.AVERAGE) + .withMetricMeasureColumn("% Processor Time") + .withResourceIdColumn("resourceId") + .withDimensions( + Arrays + .asList( + new Dimension() + .withName("ComputerIp") + .withOperator(DimensionOperator.EXCLUDE) + .withValues(Arrays.asList("192.168.1.1")), + new Dimension() + .withName("OSType") + .withOperator(DimensionOperator.INCLUDE) + .withValues(Arrays.asList("*")))) + .withOperator(ConditionOperator.GREATER_THAN) + .withThreshold(70.0D) + .withFailingPeriods( + new ConditionFailingPeriods() + .withNumberOfEvaluationPeriods(1L) + .withMinFailingPeriodsToAlert(1L))))) + .withMuteActionsDuration(Duration.parse("PT30M")) + .withActions( + new Actions() + .withActionGroups( + Arrays + .asList( + "/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")) + .withCustomProperties(mapOf("key11", "value11", "key12", "value12"))) + .withCheckWorkspaceAlertsStorageConfigured(true) + .withSkipQueryValidation(true) + .withRuleResolveConfiguration( + new RuleResolveConfiguration().withAutoResolved(true).withTimeToResolve(Duration.parse("PT10M"))) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/createOrUpdateScheduledQueryRuleResourceGroup.json + */ + /** + * Sample code: Create or update a scheduled query rule on Resource group(s). + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAScheduledQueryRuleOnResourceGroupS( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .scheduledQueryRules() + .define("heartbeat") + .withRegion("eastus") + .withExistingResourceGroup("QueryResourceGroupName") + .withDescription("Health check rule") + .withSeverity(AlertSeverity.FOUR) + .withEnabled(true) + .withScopes( + Arrays.asList("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")) + .withEvaluationFrequency(Duration.parse("PT5M")) + .withWindowSize(Duration.parse("PT10M")) + .withTargetResourceTypes(Arrays.asList("Microsoft.Compute/virtualMachines")) + .withCriteria( + new ScheduledQueryRuleCriteria() + .withAllOf( + Arrays + .asList( + new Condition() + .withQuery("Heartbeat") + .withTimeAggregation(TimeAggregation.COUNT) + .withDimensions(Arrays.asList()) + .withOperator(ConditionOperator.GREATER_THAN) + .withThreshold(360.0D) + .withFailingPeriods( + new ConditionFailingPeriods() + .withNumberOfEvaluationPeriods(1L) + .withMinFailingPeriodsToAlert(1L))))) + .withMuteActionsDuration(Duration.parse("PT30M")) + .withActions( + new Actions() + .withActionGroups( + Arrays + .asList( + "/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")) + .withCustomProperties(mapOf("key11", "value11", "key12", "value12"))) + .withCheckWorkspaceAlertsStorageConfigured(true) + .withSkipQueryValidation(true) + .withRuleResolveConfiguration( + new RuleResolveConfiguration().withAutoResolved(true).withTimeToResolve(Duration.parse("PT10M"))) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/createOrUpdateScheduledQueryRule.json + */ + /** + * Sample code: Create or update a scheduled query rule for Single Resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAScheduledQueryRuleForSingleResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .scheduledQueryRules() + .define("perf") + .withRegion("eastus") + .withExistingResourceGroup("QueryResourceGroupName") + .withDescription("Performance rule") + .withSeverity(AlertSeverity.FOUR) + .withEnabled(true) + .withScopes( + Arrays + .asList( + "/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1")) + .withEvaluationFrequency(Duration.parse("PT5M")) + .withWindowSize(Duration.parse("PT10M")) + .withCriteria( + new ScheduledQueryRuleCriteria() + .withAllOf( + Arrays + .asList( + new Condition() + .withQuery("Perf | where ObjectName == \"Processor\"") + .withTimeAggregation(TimeAggregation.AVERAGE) + .withMetricMeasureColumn("% Processor Time") + .withResourceIdColumn("resourceId") + .withDimensions( + Arrays + .asList( + new Dimension() + .withName("ComputerIp") + .withOperator(DimensionOperator.EXCLUDE) + .withValues(Arrays.asList("192.168.1.1")), + new Dimension() + .withName("OSType") + .withOperator(DimensionOperator.INCLUDE) + .withValues(Arrays.asList("*")))) + .withOperator(ConditionOperator.GREATER_THAN) + .withThreshold(70.0D) + .withFailingPeriods( + new ConditionFailingPeriods() + .withNumberOfEvaluationPeriods(1L) + .withMinFailingPeriodsToAlert(1L))))) + .withMuteActionsDuration(Duration.parse("PT30M")) + .withActions( + new Actions() + .withActionGroups( + Arrays + .asList( + "/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")) + .withCustomProperties(mapOf("key11", "value11", "key12", "value12"))) + .withCheckWorkspaceAlertsStorageConfigured(true) + .withSkipQueryValidation(true) + .withRuleResolveConfiguration( + new RuleResolveConfiguration().withAutoResolved(true).withTimeToResolve(Duration.parse("PT10M"))) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} +``` + +### ScheduledQueryRules_Delete + +```java +/** Samples for ScheduledQueryRules Delete. */ +public final class ScheduledQueryRulesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/deleteScheduledQueryRule.json + */ + /** + * Sample code: Delete a scheduled query rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteAScheduledQueryRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .scheduledQueryRules() + .deleteByResourceGroupWithResponse("QueryResourceGroupName", "heartbeat", com.azure.core.util.Context.NONE); + } +} +``` + +### ScheduledQueryRules_GetByResourceGroup + +```java +/** Samples for ScheduledQueryRules GetByResourceGroup. */ +public final class ScheduledQueryRulesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/getScheduledQueryRule.json + */ + /** + * Sample code: Get a scheduled query rule for single resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAScheduledQueryRuleForSingleResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .scheduledQueryRules() + .getByResourceGroupWithResponse("QueryResourceGroupName", "perf", com.azure.core.util.Context.NONE); + } +} +``` + +### ScheduledQueryRules_List + +```java +/** Samples for ScheduledQueryRules List. */ +public final class ScheduledQueryRulesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/listScheduledQueryRulesBySubscription.json + */ + /** + * Sample code: List scheduled query rules by subscription. + * + * @param manager Entry point to MonitorManager. + */ + public static void listScheduledQueryRulesBySubscription( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.scheduledQueryRules().list(com.azure.core.util.Context.NONE); + } +} +``` + +### ScheduledQueryRules_ListByResourceGroup + +```java +/** Samples for ScheduledQueryRules ListByResourceGroup. */ +public final class ScheduledQueryRulesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/listScheduledQueryRulesByResourceGroup.json + */ + /** + * Sample code: List scheduled query rules by resource group. + * + * @param manager Entry point to MonitorManager. + */ + public static void listScheduledQueryRulesByResourceGroup( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.scheduledQueryRules().listByResourceGroup("QueryResourceGroupName", com.azure.core.util.Context.NONE); + } +} +``` + +### ScheduledQueryRules_Update + +```java +import com.azure.resourcemanager.monitor.generated.models.ScheduledQueryRuleResource; + +/** Samples for ScheduledQueryRules Update. */ +public final class ScheduledQueryRulesUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/patchScheduledQueryRule.json + */ + /** + * Sample code: Create or update a scheduled query rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAScheduledQueryRule( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + ScheduledQueryRuleResource resource = + manager + .scheduledQueryRules() + .getByResourceGroupWithResponse("QueryResourceGroupName", "heartbeat", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withEnabled(false).apply(); + } +} +``` + +### TenantActivityLogs_List + +```java +/** Samples for TenantActivityLogs List. */ +public final class TenantActivityLogsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsFilteredAndSelected.json + */ + /** + * Sample code: Get Tenant Activity Logs with filter and select. + * + * @param manager Entry point to MonitorManager. + */ + public static void getTenantActivityLogsWithFilterAndSelect( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .tenantActivityLogs() + .list( + "eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and" + + " resourceGroupName eq 'MSSupportGroup'", + "eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsSelected.json + */ + /** + * Sample code: Get Tenant Activity Logs with select. + * + * @param manager Entry point to MonitorManager. + */ + public static void getTenantActivityLogsWithSelect( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .tenantActivityLogs() + .list( + null, + "eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsFiltered.json + */ + /** + * Sample code: Get Tenant Activity Logs with filter. + * + * @param manager Entry point to MonitorManager. + */ + public static void getTenantActivityLogsWithFilter( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .tenantActivityLogs() + .list( + "eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and" + + " resourceGroupName eq 'MSSupportGroup'", + null, + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsNoParams.json + */ + /** + * Sample code: Get Tenant Activity Logs without filter or select. + * + * @param manager Entry point to MonitorManager. + */ + public static void getTenantActivityLogsWithoutFilterOrSelect( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.tenantActivityLogs().list(null, null, com.azure.core.util.Context.NONE); + } +} +``` + +### VMInsights_GetOnboardingStatus + +```java +/** Samples for VMInsights GetOnboardingStatus. */ +public final class VMInsightsGetOnboardingStatusSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusResourceGroup.json + */ + /** + * Sample code: Get status for a resource group that has at least one VM that is actively reporting data. + * + * @param manager Entry point to MonitorManager. + */ + public static void getStatusForAResourceGroupThatHasAtLeastOneVMThatIsActivelyReportingData( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .vMInsights() + .getOnboardingStatusWithResponse( + "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/resource-group-with-vms", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSingleVMUnknown.json + */ + /** + * Sample code: Get status for a VM that has not yet reported data. + * + * @param manager Entry point to MonitorManager. + */ + public static void getStatusForAVMThatHasNotYetReportedData( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .vMInsights() + .getOnboardingStatusWithResponse( + "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSingleVM.json + */ + /** + * Sample code: Get status for a VM that is actively reporting data. + * + * @param manager Entry point to MonitorManager. + */ + public static void getStatusForAVMThatIsActivelyReportingData( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .vMInsights() + .getOnboardingStatusWithResponse( + "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusVMScaleSet.json + */ + /** + * Sample code: Get status for a VM scale set that is actively reporting data. + * + * @param manager Entry point to MonitorManager. + */ + public static void getStatusForAVMScaleSetThatIsActivelyReportingData( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .vMInsights() + .getOnboardingStatusWithResponse( + "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/my-service-cluster/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-01", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSubscription.json + */ + /** + * Sample code: Get status for a subscription that has at least one VM that is actively reporting data. + * + * @param manager Entry point to MonitorManager. + */ + public static void getStatusForASubscriptionThatHasAtLeastOneVMThatIsActivelyReportingData( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .vMInsights() + .getOnboardingStatusWithResponse( + "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87", com.azure.core.util.Context.NONE); + } +} +``` + diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/pom.xml b/sdk/monitor/azure-resourcemanager-monitor-generated/pom.xml new file mode 100644 index 0000000000000..65e143a3ace5f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-monitor-generated + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for Monitor Management + This package contains Microsoft Azure SDK for Monitor Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. Monitor Management Client. Package tag package-preview-2022-08. + https://github.com/Azure/azure-sdk-for-java + + + + The MIT License (MIT) + http://opensource.org/licenses/MIT + repo + + + + + https://github.com/Azure/azure-sdk-for-java + scm:git:git@github.com:Azure/azure-sdk-for-java.git + scm:git:git@github.com:Azure/azure-sdk-for-java.git + HEAD + + + + microsoft + Microsoft + + + + UTF-8 + true + + + + com.azure + azure-core + 1.36.0 + + + com.azure + azure-core-management + 1.10.1 + + + diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/MonitorManager.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/MonitorManager.java new file mode 100644 index 0000000000000..3c1ae5ee73635 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/MonitorManager.java @@ -0,0 +1,771 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated; + +import com.azure.core.credential.TokenCredential; +import com.azure.core.http.HttpClient; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.HttpPipelinePosition; +import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.HttpLogOptions; +import com.azure.core.http.policy.HttpLoggingPolicy; +import com.azure.core.http.policy.HttpPipelinePolicy; +import com.azure.core.http.policy.HttpPolicyProviders; +import com.azure.core.http.policy.RequestIdPolicy; +import com.azure.core.http.policy.RetryOptions; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.MonitorClient; +import com.azure.resourcemanager.monitor.generated.implementation.ActionGroupsImpl; +import com.azure.resourcemanager.monitor.generated.implementation.ActivityLogAlertsImpl; +import com.azure.resourcemanager.monitor.generated.implementation.ActivityLogsImpl; +import com.azure.resourcemanager.monitor.generated.implementation.AlertRuleIncidentsImpl; +import com.azure.resourcemanager.monitor.generated.implementation.AlertRulesImpl; +import com.azure.resourcemanager.monitor.generated.implementation.AutoscaleSettingsImpl; +import com.azure.resourcemanager.monitor.generated.implementation.AzureMonitorWorkspacesImpl; +import com.azure.resourcemanager.monitor.generated.implementation.BaselinesImpl; +import com.azure.resourcemanager.monitor.generated.implementation.DataCollectionEndpointsImpl; +import com.azure.resourcemanager.monitor.generated.implementation.DataCollectionRuleAssociationsImpl; +import com.azure.resourcemanager.monitor.generated.implementation.DataCollectionRulesImpl; +import com.azure.resourcemanager.monitor.generated.implementation.DiagnosticSettingsCategoriesImpl; +import com.azure.resourcemanager.monitor.generated.implementation.DiagnosticSettingsOperationsImpl; +import com.azure.resourcemanager.monitor.generated.implementation.EventCategoriesImpl; +import com.azure.resourcemanager.monitor.generated.implementation.LogProfilesImpl; +import com.azure.resourcemanager.monitor.generated.implementation.MetricAlertsImpl; +import com.azure.resourcemanager.monitor.generated.implementation.MetricAlertsStatusImpl; +import com.azure.resourcemanager.monitor.generated.implementation.MetricDefinitionsImpl; +import com.azure.resourcemanager.monitor.generated.implementation.MetricNamespacesImpl; +import com.azure.resourcemanager.monitor.generated.implementation.MetricsOperationsImpl; +import com.azure.resourcemanager.monitor.generated.implementation.MonitorClientBuilder; +import com.azure.resourcemanager.monitor.generated.implementation.MonitorOperationsImpl; +import com.azure.resourcemanager.monitor.generated.implementation.OperationsImpl; +import com.azure.resourcemanager.monitor.generated.implementation.PredictiveMetricsImpl; +import com.azure.resourcemanager.monitor.generated.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.monitor.generated.implementation.PrivateLinkResourcesImpl; +import com.azure.resourcemanager.monitor.generated.implementation.PrivateLinkScopeOperationStatusImpl; +import com.azure.resourcemanager.monitor.generated.implementation.PrivateLinkScopedResourcesImpl; +import com.azure.resourcemanager.monitor.generated.implementation.PrivateLinkScopesImpl; +import com.azure.resourcemanager.monitor.generated.implementation.ScheduledQueryRulesImpl; +import com.azure.resourcemanager.monitor.generated.implementation.TenantActivityLogsImpl; +import com.azure.resourcemanager.monitor.generated.implementation.VMInsightsImpl; +import com.azure.resourcemanager.monitor.generated.models.ActionGroups; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlerts; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogs; +import com.azure.resourcemanager.monitor.generated.models.AlertRuleIncidents; +import com.azure.resourcemanager.monitor.generated.models.AlertRules; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleSettings; +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorWorkspaces; +import com.azure.resourcemanager.monitor.generated.models.Baselines; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpoints; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleAssociations; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRules; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsCategories; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsOperations; +import com.azure.resourcemanager.monitor.generated.models.EventCategories; +import com.azure.resourcemanager.monitor.generated.models.LogProfiles; +import com.azure.resourcemanager.monitor.generated.models.MetricAlerts; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertsStatus; +import com.azure.resourcemanager.monitor.generated.models.MetricDefinitions; +import com.azure.resourcemanager.monitor.generated.models.MetricNamespaces; +import com.azure.resourcemanager.monitor.generated.models.MetricsOperations; +import com.azure.resourcemanager.monitor.generated.models.MonitorOperations; +import com.azure.resourcemanager.monitor.generated.models.Operations; +import com.azure.resourcemanager.monitor.generated.models.PredictiveMetrics; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointConnections; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkResources; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkScopeOperationStatus; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkScopedResources; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkScopes; +import com.azure.resourcemanager.monitor.generated.models.ScheduledQueryRules; +import com.azure.resourcemanager.monitor.generated.models.TenantActivityLogs; +import com.azure.resourcemanager.monitor.generated.models.VMInsights; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** Entry point to MonitorManager. Monitor Management Client. */ +public final class MonitorManager { + private AutoscaleSettings autoscaleSettings; + + private PredictiveMetrics predictiveMetrics; + + private Operations operations; + + private AlertRuleIncidents alertRuleIncidents; + + private AlertRules alertRules; + + private LogProfiles logProfiles; + + private DiagnosticSettingsOperations diagnosticSettingsOperations; + + private DiagnosticSettingsCategories diagnosticSettingsCategories; + + private ActionGroups actionGroups; + + private ActivityLogs activityLogs; + + private EventCategories eventCategories; + + private TenantActivityLogs tenantActivityLogs; + + private MetricDefinitions metricDefinitions; + + private MetricsOperations metricsOperations; + + private Baselines baselines; + + private MetricAlerts metricAlerts; + + private MetricAlertsStatus metricAlertsStatus; + + private ScheduledQueryRules scheduledQueryRules; + + private MetricNamespaces metricNamespaces; + + private VMInsights vMInsights; + + private PrivateLinkScopes privateLinkScopes; + + private PrivateLinkScopeOperationStatus privateLinkScopeOperationStatus; + + private PrivateLinkResources privateLinkResources; + + private PrivateEndpointConnections privateEndpointConnections; + + private PrivateLinkScopedResources privateLinkScopedResources; + + private ActivityLogAlerts activityLogAlerts; + + private DataCollectionEndpoints dataCollectionEndpoints; + + private DataCollectionRuleAssociations dataCollectionRuleAssociations; + + private DataCollectionRules dataCollectionRules; + + private AzureMonitorWorkspaces azureMonitorWorkspaces; + + private MonitorOperations monitorOperations; + + private final MonitorClient clientObject; + + private MonitorManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new MonitorClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of Monitor service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Monitor service API instance. + */ + public static MonitorManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return configure().authenticate(credential, profile); + } + + /** + * Creates an instance of Monitor service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the Monitor service API instance. + */ + public static MonitorManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new MonitorManager(httpPipeline, profile, null); + } + + /** + * Gets a Configurable instance that can be used to create MonitorManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new MonitorManager.Configurable(); + } + + /** The Configurable allowing configurations to be set. */ + public static final class Configurable { + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); + + private HttpClient httpClient; + private HttpLogOptions httpLogOptions; + private final List policies = new ArrayList<>(); + private final List scopes = new ArrayList<>(); + private RetryPolicy retryPolicy; + private RetryOptions retryOptions; + private Duration defaultPollInterval; + + private Configurable() { + } + + /** + * Sets the http client. + * + * @param httpClient the HTTP client. + * @return the configurable object itself. + */ + public Configurable withHttpClient(HttpClient httpClient) { + this.httpClient = Objects.requireNonNull(httpClient, "'httpClient' cannot be null."); + return this; + } + + /** + * Sets the logging options to the HTTP pipeline. + * + * @param httpLogOptions the HTTP log options. + * @return the configurable object itself. + */ + public Configurable withLogOptions(HttpLogOptions httpLogOptions) { + this.httpLogOptions = Objects.requireNonNull(httpLogOptions, "'httpLogOptions' cannot be null."); + return this; + } + + /** + * Adds the pipeline policy to the HTTP pipeline. + * + * @param policy the HTTP pipeline policy. + * @return the configurable object itself. + */ + public Configurable withPolicy(HttpPipelinePolicy policy) { + this.policies.add(Objects.requireNonNull(policy, "'policy' cannot be null.")); + return this; + } + + /** + * Adds the scope to permission sets. + * + * @param scope the scope. + * @return the configurable object itself. + */ + public Configurable withScope(String scope) { + this.scopes.add(Objects.requireNonNull(scope, "'scope' cannot be null.")); + return this; + } + + /** + * Sets the retry policy to the HTTP pipeline. + * + * @param retryPolicy the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryPolicy(RetryPolicy retryPolicy) { + this.retryPolicy = Objects.requireNonNull(retryPolicy, "'retryPolicy' cannot be null."); + return this; + } + + /** + * Sets the retry options for the HTTP pipeline retry policy. + * + *

This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + + /** + * Sets the default poll interval, used when service does not provide "Retry-After" header. + * + * @param defaultPollInterval the default poll interval. + * @return the configurable object itself. + */ + public Configurable withDefaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = + Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); + } + return this; + } + + /** + * Creates an instance of Monitor service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the Monitor service API instance. + */ + public MonitorManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + StringBuilder userAgentBuilder = new StringBuilder(); + userAgentBuilder + .append("azsdk-java") + .append("-") + .append("com.azure.resourcemanager.monitor.generated") + .append("/") + .append("1.0.0-beta.1"); + if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { + userAgentBuilder + .append(" (") + .append(Configuration.getGlobalConfiguration().get("java.version")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.name")) + .append("; ") + .append(Configuration.getGlobalConfiguration().get("os.version")) + .append("; auto-generated)"); + } else { + userAgentBuilder.append(" (auto-generated)"); + } + + if (scopes.isEmpty()) { + scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); + } + if (retryPolicy == null) { + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); + policies.add(new RequestIdPolicy()); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) + .collect(Collectors.toList())); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies + .addAll( + this + .policies + .stream() + .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) + .collect(Collectors.toList())); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new MonitorManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** + * Gets the resource collection API of AutoscaleSettings. It manages AutoscaleSettingResource. + * + * @return Resource collection API of AutoscaleSettings. + */ + public AutoscaleSettings autoscaleSettings() { + if (this.autoscaleSettings == null) { + this.autoscaleSettings = new AutoscaleSettingsImpl(clientObject.getAutoscaleSettings(), this); + } + return autoscaleSettings; + } + + /** + * Gets the resource collection API of PredictiveMetrics. + * + * @return Resource collection API of PredictiveMetrics. + */ + public PredictiveMetrics predictiveMetrics() { + if (this.predictiveMetrics == null) { + this.predictiveMetrics = new PredictiveMetricsImpl(clientObject.getPredictiveMetrics(), this); + } + return predictiveMetrics; + } + + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** + * Gets the resource collection API of AlertRuleIncidents. + * + * @return Resource collection API of AlertRuleIncidents. + */ + public AlertRuleIncidents alertRuleIncidents() { + if (this.alertRuleIncidents == null) { + this.alertRuleIncidents = new AlertRuleIncidentsImpl(clientObject.getAlertRuleIncidents(), this); + } + return alertRuleIncidents; + } + + /** + * Gets the resource collection API of AlertRules. It manages AlertRuleResource. + * + * @return Resource collection API of AlertRules. + */ + public AlertRules alertRules() { + if (this.alertRules == null) { + this.alertRules = new AlertRulesImpl(clientObject.getAlertRules(), this); + } + return alertRules; + } + + /** + * Gets the resource collection API of LogProfiles. It manages LogProfileResource. + * + * @return Resource collection API of LogProfiles. + */ + public LogProfiles logProfiles() { + if (this.logProfiles == null) { + this.logProfiles = new LogProfilesImpl(clientObject.getLogProfiles(), this); + } + return logProfiles; + } + + /** + * Gets the resource collection API of DiagnosticSettingsOperations. It manages DiagnosticSettingsResource. + * + * @return Resource collection API of DiagnosticSettingsOperations. + */ + public DiagnosticSettingsOperations diagnosticSettingsOperations() { + if (this.diagnosticSettingsOperations == null) { + this.diagnosticSettingsOperations = + new DiagnosticSettingsOperationsImpl(clientObject.getDiagnosticSettingsOperations(), this); + } + return diagnosticSettingsOperations; + } + + /** + * Gets the resource collection API of DiagnosticSettingsCategories. + * + * @return Resource collection API of DiagnosticSettingsCategories. + */ + public DiagnosticSettingsCategories diagnosticSettingsCategories() { + if (this.diagnosticSettingsCategories == null) { + this.diagnosticSettingsCategories = + new DiagnosticSettingsCategoriesImpl(clientObject.getDiagnosticSettingsCategories(), this); + } + return diagnosticSettingsCategories; + } + + /** + * Gets the resource collection API of ActionGroups. It manages ActionGroupResource. + * + * @return Resource collection API of ActionGroups. + */ + public ActionGroups actionGroups() { + if (this.actionGroups == null) { + this.actionGroups = new ActionGroupsImpl(clientObject.getActionGroups(), this); + } + return actionGroups; + } + + /** + * Gets the resource collection API of ActivityLogs. + * + * @return Resource collection API of ActivityLogs. + */ + public ActivityLogs activityLogs() { + if (this.activityLogs == null) { + this.activityLogs = new ActivityLogsImpl(clientObject.getActivityLogs(), this); + } + return activityLogs; + } + + /** + * Gets the resource collection API of EventCategories. + * + * @return Resource collection API of EventCategories. + */ + public EventCategories eventCategories() { + if (this.eventCategories == null) { + this.eventCategories = new EventCategoriesImpl(clientObject.getEventCategories(), this); + } + return eventCategories; + } + + /** + * Gets the resource collection API of TenantActivityLogs. + * + * @return Resource collection API of TenantActivityLogs. + */ + public TenantActivityLogs tenantActivityLogs() { + if (this.tenantActivityLogs == null) { + this.tenantActivityLogs = new TenantActivityLogsImpl(clientObject.getTenantActivityLogs(), this); + } + return tenantActivityLogs; + } + + /** + * Gets the resource collection API of MetricDefinitions. + * + * @return Resource collection API of MetricDefinitions. + */ + public MetricDefinitions metricDefinitions() { + if (this.metricDefinitions == null) { + this.metricDefinitions = new MetricDefinitionsImpl(clientObject.getMetricDefinitions(), this); + } + return metricDefinitions; + } + + /** + * Gets the resource collection API of MetricsOperations. + * + * @return Resource collection API of MetricsOperations. + */ + public MetricsOperations metricsOperations() { + if (this.metricsOperations == null) { + this.metricsOperations = new MetricsOperationsImpl(clientObject.getMetricsOperations(), this); + } + return metricsOperations; + } + + /** + * Gets the resource collection API of Baselines. + * + * @return Resource collection API of Baselines. + */ + public Baselines baselines() { + if (this.baselines == null) { + this.baselines = new BaselinesImpl(clientObject.getBaselines(), this); + } + return baselines; + } + + /** + * Gets the resource collection API of MetricAlerts. It manages MetricAlertResource. + * + * @return Resource collection API of MetricAlerts. + */ + public MetricAlerts metricAlerts() { + if (this.metricAlerts == null) { + this.metricAlerts = new MetricAlertsImpl(clientObject.getMetricAlerts(), this); + } + return metricAlerts; + } + + /** + * Gets the resource collection API of MetricAlertsStatus. + * + * @return Resource collection API of MetricAlertsStatus. + */ + public MetricAlertsStatus metricAlertsStatus() { + if (this.metricAlertsStatus == null) { + this.metricAlertsStatus = new MetricAlertsStatusImpl(clientObject.getMetricAlertsStatus(), this); + } + return metricAlertsStatus; + } + + /** + * Gets the resource collection API of ScheduledQueryRules. It manages ScheduledQueryRuleResource. + * + * @return Resource collection API of ScheduledQueryRules. + */ + public ScheduledQueryRules scheduledQueryRules() { + if (this.scheduledQueryRules == null) { + this.scheduledQueryRules = new ScheduledQueryRulesImpl(clientObject.getScheduledQueryRules(), this); + } + return scheduledQueryRules; + } + + /** + * Gets the resource collection API of MetricNamespaces. + * + * @return Resource collection API of MetricNamespaces. + */ + public MetricNamespaces metricNamespaces() { + if (this.metricNamespaces == null) { + this.metricNamespaces = new MetricNamespacesImpl(clientObject.getMetricNamespaces(), this); + } + return metricNamespaces; + } + + /** + * Gets the resource collection API of VMInsights. + * + * @return Resource collection API of VMInsights. + */ + public VMInsights vMInsights() { + if (this.vMInsights == null) { + this.vMInsights = new VMInsightsImpl(clientObject.getVMInsights(), this); + } + return vMInsights; + } + + /** + * Gets the resource collection API of PrivateLinkScopes. It manages AzureMonitorPrivateLinkScope. + * + * @return Resource collection API of PrivateLinkScopes. + */ + public PrivateLinkScopes privateLinkScopes() { + if (this.privateLinkScopes == null) { + this.privateLinkScopes = new PrivateLinkScopesImpl(clientObject.getPrivateLinkScopes(), this); + } + return privateLinkScopes; + } + + /** + * Gets the resource collection API of PrivateLinkScopeOperationStatus. + * + * @return Resource collection API of PrivateLinkScopeOperationStatus. + */ + public PrivateLinkScopeOperationStatus privateLinkScopeOperationStatus() { + if (this.privateLinkScopeOperationStatus == null) { + this.privateLinkScopeOperationStatus = + new PrivateLinkScopeOperationStatusImpl(clientObject.getPrivateLinkScopeOperationStatus(), this); + } + return privateLinkScopeOperationStatus; + } + + /** + * Gets the resource collection API of PrivateLinkResources. + * + * @return Resource collection API of PrivateLinkResources. + */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** + * Gets the resource collection API of PrivateEndpointConnections. It manages PrivateEndpointConnection. + * + * @return Resource collection API of PrivateEndpointConnections. + */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections = + new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** + * Gets the resource collection API of PrivateLinkScopedResources. It manages ScopedResource. + * + * @return Resource collection API of PrivateLinkScopedResources. + */ + public PrivateLinkScopedResources privateLinkScopedResources() { + if (this.privateLinkScopedResources == null) { + this.privateLinkScopedResources = + new PrivateLinkScopedResourcesImpl(clientObject.getPrivateLinkScopedResources(), this); + } + return privateLinkScopedResources; + } + + /** + * Gets the resource collection API of ActivityLogAlerts. It manages ActivityLogAlertResource. + * + * @return Resource collection API of ActivityLogAlerts. + */ + public ActivityLogAlerts activityLogAlerts() { + if (this.activityLogAlerts == null) { + this.activityLogAlerts = new ActivityLogAlertsImpl(clientObject.getActivityLogAlerts(), this); + } + return activityLogAlerts; + } + + /** + * Gets the resource collection API of DataCollectionEndpoints. It manages DataCollectionEndpointResource. + * + * @return Resource collection API of DataCollectionEndpoints. + */ + public DataCollectionEndpoints dataCollectionEndpoints() { + if (this.dataCollectionEndpoints == null) { + this.dataCollectionEndpoints = + new DataCollectionEndpointsImpl(clientObject.getDataCollectionEndpoints(), this); + } + return dataCollectionEndpoints; + } + + /** + * Gets the resource collection API of DataCollectionRuleAssociations. It manages + * DataCollectionRuleAssociationProxyOnlyResource. + * + * @return Resource collection API of DataCollectionRuleAssociations. + */ + public DataCollectionRuleAssociations dataCollectionRuleAssociations() { + if (this.dataCollectionRuleAssociations == null) { + this.dataCollectionRuleAssociations = + new DataCollectionRuleAssociationsImpl(clientObject.getDataCollectionRuleAssociations(), this); + } + return dataCollectionRuleAssociations; + } + + /** + * Gets the resource collection API of DataCollectionRules. It manages DataCollectionRuleResource. + * + * @return Resource collection API of DataCollectionRules. + */ + public DataCollectionRules dataCollectionRules() { + if (this.dataCollectionRules == null) { + this.dataCollectionRules = new DataCollectionRulesImpl(clientObject.getDataCollectionRules(), this); + } + return dataCollectionRules; + } + + /** + * Gets the resource collection API of AzureMonitorWorkspaces. It manages AzureMonitorWorkspaceResource. + * + * @return Resource collection API of AzureMonitorWorkspaces. + */ + public AzureMonitorWorkspaces azureMonitorWorkspaces() { + if (this.azureMonitorWorkspaces == null) { + this.azureMonitorWorkspaces = + new AzureMonitorWorkspacesImpl(clientObject.getAzureMonitorWorkspaces(), this); + } + return azureMonitorWorkspaces; + } + + /** + * Gets the resource collection API of MonitorOperations. + * + * @return Resource collection API of MonitorOperations. + */ + public MonitorOperations monitorOperations() { + if (this.monitorOperations == null) { + this.monitorOperations = new MonitorOperationsImpl(clientObject.getMonitorOperations(), this); + } + return monitorOperations; + } + + /** + * @return Wrapped service client MonitorClient providing direct access to the underlying auto-generated API + * implementation, based on Azure REST API. + */ + public MonitorClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ActionGroupsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ActionGroupsClient.java new file mode 100644 index 0000000000000..defd4693a2f69 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ActionGroupsClient.java @@ -0,0 +1,481 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.monitor.generated.fluent.models.ActionGroupResourceInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.TestNotificationDetailsResponseInner; +import com.azure.resourcemanager.monitor.generated.models.ActionGroupPatchBody; +import com.azure.resourcemanager.monitor.generated.models.EnableRequest; +import com.azure.resourcemanager.monitor.generated.models.NotificationRequestBody; + +/** An instance of this class provides access to all the operations defined in ActionGroupsClient. */ +public interface ActionGroupsClient { + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup, Context context); + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ActionGroupResourceInner createOrUpdate( + String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup); + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String actionGroupName, Context context); + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ActionGroupResourceInner getByResourceGroup(String resourceGroupName, String actionGroupName); + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String actionGroupName, Context context); + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String actionGroupName); + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch, Context context); + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ActionGroupResourceInner update( + String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch); + + /** + * Send test notifications to a set of provided receivers. + * + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TestNotificationDetailsResponseInner> + beginPostTestNotifications(NotificationRequestBody notificationRequest); + + /** + * Send test notifications to a set of provided receivers. + * + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TestNotificationDetailsResponseInner> + beginPostTestNotifications(NotificationRequestBody notificationRequest, Context context); + + /** + * Send test notifications to a set of provided receivers. + * + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestNotificationDetailsResponseInner postTestNotifications(NotificationRequestBody notificationRequest); + + /** + * Send test notifications to a set of provided receivers. + * + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestNotificationDetailsResponseInner postTestNotifications( + NotificationRequestBody notificationRequest, Context context); + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TestNotificationDetailsResponseInner> + beginCreateNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest); + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TestNotificationDetailsResponseInner> + beginCreateNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest, Context context); + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestNotificationDetailsResponseInner createNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest); + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestNotificationDetailsResponseInner createNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest, Context context); + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TestNotificationDetailsResponseInner> + beginCreateNotificationsAtActionGroupResourceLevel( + String resourceGroupName, String actionGroupName, NotificationRequestBody notificationRequest); + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TestNotificationDetailsResponseInner> + beginCreateNotificationsAtActionGroupResourceLevel( + String resourceGroupName, + String actionGroupName, + NotificationRequestBody notificationRequest, + Context context); + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestNotificationDetailsResponseInner createNotificationsAtActionGroupResourceLevel( + String resourceGroupName, String actionGroupName, NotificationRequestBody notificationRequest); + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestNotificationDetailsResponseInner createNotificationsAtActionGroupResourceLevel( + String resourceGroupName, String actionGroupName, NotificationRequestBody notificationRequest, Context context); + + /** + * Get the test notifications by the notification id. + * + * @param notificationId The notification id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getTestNotificationsWithResponse( + String notificationId, Context context); + + /** + * Get the test notifications by the notification id. + * + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestNotificationDetailsResponseInner getTestNotifications(String notificationId); + + /** + * Get the test notifications by the notification id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationId The notification id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getTestNotificationsAtResourceGroupLevelWithResponse( + String resourceGroupName, String notificationId, Context context); + + /** + * Get the test notifications by the notification id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestNotificationDetailsResponseInner getTestNotificationsAtResourceGroupLevel( + String resourceGroupName, String notificationId); + + /** + * Get the test notifications by the notification id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationId The notification id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getTestNotificationsAtActionGroupResourceLevelWithResponse( + String resourceGroupName, String actionGroupName, String notificationId, Context context); + + /** + * Get the test notifications by the notification id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestNotificationDetailsResponseInner getTestNotificationsAtActionGroupResourceLevel( + String resourceGroupName, String actionGroupName, String notificationId); + + /** + * Get a list of all action groups in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get a list of all action groups in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param enableRequest The receiver to re-enable. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response enableReceiverWithResponse( + String resourceGroupName, String actionGroupName, EnableRequest enableRequest, Context context); + + /** + * 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param enableRequest The receiver to re-enable. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void enableReceiver(String resourceGroupName, String actionGroupName, EnableRequest enableRequest); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ActivityLogAlertsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ActivityLogAlertsClient.java new file mode 100644 index 0000000000000..2069c80f72ffd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ActivityLogAlertsClient.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.ActivityLogAlertResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AlertRulePatchObject; + +/** An instance of this class provides access to all the operations defined in ActivityLogAlertsClient. */ +public interface ActivityLogAlertsClient { + /** + * Create a new Activity Log Alert rule or update an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param activityLogAlertRule The Activity Log Alert rule to create or use for the update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String activityLogAlertName, + ActivityLogAlertResourceInner activityLogAlertRule, + Context context); + + /** + * Create a new Activity Log Alert rule or update an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param activityLogAlertRule The Activity Log Alert rule to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ActivityLogAlertResourceInner createOrUpdate( + String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlertRule); + + /** + * Get an Activity Log Alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String activityLogAlertName, Context context); + + /** + * Get an Activity Log Alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ActivityLogAlertResourceInner getByResourceGroup(String resourceGroupName, String activityLogAlertName); + + /** + * Delete an Activity Log Alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String activityLogAlertName, Context context); + + /** + * Delete an Activity Log Alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String activityLogAlertName); + + /** + * Updates 'tags' and 'enabled' fields in an existing Alert rule. This method is used to update the Alert rule tags, + * and to enable or disable the Alert rule. To update other fields use CreateOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param activityLogAlertRulePatch Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String activityLogAlertName, + AlertRulePatchObject activityLogAlertRulePatch, + Context context); + + /** + * Updates 'tags' and 'enabled' fields in an existing Alert rule. This method is used to update the Alert rule tags, + * and to enable or disable the Alert rule. To update other fields use CreateOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param activityLogAlertRulePatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ActivityLogAlertResourceInner update( + String resourceGroupName, String activityLogAlertName, AlertRulePatchObject activityLogAlertRulePatch); + + /** + * Get a list of all Activity Log Alert rules in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a subscription as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get a list of all Activity Log Alert rules in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a subscription as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Get a list of all Activity Log Alert rules in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get a list of all Activity Log Alert rules in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ActivityLogsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ActivityLogsClient.java new file mode 100644 index 0000000000000..bf91ecfa86ed5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ActivityLogsClient.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.EventDataInner; + +/** An instance of this class provides access to all the operations defined in ActivityLogsClient. */ +public interface ActivityLogsClient { + /** + * Provides the list of records from the activity logs. + * + * @param filter Reduces the set of data collected.<br>This argument is required and it also requires at least + * the start date/time.<br>The **$filter** argument is very restricted and allows only the following + * patterns.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br><br>**NOTE**: No other + * syntax is allowed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of events as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter); + + /** + * Provides the list of records from the activity logs. + * + * @param filter Reduces the set of data collected.<br>This argument is required and it also requires at least + * the start date/time.<br>The **$filter** argument is very restricted and allows only the following + * patterns.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br><br>**NOTE**: No other + * syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>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*. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of events as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, String select, Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/AlertRuleIncidentsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/AlertRuleIncidentsClient.java new file mode 100644 index 0000000000000..d3fb57ef22b81 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/AlertRuleIncidentsClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.IncidentInner; + +/** An instance of this class provides access to all the operations defined in AlertRuleIncidentsClient. */ +public interface AlertRuleIncidentsClient { + /** + * Gets an incident associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param incidentName The name of the incident to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident associated to an alert rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String ruleName, String incidentName, Context context); + + /** + * Gets an incident associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param incidentName The name of the incident to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident associated to an alert rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + IncidentInner get(String resourceGroupName, String ruleName, String incidentName); + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of incidents associated to an alert rule as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAlertRule(String resourceGroupName, String ruleName); + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of incidents associated to an alert rule as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByAlertRule(String resourceGroupName, String ruleName, Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/AlertRulesClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/AlertRulesClient.java new file mode 100644 index 0000000000000..2b913c23acf72 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/AlertRulesClient.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.AlertRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AlertRuleResourcePatch; + +/** An instance of this class provides access to all the operations defined in AlertRulesClient. */ +public interface AlertRulesClient { + /** + * Creates or updates a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the alert rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String ruleName, AlertRuleResourceInner parameters, Context context); + + /** + * Creates or updates a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the alert rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AlertRuleResourceInner createOrUpdate(String resourceGroupName, String ruleName, AlertRuleResourceInner parameters); + + /** + * Deletes a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String ruleName, Context context); + + /** + * Deletes a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String ruleName); + + /** + * Gets a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a classic metric alert rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context); + + /** + * Gets a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a classic metric alert rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AlertRuleResourceInner getByResourceGroup(String resourceGroupName, String ruleName); + + /** + * Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param alertRulesResource Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the alert rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource, Context context); + + /** + * Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param alertRulesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the alert rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AlertRuleResourceInner update(String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource); + + /** + * List the classic metric alert rules within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List the classic metric alert rules within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List the classic metric alert rules within a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the classic metric alert rules within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/AutoscaleSettingsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/AutoscaleSettingsClient.java new file mode 100644 index 0000000000000..a63e82ba0e0d4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/AutoscaleSettingsClient.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.AutoscaleSettingResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleSettingResourcePatch; + +/** An instance of this class provides access to all the operations defined in AutoscaleSettingsClient. */ +public interface AutoscaleSettingsClient { + /** + * Lists the autoscale settings for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists the autoscale settings for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Creates or updates an autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param parameters Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the autoscale setting resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String autoscaleSettingName, + AutoscaleSettingResourceInner parameters, + Context context); + + /** + * Creates or updates an autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the autoscale setting resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AutoscaleSettingResourceInner createOrUpdate( + String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourceInner parameters); + + /** + * Deletes and autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String autoscaleSettingName, Context context); + + /** + * Deletes and autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String autoscaleSettingName); + + /** + * Gets an autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an autoscale setting along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String autoscaleSettingName, Context context); + + /** + * Gets an autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an autoscale setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AutoscaleSettingResourceInner getByResourceGroup(String resourceGroupName, String autoscaleSettingName); + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param autoscaleSettingResource Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the autoscale setting resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String autoscaleSettingName, + AutoscaleSettingResourcePatch autoscaleSettingResource, + Context context); + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param autoscaleSettingResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the autoscale setting resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AutoscaleSettingResourceInner update( + String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource); + + /** + * Lists the autoscale settings for a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists the autoscale settings for a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/AzureMonitorWorkspacesClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/AzureMonitorWorkspacesClient.java new file mode 100644 index 0000000000000..aab4994f4d093 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/AzureMonitorWorkspacesClient.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.AzureMonitorWorkspaceResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorWorkspaceResourceForUpdate; + +/** An instance of this class provides access to all the operations defined in AzureMonitorWorkspacesClient. */ +public interface AzureMonitorWorkspacesClient { + /** + * Lists all workspaces in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all workspaces in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all workspaces in the specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all workspaces in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Returns the specific Azure Monitor workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String azureMonitorWorkspaceName, Context context); + + /** + * Returns the specific Azure Monitor workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureMonitorWorkspaceResourceInner getByResourceGroup(String resourceGroupName, String azureMonitorWorkspaceName); + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param azureMonitorWorkspaceProperties Properties that need to be specified to create a new workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String azureMonitorWorkspaceName, + AzureMonitorWorkspaceResourceInner azureMonitorWorkspaceProperties, + Context context); + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param azureMonitorWorkspaceProperties Properties that need to be specified to create a new workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureMonitorWorkspaceResourceInner create( + String resourceGroupName, + String azureMonitorWorkspaceName, + AzureMonitorWorkspaceResourceInner azureMonitorWorkspaceProperties); + + /** + * Updates part of a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param azureMonitorWorkspaceProperties The payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String azureMonitorWorkspaceName, + AzureMonitorWorkspaceResourceForUpdate azureMonitorWorkspaceProperties, + Context context); + + /** + * Updates part of a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureMonitorWorkspaceResourceInner update(String resourceGroupName, String azureMonitorWorkspaceName); + + /** + * Delete a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String azureMonitorWorkspaceName, Context context); + + /** + * Delete a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String azureMonitorWorkspaceName); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/BaselinesClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/BaselinesClient.java new file mode 100644 index 0000000000000..f7c89c4823316 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/BaselinesClient.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.SingleMetricBaselineInner; +import com.azure.resourcemanager.monitor.generated.models.ResultType; +import java.time.Duration; + +/** An instance of this class provides access to all the operations defined in BaselinesClient. */ +public interface BaselinesClient { + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of metric baselines as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri); + + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @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'**. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @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' "**. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of metric baselines as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list( + String resourceUri, + String metricnames, + String metricnamespace, + String timespan, + Duration interval, + String aggregation, + String sensitivities, + String filter, + ResultType resultType, + Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DataCollectionEndpointsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DataCollectionEndpointsClient.java new file mode 100644 index 0000000000000..a41b0bbfc2479 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DataCollectionEndpointsClient.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionEndpointResourceInner; +import com.azure.resourcemanager.monitor.generated.models.ResourceForUpdate; + +/** An instance of this class provides access to all the operations defined in DataCollectionEndpointsClient. */ +public interface DataCollectionEndpointsClient { + /** + * Lists all data collection endpoints in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all data collection endpoints in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all data collection endpoints in the specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all data collection endpoints in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Returns the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String dataCollectionEndpointName, Context context); + + /** + * Returns the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataCollectionEndpointResourceInner getByResourceGroup(String resourceGroupName, String dataCollectionEndpointName); + + /** + * Creates or updates a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param body The payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, + String dataCollectionEndpointName, + DataCollectionEndpointResourceInner body, + Context context); + + /** + * Creates or updates a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataCollectionEndpointResourceInner create(String resourceGroupName, String dataCollectionEndpointName); + + /** + * Updates part of a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param body The payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String dataCollectionEndpointName, ResourceForUpdate body, Context context); + + /** + * Updates part of a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataCollectionEndpointResourceInner update(String resourceGroupName, String dataCollectionEndpointName); + + /** + * Deletes a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String dataCollectionEndpointName, Context context); + + /** + * Deletes a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String dataCollectionEndpointName); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DataCollectionRuleAssociationsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DataCollectionRuleAssociationsClient.java new file mode 100644 index 0000000000000..7d789f9cb745e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DataCollectionRuleAssociationsClient.java @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleAssociationProxyOnlyResourceInner; + +/** An instance of this class provides access to all the operations defined in DataCollectionRuleAssociationsClient. */ +public interface DataCollectionRuleAssociationsClient { + /** + * Lists associations for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResource(String resourceUri); + + /** + * Lists associations for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResource( + String resourceUri, Context context); + + /** + * Lists associations for the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByRule( + String resourceGroupName, String dataCollectionRuleName); + + /** + * Lists associations for the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByRule( + String resourceGroupName, String dataCollectionRuleName, Context context); + + /** + * Lists associations for the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDataCollectionEndpoint( + String resourceGroupName, String dataCollectionEndpointName); + + /** + * Lists associations for the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByDataCollectionEndpoint( + String resourceGroupName, String dataCollectionEndpointName, Context context); + + /** + * Returns the specified association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of generic ARM proxy resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceUri, String associationName, Context context); + + /** + * Returns the specified association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of generic ARM proxy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataCollectionRuleAssociationProxyOnlyResourceInner get(String resourceUri, String associationName); + + /** + * Creates or updates an association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @param body The payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of generic ARM proxy resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceUri, + String associationName, + DataCollectionRuleAssociationProxyOnlyResourceInner body, + Context context); + + /** + * Creates or updates an association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of generic ARM proxy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataCollectionRuleAssociationProxyOnlyResourceInner create(String resourceUri, String associationName); + + /** + * Deletes an association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceUri, String associationName, Context context); + + /** + * Deletes an association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceUri, String associationName); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DataCollectionRulesClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DataCollectionRulesClient.java new file mode 100644 index 0000000000000..6d9c53ad53d7b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DataCollectionRulesClient.java @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.ResourceForUpdate; + +/** An instance of this class provides access to all the operations defined in DataCollectionRulesClient. */ +public interface DataCollectionRulesClient { + /** + * Lists all data collection rules in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all data collection rules in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all data collection rules in the specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists all data collection rules in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Returns the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String dataCollectionRuleName, Context context); + + /** + * Returns the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataCollectionRuleResourceInner getByResourceGroup(String resourceGroupName, String dataCollectionRuleName); + + /** + * Creates or updates a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param body The payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createWithResponse( + String resourceGroupName, String dataCollectionRuleName, DataCollectionRuleResourceInner body, Context context); + + /** + * Creates or updates a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataCollectionRuleResourceInner create(String resourceGroupName, String dataCollectionRuleName); + + /** + * Updates part of a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param body The payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String dataCollectionRuleName, ResourceForUpdate body, Context context); + + /** + * Updates part of a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DataCollectionRuleResourceInner update(String resourceGroupName, String dataCollectionRuleName); + + /** + * Deletes a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String dataCollectionRuleName, Context context); + + /** + * Deletes a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String dataCollectionRuleName); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DiagnosticSettingsCategoriesClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DiagnosticSettingsCategoriesClient.java new file mode 100644 index 0000000000000..b0a501b7418cc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DiagnosticSettingsCategoriesClient.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsCategoryResourceInner; + +/** An instance of this class provides access to all the operations defined in DiagnosticSettingsCategoriesClient. */ +public interface DiagnosticSettingsCategoriesClient { + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostic settings category for the specified resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, String name, Context context); + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostic settings category for the specified resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiagnosticSettingsCategoryResourceInner get(String resourceUri, String name); + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of diagnostic setting category resources as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri); + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of diagnostic setting category resources as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri, Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DiagnosticSettingsOperationsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DiagnosticSettingsOperationsClient.java new file mode 100644 index 0000000000000..ce21a5c36b592 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DiagnosticSettingsOperationsClient.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsResourceInner; + +/** An instance of this class provides access to all the operations defined in DiagnosticSettingsOperationsClient. */ +public interface DiagnosticSettingsOperationsClient { + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings for the specified resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String resourceUri, String name, Context context); + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings for the specified resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiagnosticSettingsResourceInner get(String resourceUri, String name); + + /** + * Creates or updates diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param parameters Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostic setting resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceUri, String name, DiagnosticSettingsResourceInner parameters, Context context); + + /** + * Creates or updates diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostic setting resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiagnosticSettingsResourceInner createOrUpdate( + String resourceUri, String name, DiagnosticSettingsResourceInner parameters); + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceUri, String name, Context context); + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceUri, String name); + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings list for the specified resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri); + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings list for the specified resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri, Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/EventCategoriesClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/EventCategoriesClient.java new file mode 100644 index 0000000000000..ab97dcb9521af --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/EventCategoriesClient.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.LocalizableStringInner; + +/** An instance of this class provides access to all the operations defined in EventCategoriesClient. */ +public interface EventCategoriesClient { + /** + * Get the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/LogProfilesClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/LogProfilesClient.java new file mode 100644 index 0000000000000..338668e6dffe4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/LogProfilesClient.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.LogProfileResourceInner; +import com.azure.resourcemanager.monitor.generated.models.LogProfileResourcePatch; + +/** An instance of this class provides access to all the operations defined in LogProfilesClient. */ +public interface LogProfilesClient { + /** + * Deletes the log profile. + * + * @param logProfileName The name of the log profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String logProfileName, Context context); + + /** + * Deletes the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String logProfileName); + + /** + * Gets the log profile. + * + * @param logProfileName The name of the log profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse(String logProfileName, Context context); + + /** + * Gets the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogProfileResourceInner get(String logProfileName); + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param logProfileName The name of the log profile. + * @param parameters Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String logProfileName, LogProfileResourceInner parameters, Context context); + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param logProfileName The name of the log profile. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogProfileResourceInner createOrUpdate(String logProfileName, LogProfileResourceInner parameters); + + /** + * Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. + * + * @param logProfileName The name of the log profile. + * @param logProfilesResource Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String logProfileName, LogProfileResourcePatch logProfilesResource, Context context); + + /** + * Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. + * + * @param logProfileName The name of the log profile. + * @param logProfilesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogProfileResourceInner update(String logProfileName, LogProfileResourcePatch logProfilesResource); + + /** + * List the log profiles. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of log profiles as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the log profiles. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of log profiles as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricAlertsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricAlertsClient.java new file mode 100644 index 0000000000000..14f9f51b0ba9e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricAlertsClient.java @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricAlertResourceInner; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertResourcePatch; + +/** An instance of this class provides access to all the operations defined in MetricAlertsClient. */ +public interface MetricAlertsClient { + /** + * Retrieve alert rule definitions in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Retrieve alert rule definitions in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context); + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetricAlertResourceInner getByResourceGroup(String resourceGroupName, String ruleName); + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String ruleName, MetricAlertResourceInner parameters, Context context); + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetricAlertResourceInner createOrUpdate( + String resourceGroupName, String ruleName, MetricAlertResourceInner parameters); + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters, Context context); + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetricAlertResourceInner update(String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters); + + /** + * Delete an alert rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String ruleName, Context context); + + /** + * Delete an alert rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String ruleName); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricAlertsStatusClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricAlertsStatusClient.java new file mode 100644 index 0000000000000..d92db8fe26b1a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricAlertsStatusClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricAlertStatusCollectionInner; + +/** An instance of this class provides access to all the operations defined in MetricAlertsStatusClient. */ +public interface MetricAlertsStatusClient { + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse( + String resourceGroupName, String ruleName, Context context); + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetricAlertStatusCollectionInner list(String resourceGroupName, String ruleName); + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listByNameWithResponse( + String resourceGroupName, String ruleName, String statusName, Context context); + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + MetricAlertStatusCollectionInner listByName(String resourceGroupName, String ruleName, String statusName); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricDefinitionsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricDefinitionsClient.java new file mode 100644 index 0000000000000..f970e2ce23d59 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricDefinitionsClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricDefinitionInner; + +/** An instance of this class provides access to all the operations defined in MetricDefinitionsClient. */ +public interface MetricDefinitionsClient { + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri); + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri, String metricnamespace, Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricNamespacesClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricNamespacesClient.java new file mode 100644 index 0000000000000..924ab3f34e5f6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricNamespacesClient.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricNamespaceInner; + +/** An instance of this class provides access to all the operations defined in MetricNamespacesClient. */ +public interface MetricNamespacesClient { + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric namespaces as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri); + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @param startTime The ISO 8601 conform Date start time from which to query for metric namespaces. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric namespaces as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceUri, String startTime, Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricsOperationsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricsOperationsClient.java new file mode 100644 index 0000000000000..dd30cd40a8166 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricsOperationsClient.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.ResponseInner; +import com.azure.resourcemanager.monitor.generated.models.ResultType; +import java.time.Duration; + +/** An instance of this class provides access to all the operations defined in MetricsOperationsClient. */ +public interface MetricsOperationsClient { + /** + * **Lists the metric values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @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'**. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param top The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. + * @param orderBy The aggregation to use for sorting results and the direction of the sort. Only one order can be + * specified. Examples: sum asc. + * @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' "**. + * @param resultType Reduces the set of data collected. The syntax allowed depends on the operation. See the + * operation's description for details. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a metrics query along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse( + String resourceUri, + String timespan, + Duration interval, + String metricnames, + String aggregation, + Integer top, + String orderBy, + String filter, + ResultType resultType, + String metricnamespace, + Context context); + + /** + * **Lists the metric values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a metrics query. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ResponseInner list(String resourceUri); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MonitorClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MonitorClient.java new file mode 100644 index 0000000000000..1073967afbf41 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MonitorClient.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for MonitorClient class. */ +public interface MonitorClient { + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + String getSubscriptionId(); + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + String getEndpoint(); + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + HttpPipeline getHttpPipeline(); + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + Duration getDefaultPollInterval(); + + /** + * Gets the AutoscaleSettingsClient object to access its operations. + * + * @return the AutoscaleSettingsClient object. + */ + AutoscaleSettingsClient getAutoscaleSettings(); + + /** + * Gets the PredictiveMetricsClient object to access its operations. + * + * @return the PredictiveMetricsClient object. + */ + PredictiveMetricsClient getPredictiveMetrics(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the AlertRuleIncidentsClient object to access its operations. + * + * @return the AlertRuleIncidentsClient object. + */ + AlertRuleIncidentsClient getAlertRuleIncidents(); + + /** + * Gets the AlertRulesClient object to access its operations. + * + * @return the AlertRulesClient object. + */ + AlertRulesClient getAlertRules(); + + /** + * Gets the LogProfilesClient object to access its operations. + * + * @return the LogProfilesClient object. + */ + LogProfilesClient getLogProfiles(); + + /** + * Gets the DiagnosticSettingsOperationsClient object to access its operations. + * + * @return the DiagnosticSettingsOperationsClient object. + */ + DiagnosticSettingsOperationsClient getDiagnosticSettingsOperations(); + + /** + * Gets the DiagnosticSettingsCategoriesClient object to access its operations. + * + * @return the DiagnosticSettingsCategoriesClient object. + */ + DiagnosticSettingsCategoriesClient getDiagnosticSettingsCategories(); + + /** + * Gets the ActionGroupsClient object to access its operations. + * + * @return the ActionGroupsClient object. + */ + ActionGroupsClient getActionGroups(); + + /** + * Gets the ActivityLogsClient object to access its operations. + * + * @return the ActivityLogsClient object. + */ + ActivityLogsClient getActivityLogs(); + + /** + * Gets the EventCategoriesClient object to access its operations. + * + * @return the EventCategoriesClient object. + */ + EventCategoriesClient getEventCategories(); + + /** + * Gets the TenantActivityLogsClient object to access its operations. + * + * @return the TenantActivityLogsClient object. + */ + TenantActivityLogsClient getTenantActivityLogs(); + + /** + * Gets the MetricDefinitionsClient object to access its operations. + * + * @return the MetricDefinitionsClient object. + */ + MetricDefinitionsClient getMetricDefinitions(); + + /** + * Gets the MetricsOperationsClient object to access its operations. + * + * @return the MetricsOperationsClient object. + */ + MetricsOperationsClient getMetricsOperations(); + + /** + * Gets the BaselinesClient object to access its operations. + * + * @return the BaselinesClient object. + */ + BaselinesClient getBaselines(); + + /** + * Gets the MetricAlertsClient object to access its operations. + * + * @return the MetricAlertsClient object. + */ + MetricAlertsClient getMetricAlerts(); + + /** + * Gets the MetricAlertsStatusClient object to access its operations. + * + * @return the MetricAlertsStatusClient object. + */ + MetricAlertsStatusClient getMetricAlertsStatus(); + + /** + * Gets the ScheduledQueryRulesClient object to access its operations. + * + * @return the ScheduledQueryRulesClient object. + */ + ScheduledQueryRulesClient getScheduledQueryRules(); + + /** + * Gets the MetricNamespacesClient object to access its operations. + * + * @return the MetricNamespacesClient object. + */ + MetricNamespacesClient getMetricNamespaces(); + + /** + * Gets the VMInsightsClient object to access its operations. + * + * @return the VMInsightsClient object. + */ + VMInsightsClient getVMInsights(); + + /** + * Gets the PrivateLinkScopesClient object to access its operations. + * + * @return the PrivateLinkScopesClient object. + */ + PrivateLinkScopesClient getPrivateLinkScopes(); + + /** + * Gets the PrivateLinkScopeOperationStatusClient object to access its operations. + * + * @return the PrivateLinkScopeOperationStatusClient object. + */ + PrivateLinkScopeOperationStatusClient getPrivateLinkScopeOperationStatus(); + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + PrivateLinkResourcesClient getPrivateLinkResources(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); + + /** + * Gets the PrivateLinkScopedResourcesClient object to access its operations. + * + * @return the PrivateLinkScopedResourcesClient object. + */ + PrivateLinkScopedResourcesClient getPrivateLinkScopedResources(); + + /** + * Gets the ActivityLogAlertsClient object to access its operations. + * + * @return the ActivityLogAlertsClient object. + */ + ActivityLogAlertsClient getActivityLogAlerts(); + + /** + * Gets the DataCollectionEndpointsClient object to access its operations. + * + * @return the DataCollectionEndpointsClient object. + */ + DataCollectionEndpointsClient getDataCollectionEndpoints(); + + /** + * Gets the DataCollectionRuleAssociationsClient object to access its operations. + * + * @return the DataCollectionRuleAssociationsClient object. + */ + DataCollectionRuleAssociationsClient getDataCollectionRuleAssociations(); + + /** + * Gets the DataCollectionRulesClient object to access its operations. + * + * @return the DataCollectionRulesClient object. + */ + DataCollectionRulesClient getDataCollectionRules(); + + /** + * Gets the AzureMonitorWorkspacesClient object to access its operations. + * + * @return the AzureMonitorWorkspacesClient object. + */ + AzureMonitorWorkspacesClient getAzureMonitorWorkspaces(); + + /** + * Gets the MonitorOperationsClient object to access its operations. + * + * @return the MonitorOperationsClient object. + */ + MonitorOperationsClient getMonitorOperations(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MonitorOperationsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MonitorOperationsClient.java new file mode 100644 index 0000000000000..a3c67cc8b6713 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MonitorOperationsClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.OperationAutoGeneratedInner; + +/** An instance of this class provides access to all the operations defined in MonitorOperationsClient. */ +public interface MonitorOperationsClient { + /** + * Lists available Operations for this Resource Provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Lists available Operations for this Resource Provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/OperationsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/OperationsClient.java new file mode 100644 index 0000000000000..c9717dd94c1a5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/OperationsClient.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.OperationListResultInner; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public interface OperationsClient { + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Microsoft.Insights operations along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Microsoft.Insights operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationListResultInner list(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PredictiveMetricsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PredictiveMetricsClient.java new file mode 100644 index 0000000000000..e6def45d5c16d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PredictiveMetricsClient.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.PredictiveResponseInner; +import java.time.Duration; + +/** An instance of this class provides access to all the operations defined in PredictiveMetricsClient. */ +public interface PredictiveMetricsClient { + /** + * get predictive autoscale metric future data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param metricName 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'**. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return predictive autoscale metric future data along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, + String autoscaleSettingName, + String timespan, + Duration interval, + String metricNamespace, + String metricName, + String aggregation, + Context context); + + /** + * get predictive autoscale metric future data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param metricName 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'**. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return predictive autoscale metric future data. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PredictiveResponseInner get( + String resourceGroupName, + String autoscaleSettingName, + String timespan, + Duration interval, + String metricNamespace, + String metricName, + String aggregation); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateEndpointConnectionsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 0000000000000..b3bb68eff01f1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionListResultInner; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public interface PrivateEndpointConnectionsClient { + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner get( + String resourceGroupName, String scopeName, String privateEndpointConnectionName); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String scopeName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The Private Endpoint Connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String scopeName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String scopeName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The Private Endpoint Connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String scopeName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String scopeName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String scopeName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context); + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listByPrivateLinkScopeWithResponse( + String resourceGroupName, String scopeName, Context context); + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionListResultInner listByPrivateLinkScope(String resourceGroupName, String scopeName); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkResourcesClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkResourcesClient.java new file mode 100644 index 0000000000000..02e2cea0f531b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkResourcesClient.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateLinkResourceListResultInner; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public interface PrivateLinkResourcesClient { + /** + * Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listByPrivateLinkScopeWithResponse( + String resourceGroupName, String scopeName, Context context); + + /** + * Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceListResultInner listByPrivateLinkScope(String resourceGroupName, String scopeName); + + /** + * Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String scopeName, String groupName, Context context); + + /** + * Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner get(String resourceGroupName, String scopeName, String groupName); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkScopeOperationStatusClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkScopeOperationStatusClient.java new file mode 100644 index 0000000000000..e7fa5af260935 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkScopeOperationStatusClient.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.OperationStatusInner; + +/** An instance of this class provides access to all the operations defined in PrivateLinkScopeOperationStatusClient. */ +public interface PrivateLinkScopeOperationStatusClient { + /** + * Get the status of an azure asynchronous operation associated with a private link scope operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param asyncOperationId The operation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of an azure asynchronous operation associated with a private link scope operation along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String asyncOperationId, Context context); + + /** + * Get the status of an azure asynchronous operation associated with a private link scope operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param asyncOperationId The operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of an azure asynchronous operation associated with a private link scope operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationStatusInner getByResourceGroup(String resourceGroupName, String asyncOperationId); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkScopedResourcesClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkScopedResourcesClient.java new file mode 100644 index 0000000000000..aa26241549195 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkScopedResourcesClient.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.monitor.generated.fluent.models.ScopedResourceInner; + +/** An instance of this class provides access to all the operations defined in PrivateLinkScopedResourcesClient. */ +public interface PrivateLinkScopedResourcesClient { + /** + * Gets a scoped resource in a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a scoped resource in a private link scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String scopeName, String name, Context context); + + /** + * Gets a scoped resource in a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a scoped resource in a private link scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScopedResourceInner get(String resourceGroupName, String scopeName, String name); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param parameters A private link scoped resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a private link scoped resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ScopedResourceInner> beginCreateOrUpdate( + String resourceGroupName, String scopeName, String name, ScopedResourceInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param parameters A private link scoped resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a private link scoped resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, ScopedResourceInner> beginCreateOrUpdate( + String resourceGroupName, String scopeName, String name, ScopedResourceInner parameters, Context context); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param parameters A private link scoped resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link scoped resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScopedResourceInner createOrUpdate( + String resourceGroupName, String scopeName, String name, ScopedResourceInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param parameters A private link scoped resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link scoped resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScopedResourceInner createOrUpdate( + String resourceGroupName, String scopeName, String name, ScopedResourceInner parameters, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String scopeName, String name); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete( + String resourceGroupName, String scopeName, String name, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String scopeName, String name); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String scopeName, String name, Context context); + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPrivateLinkScope(String resourceGroupName, String scopeName); + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPrivateLinkScope( + String resourceGroupName, String scopeName, Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkScopesClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkScopesClient.java new file mode 100644 index 0000000000000..dc8d356a55a68 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkScopesClient.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.monitor.generated.fluent.models.AzureMonitorPrivateLinkScopeInner; +import com.azure.resourcemanager.monitor.generated.models.TagsResource; + +/** An instance of this class provides access to all the operations defined in PrivateLinkScopesClient. */ +public interface PrivateLinkScopesClient { + /** + * Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure Monitor PrivateLinkScopes within a subscription as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure Monitor PrivateLinkScopes within a subscription as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Gets a list of Azure Monitor PrivateLinkScopes within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Monitor PrivateLinkScopes within a resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of Azure Monitor PrivateLinkScopes within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Monitor PrivateLinkScopes within a resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String scopeName); + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, Void> beginDelete(String resourceGroupName, String scopeName, Context context); + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String scopeName); + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String scopeName, Context context); + + /** + * Returns a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String scopeName, Context context); + + /** + * Returns a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureMonitorPrivateLinkScopeInner getByResourceGroup(String resourceGroupName, String scopeName); + + /** + * Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different value for + * InstrumentationKey nor AppId in the Put operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param azureMonitorPrivateLinkScopePayload Properties that need to be specified to create or update a Azure + * Monitor PrivateLinkScope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String scopeName, + AzureMonitorPrivateLinkScopeInner azureMonitorPrivateLinkScopePayload, + Context context); + + /** + * Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different value for + * InstrumentationKey nor AppId in the Put operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param azureMonitorPrivateLinkScopePayload Properties that need to be specified to create or update a Azure + * Monitor PrivateLinkScope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureMonitorPrivateLinkScopeInner createOrUpdate( + String resourceGroupName, + String scopeName, + AzureMonitorPrivateLinkScopeInner azureMonitorPrivateLinkScopePayload); + + /** + * Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateLinkScopeTags Updated tag information to set into the PrivateLinkScope instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateTagsWithResponse( + String resourceGroupName, String scopeName, TagsResource privateLinkScopeTags, Context context); + + /** + * Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateLinkScopeTags Updated tag information to set into the PrivateLinkScope instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AzureMonitorPrivateLinkScopeInner updateTags( + String resourceGroupName, String scopeName, TagsResource privateLinkScopeTags); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ScheduledQueryRulesClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ScheduledQueryRulesClient.java new file mode 100644 index 0000000000000..11927bb90dfed --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ScheduledQueryRulesClient.java @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.ScheduledQueryRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.ScheduledQueryRuleResourcePatch; + +/** An instance of this class provides access to all the operations defined in ScheduledQueryRulesClient. */ +public interface ScheduledQueryRulesClient { + /** + * Retrieve a scheduled query rule definitions in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Retrieve a scheduled query rule definitions in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Retrieve scheduled query rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Retrieve scheduled query rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieve an scheduled query rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context); + + /** + * Retrieve an scheduled query rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduledQueryRuleResourceInner getByResourceGroup(String resourceGroupName, String ruleName); + + /** + * Creates or updates a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String ruleName, ScheduledQueryRuleResourceInner parameters, Context context); + + /** + * Creates or updates a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduledQueryRuleResourceInner createOrUpdate( + String resourceGroupName, String ruleName, ScheduledQueryRuleResourceInner parameters); + + /** + * Update a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String ruleName, ScheduledQueryRuleResourcePatch parameters, Context context); + + /** + * Update a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ScheduledQueryRuleResourceInner update( + String resourceGroupName, String ruleName, ScheduledQueryRuleResourcePatch parameters); + + /** + * Deletes a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String ruleName, Context context); + + /** + * Deletes a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String ruleName); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/TenantActivityLogsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/TenantActivityLogsClient.java new file mode 100644 index 0000000000000..982a93f34da57 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/TenantActivityLogsClient.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.EventDataInner; + +/** An instance of this class provides access to all the operations defined in TenantActivityLogsClient. */ +public interface TenantActivityLogsClient { + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs + * for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity + * Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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 as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs + * for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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. <br>The **$filter** is very restricted and allows only the + * following patterns.<br>- List events for a resource group: $filter=eventTimestamp ge '<Start + * Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and + * resourceGroupName eq '<ResourceGroupName>'.<br>- List events for resource: $filter=eventTimestamp + * ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and + * resourceUri eq '<ResourceURI>'.<br>- List events for a subscription: $filter=eventTimestamp ge + * '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, + * Operation'.<br>- List events for a resource provider: $filter=eventTimestamp ge '<Start Time>' + * and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceProvider eq + * '<ResourceProviderName>'.<br>- 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 + * '<CorrelationID>'.<br>**NOTE**: No other syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>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*. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity + * Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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 as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, String select, Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/VMInsightsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/VMInsightsClient.java new file mode 100644 index 0000000000000..7b83633a073ee --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/VMInsightsClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.VMInsightsOnboardingStatusInner; + +/** An instance of this class provides access to all the operations defined in VMInsightsClient. */ +public interface VMInsightsClient { + /** + * Retrieves the VM Insights onboarding status for the specified resource or resource scope. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource, or scope, whose status + * to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return vM Insights onboarding status for a resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getOnboardingStatusWithResponse(String resourceUri, Context context); + + /** + * Retrieves the VM Insights onboarding status for the specified resource or resource scope. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource, or scope, whose status + * to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return vM Insights onboarding status for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VMInsightsOnboardingStatusInner getOnboardingStatus(String resourceUri); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroup.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroup.java new file mode 100644 index 0000000000000..0024e4d669c1f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroup.java @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.ArmRoleReceiver; +import com.azure.resourcemanager.monitor.generated.models.AutomationRunbookReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureAppPushReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureFunctionReceiver; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +import com.azure.resourcemanager.monitor.generated.models.EventHubReceiver; +import com.azure.resourcemanager.monitor.generated.models.ItsmReceiver; +import com.azure.resourcemanager.monitor.generated.models.LogicAppReceiver; +import com.azure.resourcemanager.monitor.generated.models.SmsReceiver; +import com.azure.resourcemanager.monitor.generated.models.VoiceReceiver; +import com.azure.resourcemanager.monitor.generated.models.WebhookReceiver; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** An Azure action group. */ +@Fluent +public final class ActionGroup { + /* + * The short name of the action group. This will be used in SMS messages. + */ + @JsonProperty(value = "groupShortName", required = true) + private String groupShortName; + + /* + * Indicates whether this action group is enabled. If an action group is not enabled, then none of its receivers + * will receive communications. + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /* + * The list of email receivers that are part of this action group. + */ + @JsonProperty(value = "emailReceivers") + private List emailReceivers; + + /* + * The list of SMS receivers that are part of this action group. + */ + @JsonProperty(value = "smsReceivers") + private List smsReceivers; + + /* + * The list of webhook receivers that are part of this action group. + */ + @JsonProperty(value = "webhookReceivers") + private List webhookReceivers; + + /* + * The list of ITSM receivers that are part of this action group. + */ + @JsonProperty(value = "itsmReceivers") + private List itsmReceivers; + + /* + * The list of AzureAppPush receivers that are part of this action group. + */ + @JsonProperty(value = "azureAppPushReceivers") + private List azureAppPushReceivers; + + /* + * The list of AutomationRunbook receivers that are part of this action group. + */ + @JsonProperty(value = "automationRunbookReceivers") + private List automationRunbookReceivers; + + /* + * The list of voice receivers that are part of this action group. + */ + @JsonProperty(value = "voiceReceivers") + private List voiceReceivers; + + /* + * The list of logic app receivers that are part of this action group. + */ + @JsonProperty(value = "logicAppReceivers") + private List logicAppReceivers; + + /* + * The list of azure function receivers that are part of this action group. + */ + @JsonProperty(value = "azureFunctionReceivers") + private List azureFunctionReceivers; + + /* + * 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. + */ + @JsonProperty(value = "armRoleReceivers") + private List armRoleReceivers; + + /* + * The list of event hub receivers that are part of this action group. + */ + @JsonProperty(value = "eventHubReceivers") + private List eventHubReceivers; + + /** Creates an instance of ActionGroup class. */ + public ActionGroup() { + } + + /** + * Get the groupShortName property: The short name of the action group. This will be used in SMS messages. + * + * @return the groupShortName value. + */ + public String groupShortName() { + return this.groupShortName; + } + + /** + * Set the groupShortName property: The short name of the action group. This will be used in SMS messages. + * + * @param groupShortName the groupShortName value to set. + * @return the ActionGroup object itself. + */ + public ActionGroup withGroupShortName(String groupShortName) { + this.groupShortName = groupShortName; + return this; + } + + /** + * Get the enabled property: Indicates whether this action group is enabled. If an action group is not enabled, then + * none of its receivers will receive communications. + * + * @return the enabled value. + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates whether this action group is enabled. If an action group is not enabled, then + * none of its receivers will receive communications. + * + * @param enabled the enabled value to set. + * @return the ActionGroup object itself. + */ + public ActionGroup withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the emailReceivers property: The list of email receivers that are part of this action group. + * + * @return the emailReceivers value. + */ + public List emailReceivers() { + return this.emailReceivers; + } + + /** + * Set the emailReceivers property: The list of email receivers that are part of this action group. + * + * @param emailReceivers the emailReceivers value to set. + * @return the ActionGroup object itself. + */ + public ActionGroup withEmailReceivers(List emailReceivers) { + this.emailReceivers = emailReceivers; + return this; + } + + /** + * Get the smsReceivers property: The list of SMS receivers that are part of this action group. + * + * @return the smsReceivers value. + */ + public List smsReceivers() { + return this.smsReceivers; + } + + /** + * Set the smsReceivers property: The list of SMS receivers that are part of this action group. + * + * @param smsReceivers the smsReceivers value to set. + * @return the ActionGroup object itself. + */ + public ActionGroup withSmsReceivers(List smsReceivers) { + this.smsReceivers = smsReceivers; + return this; + } + + /** + * Get the webhookReceivers property: The list of webhook receivers that are part of this action group. + * + * @return the webhookReceivers value. + */ + public List webhookReceivers() { + return this.webhookReceivers; + } + + /** + * Set the webhookReceivers property: The list of webhook receivers that are part of this action group. + * + * @param webhookReceivers the webhookReceivers value to set. + * @return the ActionGroup object itself. + */ + public ActionGroup withWebhookReceivers(List webhookReceivers) { + this.webhookReceivers = webhookReceivers; + return this; + } + + /** + * Get the itsmReceivers property: The list of ITSM receivers that are part of this action group. + * + * @return the itsmReceivers value. + */ + public List itsmReceivers() { + return this.itsmReceivers; + } + + /** + * Set the itsmReceivers property: The list of ITSM receivers that are part of this action group. + * + * @param itsmReceivers the itsmReceivers value to set. + * @return the ActionGroup object itself. + */ + public ActionGroup withItsmReceivers(List itsmReceivers) { + this.itsmReceivers = itsmReceivers; + return this; + } + + /** + * Get the azureAppPushReceivers property: The list of AzureAppPush receivers that are part of this action group. + * + * @return the azureAppPushReceivers value. + */ + public List azureAppPushReceivers() { + return this.azureAppPushReceivers; + } + + /** + * Set the azureAppPushReceivers property: The list of AzureAppPush receivers that are part of this action group. + * + * @param azureAppPushReceivers the azureAppPushReceivers value to set. + * @return the ActionGroup object itself. + */ + public ActionGroup withAzureAppPushReceivers(List azureAppPushReceivers) { + this.azureAppPushReceivers = azureAppPushReceivers; + return this; + } + + /** + * Get the automationRunbookReceivers property: The list of AutomationRunbook receivers that are part of this action + * group. + * + * @return the automationRunbookReceivers value. + */ + public List automationRunbookReceivers() { + return this.automationRunbookReceivers; + } + + /** + * Set the automationRunbookReceivers property: The list of AutomationRunbook receivers that are part of this action + * group. + * + * @param automationRunbookReceivers the automationRunbookReceivers value to set. + * @return the ActionGroup object itself. + */ + public ActionGroup withAutomationRunbookReceivers(List automationRunbookReceivers) { + this.automationRunbookReceivers = automationRunbookReceivers; + return this; + } + + /** + * Get the voiceReceivers property: The list of voice receivers that are part of this action group. + * + * @return the voiceReceivers value. + */ + public List voiceReceivers() { + return this.voiceReceivers; + } + + /** + * Set the voiceReceivers property: The list of voice receivers that are part of this action group. + * + * @param voiceReceivers the voiceReceivers value to set. + * @return the ActionGroup object itself. + */ + public ActionGroup withVoiceReceivers(List voiceReceivers) { + this.voiceReceivers = voiceReceivers; + return this; + } + + /** + * Get the logicAppReceivers property: The list of logic app receivers that are part of this action group. + * + * @return the logicAppReceivers value. + */ + public List logicAppReceivers() { + return this.logicAppReceivers; + } + + /** + * Set the logicAppReceivers property: The list of logic app receivers that are part of this action group. + * + * @param logicAppReceivers the logicAppReceivers value to set. + * @return the ActionGroup object itself. + */ + public ActionGroup withLogicAppReceivers(List logicAppReceivers) { + this.logicAppReceivers = logicAppReceivers; + return this; + } + + /** + * Get the azureFunctionReceivers property: The list of azure function receivers that are part of this action group. + * + * @return the azureFunctionReceivers value. + */ + public List azureFunctionReceivers() { + return this.azureFunctionReceivers; + } + + /** + * Set the azureFunctionReceivers property: The list of azure function receivers that are part of this action group. + * + * @param azureFunctionReceivers the azureFunctionReceivers value to set. + * @return the ActionGroup object itself. + */ + public ActionGroup withAzureFunctionReceivers(List azureFunctionReceivers) { + this.azureFunctionReceivers = azureFunctionReceivers; + return this; + } + + /** + * Get the armRoleReceivers property: 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. + * + * @return the armRoleReceivers value. + */ + public List armRoleReceivers() { + return this.armRoleReceivers; + } + + /** + * Set the armRoleReceivers property: 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. + * + * @param armRoleReceivers the armRoleReceivers value to set. + * @return the ActionGroup object itself. + */ + public ActionGroup withArmRoleReceivers(List armRoleReceivers) { + this.armRoleReceivers = armRoleReceivers; + return this; + } + + /** + * Get the eventHubReceivers property: The list of event hub receivers that are part of this action group. + * + * @return the eventHubReceivers value. + */ + public List eventHubReceivers() { + return this.eventHubReceivers; + } + + /** + * Set the eventHubReceivers property: The list of event hub receivers that are part of this action group. + * + * @param eventHubReceivers the eventHubReceivers value to set. + * @return the ActionGroup object itself. + */ + public ActionGroup withEventHubReceivers(List eventHubReceivers) { + this.eventHubReceivers = eventHubReceivers; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (groupShortName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property groupShortName in model ActionGroup")); + } + if (emailReceivers() != null) { + emailReceivers().forEach(e -> e.validate()); + } + if (smsReceivers() != null) { + smsReceivers().forEach(e -> e.validate()); + } + if (webhookReceivers() != null) { + webhookReceivers().forEach(e -> e.validate()); + } + if (itsmReceivers() != null) { + itsmReceivers().forEach(e -> e.validate()); + } + if (azureAppPushReceivers() != null) { + azureAppPushReceivers().forEach(e -> e.validate()); + } + if (automationRunbookReceivers() != null) { + automationRunbookReceivers().forEach(e -> e.validate()); + } + if (voiceReceivers() != null) { + voiceReceivers().forEach(e -> e.validate()); + } + if (logicAppReceivers() != null) { + logicAppReceivers().forEach(e -> e.validate()); + } + if (azureFunctionReceivers() != null) { + azureFunctionReceivers().forEach(e -> e.validate()); + } + if (armRoleReceivers() != null) { + armRoleReceivers().forEach(e -> e.validate()); + } + if (eventHubReceivers() != null) { + eventHubReceivers().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ActionGroup.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroupPatch.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroupPatch.java new file mode 100644 index 0000000000000..6880a5863968b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroupPatch.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Azure action group for patch operations. */ +@Fluent +public final class ActionGroupPatch { + /* + * Indicates whether this action group is enabled. If an action group is not enabled, then none of its actions will + * be activated. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** Creates an instance of ActionGroupPatch class. */ + public ActionGroupPatch() { + } + + /** + * Get the enabled property: Indicates whether this action group is enabled. If an action group is not enabled, then + * none of its actions will be activated. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates whether this action group is enabled. If an action group is not enabled, then + * none of its actions will be activated. + * + * @param enabled the enabled value to set. + * @return the ActionGroupPatch object itself. + */ + public ActionGroupPatch withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroupResourceInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroupResourceInner.java new file mode 100644 index 0000000000000..c9ce9817e0900 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroupResourceInner.java @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.resourcemanager.monitor.generated.models.ArmRoleReceiver; +import com.azure.resourcemanager.monitor.generated.models.AutomationRunbookReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureAppPushReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureFunctionReceiver; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +import com.azure.resourcemanager.monitor.generated.models.EventHubReceiver; +import com.azure.resourcemanager.monitor.generated.models.ItsmReceiver; +import com.azure.resourcemanager.monitor.generated.models.LogicAppReceiver; +import com.azure.resourcemanager.monitor.generated.models.SmsReceiver; +import com.azure.resourcemanager.monitor.generated.models.VoiceReceiver; +import com.azure.resourcemanager.monitor.generated.models.WebhookReceiver; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An action group resource. */ +@Fluent +public final class ActionGroupResourceInner extends Resource { + /* + * The action groups properties of the resource. + */ + @JsonProperty(value = "properties") + private ActionGroup innerProperties; + + /** Creates an instance of ActionGroupResourceInner class. */ + public ActionGroupResourceInner() { + } + + /** + * Get the innerProperties property: The action groups properties of the resource. + * + * @return the innerProperties value. + */ + private ActionGroup innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ActionGroupResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ActionGroupResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the groupShortName property: The short name of the action group. This will be used in SMS messages. + * + * @return the groupShortName value. + */ + public String groupShortName() { + return this.innerProperties() == null ? null : this.innerProperties().groupShortName(); + } + + /** + * Set the groupShortName property: The short name of the action group. This will be used in SMS messages. + * + * @param groupShortName the groupShortName value to set. + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withGroupShortName(String groupShortName) { + if (this.innerProperties() == null) { + this.innerProperties = new ActionGroup(); + } + this.innerProperties().withGroupShortName(groupShortName); + return this; + } + + /** + * Get the enabled property: Indicates whether this action group is enabled. If an action group is not enabled, then + * none of its receivers will receive communications. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: Indicates whether this action group is enabled. If an action group is not enabled, then + * none of its receivers will receive communications. + * + * @param enabled the enabled value to set. + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withEnabled(Boolean enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new ActionGroup(); + } + this.innerProperties().withEnabled(enabled); + return this; + } + + /** + * Get the emailReceivers property: The list of email receivers that are part of this action group. + * + * @return the emailReceivers value. + */ + public List emailReceivers() { + return this.innerProperties() == null ? null : this.innerProperties().emailReceivers(); + } + + /** + * Set the emailReceivers property: The list of email receivers that are part of this action group. + * + * @param emailReceivers the emailReceivers value to set. + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withEmailReceivers(List emailReceivers) { + if (this.innerProperties() == null) { + this.innerProperties = new ActionGroup(); + } + this.innerProperties().withEmailReceivers(emailReceivers); + return this; + } + + /** + * Get the smsReceivers property: The list of SMS receivers that are part of this action group. + * + * @return the smsReceivers value. + */ + public List smsReceivers() { + return this.innerProperties() == null ? null : this.innerProperties().smsReceivers(); + } + + /** + * Set the smsReceivers property: The list of SMS receivers that are part of this action group. + * + * @param smsReceivers the smsReceivers value to set. + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withSmsReceivers(List smsReceivers) { + if (this.innerProperties() == null) { + this.innerProperties = new ActionGroup(); + } + this.innerProperties().withSmsReceivers(smsReceivers); + return this; + } + + /** + * Get the webhookReceivers property: The list of webhook receivers that are part of this action group. + * + * @return the webhookReceivers value. + */ + public List webhookReceivers() { + return this.innerProperties() == null ? null : this.innerProperties().webhookReceivers(); + } + + /** + * Set the webhookReceivers property: The list of webhook receivers that are part of this action group. + * + * @param webhookReceivers the webhookReceivers value to set. + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withWebhookReceivers(List webhookReceivers) { + if (this.innerProperties() == null) { + this.innerProperties = new ActionGroup(); + } + this.innerProperties().withWebhookReceivers(webhookReceivers); + return this; + } + + /** + * Get the itsmReceivers property: The list of ITSM receivers that are part of this action group. + * + * @return the itsmReceivers value. + */ + public List itsmReceivers() { + return this.innerProperties() == null ? null : this.innerProperties().itsmReceivers(); + } + + /** + * Set the itsmReceivers property: The list of ITSM receivers that are part of this action group. + * + * @param itsmReceivers the itsmReceivers value to set. + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withItsmReceivers(List itsmReceivers) { + if (this.innerProperties() == null) { + this.innerProperties = new ActionGroup(); + } + this.innerProperties().withItsmReceivers(itsmReceivers); + return this; + } + + /** + * Get the azureAppPushReceivers property: The list of AzureAppPush receivers that are part of this action group. + * + * @return the azureAppPushReceivers value. + */ + public List azureAppPushReceivers() { + return this.innerProperties() == null ? null : this.innerProperties().azureAppPushReceivers(); + } + + /** + * Set the azureAppPushReceivers property: The list of AzureAppPush receivers that are part of this action group. + * + * @param azureAppPushReceivers the azureAppPushReceivers value to set. + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withAzureAppPushReceivers(List azureAppPushReceivers) { + if (this.innerProperties() == null) { + this.innerProperties = new ActionGroup(); + } + this.innerProperties().withAzureAppPushReceivers(azureAppPushReceivers); + return this; + } + + /** + * Get the automationRunbookReceivers property: The list of AutomationRunbook receivers that are part of this action + * group. + * + * @return the automationRunbookReceivers value. + */ + public List automationRunbookReceivers() { + return this.innerProperties() == null ? null : this.innerProperties().automationRunbookReceivers(); + } + + /** + * Set the automationRunbookReceivers property: The list of AutomationRunbook receivers that are part of this action + * group. + * + * @param automationRunbookReceivers the automationRunbookReceivers value to set. + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withAutomationRunbookReceivers( + List automationRunbookReceivers) { + if (this.innerProperties() == null) { + this.innerProperties = new ActionGroup(); + } + this.innerProperties().withAutomationRunbookReceivers(automationRunbookReceivers); + return this; + } + + /** + * Get the voiceReceivers property: The list of voice receivers that are part of this action group. + * + * @return the voiceReceivers value. + */ + public List voiceReceivers() { + return this.innerProperties() == null ? null : this.innerProperties().voiceReceivers(); + } + + /** + * Set the voiceReceivers property: The list of voice receivers that are part of this action group. + * + * @param voiceReceivers the voiceReceivers value to set. + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withVoiceReceivers(List voiceReceivers) { + if (this.innerProperties() == null) { + this.innerProperties = new ActionGroup(); + } + this.innerProperties().withVoiceReceivers(voiceReceivers); + return this; + } + + /** + * Get the logicAppReceivers property: The list of logic app receivers that are part of this action group. + * + * @return the logicAppReceivers value. + */ + public List logicAppReceivers() { + return this.innerProperties() == null ? null : this.innerProperties().logicAppReceivers(); + } + + /** + * Set the logicAppReceivers property: The list of logic app receivers that are part of this action group. + * + * @param logicAppReceivers the logicAppReceivers value to set. + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withLogicAppReceivers(List logicAppReceivers) { + if (this.innerProperties() == null) { + this.innerProperties = new ActionGroup(); + } + this.innerProperties().withLogicAppReceivers(logicAppReceivers); + return this; + } + + /** + * Get the azureFunctionReceivers property: The list of azure function receivers that are part of this action group. + * + * @return the azureFunctionReceivers value. + */ + public List azureFunctionReceivers() { + return this.innerProperties() == null ? null : this.innerProperties().azureFunctionReceivers(); + } + + /** + * Set the azureFunctionReceivers property: The list of azure function receivers that are part of this action group. + * + * @param azureFunctionReceivers the azureFunctionReceivers value to set. + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withAzureFunctionReceivers(List azureFunctionReceivers) { + if (this.innerProperties() == null) { + this.innerProperties = new ActionGroup(); + } + this.innerProperties().withAzureFunctionReceivers(azureFunctionReceivers); + return this; + } + + /** + * Get the armRoleReceivers property: 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. + * + * @return the armRoleReceivers value. + */ + public List armRoleReceivers() { + return this.innerProperties() == null ? null : this.innerProperties().armRoleReceivers(); + } + + /** + * Set the armRoleReceivers property: 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. + * + * @param armRoleReceivers the armRoleReceivers value to set. + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withArmRoleReceivers(List armRoleReceivers) { + if (this.innerProperties() == null) { + this.innerProperties = new ActionGroup(); + } + this.innerProperties().withArmRoleReceivers(armRoleReceivers); + return this; + } + + /** + * Get the eventHubReceivers property: The list of event hub receivers that are part of this action group. + * + * @return the eventHubReceivers value. + */ + public List eventHubReceivers() { + return this.innerProperties() == null ? null : this.innerProperties().eventHubReceivers(); + } + + /** + * Set the eventHubReceivers property: The list of event hub receivers that are part of this action group. + * + * @param eventHubReceivers the eventHubReceivers value to set. + * @return the ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withEventHubReceivers(List eventHubReceivers) { + if (this.innerProperties() == null) { + this.innerProperties = new ActionGroup(); + } + this.innerProperties().withEventHubReceivers(eventHubReceivers); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActivityLogAlertResourceInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActivityLogAlertResourceInner.java new file mode 100644 index 0000000000000..5cbb7b14bfdf8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActivityLogAlertResourceInner.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.resourcemanager.monitor.generated.models.ActionList; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertAllOfCondition; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An Activity Log Alert rule resource. */ +@Fluent +public final class ActivityLogAlertResourceInner extends Resource { + /* + * The Activity Log Alert rule properties of the resource. + */ + @JsonProperty(value = "properties") + private AlertRuleProperties innerProperties; + + /** Creates an instance of ActivityLogAlertResourceInner class. */ + public ActivityLogAlertResourceInner() { + } + + /** + * Get the innerProperties property: The Activity Log Alert rule properties of the resource. + * + * @return the innerProperties value. + */ + private AlertRuleProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ActivityLogAlertResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ActivityLogAlertResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the scopes property: A list of resource IDs that will be used as prefixes. The alert will only apply to + * Activity Log events with resource IDs that fall under one of these prefixes. This list must include at least one + * item. + * + * @return the scopes value. + */ + public List scopes() { + return this.innerProperties() == null ? null : this.innerProperties().scopes(); + } + + /** + * Set the scopes property: A list of resource IDs that will be used as prefixes. The alert will only apply to + * Activity Log events with resource IDs that fall under one of these prefixes. This list must include at least one + * item. + * + * @param scopes the scopes value to set. + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withScopes(List scopes) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRuleProperties(); + } + this.innerProperties().withScopes(scopes); + return this; + } + + /** + * Get the condition property: The condition that will cause this alert to activate. + * + * @return the condition value. + */ + public ActivityLogAlertAllOfCondition condition() { + return this.innerProperties() == null ? null : this.innerProperties().condition(); + } + + /** + * Set the condition property: The condition that will cause this alert to activate. + * + * @param condition the condition value to set. + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withCondition(ActivityLogAlertAllOfCondition condition) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRuleProperties(); + } + this.innerProperties().withCondition(condition); + return this; + } + + /** + * Get the actions property: The actions that will activate when the condition is met. + * + * @return the actions value. + */ + public ActionList actions() { + return this.innerProperties() == null ? null : this.innerProperties().actions(); + } + + /** + * Set the actions property: The actions that will activate when the condition is met. + * + * @param actions the actions value to set. + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withActions(ActionList actions) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRuleProperties(); + } + this.innerProperties().withActions(actions); + return this; + } + + /** + * Get the enabled property: Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert + * rule is not enabled, then none of its actions will be activated. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert + * rule is not enabled, then none of its actions will be activated. + * + * @param enabled the enabled value to set. + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withEnabled(Boolean enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRuleProperties(); + } + this.innerProperties().withEnabled(enabled); + return this; + } + + /** + * Get the description property: A description of this Activity Log Alert rule. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: A description of this Activity Log Alert rule. + * + * @param description the description value to set. + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRuleProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRule.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRule.java new file mode 100644 index 0000000000000..8f5a64bd075a3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRule.java @@ -0,0 +1,250 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.RuleAction; +import com.azure.resourcemanager.monitor.generated.models.RuleCondition; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** An alert rule. */ +@Fluent +public final class AlertRule { + /* + * the name of the alert rule. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * the description of the alert rule that will be included in the alert email. + */ + @JsonProperty(value = "description") + private String description; + + /* + * the provisioning state. + */ + @JsonProperty(value = "provisioningState") + private String provisioningState; + + /* + * the flag that indicates whether the alert rule is enabled. + */ + @JsonProperty(value = "isEnabled", required = true) + private boolean isEnabled; + + /* + * the condition that results in the alert rule being activated. + */ + @JsonProperty(value = "condition", required = true) + private RuleCondition condition; + + /* + * action that is performed when the alert rule becomes active, and when an alert condition is resolved. + */ + @JsonProperty(value = "action") + private RuleAction action; + + /* + * the array of actions that are performed when the alert rule becomes active, and when an alert condition is + * resolved. + */ + @JsonProperty(value = "actions") + private List actions; + + /* + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdatedTime; + + /** Creates an instance of AlertRule class. */ + public AlertRule() { + } + + /** + * Get the name property: the name of the alert rule. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: the name of the alert rule. + * + * @param name the name value to set. + * @return the AlertRule object itself. + */ + public AlertRule withName(String name) { + this.name = name; + return this; + } + + /** + * Get the description property: the description of the alert rule that will be included in the alert email. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: the description of the alert rule that will be included in the alert email. + * + * @param description the description value to set. + * @return the AlertRule object itself. + */ + public AlertRule withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the provisioningState property: the provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Set the provisioningState property: the provisioning state. + * + * @param provisioningState the provisioningState value to set. + * @return the AlertRule object itself. + */ + public AlertRule withProvisioningState(String provisioningState) { + this.provisioningState = provisioningState; + return this; + } + + /** + * Get the isEnabled property: the flag that indicates whether the alert rule is enabled. + * + * @return the isEnabled value. + */ + public boolean isEnabled() { + return this.isEnabled; + } + + /** + * Set the isEnabled property: the flag that indicates whether the alert rule is enabled. + * + * @param isEnabled the isEnabled value to set. + * @return the AlertRule object itself. + */ + public AlertRule withIsEnabled(boolean isEnabled) { + this.isEnabled = isEnabled; + return this; + } + + /** + * Get the condition property: the condition that results in the alert rule being activated. + * + * @return the condition value. + */ + public RuleCondition condition() { + return this.condition; + } + + /** + * Set the condition property: the condition that results in the alert rule being activated. + * + * @param condition the condition value to set. + * @return the AlertRule object itself. + */ + public AlertRule withCondition(RuleCondition condition) { + this.condition = condition; + return this; + } + + /** + * Get the action property: action that is performed when the alert rule becomes active, and when an alert condition + * is resolved. + * + * @return the action value. + */ + public RuleAction action() { + return this.action; + } + + /** + * Set the action property: action that is performed when the alert rule becomes active, and when an alert condition + * is resolved. + * + * @param action the action value to set. + * @return the AlertRule object itself. + */ + public AlertRule withAction(RuleAction action) { + this.action = action; + return this; + } + + /** + * Get the actions property: the array of actions that are performed when the alert rule becomes active, and when an + * alert condition is resolved. + * + * @return the actions value. + */ + public List actions() { + return this.actions; + } + + /** + * Set the actions property: the array of actions that are performed when the alert rule becomes active, and when an + * alert condition is resolved. + * + * @param actions the actions value to set. + * @return the AlertRule object itself. + */ + public AlertRule withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get the lastUpdatedTime property: Last time the rule was updated in ISO8601 format. + * + * @return the lastUpdatedTime value. + */ + public OffsetDateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model AlertRule")); + } + if (condition() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property condition in model AlertRule")); + } else { + condition().validate(); + } + if (action() != null) { + action().validate(); + } + if (actions() != null) { + actions().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AlertRule.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRulePatchProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRulePatchProperties.java new file mode 100644 index 0000000000000..7d24d4d9c9e1a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRulePatchProperties.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Activity Log Alert rule properties for patch operations. */ +@Fluent +public final class AlertRulePatchProperties { + /* + * Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule is not enabled, then + * none of its actions will be activated. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /** Creates an instance of AlertRulePatchProperties class. */ + public AlertRulePatchProperties() { + } + + /** + * Get the enabled property: Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert + * rule is not enabled, then none of its actions will be activated. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert + * rule is not enabled, then none of its actions will be activated. + * + * @param enabled the enabled value to set. + * @return the AlertRulePatchProperties object itself. + */ + public AlertRulePatchProperties withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRuleProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRuleProperties.java new file mode 100644 index 0000000000000..cda7249ea2396 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRuleProperties.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.ActionList; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertAllOfCondition; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** An Azure Activity Log Alert rule. */ +@Fluent +public final class AlertRuleProperties { + /* + * A list of resource IDs that will be used as prefixes. The alert will only apply to Activity Log events with + * resource IDs that fall under one of these prefixes. This list must include at least one item. + */ + @JsonProperty(value = "scopes", required = true) + private List scopes; + + /* + * The condition that will cause this alert to activate. + */ + @JsonProperty(value = "condition", required = true) + private ActivityLogAlertAllOfCondition condition; + + /* + * The actions that will activate when the condition is met. + */ + @JsonProperty(value = "actions", required = true) + private ActionList actions; + + /* + * Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule is not enabled, then + * none of its actions will be activated. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /* + * A description of this Activity Log Alert rule. + */ + @JsonProperty(value = "description") + private String description; + + /** Creates an instance of AlertRuleProperties class. */ + public AlertRuleProperties() { + } + + /** + * Get the scopes property: A list of resource IDs that will be used as prefixes. The alert will only apply to + * Activity Log events with resource IDs that fall under one of these prefixes. This list must include at least one + * item. + * + * @return the scopes value. + */ + public List scopes() { + return this.scopes; + } + + /** + * Set the scopes property: A list of resource IDs that will be used as prefixes. The alert will only apply to + * Activity Log events with resource IDs that fall under one of these prefixes. This list must include at least one + * item. + * + * @param scopes the scopes value to set. + * @return the AlertRuleProperties object itself. + */ + public AlertRuleProperties withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Get the condition property: The condition that will cause this alert to activate. + * + * @return the condition value. + */ + public ActivityLogAlertAllOfCondition condition() { + return this.condition; + } + + /** + * Set the condition property: The condition that will cause this alert to activate. + * + * @param condition the condition value to set. + * @return the AlertRuleProperties object itself. + */ + public AlertRuleProperties withCondition(ActivityLogAlertAllOfCondition condition) { + this.condition = condition; + return this; + } + + /** + * Get the actions property: The actions that will activate when the condition is met. + * + * @return the actions value. + */ + public ActionList actions() { + return this.actions; + } + + /** + * Set the actions property: The actions that will activate when the condition is met. + * + * @param actions the actions value to set. + * @return the AlertRuleProperties object itself. + */ + public AlertRuleProperties withActions(ActionList actions) { + this.actions = actions; + return this; + } + + /** + * Get the enabled property: Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert + * rule is not enabled, then none of its actions will be activated. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert + * rule is not enabled, then none of its actions will be activated. + * + * @param enabled the enabled value to set. + * @return the AlertRuleProperties object itself. + */ + public AlertRuleProperties withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the description property: A description of this Activity Log Alert rule. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: A description of this Activity Log Alert rule. + * + * @param description the description value to set. + * @return the AlertRuleProperties object itself. + */ + public AlertRuleProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (scopes() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property scopes in model AlertRuleProperties")); + } + if (condition() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property condition in model AlertRuleProperties")); + } else { + condition().validate(); + } + if (actions() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property actions in model AlertRuleProperties")); + } else { + actions().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AlertRuleProperties.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRuleResourceInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRuleResourceInner.java new file mode 100644 index 0000000000000..2fafd2988f0ec --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRuleResourceInner.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.RuleAction; +import com.azure.resourcemanager.monitor.generated.models.RuleCondition; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** The alert rule resource. */ +@Fluent +public final class AlertRuleResourceInner extends Resource { + /* + * The alert rule properties of the resource. + */ + @JsonProperty(value = "properties", required = true) + private AlertRule innerProperties = new AlertRule(); + + /** Creates an instance of AlertRuleResourceInner class. */ + public AlertRuleResourceInner() { + } + + /** + * Get the innerProperties property: The alert rule properties of the resource. + * + * @return the innerProperties value. + */ + private AlertRule innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public AlertRuleResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AlertRuleResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the name property: the name of the alert rule. + * + * @return the name value. + */ + public String namePropertiesName() { + return this.innerProperties() == null ? null : this.innerProperties().name(); + } + + /** + * Set the name property: the name of the alert rule. + * + * @param name the name value to set. + * @return the AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner withNamePropertiesName(String name) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRule(); + } + this.innerProperties().withName(name); + return this; + } + + /** + * Get the description property: the description of the alert rule that will be included in the alert email. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: the description of the alert rule that will be included in the alert email. + * + * @param description the description value to set. + * @return the AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRule(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the provisioningState property: the provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Set the provisioningState property: the provisioning state. + * + * @param provisioningState the provisioningState value to set. + * @return the AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner withProvisioningState(String provisioningState) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRule(); + } + this.innerProperties().withProvisioningState(provisioningState); + return this; + } + + /** + * Get the isEnabled property: the flag that indicates whether the alert rule is enabled. + * + * @return the isEnabled value. + */ + public boolean isEnabled() { + return this.innerProperties() == null ? false : this.innerProperties().isEnabled(); + } + + /** + * Set the isEnabled property: the flag that indicates whether the alert rule is enabled. + * + * @param isEnabled the isEnabled value to set. + * @return the AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner withIsEnabled(boolean isEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRule(); + } + this.innerProperties().withIsEnabled(isEnabled); + return this; + } + + /** + * Get the condition property: the condition that results in the alert rule being activated. + * + * @return the condition value. + */ + public RuleCondition condition() { + return this.innerProperties() == null ? null : this.innerProperties().condition(); + } + + /** + * Set the condition property: the condition that results in the alert rule being activated. + * + * @param condition the condition value to set. + * @return the AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner withCondition(RuleCondition condition) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRule(); + } + this.innerProperties().withCondition(condition); + return this; + } + + /** + * Get the action property: action that is performed when the alert rule becomes active, and when an alert condition + * is resolved. + * + * @return the action value. + */ + public RuleAction action() { + return this.innerProperties() == null ? null : this.innerProperties().action(); + } + + /** + * Set the action property: action that is performed when the alert rule becomes active, and when an alert condition + * is resolved. + * + * @param action the action value to set. + * @return the AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner withAction(RuleAction action) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRule(); + } + this.innerProperties().withAction(action); + return this; + } + + /** + * Get the actions property: the array of actions that are performed when the alert rule becomes active, and when an + * alert condition is resolved. + * + * @return the actions value. + */ + public List actions() { + return this.innerProperties() == null ? null : this.innerProperties().actions(); + } + + /** + * Set the actions property: the array of actions that are performed when the alert rule becomes active, and when an + * alert condition is resolved. + * + * @param actions the actions value to set. + * @return the AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner withActions(List actions) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRule(); + } + this.innerProperties().withActions(actions); + return this; + } + + /** + * Get the lastUpdatedTime property: Last time the rule was updated in ISO8601 format. + * + * @return the lastUpdatedTime value. + */ + public OffsetDateTime lastUpdatedTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedTime(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model AlertRuleResourceInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AlertRuleResourceInner.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AutoscaleSetting.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AutoscaleSetting.java new file mode 100644 index 0000000000000..d68cdcd418a6e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AutoscaleSetting.java @@ -0,0 +1,235 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleNotification; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleProfile; +import com.azure.resourcemanager.monitor.generated.models.PredictiveAutoscalePolicy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A setting that contains all of the configuration for the automatic scaling of a resource. */ +@Fluent +public final class AutoscaleSetting { + /* + * the collection of automatic scaling profiles that specify different scaling parameters for different time + * periods. A maximum of 20 profiles can be specified. + */ + @JsonProperty(value = "profiles", required = true) + private List profiles; + + /* + * the collection of notifications. + */ + @JsonProperty(value = "notifications") + private List notifications; + + /* + * the enabled flag. Specifies whether automatic scaling is enabled for the resource. The default value is 'false'. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /* + * the predictive autoscale policy mode. + */ + @JsonProperty(value = "predictiveAutoscalePolicy") + private PredictiveAutoscalePolicy predictiveAutoscalePolicy; + + /* + * the name of the autoscale setting. + */ + @JsonProperty(value = "name") + private String name; + + /* + * the resource identifier of the resource that the autoscale setting should be added to. + */ + @JsonProperty(value = "targetResourceUri") + private String targetResourceUri; + + /* + * the location of the resource that the autoscale setting should be added to. + */ + @JsonProperty(value = "targetResourceLocation") + private String targetResourceLocation; + + /** Creates an instance of AutoscaleSetting class. */ + public AutoscaleSetting() { + } + + /** + * Get the profiles property: the collection of automatic scaling profiles that specify different scaling parameters + * for different time periods. A maximum of 20 profiles can be specified. + * + * @return the profiles value. + */ + public List profiles() { + return this.profiles; + } + + /** + * Set the profiles property: the collection of automatic scaling profiles that specify different scaling parameters + * for different time periods. A maximum of 20 profiles can be specified. + * + * @param profiles the profiles value to set. + * @return the AutoscaleSetting object itself. + */ + public AutoscaleSetting withProfiles(List profiles) { + this.profiles = profiles; + return this; + } + + /** + * Get the notifications property: the collection of notifications. + * + * @return the notifications value. + */ + public List notifications() { + return this.notifications; + } + + /** + * Set the notifications property: the collection of notifications. + * + * @param notifications the notifications value to set. + * @return the AutoscaleSetting object itself. + */ + public AutoscaleSetting withNotifications(List notifications) { + this.notifications = notifications; + return this; + } + + /** + * Get the enabled property: the enabled flag. Specifies whether automatic scaling is enabled for the resource. The + * default value is 'false'. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: the enabled flag. Specifies whether automatic scaling is enabled for the resource. The + * default value is 'false'. + * + * @param enabled the enabled value to set. + * @return the AutoscaleSetting object itself. + */ + public AutoscaleSetting withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the predictiveAutoscalePolicy property: the predictive autoscale policy mode. + * + * @return the predictiveAutoscalePolicy value. + */ + public PredictiveAutoscalePolicy predictiveAutoscalePolicy() { + return this.predictiveAutoscalePolicy; + } + + /** + * Set the predictiveAutoscalePolicy property: the predictive autoscale policy mode. + * + * @param predictiveAutoscalePolicy the predictiveAutoscalePolicy value to set. + * @return the AutoscaleSetting object itself. + */ + public AutoscaleSetting withPredictiveAutoscalePolicy(PredictiveAutoscalePolicy predictiveAutoscalePolicy) { + this.predictiveAutoscalePolicy = predictiveAutoscalePolicy; + return this; + } + + /** + * Get the name property: the name of the autoscale setting. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: the name of the autoscale setting. + * + * @param name the name value to set. + * @return the AutoscaleSetting object itself. + */ + public AutoscaleSetting withName(String name) { + this.name = name; + return this; + } + + /** + * Get the targetResourceUri property: the resource identifier of the resource that the autoscale setting should be + * added to. + * + * @return the targetResourceUri value. + */ + public String targetResourceUri() { + return this.targetResourceUri; + } + + /** + * Set the targetResourceUri property: the resource identifier of the resource that the autoscale setting should be + * added to. + * + * @param targetResourceUri the targetResourceUri value to set. + * @return the AutoscaleSetting object itself. + */ + public AutoscaleSetting withTargetResourceUri(String targetResourceUri) { + this.targetResourceUri = targetResourceUri; + return this; + } + + /** + * Get the targetResourceLocation property: the location of the resource that the autoscale setting should be added + * to. + * + * @return the targetResourceLocation value. + */ + public String targetResourceLocation() { + return this.targetResourceLocation; + } + + /** + * Set the targetResourceLocation property: the location of the resource that the autoscale setting should be added + * to. + * + * @param targetResourceLocation the targetResourceLocation value to set. + * @return the AutoscaleSetting object itself. + */ + public AutoscaleSetting withTargetResourceLocation(String targetResourceLocation) { + this.targetResourceLocation = targetResourceLocation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (profiles() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property profiles in model AutoscaleSetting")); + } else { + profiles().forEach(e -> e.validate()); + } + if (notifications() != null) { + notifications().forEach(e -> e.validate()); + } + if (predictiveAutoscalePolicy() != null) { + predictiveAutoscalePolicy().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AutoscaleSetting.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AutoscaleSettingResourceInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AutoscaleSettingResourceInner.java new file mode 100644 index 0000000000000..89ccffc5ca100 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AutoscaleSettingResourceInner.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleNotification; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleProfile; +import com.azure.resourcemanager.monitor.generated.models.PredictiveAutoscalePolicy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The autoscale setting resource. */ +@Fluent +public final class AutoscaleSettingResourceInner extends Resource { + /* + * The autoscale setting of the resource. + */ + @JsonProperty(value = "properties", required = true) + private AutoscaleSetting innerProperties = new AutoscaleSetting(); + + /* + * The system metadata related to the response. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of AutoscaleSettingResourceInner class. */ + public AutoscaleSettingResourceInner() { + } + + /** + * Get the innerProperties property: The autoscale setting of the resource. + * + * @return the innerProperties value. + */ + private AutoscaleSetting innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: The system metadata related to the response. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public AutoscaleSettingResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AutoscaleSettingResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the profiles property: the collection of automatic scaling profiles that specify different scaling parameters + * for different time periods. A maximum of 20 profiles can be specified. + * + * @return the profiles value. + */ + public List profiles() { + return this.innerProperties() == null ? null : this.innerProperties().profiles(); + } + + /** + * Set the profiles property: the collection of automatic scaling profiles that specify different scaling parameters + * for different time periods. A maximum of 20 profiles can be specified. + * + * @param profiles the profiles value to set. + * @return the AutoscaleSettingResourceInner object itself. + */ + public AutoscaleSettingResourceInner withProfiles(List profiles) { + if (this.innerProperties() == null) { + this.innerProperties = new AutoscaleSetting(); + } + this.innerProperties().withProfiles(profiles); + return this; + } + + /** + * Get the notifications property: the collection of notifications. + * + * @return the notifications value. + */ + public List notifications() { + return this.innerProperties() == null ? null : this.innerProperties().notifications(); + } + + /** + * Set the notifications property: the collection of notifications. + * + * @param notifications the notifications value to set. + * @return the AutoscaleSettingResourceInner object itself. + */ + public AutoscaleSettingResourceInner withNotifications(List notifications) { + if (this.innerProperties() == null) { + this.innerProperties = new AutoscaleSetting(); + } + this.innerProperties().withNotifications(notifications); + return this; + } + + /** + * Get the enabled property: the enabled flag. Specifies whether automatic scaling is enabled for the resource. The + * default value is 'false'. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: the enabled flag. Specifies whether automatic scaling is enabled for the resource. The + * default value is 'false'. + * + * @param enabled the enabled value to set. + * @return the AutoscaleSettingResourceInner object itself. + */ + public AutoscaleSettingResourceInner withEnabled(Boolean enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new AutoscaleSetting(); + } + this.innerProperties().withEnabled(enabled); + return this; + } + + /** + * Get the predictiveAutoscalePolicy property: the predictive autoscale policy mode. + * + * @return the predictiveAutoscalePolicy value. + */ + public PredictiveAutoscalePolicy predictiveAutoscalePolicy() { + return this.innerProperties() == null ? null : this.innerProperties().predictiveAutoscalePolicy(); + } + + /** + * Set the predictiveAutoscalePolicy property: the predictive autoscale policy mode. + * + * @param predictiveAutoscalePolicy the predictiveAutoscalePolicy value to set. + * @return the AutoscaleSettingResourceInner object itself. + */ + public AutoscaleSettingResourceInner withPredictiveAutoscalePolicy( + PredictiveAutoscalePolicy predictiveAutoscalePolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new AutoscaleSetting(); + } + this.innerProperties().withPredictiveAutoscalePolicy(predictiveAutoscalePolicy); + return this; + } + + /** + * Get the name property: the name of the autoscale setting. + * + * @return the name value. + */ + public String namePropertiesName() { + return this.innerProperties() == null ? null : this.innerProperties().name(); + } + + /** + * Set the name property: the name of the autoscale setting. + * + * @param name the name value to set. + * @return the AutoscaleSettingResourceInner object itself. + */ + public AutoscaleSettingResourceInner withNamePropertiesName(String name) { + if (this.innerProperties() == null) { + this.innerProperties = new AutoscaleSetting(); + } + this.innerProperties().withName(name); + return this; + } + + /** + * Get the targetResourceUri property: the resource identifier of the resource that the autoscale setting should be + * added to. + * + * @return the targetResourceUri value. + */ + public String targetResourceUri() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceUri(); + } + + /** + * Set the targetResourceUri property: the resource identifier of the resource that the autoscale setting should be + * added to. + * + * @param targetResourceUri the targetResourceUri value to set. + * @return the AutoscaleSettingResourceInner object itself. + */ + public AutoscaleSettingResourceInner withTargetResourceUri(String targetResourceUri) { + if (this.innerProperties() == null) { + this.innerProperties = new AutoscaleSetting(); + } + this.innerProperties().withTargetResourceUri(targetResourceUri); + return this; + } + + /** + * Get the targetResourceLocation property: the location of the resource that the autoscale setting should be added + * to. + * + * @return the targetResourceLocation value. + */ + public String targetResourceLocation() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceLocation(); + } + + /** + * Set the targetResourceLocation property: the location of the resource that the autoscale setting should be added + * to. + * + * @param targetResourceLocation the targetResourceLocation value to set. + * @return the AutoscaleSettingResourceInner object itself. + */ + public AutoscaleSettingResourceInner withTargetResourceLocation(String targetResourceLocation) { + if (this.innerProperties() == null) { + this.innerProperties = new AutoscaleSetting(); + } + this.innerProperties().withTargetResourceLocation(targetResourceLocation); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model AutoscaleSettingResourceInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AutoscaleSettingResourceInner.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorPrivateLinkScopeInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorPrivateLinkScopeInner.java new file mode 100644 index 0000000000000..e4f85fd6e0134 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorPrivateLinkScopeInner.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.AccessModeSettings; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An Azure Monitor PrivateLinkScope definition. */ +@Fluent +public final class AzureMonitorPrivateLinkScopeInner extends Resource { + /* + * Properties that define a Azure Monitor PrivateLinkScope resource. + */ + @JsonProperty(value = "properties", required = true) + private AzureMonitorPrivateLinkScopeProperties innerProperties = new AzureMonitorPrivateLinkScopeProperties(); + + /* + * System data + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of AzureMonitorPrivateLinkScopeInner class. */ + public AzureMonitorPrivateLinkScopeInner() { + } + + /** + * Get the innerProperties property: Properties that define a Azure Monitor PrivateLinkScope resource. + * + * @return the innerProperties value. + */ + private AzureMonitorPrivateLinkScopeProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: System data. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public AzureMonitorPrivateLinkScopeInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureMonitorPrivateLinkScopeInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the provisioningState property: 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. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpointConnections(); + } + + /** + * Get the accessModeSettings property: Access mode settings. + * + * @return the accessModeSettings value. + */ + public AccessModeSettings accessModeSettings() { + return this.innerProperties() == null ? null : this.innerProperties().accessModeSettings(); + } + + /** + * Set the accessModeSettings property: Access mode settings. + * + * @param accessModeSettings the accessModeSettings value to set. + * @return the AzureMonitorPrivateLinkScopeInner object itself. + */ + public AzureMonitorPrivateLinkScopeInner withAccessModeSettings(AccessModeSettings accessModeSettings) { + if (this.innerProperties() == null) { + this.innerProperties = new AzureMonitorPrivateLinkScopeProperties(); + } + this.innerProperties().withAccessModeSettings(accessModeSettings); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model AzureMonitorPrivateLinkScopeInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AzureMonitorPrivateLinkScopeInner.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorPrivateLinkScopeProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorPrivateLinkScopeProperties.java new file mode 100644 index 0000000000000..26a8cc2161a1f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorPrivateLinkScopeProperties.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.AccessModeSettings; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties that define a Azure Monitor PrivateLinkScope resource. */ +@Fluent +public final class AzureMonitorPrivateLinkScopeProperties { + /* + * 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. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * List of private endpoint connections. + */ + @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /* + * Access mode settings + */ + @JsonProperty(value = "accessModeSettings", required = true) + private AccessModeSettings accessModeSettings; + + /** Creates an instance of AzureMonitorPrivateLinkScopeProperties class. */ + public AzureMonitorPrivateLinkScopeProperties() { + } + + /** + * Get the provisioningState property: 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. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** + * Get the accessModeSettings property: Access mode settings. + * + * @return the accessModeSettings value. + */ + public AccessModeSettings accessModeSettings() { + return this.accessModeSettings; + } + + /** + * Set the accessModeSettings property: Access mode settings. + * + * @param accessModeSettings the accessModeSettings value to set. + * @return the AzureMonitorPrivateLinkScopeProperties object itself. + */ + public AzureMonitorPrivateLinkScopeProperties withAccessModeSettings(AccessModeSettings accessModeSettings) { + this.accessModeSettings = accessModeSettings; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + if (accessModeSettings() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property accessModeSettings in model" + + " AzureMonitorPrivateLinkScopeProperties")); + } else { + accessModeSettings().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AzureMonitorPrivateLinkScopeProperties.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorWorkspaceResourceInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorWorkspaceResourceInner.java new file mode 100644 index 0000000000000..e1f1118db29e5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorWorkspaceResourceInner.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorWorkspaceDefaultIngestionSettings; +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorWorkspaceMetrics; +import com.azure.resourcemanager.monitor.generated.models.ProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Azure Monitor Workspace definition. */ +@Fluent +public final class AzureMonitorWorkspaceResourceInner extends Resource { + /* + * Resource properties + */ + @JsonProperty(value = "properties") + private AzureMonitorWorkspaceResourceProperties innerProperties; + + /* + * Resource entity tag (ETag) + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /* + * Azure Resource Manager metadata containing createdBy and modifiedBy information. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of AzureMonitorWorkspaceResourceInner class. */ + public AzureMonitorWorkspaceResourceInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private AzureMonitorWorkspaceResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the etag property: Resource entity tag (ETag). + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Get the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public AzureMonitorWorkspaceResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureMonitorWorkspaceResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the accountId property: The immutable ID of the Azure Monitor workspace. This property is read-only. + * + * @return the accountId value. + */ + public String accountId() { + return this.innerProperties() == null ? null : this.innerProperties().accountId(); + } + + /** + * Get the metrics property: Information about metrics for the Azure Monitor workspace. + * + * @return the metrics value. + */ + public AzureMonitorWorkspaceMetrics metrics() { + return this.innerProperties() == null ? null : this.innerProperties().metrics(); + } + + /** + * Get the provisioningState property: The provisioning state of the Azure Monitor workspace. Set to Succeeded if + * everything is healthy. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the defaultIngestionSettings property: The Data Collection Rule and Endpoint used for ingestion by default. + * + * @return the defaultIngestionSettings value. + */ + public AzureMonitorWorkspaceDefaultIngestionSettings defaultIngestionSettings() { + return this.innerProperties() == null ? null : this.innerProperties().defaultIngestionSettings(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorWorkspaceResourceProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorWorkspaceResourceProperties.java new file mode 100644 index 0000000000000..0e7e9a22e0e7e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorWorkspaceResourceProperties.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorWorkspace; + +/** Resource properties. */ +@Immutable +public final class AzureMonitorWorkspaceResourceProperties extends AzureMonitorWorkspace { + /** Creates an instance of AzureMonitorWorkspaceResourceProperties class. */ + public AzureMonitorWorkspaceResourceProperties() { + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionEndpointResourceInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionEndpointResourceInner.java new file mode 100644 index 0000000000000..83d984043cc0d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionEndpointResourceInner.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointConfigurationAccess; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointLogsIngestion; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointNetworkAcls; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionEndpointProvisioningState; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionEndpointResourceKind; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Definition of ARM tracked top level resource. */ +@Fluent +public final class DataCollectionEndpointResourceInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DataCollectionEndpointResourceProperties innerProperties; + + /* + * The kind of the resource. + */ + @JsonProperty(value = "kind") + private KnownDataCollectionEndpointResourceKind kind; + + /* + * Resource entity tag (ETag). + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of DataCollectionEndpointResourceInner class. */ + public DataCollectionEndpointResourceInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DataCollectionEndpointResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the kind property: The kind of the resource. + * + * @return the kind value. + */ + public KnownDataCollectionEndpointResourceKind kind() { + return this.kind; + } + + /** + * Set the kind property: The kind of the resource. + * + * @param kind the kind value to set. + * @return the DataCollectionEndpointResourceInner object itself. + */ + public DataCollectionEndpointResourceInner withKind(KnownDataCollectionEndpointResourceKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the etag property: Resource entity tag (ETag). + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionEndpointResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionEndpointResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the description property: Description of the data collection endpoint. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Description of the data collection endpoint. + * + * @param description the description value to set. + * @return the DataCollectionEndpointResourceInner object itself. + */ + public DataCollectionEndpointResourceInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new DataCollectionEndpointResourceProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the immutableId property: The immutable ID of this data collection endpoint resource. This property is + * READ-ONLY. + * + * @return the immutableId value. + */ + public String immutableId() { + return this.innerProperties() == null ? null : this.innerProperties().immutableId(); + } + + /** + * Set the immutableId property: The immutable ID of this data collection endpoint resource. This property is + * READ-ONLY. + * + * @param immutableId the immutableId value to set. + * @return the DataCollectionEndpointResourceInner object itself. + */ + public DataCollectionEndpointResourceInner withImmutableId(String immutableId) { + if (this.innerProperties() == null) { + this.innerProperties = new DataCollectionEndpointResourceProperties(); + } + this.innerProperties().withImmutableId(immutableId); + return this; + } + + /** + * Get the configurationAccess property: The endpoint used by clients to access their configuration. + * + * @return the configurationAccess value. + */ + public DataCollectionEndpointConfigurationAccess configurationAccess() { + return this.innerProperties() == null ? null : this.innerProperties().configurationAccess(); + } + + /** + * Set the configurationAccess property: The endpoint used by clients to access their configuration. + * + * @param configurationAccess the configurationAccess value to set. + * @return the DataCollectionEndpointResourceInner object itself. + */ + public DataCollectionEndpointResourceInner withConfigurationAccess( + DataCollectionEndpointConfigurationAccess configurationAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new DataCollectionEndpointResourceProperties(); + } + this.innerProperties().withConfigurationAccess(configurationAccess); + return this; + } + + /** + * Get the logsIngestion property: The endpoint used by clients to ingest logs. + * + * @return the logsIngestion value. + */ + public DataCollectionEndpointLogsIngestion logsIngestion() { + return this.innerProperties() == null ? null : this.innerProperties().logsIngestion(); + } + + /** + * Set the logsIngestion property: The endpoint used by clients to ingest logs. + * + * @param logsIngestion the logsIngestion value to set. + * @return the DataCollectionEndpointResourceInner object itself. + */ + public DataCollectionEndpointResourceInner withLogsIngestion(DataCollectionEndpointLogsIngestion logsIngestion) { + if (this.innerProperties() == null) { + this.innerProperties = new DataCollectionEndpointResourceProperties(); + } + this.innerProperties().withLogsIngestion(logsIngestion); + return this; + } + + /** + * Get the networkAcls property: Network access control rules for the endpoints. + * + * @return the networkAcls value. + */ + public DataCollectionEndpointNetworkAcls networkAcls() { + return this.innerProperties() == null ? null : this.innerProperties().networkAcls(); + } + + /** + * Set the networkAcls property: Network access control rules for the endpoints. + * + * @param networkAcls the networkAcls value to set. + * @return the DataCollectionEndpointResourceInner object itself. + */ + public DataCollectionEndpointResourceInner withNetworkAcls(DataCollectionEndpointNetworkAcls networkAcls) { + if (this.innerProperties() == null) { + this.innerProperties = new DataCollectionEndpointResourceProperties(); + } + this.innerProperties().withNetworkAcls(networkAcls); + return this; + } + + /** + * Get the provisioningState property: The resource provisioning state. This property is READ-ONLY. + * + * @return the provisioningState value. + */ + public KnownDataCollectionEndpointProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionEndpointResourceProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionEndpointResourceProperties.java new file mode 100644 index 0000000000000..99688191baa82 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionEndpointResourceProperties.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpoint; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointConfigurationAccess; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointLogsIngestion; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointNetworkAcls; + +/** Resource properties. */ +@Fluent +public final class DataCollectionEndpointResourceProperties extends DataCollectionEndpoint { + /** Creates an instance of DataCollectionEndpointResourceProperties class. */ + public DataCollectionEndpointResourceProperties() { + } + + /** {@inheritDoc} */ + @Override + public DataCollectionEndpointResourceProperties withDescription(String description) { + super.withDescription(description); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionEndpointResourceProperties withImmutableId(String immutableId) { + super.withImmutableId(immutableId); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionEndpointResourceProperties withConfigurationAccess( + DataCollectionEndpointConfigurationAccess configurationAccess) { + super.withConfigurationAccess(configurationAccess); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionEndpointResourceProperties withLogsIngestion( + DataCollectionEndpointLogsIngestion logsIngestion) { + super.withLogsIngestion(logsIngestion); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionEndpointResourceProperties withNetworkAcls(DataCollectionEndpointNetworkAcls networkAcls) { + super.withNetworkAcls(networkAcls); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleAssociationProxyOnlyResourceInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleAssociationProxyOnlyResourceInner.java new file mode 100644 index 0000000000000..fe4922fad2374 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleAssociationProxyOnlyResourceInner.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleAssociationMetadata; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionRuleAssociationProvisioningState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Definition of generic ARM proxy resource. */ +@Fluent +public final class DataCollectionRuleAssociationProxyOnlyResourceInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DataCollectionRuleAssociationProxyOnlyResourceProperties innerProperties; + + /* + * Resource entity tag (ETag). + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of DataCollectionRuleAssociationProxyOnlyResourceInner class. */ + public DataCollectionRuleAssociationProxyOnlyResourceInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DataCollectionRuleAssociationProxyOnlyResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the etag property: Resource entity tag (ETag). + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the description property: Description of the association. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Description of the association. + * + * @param description the description value to set. + * @return the DataCollectionRuleAssociationProxyOnlyResourceInner object itself. + */ + public DataCollectionRuleAssociationProxyOnlyResourceInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new DataCollectionRuleAssociationProxyOnlyResourceProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the dataCollectionRuleId property: The resource ID of the data collection rule that is to be associated. + * + * @return the dataCollectionRuleId value. + */ + public String dataCollectionRuleId() { + return this.innerProperties() == null ? null : this.innerProperties().dataCollectionRuleId(); + } + + /** + * Set the dataCollectionRuleId property: The resource ID of the data collection rule that is to be associated. + * + * @param dataCollectionRuleId the dataCollectionRuleId value to set. + * @return the DataCollectionRuleAssociationProxyOnlyResourceInner object itself. + */ + public DataCollectionRuleAssociationProxyOnlyResourceInner withDataCollectionRuleId(String dataCollectionRuleId) { + if (this.innerProperties() == null) { + this.innerProperties = new DataCollectionRuleAssociationProxyOnlyResourceProperties(); + } + this.innerProperties().withDataCollectionRuleId(dataCollectionRuleId); + return this; + } + + /** + * Get the dataCollectionEndpointId property: The resource ID of the data collection endpoint that is to be + * associated. + * + * @return the dataCollectionEndpointId value. + */ + public String dataCollectionEndpointId() { + return this.innerProperties() == null ? null : this.innerProperties().dataCollectionEndpointId(); + } + + /** + * Set the dataCollectionEndpointId property: The resource ID of the data collection endpoint that is to be + * associated. + * + * @param dataCollectionEndpointId the dataCollectionEndpointId value to set. + * @return the DataCollectionRuleAssociationProxyOnlyResourceInner object itself. + */ + public DataCollectionRuleAssociationProxyOnlyResourceInner withDataCollectionEndpointId( + String dataCollectionEndpointId) { + if (this.innerProperties() == null) { + this.innerProperties = new DataCollectionRuleAssociationProxyOnlyResourceProperties(); + } + this.innerProperties().withDataCollectionEndpointId(dataCollectionEndpointId); + return this; + } + + /** + * Get the provisioningState property: The resource provisioning state. + * + * @return the provisioningState value. + */ + public KnownDataCollectionRuleAssociationProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the metadata property: Metadata about the resource. + * + * @return the metadata value. + */ + public DataCollectionRuleAssociationMetadata metadata() { + return this.innerProperties() == null ? null : this.innerProperties().metadata(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleAssociationProxyOnlyResourceProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleAssociationProxyOnlyResourceProperties.java new file mode 100644 index 0000000000000..c25b1bc5747d2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleAssociationProxyOnlyResourceProperties.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleAssociation; + +/** Resource properties. */ +@Fluent +public final class DataCollectionRuleAssociationProxyOnlyResourceProperties extends DataCollectionRuleAssociation { + /** Creates an instance of DataCollectionRuleAssociationProxyOnlyResourceProperties class. */ + public DataCollectionRuleAssociationProxyOnlyResourceProperties() { + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleAssociationProxyOnlyResourceProperties withDescription(String description) { + super.withDescription(description); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleAssociationProxyOnlyResourceProperties withDataCollectionRuleId( + String dataCollectionRuleId) { + super.withDataCollectionRuleId(dataCollectionRuleId); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleAssociationProxyOnlyResourceProperties withDataCollectionEndpointId( + String dataCollectionEndpointId) { + super.withDataCollectionEndpointId(dataCollectionEndpointId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleResourceInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleResourceInner.java new file mode 100644 index 0000000000000..1ea7162190281 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleResourceInner.java @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleDataSources; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleDestinations; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleMetadata; +import com.azure.resourcemanager.monitor.generated.models.DataFlow; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionRuleProvisioningState; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionRuleResourceKind; +import com.azure.resourcemanager.monitor.generated.models.StreamDeclaration; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Definition of ARM tracked top level resource. */ +@Fluent +public final class DataCollectionRuleResourceInner extends Resource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private DataCollectionRuleResourceProperties innerProperties; + + /* + * The kind of the resource. + */ + @JsonProperty(value = "kind") + private KnownDataCollectionRuleResourceKind kind; + + /* + * Resource entity tag (ETag). + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /* + * Metadata pertaining to creation and last modification of the resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of DataCollectionRuleResourceInner class. */ + public DataCollectionRuleResourceInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private DataCollectionRuleResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the kind property: The kind of the resource. + * + * @return the kind value. + */ + public KnownDataCollectionRuleResourceKind kind() { + return this.kind; + } + + /** + * Set the kind property: The kind of the resource. + * + * @param kind the kind value to set. + * @return the DataCollectionRuleResourceInner object itself. + */ + public DataCollectionRuleResourceInner withKind(KnownDataCollectionRuleResourceKind kind) { + this.kind = kind; + return this; + } + + /** + * Get the etag property: Resource entity tag (ETag). + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the description property: Description of the data collection rule. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: Description of the data collection rule. + * + * @param description the description value to set. + * @return the DataCollectionRuleResourceInner object itself. + */ + public DataCollectionRuleResourceInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new DataCollectionRuleResourceProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the immutableId property: The immutable ID of this data collection rule. This property is READ-ONLY. + * + * @return the immutableId value. + */ + public String immutableId() { + return this.innerProperties() == null ? null : this.innerProperties().immutableId(); + } + + /** + * Get the dataCollectionEndpointId property: The resource ID of the data collection endpoint that this rule can be + * used with. + * + * @return the dataCollectionEndpointId value. + */ + public String dataCollectionEndpointId() { + return this.innerProperties() == null ? null : this.innerProperties().dataCollectionEndpointId(); + } + + /** + * Set the dataCollectionEndpointId property: The resource ID of the data collection endpoint that this rule can be + * used with. + * + * @param dataCollectionEndpointId the dataCollectionEndpointId value to set. + * @return the DataCollectionRuleResourceInner object itself. + */ + public DataCollectionRuleResourceInner withDataCollectionEndpointId(String dataCollectionEndpointId) { + if (this.innerProperties() == null) { + this.innerProperties = new DataCollectionRuleResourceProperties(); + } + this.innerProperties().withDataCollectionEndpointId(dataCollectionEndpointId); + return this; + } + + /** + * Get the metadata property: Metadata about the resource. + * + * @return the metadata value. + */ + public DataCollectionRuleMetadata metadata() { + return this.innerProperties() == null ? null : this.innerProperties().metadata(); + } + + /** + * Get the streamDeclarations property: Declaration of custom streams used in this rule. + * + * @return the streamDeclarations value. + */ + public Map streamDeclarations() { + return this.innerProperties() == null ? null : this.innerProperties().streamDeclarations(); + } + + /** + * Set the streamDeclarations property: Declaration of custom streams used in this rule. + * + * @param streamDeclarations the streamDeclarations value to set. + * @return the DataCollectionRuleResourceInner object itself. + */ + public DataCollectionRuleResourceInner withStreamDeclarations(Map streamDeclarations) { + if (this.innerProperties() == null) { + this.innerProperties = new DataCollectionRuleResourceProperties(); + } + this.innerProperties().withStreamDeclarations(streamDeclarations); + return this; + } + + /** + * Get the dataSources property: The specification of data sources. This property is optional and can be omitted if + * the rule is meant to be used via direct calls to the provisioned endpoint. + * + * @return the dataSources value. + */ + public DataCollectionRuleDataSources dataSources() { + return this.innerProperties() == null ? null : this.innerProperties().dataSources(); + } + + /** + * Set the dataSources property: The specification of data sources. This property is optional and can be omitted if + * the rule is meant to be used via direct calls to the provisioned endpoint. + * + * @param dataSources the dataSources value to set. + * @return the DataCollectionRuleResourceInner object itself. + */ + public DataCollectionRuleResourceInner withDataSources(DataCollectionRuleDataSources dataSources) { + if (this.innerProperties() == null) { + this.innerProperties = new DataCollectionRuleResourceProperties(); + } + this.innerProperties().withDataSources(dataSources); + return this; + } + + /** + * Get the destinations property: The specification of destinations. + * + * @return the destinations value. + */ + public DataCollectionRuleDestinations destinations() { + return this.innerProperties() == null ? null : this.innerProperties().destinations(); + } + + /** + * Set the destinations property: The specification of destinations. + * + * @param destinations the destinations value to set. + * @return the DataCollectionRuleResourceInner object itself. + */ + public DataCollectionRuleResourceInner withDestinations(DataCollectionRuleDestinations destinations) { + if (this.innerProperties() == null) { + this.innerProperties = new DataCollectionRuleResourceProperties(); + } + this.innerProperties().withDestinations(destinations); + return this; + } + + /** + * Get the dataFlows property: The specification of data flows. + * + * @return the dataFlows value. + */ + public List dataFlows() { + return this.innerProperties() == null ? null : this.innerProperties().dataFlows(); + } + + /** + * Set the dataFlows property: The specification of data flows. + * + * @param dataFlows the dataFlows value to set. + * @return the DataCollectionRuleResourceInner object itself. + */ + public DataCollectionRuleResourceInner withDataFlows(List dataFlows) { + if (this.innerProperties() == null) { + this.innerProperties = new DataCollectionRuleResourceProperties(); + } + this.innerProperties().withDataFlows(dataFlows); + return this; + } + + /** + * Get the provisioningState property: The resource provisioning state. + * + * @return the provisioningState value. + */ + public KnownDataCollectionRuleProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleResourceProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleResourceProperties.java new file mode 100644 index 0000000000000..1989e5f2f8f31 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleResourceProperties.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRule; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleDataSources; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleDestinations; +import com.azure.resourcemanager.monitor.generated.models.DataFlow; +import com.azure.resourcemanager.monitor.generated.models.StreamDeclaration; +import java.util.List; +import java.util.Map; + +/** Resource properties. */ +@Fluent +public final class DataCollectionRuleResourceProperties extends DataCollectionRule { + /** Creates an instance of DataCollectionRuleResourceProperties class. */ + public DataCollectionRuleResourceProperties() { + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleResourceProperties withDescription(String description) { + super.withDescription(description); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleResourceProperties withDataCollectionEndpointId(String dataCollectionEndpointId) { + super.withDataCollectionEndpointId(dataCollectionEndpointId); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleResourceProperties withStreamDeclarations( + Map streamDeclarations) { + super.withStreamDeclarations(streamDeclarations); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleResourceProperties withDataSources(DataCollectionRuleDataSources dataSources) { + super.withDataSources(dataSources); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleResourceProperties withDestinations(DataCollectionRuleDestinations destinations) { + super.withDestinations(destinations); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleResourceProperties withDataFlows(List dataFlows) { + super.withDataFlows(dataFlows); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettings.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettings.java new file mode 100644 index 0000000000000..fd079a0d69b99 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettings.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.models.LogSettings; +import com.azure.resourcemanager.monitor.generated.models.MetricSettings; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The diagnostic settings. */ +@Fluent +public final class DiagnosticSettings { + /* + * The resource ID of the storage account to which you would like to send Diagnostic Logs. + */ + @JsonProperty(value = "storageAccountId") + private String storageAccountId; + + /* + * The service bus rule Id of the diagnostic setting. This is here to maintain backwards compatibility. + */ + @JsonProperty(value = "serviceBusRuleId") + private String serviceBusRuleId; + + /* + * The resource Id for the event hub authorization rule. + */ + @JsonProperty(value = "eventHubAuthorizationRuleId") + private String eventHubAuthorizationRuleId; + + /* + * The name of the event hub. If none is specified, the default event hub will be selected. + */ + @JsonProperty(value = "eventHubName") + private String eventHubName; + + /* + * The list of metric settings. + */ + @JsonProperty(value = "metrics") + private List metrics; + + /* + * The list of logs settings. + */ + @JsonProperty(value = "logs") + private List logs; + + /* + * 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 + */ + @JsonProperty(value = "workspaceId") + private String workspaceId; + + /* + * The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs. + */ + @JsonProperty(value = "marketplacePartnerId") + private String marketplacePartnerId; + + /* + * 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: _. Possible values are: Dedicated and null (null is default.) + */ + @JsonProperty(value = "logAnalyticsDestinationType") + private String logAnalyticsDestinationType; + + /** Creates an instance of DiagnosticSettings class. */ + public DiagnosticSettings() { + } + + /** + * Get the storageAccountId property: The resource ID of the storage account to which you would like to send + * Diagnostic Logs. + * + * @return the storageAccountId value. + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Set the storageAccountId property: The resource ID of the storage account to which you would like to send + * Diagnostic Logs. + * + * @param storageAccountId the storageAccountId value to set. + * @return the DiagnosticSettings object itself. + */ + public DiagnosticSettings withStorageAccountId(String storageAccountId) { + this.storageAccountId = storageAccountId; + return this; + } + + /** + * Get the serviceBusRuleId property: The service bus rule Id of the diagnostic setting. This is here to maintain + * backwards compatibility. + * + * @return the serviceBusRuleId value. + */ + public String serviceBusRuleId() { + return this.serviceBusRuleId; + } + + /** + * Set the serviceBusRuleId property: The service bus rule Id of the diagnostic setting. This is here to maintain + * backwards compatibility. + * + * @param serviceBusRuleId the serviceBusRuleId value to set. + * @return the DiagnosticSettings object itself. + */ + public DiagnosticSettings withServiceBusRuleId(String serviceBusRuleId) { + this.serviceBusRuleId = serviceBusRuleId; + return this; + } + + /** + * Get the eventHubAuthorizationRuleId property: The resource Id for the event hub authorization rule. + * + * @return the eventHubAuthorizationRuleId value. + */ + public String eventHubAuthorizationRuleId() { + return this.eventHubAuthorizationRuleId; + } + + /** + * Set the eventHubAuthorizationRuleId property: The resource Id for the event hub authorization rule. + * + * @param eventHubAuthorizationRuleId the eventHubAuthorizationRuleId value to set. + * @return the DiagnosticSettings object itself. + */ + public DiagnosticSettings withEventHubAuthorizationRuleId(String eventHubAuthorizationRuleId) { + this.eventHubAuthorizationRuleId = eventHubAuthorizationRuleId; + return this; + } + + /** + * Get the eventHubName property: The name of the event hub. If none is specified, the default event hub will be + * selected. + * + * @return the eventHubName value. + */ + public String eventHubName() { + return this.eventHubName; + } + + /** + * Set the eventHubName property: The name of the event hub. If none is specified, the default event hub will be + * selected. + * + * @param eventHubName the eventHubName value to set. + * @return the DiagnosticSettings object itself. + */ + public DiagnosticSettings withEventHubName(String eventHubName) { + this.eventHubName = eventHubName; + return this; + } + + /** + * Get the metrics property: The list of metric settings. + * + * @return the metrics value. + */ + public List metrics() { + return this.metrics; + } + + /** + * Set the metrics property: The list of metric settings. + * + * @param metrics the metrics value to set. + * @return the DiagnosticSettings object itself. + */ + public DiagnosticSettings withMetrics(List metrics) { + this.metrics = metrics; + return this; + } + + /** + * Get the logs property: The list of logs settings. + * + * @return the logs value. + */ + public List logs() { + return this.logs; + } + + /** + * Set the logs property: The list of logs settings. + * + * @param logs the logs value to set. + * @return the DiagnosticSettings object itself. + */ + public DiagnosticSettings withLogs(List logs) { + this.logs = logs; + return this; + } + + /** + * Get the workspaceId property: 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. + * + * @return the workspaceId value. + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Set the workspaceId property: 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. + * + * @param workspaceId the workspaceId value to set. + * @return the DiagnosticSettings object itself. + */ + public DiagnosticSettings withWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + return this; + } + + /** + * Get the marketplacePartnerId property: The full ARM resource ID of the Marketplace resource to which you would + * like to send Diagnostic Logs. + * + * @return the marketplacePartnerId value. + */ + public String marketplacePartnerId() { + return this.marketplacePartnerId; + } + + /** + * Set the marketplacePartnerId property: The full ARM resource ID of the Marketplace resource to which you would + * like to send Diagnostic Logs. + * + * @param marketplacePartnerId the marketplacePartnerId value to set. + * @return the DiagnosticSettings object itself. + */ + public DiagnosticSettings withMarketplacePartnerId(String marketplacePartnerId) { + this.marketplacePartnerId = marketplacePartnerId; + return this; + } + + /** + * Get the logAnalyticsDestinationType property: 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: + * <normalized service identity>_<normalized category name>. Possible values are: Dedicated and null + * (null is default.). + * + * @return the logAnalyticsDestinationType value. + */ + public String logAnalyticsDestinationType() { + return this.logAnalyticsDestinationType; + } + + /** + * Set the logAnalyticsDestinationType property: 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: + * <normalized service identity>_<normalized category name>. Possible values are: Dedicated and null + * (null is default.). + * + * @param logAnalyticsDestinationType the logAnalyticsDestinationType value to set. + * @return the DiagnosticSettings object itself. + */ + public DiagnosticSettings withLogAnalyticsDestinationType(String logAnalyticsDestinationType) { + this.logAnalyticsDestinationType = logAnalyticsDestinationType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metrics() != null) { + metrics().forEach(e -> e.validate()); + } + if (logs() != null) { + logs().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsCategory.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsCategory.java new file mode 100644 index 0000000000000..3e452157dc104 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsCategory.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.models.CategoryType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The diagnostic settings Category. */ +@Fluent +public final class DiagnosticSettingsCategory { + /* + * The type of the diagnostic settings category. + */ + @JsonProperty(value = "categoryType") + private CategoryType categoryType; + + /* + * the collection of what category groups are supported. + */ + @JsonProperty(value = "categoryGroups") + private List categoryGroups; + + /** Creates an instance of DiagnosticSettingsCategory class. */ + public DiagnosticSettingsCategory() { + } + + /** + * Get the categoryType property: The type of the diagnostic settings category. + * + * @return the categoryType value. + */ + public CategoryType categoryType() { + return this.categoryType; + } + + /** + * Set the categoryType property: The type of the diagnostic settings category. + * + * @param categoryType the categoryType value to set. + * @return the DiagnosticSettingsCategory object itself. + */ + public DiagnosticSettingsCategory withCategoryType(CategoryType categoryType) { + this.categoryType = categoryType; + return this; + } + + /** + * Get the categoryGroups property: the collection of what category groups are supported. + * + * @return the categoryGroups value. + */ + public List categoryGroups() { + return this.categoryGroups; + } + + /** + * Set the categoryGroups property: the collection of what category groups are supported. + * + * @param categoryGroups the categoryGroups value to set. + * @return the DiagnosticSettingsCategory object itself. + */ + public DiagnosticSettingsCategory withCategoryGroups(List categoryGroups) { + this.categoryGroups = categoryGroups; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsCategoryResourceInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsCategoryResourceInner.java new file mode 100644 index 0000000000000..d50020e5b58fc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsCategoryResourceInner.java @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.monitor.generated.models.CategoryType; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The diagnostic settings category resource. */ +@Immutable +public final class DiagnosticSettingsCategoryResourceInner extends ProxyResource { + /* + * The properties of a Diagnostic Settings Category. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private DiagnosticSettingsCategory innerProperties; + + /* + * The system metadata related to this resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of DiagnosticSettingsCategoryResourceInner class. */ + public DiagnosticSettingsCategoryResourceInner() { + } + + /** + * Get the innerProperties property: The properties of a Diagnostic Settings Category. + * + * @return the innerProperties value. + */ + private DiagnosticSettingsCategory innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: The system metadata related to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the categoryType property: The type of the diagnostic settings category. + * + * @return the categoryType value. + */ + public CategoryType categoryType() { + return this.innerProperties() == null ? null : this.innerProperties().categoryType(); + } + + /** + * Set the categoryType property: The type of the diagnostic settings category. + * + * @param categoryType the categoryType value to set. + * @return the DiagnosticSettingsCategoryResourceInner object itself. + */ + public DiagnosticSettingsCategoryResourceInner withCategoryType(CategoryType categoryType) { + if (this.innerProperties() == null) { + this.innerProperties = new DiagnosticSettingsCategory(); + } + this.innerProperties().withCategoryType(categoryType); + return this; + } + + /** + * Get the categoryGroups property: the collection of what category groups are supported. + * + * @return the categoryGroups value. + */ + public List categoryGroups() { + return this.innerProperties() == null ? null : this.innerProperties().categoryGroups(); + } + + /** + * Set the categoryGroups property: the collection of what category groups are supported. + * + * @param categoryGroups the categoryGroups value to set. + * @return the DiagnosticSettingsCategoryResourceInner object itself. + */ + public DiagnosticSettingsCategoryResourceInner withCategoryGroups(List categoryGroups) { + if (this.innerProperties() == null) { + this.innerProperties = new DiagnosticSettingsCategory(); + } + this.innerProperties().withCategoryGroups(categoryGroups); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsResourceInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsResourceInner.java new file mode 100644 index 0000000000000..5ccc9a0ef4006 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsResourceInner.java @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.monitor.generated.models.LogSettings; +import com.azure.resourcemanager.monitor.generated.models.MetricSettings; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The diagnostic setting resource. */ +@Fluent +public final class DiagnosticSettingsResourceInner extends ProxyResource { + /* + * Properties of a Diagnostic Settings Resource. + */ + @JsonProperty(value = "properties") + private DiagnosticSettings innerProperties; + + /* + * The system metadata related to this resource. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of DiagnosticSettingsResourceInner class. */ + public DiagnosticSettingsResourceInner() { + } + + /** + * Get the innerProperties property: Properties of a Diagnostic Settings Resource. + * + * @return the innerProperties value. + */ + private DiagnosticSettings innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: The system metadata related to this resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the storageAccountId property: The resource ID of the storage account to which you would like to send + * Diagnostic Logs. + * + * @return the storageAccountId value. + */ + public String storageAccountId() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountId(); + } + + /** + * Set the storageAccountId property: The resource ID of the storage account to which you would like to send + * Diagnostic Logs. + * + * @param storageAccountId the storageAccountId value to set. + * @return the DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner withStorageAccountId(String storageAccountId) { + if (this.innerProperties() == null) { + this.innerProperties = new DiagnosticSettings(); + } + this.innerProperties().withStorageAccountId(storageAccountId); + return this; + } + + /** + * Get the serviceBusRuleId property: The service bus rule Id of the diagnostic setting. This is here to maintain + * backwards compatibility. + * + * @return the serviceBusRuleId value. + */ + public String serviceBusRuleId() { + return this.innerProperties() == null ? null : this.innerProperties().serviceBusRuleId(); + } + + /** + * Set the serviceBusRuleId property: The service bus rule Id of the diagnostic setting. This is here to maintain + * backwards compatibility. + * + * @param serviceBusRuleId the serviceBusRuleId value to set. + * @return the DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner withServiceBusRuleId(String serviceBusRuleId) { + if (this.innerProperties() == null) { + this.innerProperties = new DiagnosticSettings(); + } + this.innerProperties().withServiceBusRuleId(serviceBusRuleId); + return this; + } + + /** + * Get the eventHubAuthorizationRuleId property: The resource Id for the event hub authorization rule. + * + * @return the eventHubAuthorizationRuleId value. + */ + public String eventHubAuthorizationRuleId() { + return this.innerProperties() == null ? null : this.innerProperties().eventHubAuthorizationRuleId(); + } + + /** + * Set the eventHubAuthorizationRuleId property: The resource Id for the event hub authorization rule. + * + * @param eventHubAuthorizationRuleId the eventHubAuthorizationRuleId value to set. + * @return the DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner withEventHubAuthorizationRuleId(String eventHubAuthorizationRuleId) { + if (this.innerProperties() == null) { + this.innerProperties = new DiagnosticSettings(); + } + this.innerProperties().withEventHubAuthorizationRuleId(eventHubAuthorizationRuleId); + return this; + } + + /** + * Get the eventHubName property: The name of the event hub. If none is specified, the default event hub will be + * selected. + * + * @return the eventHubName value. + */ + public String eventHubName() { + return this.innerProperties() == null ? null : this.innerProperties().eventHubName(); + } + + /** + * Set the eventHubName property: The name of the event hub. If none is specified, the default event hub will be + * selected. + * + * @param eventHubName the eventHubName value to set. + * @return the DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner withEventHubName(String eventHubName) { + if (this.innerProperties() == null) { + this.innerProperties = new DiagnosticSettings(); + } + this.innerProperties().withEventHubName(eventHubName); + return this; + } + + /** + * Get the metrics property: The list of metric settings. + * + * @return the metrics value. + */ + public List metrics() { + return this.innerProperties() == null ? null : this.innerProperties().metrics(); + } + + /** + * Set the metrics property: The list of metric settings. + * + * @param metrics the metrics value to set. + * @return the DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner withMetrics(List metrics) { + if (this.innerProperties() == null) { + this.innerProperties = new DiagnosticSettings(); + } + this.innerProperties().withMetrics(metrics); + return this; + } + + /** + * Get the logs property: The list of logs settings. + * + * @return the logs value. + */ + public List logs() { + return this.innerProperties() == null ? null : this.innerProperties().logs(); + } + + /** + * Set the logs property: The list of logs settings. + * + * @param logs the logs value to set. + * @return the DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner withLogs(List logs) { + if (this.innerProperties() == null) { + this.innerProperties = new DiagnosticSettings(); + } + this.innerProperties().withLogs(logs); + return this; + } + + /** + * Get the workspaceId property: 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. + * + * @return the workspaceId value. + */ + public String workspaceId() { + return this.innerProperties() == null ? null : this.innerProperties().workspaceId(); + } + + /** + * Set the workspaceId property: 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. + * + * @param workspaceId the workspaceId value to set. + * @return the DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner withWorkspaceId(String workspaceId) { + if (this.innerProperties() == null) { + this.innerProperties = new DiagnosticSettings(); + } + this.innerProperties().withWorkspaceId(workspaceId); + return this; + } + + /** + * Get the marketplacePartnerId property: The full ARM resource ID of the Marketplace resource to which you would + * like to send Diagnostic Logs. + * + * @return the marketplacePartnerId value. + */ + public String marketplacePartnerId() { + return this.innerProperties() == null ? null : this.innerProperties().marketplacePartnerId(); + } + + /** + * Set the marketplacePartnerId property: The full ARM resource ID of the Marketplace resource to which you would + * like to send Diagnostic Logs. + * + * @param marketplacePartnerId the marketplacePartnerId value to set. + * @return the DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner withMarketplacePartnerId(String marketplacePartnerId) { + if (this.innerProperties() == null) { + this.innerProperties = new DiagnosticSettings(); + } + this.innerProperties().withMarketplacePartnerId(marketplacePartnerId); + return this; + } + + /** + * Get the logAnalyticsDestinationType property: 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: + * <normalized service identity>_<normalized category name>. Possible values are: Dedicated and null + * (null is default.). + * + * @return the logAnalyticsDestinationType value. + */ + public String logAnalyticsDestinationType() { + return this.innerProperties() == null ? null : this.innerProperties().logAnalyticsDestinationType(); + } + + /** + * Set the logAnalyticsDestinationType property: 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: + * <normalized service identity>_<normalized category name>. Possible values are: Dedicated and null + * (null is default.). + * + * @param logAnalyticsDestinationType the logAnalyticsDestinationType value to set. + * @return the DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner withLogAnalyticsDestinationType(String logAnalyticsDestinationType) { + if (this.innerProperties() == null) { + this.innerProperties = new DiagnosticSettings(); + } + this.innerProperties().withLogAnalyticsDestinationType(logAnalyticsDestinationType); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/EventDataInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/EventDataInner.java new file mode 100644 index 0000000000000..b0a204cae5eed --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/EventDataInner.java @@ -0,0 +1,446 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.monitor.generated.models.EventLevel; +import com.azure.resourcemanager.monitor.generated.models.HttpRequestInfo; +import com.azure.resourcemanager.monitor.generated.models.SenderAuthorization; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** The Azure event log entries are of type EventData. */ +@Immutable +public final class EventDataInner { + /* + * The sender authorization information. + */ + @JsonProperty(value = "authorization", access = JsonProperty.Access.WRITE_ONLY) + private SenderAuthorization authorization; + + /* + * key value pairs to identify ARM permissions. + */ + @JsonProperty(value = "claims", access = JsonProperty.Access.WRITE_ONLY) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map claims; + + /* + * the email address of the user who has performed the operation, the UPN claim or SPN claim based on availability. + */ + @JsonProperty(value = "caller", access = JsonProperty.Access.WRITE_ONLY) + private String caller; + + /* + * the description of the event. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * the Id of this event as required by ARM for RBAC. It contains the EventDataID and a timestamp information. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * the event data Id. This is a unique identifier for an event. + */ + @JsonProperty(value = "eventDataId", access = JsonProperty.Access.WRITE_ONLY) + private String eventDataId; + + /* + * 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. + */ + @JsonProperty(value = "correlationId", access = JsonProperty.Access.WRITE_ONLY) + private String correlationId; + + /* + * the event name. This value should not be confused with OperationName. For practical purposes, OperationName + * might be more appealing to end users. + */ + @JsonProperty(value = "eventName", access = JsonProperty.Access.WRITE_ONLY) + private LocalizableStringInner eventName; + + /* + * the event category. + */ + @JsonProperty(value = "category", access = JsonProperty.Access.WRITE_ONLY) + private LocalizableStringInner category; + + /* + * 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). + */ + @JsonProperty(value = "httpRequest", access = JsonProperty.Access.WRITE_ONLY) + private HttpRequestInfo httpRequest; + + /* + * the event level + */ + @JsonProperty(value = "level", access = JsonProperty.Access.WRITE_ONLY) + private EventLevel level; + + /* + * the resource group name of the impacted resource. + */ + @JsonProperty(value = "resourceGroupName", access = JsonProperty.Access.WRITE_ONLY) + private String resourceGroupName; + + /* + * the resource provider name of the impacted resource. + */ + @JsonProperty(value = "resourceProviderName", access = JsonProperty.Access.WRITE_ONLY) + private LocalizableStringInner resourceProviderName; + + /* + * the resource uri that uniquely identifies the resource that caused this event. + */ + @JsonProperty(value = "resourceId", access = JsonProperty.Access.WRITE_ONLY) + private String resourceId; + + /* + * the resource type + */ + @JsonProperty(value = "resourceType", access = JsonProperty.Access.WRITE_ONLY) + private LocalizableStringInner resourceType; + + /* + * It is usually a GUID shared among the events corresponding to single operation. This value should not be + * confused with EventName. + */ + @JsonProperty(value = "operationId", access = JsonProperty.Access.WRITE_ONLY) + private String operationId; + + /* + * the operation name. + */ + @JsonProperty(value = "operationName", access = JsonProperty.Access.WRITE_ONLY) + private LocalizableStringInner operationName; + + /* + * the set of pairs (usually a Dictionary) that includes details about the event. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map properties; + + /* + * a string describing the status of the operation. Some typical values are: Started, In progress, Succeeded, + * Failed, Resolved. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private LocalizableStringInner 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) + */ + @JsonProperty(value = "subStatus", access = JsonProperty.Access.WRITE_ONLY) + private LocalizableStringInner subStatus; + + /* + * the timestamp of when the event was generated by the Azure service processing the request corresponding the + * event. It in ISO 8601 format. + */ + @JsonProperty(value = "eventTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime eventTimestamp; + + /* + * 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. + */ + @JsonProperty(value = "submissionTimestamp", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime submissionTimestamp; + + /* + * the Azure subscription Id usually a GUID. + */ + @JsonProperty(value = "subscriptionId", access = JsonProperty.Access.WRITE_ONLY) + private String subscriptionId; + + /* + * the Azure tenant Id + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /** Creates an instance of EventDataInner class. */ + public EventDataInner() { + } + + /** + * Get the authorization property: The sender authorization information. + * + * @return the authorization value. + */ + public SenderAuthorization authorization() { + return this.authorization; + } + + /** + * Get the claims property: key value pairs to identify ARM permissions. + * + * @return the claims value. + */ + public Map claims() { + return this.claims; + } + + /** + * Get the caller property: the email address of the user who has performed the operation, the UPN claim or SPN + * claim based on availability. + * + * @return the caller value. + */ + public String caller() { + return this.caller; + } + + /** + * Get the description property: the description of the event. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the id property: the Id of this event as required by ARM for RBAC. It contains the EventDataID and a + * timestamp information. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the eventDataId property: the event data Id. This is a unique identifier for an event. + * + * @return the eventDataId value. + */ + public String eventDataId() { + return this.eventDataId; + } + + /** + * Get the correlationId property: 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. + * + * @return the correlationId value. + */ + public String correlationId() { + return this.correlationId; + } + + /** + * Get the eventName property: the event name. This value should not be confused with OperationName. For practical + * purposes, OperationName might be more appealing to end users. + * + * @return the eventName value. + */ + public LocalizableStringInner eventName() { + return this.eventName; + } + + /** + * Get the category property: the event category. + * + * @return the category value. + */ + public LocalizableStringInner category() { + return this.category; + } + + /** + * Get the httpRequest property: 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). + * + * @return the httpRequest value. + */ + public HttpRequestInfo httpRequest() { + return this.httpRequest; + } + + /** + * Get the level property: the event level. + * + * @return the level value. + */ + public EventLevel level() { + return this.level; + } + + /** + * Get the resourceGroupName property: the resource group name of the impacted resource. + * + * @return the resourceGroupName value. + */ + public String resourceGroupName() { + return this.resourceGroupName; + } + + /** + * Get the resourceProviderName property: the resource provider name of the impacted resource. + * + * @return the resourceProviderName value. + */ + public LocalizableStringInner resourceProviderName() { + return this.resourceProviderName; + } + + /** + * Get the resourceId property: the resource uri that uniquely identifies the resource that caused this event. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Get the resourceType property: the resource type. + * + * @return the resourceType value. + */ + public LocalizableStringInner resourceType() { + return this.resourceType; + } + + /** + * Get the operationId property: It is usually a GUID shared among the events corresponding to single operation. + * This value should not be confused with EventName. + * + * @return the operationId value. + */ + public String operationId() { + return this.operationId; + } + + /** + * Get the operationName property: the operation name. + * + * @return the operationName value. + */ + public LocalizableStringInner operationName() { + return this.operationName; + } + + /** + * Get the properties property: the set of <Key, Value> pairs (usually a Dictionary<String, String>) + * that includes details about the event. + * + * @return the properties value. + */ + public Map properties() { + return this.properties; + } + + /** + * Get the status property: a string describing the status of the operation. Some typical values are: Started, In + * progress, Succeeded, Failed, Resolved. + * + * @return the status value. + */ + public LocalizableStringInner status() { + return this.status; + } + + /** + * Get the subStatus property: 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). + * + * @return the subStatus value. + */ + public LocalizableStringInner subStatus() { + return this.subStatus; + } + + /** + * Get the eventTimestamp property: the timestamp of when the event was generated by the Azure service processing + * the request corresponding the event. It in ISO 8601 format. + * + * @return the eventTimestamp value. + */ + public OffsetDateTime eventTimestamp() { + return this.eventTimestamp; + } + + /** + * Get the submissionTimestamp property: 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. + * + * @return the submissionTimestamp value. + */ + public OffsetDateTime submissionTimestamp() { + return this.submissionTimestamp; + } + + /** + * Get the subscriptionId property: the Azure subscription Id usually a GUID. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Get the tenantId property: the Azure tenant Id. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (authorization() != null) { + authorization().validate(); + } + if (eventName() != null) { + eventName().validate(); + } + if (category() != null) { + category().validate(); + } + if (httpRequest() != null) { + httpRequest().validate(); + } + if (resourceProviderName() != null) { + resourceProviderName().validate(); + } + if (resourceType() != null) { + resourceType().validate(); + } + if (operationName() != null) { + operationName().validate(); + } + if (status() != null) { + status().validate(); + } + if (subStatus() != null) { + subStatus().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/IncidentInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/IncidentInner.java new file mode 100644 index 0000000000000..e8260a909aa40 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/IncidentInner.java @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** An alert incident indicates the activation status of an alert rule. */ +@Immutable +public final class IncidentInner { + /* + * Incident name. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Rule name that is associated with the incident. + */ + @JsonProperty(value = "ruleName", access = JsonProperty.Access.WRITE_ONLY) + private String ruleName; + + /* + * A boolean to indicate whether the incident is active or resolved. + */ + @JsonProperty(value = "isActive", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isActive; + + /* + * The time at which the incident was activated in ISO8601 format. + */ + @JsonProperty(value = "activatedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime activatedTime; + + /* + * The time at which the incident was resolved in ISO8601 format. If null, it means the incident is still active. + */ + @JsonProperty(value = "resolvedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime resolvedTime; + + /** Creates an instance of IncidentInner class. */ + public IncidentInner() { + } + + /** + * Get the name property: Incident name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the ruleName property: Rule name that is associated with the incident. + * + * @return the ruleName value. + */ + public String ruleName() { + return this.ruleName; + } + + /** + * Get the isActive property: A boolean to indicate whether the incident is active or resolved. + * + * @return the isActive value. + */ + public Boolean isActive() { + return this.isActive; + } + + /** + * Get the activatedTime property: The time at which the incident was activated in ISO8601 format. + * + * @return the activatedTime value. + */ + public OffsetDateTime activatedTime() { + return this.activatedTime; + } + + /** + * Get the resolvedTime property: The time at which the incident was resolved in ISO8601 format. If null, it means + * the incident is still active. + * + * @return the resolvedTime value. + */ + public OffsetDateTime resolvedTime() { + return this.resolvedTime; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LocalizableStringInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LocalizableStringInner.java new file mode 100644 index 0000000000000..439f9cdea6b56 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LocalizableStringInner.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The localizable string class. */ +@Fluent +public final class LocalizableStringInner { + /* + * the invariant value. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /* + * the locale specific value. + */ + @JsonProperty(value = "localizedValue") + private String localizedValue; + + /** Creates an instance of LocalizableStringInner class. */ + public LocalizableStringInner() { + } + + /** + * Get the value property: the invariant value. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: the invariant value. + * + * @param value the value value to set. + * @return the LocalizableStringInner object itself. + */ + public LocalizableStringInner withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the localizedValue property: the locale specific value. + * + * @return the localizedValue value. + */ + public String localizedValue() { + return this.localizedValue; + } + + /** + * Set the localizedValue property: the locale specific value. + * + * @param localizedValue the localizedValue value to set. + * @return the LocalizableStringInner object itself. + */ + public LocalizableStringInner withLocalizedValue(String localizedValue) { + this.localizedValue = localizedValue; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model LocalizableStringInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LocalizableStringInner.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogProfileProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogProfileProperties.java new file mode 100644 index 0000000000000..7dc0e1b6430c5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogProfileProperties.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.RetentionPolicy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The log profile properties. */ +@Fluent +public final class LogProfileProperties { + /* + * the resource id of the storage account to which you would like to send the Activity Log. + */ + @JsonProperty(value = "storageAccountId") + private String storageAccountId; + + /* + * 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}'. + */ + @JsonProperty(value = "serviceBusRuleId") + private String serviceBusRuleId; + + /* + * 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. + */ + @JsonProperty(value = "locations", required = true) + private List locations; + + /* + * the categories of the logs. These categories are created as is convenient to the user. Some values are: 'Write', + * 'Delete', and/or 'Action.' + */ + @JsonProperty(value = "categories", required = true) + private List categories; + + /* + * the retention policy for the events in the log. + */ + @JsonProperty(value = "retentionPolicy", required = true) + private RetentionPolicy retentionPolicy; + + /** Creates an instance of LogProfileProperties class. */ + public LogProfileProperties() { + } + + /** + * Get the storageAccountId property: the resource id of the storage account to which you would like to send the + * Activity Log. + * + * @return the storageAccountId value. + */ + public String storageAccountId() { + return this.storageAccountId; + } + + /** + * Set the storageAccountId property: the resource id of the storage account to which you would like to send the + * Activity Log. + * + * @param storageAccountId the storageAccountId value to set. + * @return the LogProfileProperties object itself. + */ + public LogProfileProperties withStorageAccountId(String storageAccountId) { + this.storageAccountId = storageAccountId; + return this; + } + + /** + * Get the serviceBusRuleId property: 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}'. + * + * @return the serviceBusRuleId value. + */ + public String serviceBusRuleId() { + return this.serviceBusRuleId; + } + + /** + * Set the serviceBusRuleId property: 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}'. + * + * @param serviceBusRuleId the serviceBusRuleId value to set. + * @return the LogProfileProperties object itself. + */ + public LogProfileProperties withServiceBusRuleId(String serviceBusRuleId) { + this.serviceBusRuleId = serviceBusRuleId; + return this; + } + + /** + * Get the locations property: 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. + * + * @return the locations value. + */ + public List locations() { + return this.locations; + } + + /** + * Set the locations property: 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. + * + * @param locations the locations value to set. + * @return the LogProfileProperties object itself. + */ + public LogProfileProperties withLocations(List locations) { + this.locations = locations; + return this; + } + + /** + * Get the categories property: the categories of the logs. These categories are created as is convenient to the + * user. Some values are: 'Write', 'Delete', and/or 'Action.'. + * + * @return the categories value. + */ + public List categories() { + return this.categories; + } + + /** + * Set the categories property: the categories of the logs. These categories are created as is convenient to the + * user. Some values are: 'Write', 'Delete', and/or 'Action.'. + * + * @param categories the categories value to set. + * @return the LogProfileProperties object itself. + */ + public LogProfileProperties withCategories(List categories) { + this.categories = categories; + return this; + } + + /** + * Get the retentionPolicy property: the retention policy for the events in the log. + * + * @return the retentionPolicy value. + */ + public RetentionPolicy retentionPolicy() { + return this.retentionPolicy; + } + + /** + * Set the retentionPolicy property: the retention policy for the events in the log. + * + * @param retentionPolicy the retentionPolicy value to set. + * @return the LogProfileProperties object itself. + */ + public LogProfileProperties withRetentionPolicy(RetentionPolicy retentionPolicy) { + this.retentionPolicy = retentionPolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (locations() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property locations in model LogProfileProperties")); + } + if (categories() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property categories in model LogProfileProperties")); + } + if (retentionPolicy() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property retentionPolicy in model LogProfileProperties")); + } else { + retentionPolicy().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LogProfileProperties.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogProfileResourceInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogProfileResourceInner.java new file mode 100644 index 0000000000000..51b0d0e88d35b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogProfileResourceInner.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.RetentionPolicy; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The log profile resource. */ +@Fluent +public final class LogProfileResourceInner extends Resource { + /* + * The log profile properties of the resource. + */ + @JsonProperty(value = "properties", required = true) + private LogProfileProperties innerProperties = new LogProfileProperties(); + + /** Creates an instance of LogProfileResourceInner class. */ + public LogProfileResourceInner() { + } + + /** + * Get the innerProperties property: The log profile properties of the resource. + * + * @return the innerProperties value. + */ + private LogProfileProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public LogProfileResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public LogProfileResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the storageAccountId property: the resource id of the storage account to which you would like to send the + * Activity Log. + * + * @return the storageAccountId value. + */ + public String storageAccountId() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountId(); + } + + /** + * Set the storageAccountId property: the resource id of the storage account to which you would like to send the + * Activity Log. + * + * @param storageAccountId the storageAccountId value to set. + * @return the LogProfileResourceInner object itself. + */ + public LogProfileResourceInner withStorageAccountId(String storageAccountId) { + if (this.innerProperties() == null) { + this.innerProperties = new LogProfileProperties(); + } + this.innerProperties().withStorageAccountId(storageAccountId); + return this; + } + + /** + * Get the serviceBusRuleId property: 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}'. + * + * @return the serviceBusRuleId value. + */ + public String serviceBusRuleId() { + return this.innerProperties() == null ? null : this.innerProperties().serviceBusRuleId(); + } + + /** + * Set the serviceBusRuleId property: 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}'. + * + * @param serviceBusRuleId the serviceBusRuleId value to set. + * @return the LogProfileResourceInner object itself. + */ + public LogProfileResourceInner withServiceBusRuleId(String serviceBusRuleId) { + if (this.innerProperties() == null) { + this.innerProperties = new LogProfileProperties(); + } + this.innerProperties().withServiceBusRuleId(serviceBusRuleId); + return this; + } + + /** + * Get the locations property: 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. + * + * @return the locations value. + */ + public List locations() { + return this.innerProperties() == null ? null : this.innerProperties().locations(); + } + + /** + * Set the locations property: 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. + * + * @param locations the locations value to set. + * @return the LogProfileResourceInner object itself. + */ + public LogProfileResourceInner withLocations(List locations) { + if (this.innerProperties() == null) { + this.innerProperties = new LogProfileProperties(); + } + this.innerProperties().withLocations(locations); + return this; + } + + /** + * Get the categories property: the categories of the logs. These categories are created as is convenient to the + * user. Some values are: 'Write', 'Delete', and/or 'Action.'. + * + * @return the categories value. + */ + public List categories() { + return this.innerProperties() == null ? null : this.innerProperties().categories(); + } + + /** + * Set the categories property: the categories of the logs. These categories are created as is convenient to the + * user. Some values are: 'Write', 'Delete', and/or 'Action.'. + * + * @param categories the categories value to set. + * @return the LogProfileResourceInner object itself. + */ + public LogProfileResourceInner withCategories(List categories) { + if (this.innerProperties() == null) { + this.innerProperties = new LogProfileProperties(); + } + this.innerProperties().withCategories(categories); + return this; + } + + /** + * Get the retentionPolicy property: the retention policy for the events in the log. + * + * @return the retentionPolicy value. + */ + public RetentionPolicy retentionPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().retentionPolicy(); + } + + /** + * Set the retentionPolicy property: the retention policy for the events in the log. + * + * @param retentionPolicy the retentionPolicy value to set. + * @return the LogProfileResourceInner object itself. + */ + public LogProfileResourceInner withRetentionPolicy(RetentionPolicy retentionPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new LogProfileProperties(); + } + this.innerProperties().withRetentionPolicy(retentionPolicy); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model LogProfileResourceInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LogProfileResourceInner.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetadataValueInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetadataValueInner.java new file mode 100644 index 0000000000000..ba49378cbbae6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetadataValueInner.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a metric metadata value. */ +@Fluent +public final class MetadataValueInner { + /* + * the name of the metadata. + */ + @JsonProperty(value = "name") + private LocalizableStringInner name; + + /* + * the value of the metadata. + */ + @JsonProperty(value = "value") + private String value; + + /** Creates an instance of MetadataValueInner class. */ + public MetadataValueInner() { + } + + /** + * Get the name property: the name of the metadata. + * + * @return the name value. + */ + public LocalizableStringInner name() { + return this.name; + } + + /** + * Set the name property: the name of the metadata. + * + * @param name the name value to set. + * @return the MetadataValueInner object itself. + */ + public MetadataValueInner withName(LocalizableStringInner name) { + this.name = name; + return this; + } + + /** + * Get the value property: the value of the metadata. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: the value of the metadata. + * + * @param value the value value to set. + * @return the MetadataValueInner object itself. + */ + public MetadataValueInner withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertProperties.java new file mode 100644 index 0000000000000..22979af3486ef --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertProperties.java @@ -0,0 +1,390 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertAction; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertCriteria; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.List; + +/** An alert rule. */ +@Fluent +public final class MetricAlertProperties { + /* + * the description of the metric alert that will be included in the alert email. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Alert severity {0, 1, 2, 3, 4} + */ + @JsonProperty(value = "severity", required = true) + private int severity; + + /* + * the flag that indicates whether the metric alert is enabled. + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /* + * the list of resource id's that this metric alert is scoped to. + */ + @JsonProperty(value = "scopes", required = true) + private List scopes; + + /* + * how often the metric alert is evaluated represented in ISO 8601 duration format. + */ + @JsonProperty(value = "evaluationFrequency", required = true) + private Duration evaluationFrequency; + + /* + * the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + */ + @JsonProperty(value = "windowSize", required = true) + private Duration windowSize; + + /* + * 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. + */ + @JsonProperty(value = "targetResourceType") + private String targetResourceType; + + /* + * 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. + */ + @JsonProperty(value = "targetResourceRegion") + private String targetResourceRegion; + + /* + * defines the specific alert criteria information. + */ + @JsonProperty(value = "criteria", required = true) + private MetricAlertCriteria criteria; + + /* + * the flag that indicates whether the alert should be auto resolved or not. The default is true. + */ + @JsonProperty(value = "autoMitigate") + private Boolean autoMitigate; + + /* + * the array of actions that are performed when the alert rule becomes active, and when an alert condition is + * resolved. + */ + @JsonProperty(value = "actions") + private List actions; + + /* + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdatedTime; + + /* + * the value indicating whether this alert rule is migrated. + */ + @JsonProperty(value = "isMigrated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isMigrated; + + /** Creates an instance of MetricAlertProperties class. */ + public MetricAlertProperties() { + } + + /** + * Get the description property: the description of the metric alert that will be included in the alert email. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: the description of the metric alert that will be included in the alert email. + * + * @param description the description value to set. + * @return the MetricAlertProperties object itself. + */ + public MetricAlertProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the severity property: Alert severity {0, 1, 2, 3, 4}. + * + * @return the severity value. + */ + public int severity() { + return this.severity; + } + + /** + * Set the severity property: Alert severity {0, 1, 2, 3, 4}. + * + * @param severity the severity value to set. + * @return the MetricAlertProperties object itself. + */ + public MetricAlertProperties withSeverity(int severity) { + this.severity = severity; + return this; + } + + /** + * Get the enabled property: the flag that indicates whether the metric alert is enabled. + * + * @return the enabled value. + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: the flag that indicates whether the metric alert is enabled. + * + * @param enabled the enabled value to set. + * @return the MetricAlertProperties object itself. + */ + public MetricAlertProperties withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the scopes property: the list of resource id's that this metric alert is scoped to. + * + * @return the scopes value. + */ + public List scopes() { + return this.scopes; + } + + /** + * Set the scopes property: the list of resource id's that this metric alert is scoped to. + * + * @param scopes the scopes value to set. + * @return the MetricAlertProperties object itself. + */ + public MetricAlertProperties withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Get the evaluationFrequency property: how often the metric alert is evaluated represented in ISO 8601 duration + * format. + * + * @return the evaluationFrequency value. + */ + public Duration evaluationFrequency() { + return this.evaluationFrequency; + } + + /** + * Set the evaluationFrequency property: how often the metric alert is evaluated represented in ISO 8601 duration + * format. + * + * @param evaluationFrequency the evaluationFrequency value to set. + * @return the MetricAlertProperties object itself. + */ + public MetricAlertProperties withEvaluationFrequency(Duration evaluationFrequency) { + this.evaluationFrequency = evaluationFrequency; + return this; + } + + /** + * Get the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert + * activity based on the threshold. + * + * @return the windowSize value. + */ + public Duration windowSize() { + return this.windowSize; + } + + /** + * Set the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert + * activity based on the threshold. + * + * @param windowSize the windowSize value to set. + * @return the MetricAlertProperties object itself. + */ + public MetricAlertProperties withWindowSize(Duration windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * Get the targetResourceType property: 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. + * + * @return the targetResourceType value. + */ + public String targetResourceType() { + return this.targetResourceType; + } + + /** + * Set the targetResourceType property: 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. + * + * @param targetResourceType the targetResourceType value to set. + * @return the MetricAlertProperties object itself. + */ + public MetricAlertProperties withTargetResourceType(String targetResourceType) { + this.targetResourceType = targetResourceType; + return this; + } + + /** + * Get the targetResourceRegion property: 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. + * + * @return the targetResourceRegion value. + */ + public String targetResourceRegion() { + return this.targetResourceRegion; + } + + /** + * Set the targetResourceRegion property: 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. + * + * @param targetResourceRegion the targetResourceRegion value to set. + * @return the MetricAlertProperties object itself. + */ + public MetricAlertProperties withTargetResourceRegion(String targetResourceRegion) { + this.targetResourceRegion = targetResourceRegion; + return this; + } + + /** + * Get the criteria property: defines the specific alert criteria information. + * + * @return the criteria value. + */ + public MetricAlertCriteria criteria() { + return this.criteria; + } + + /** + * Set the criteria property: defines the specific alert criteria information. + * + * @param criteria the criteria value to set. + * @return the MetricAlertProperties object itself. + */ + public MetricAlertProperties withCriteria(MetricAlertCriteria criteria) { + this.criteria = criteria; + return this; + } + + /** + * Get the autoMitigate property: the flag that indicates whether the alert should be auto resolved or not. The + * default is true. + * + * @return the autoMitigate value. + */ + public Boolean autoMitigate() { + return this.autoMitigate; + } + + /** + * Set the autoMitigate property: the flag that indicates whether the alert should be auto resolved or not. The + * default is true. + * + * @param autoMitigate the autoMitigate value to set. + * @return the MetricAlertProperties object itself. + */ + public MetricAlertProperties withAutoMitigate(Boolean autoMitigate) { + this.autoMitigate = autoMitigate; + return this; + } + + /** + * Get the actions property: the array of actions that are performed when the alert rule becomes active, and when an + * alert condition is resolved. + * + * @return the actions value. + */ + public List actions() { + return this.actions; + } + + /** + * Set the actions property: the array of actions that are performed when the alert rule becomes active, and when an + * alert condition is resolved. + * + * @param actions the actions value to set. + * @return the MetricAlertProperties object itself. + */ + public MetricAlertProperties withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get the lastUpdatedTime property: Last time the rule was updated in ISO8601 format. + * + * @return the lastUpdatedTime value. + */ + public OffsetDateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + + /** + * Get the isMigrated property: the value indicating whether this alert rule is migrated. + * + * @return the isMigrated value. + */ + public Boolean isMigrated() { + return this.isMigrated; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (scopes() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property scopes in model MetricAlertProperties")); + } + if (evaluationFrequency() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property evaluationFrequency in model MetricAlertProperties")); + } + if (windowSize() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property windowSize in model MetricAlertProperties")); + } + if (criteria() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property criteria in model MetricAlertProperties")); + } else { + criteria().validate(); + } + if (actions() != null) { + actions().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricAlertProperties.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertPropertiesPatch.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertPropertiesPatch.java new file mode 100644 index 0000000000000..de1decbbd61dd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertPropertiesPatch.java @@ -0,0 +1,366 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertAction; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertCriteria; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.List; + +/** An alert rule properties for patch. */ +@Fluent +public final class MetricAlertPropertiesPatch { + /* + * the description of the metric alert that will be included in the alert email. + */ + @JsonProperty(value = "description") + private String description; + + /* + * Alert severity {0, 1, 2, 3, 4} + */ + @JsonProperty(value = "severity") + private Integer severity; + + /* + * the flag that indicates whether the metric alert is enabled. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /* + * the list of resource id's that this metric alert is scoped to. + */ + @JsonProperty(value = "scopes") + private List scopes; + + /* + * how often the metric alert is evaluated represented in ISO 8601 duration format. + */ + @JsonProperty(value = "evaluationFrequency") + private Duration evaluationFrequency; + + /* + * the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + */ + @JsonProperty(value = "windowSize") + private Duration windowSize; + + /* + * the resource type of the target resource(s) on which the alert is created/updated. Mandatory for + * MultipleResourceMultipleMetricCriteria. + */ + @JsonProperty(value = "targetResourceType") + private String targetResourceType; + + /* + * the region of the target resource(s) on which the alert is created/updated. Mandatory for + * MultipleResourceMultipleMetricCriteria. + */ + @JsonProperty(value = "targetResourceRegion") + private String targetResourceRegion; + + /* + * defines the specific alert criteria information. + */ + @JsonProperty(value = "criteria") + private MetricAlertCriteria criteria; + + /* + * the flag that indicates whether the alert should be auto resolved or not. The default is true. + */ + @JsonProperty(value = "autoMitigate") + private Boolean autoMitigate; + + /* + * the array of actions that are performed when the alert rule becomes active, and when an alert condition is + * resolved. + */ + @JsonProperty(value = "actions") + private List actions; + + /* + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdatedTime; + + /* + * the value indicating whether this alert rule is migrated. + */ + @JsonProperty(value = "isMigrated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isMigrated; + + /** Creates an instance of MetricAlertPropertiesPatch class. */ + public MetricAlertPropertiesPatch() { + } + + /** + * Get the description property: the description of the metric alert that will be included in the alert email. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: the description of the metric alert that will be included in the alert email. + * + * @param description the description value to set. + * @return the MetricAlertPropertiesPatch object itself. + */ + public MetricAlertPropertiesPatch withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the severity property: Alert severity {0, 1, 2, 3, 4}. + * + * @return the severity value. + */ + public Integer severity() { + return this.severity; + } + + /** + * Set the severity property: Alert severity {0, 1, 2, 3, 4}. + * + * @param severity the severity value to set. + * @return the MetricAlertPropertiesPatch object itself. + */ + public MetricAlertPropertiesPatch withSeverity(Integer severity) { + this.severity = severity; + return this; + } + + /** + * Get the enabled property: the flag that indicates whether the metric alert is enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: the flag that indicates whether the metric alert is enabled. + * + * @param enabled the enabled value to set. + * @return the MetricAlertPropertiesPatch object itself. + */ + public MetricAlertPropertiesPatch withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the scopes property: the list of resource id's that this metric alert is scoped to. + * + * @return the scopes value. + */ + public List scopes() { + return this.scopes; + } + + /** + * Set the scopes property: the list of resource id's that this metric alert is scoped to. + * + * @param scopes the scopes value to set. + * @return the MetricAlertPropertiesPatch object itself. + */ + public MetricAlertPropertiesPatch withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Get the evaluationFrequency property: how often the metric alert is evaluated represented in ISO 8601 duration + * format. + * + * @return the evaluationFrequency value. + */ + public Duration evaluationFrequency() { + return this.evaluationFrequency; + } + + /** + * Set the evaluationFrequency property: how often the metric alert is evaluated represented in ISO 8601 duration + * format. + * + * @param evaluationFrequency the evaluationFrequency value to set. + * @return the MetricAlertPropertiesPatch object itself. + */ + public MetricAlertPropertiesPatch withEvaluationFrequency(Duration evaluationFrequency) { + this.evaluationFrequency = evaluationFrequency; + return this; + } + + /** + * Get the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert + * activity based on the threshold. + * + * @return the windowSize value. + */ + public Duration windowSize() { + return this.windowSize; + } + + /** + * Set the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert + * activity based on the threshold. + * + * @param windowSize the windowSize value to set. + * @return the MetricAlertPropertiesPatch object itself. + */ + public MetricAlertPropertiesPatch withWindowSize(Duration windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * Get the targetResourceType property: the resource type of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @return the targetResourceType value. + */ + public String targetResourceType() { + return this.targetResourceType; + } + + /** + * Set the targetResourceType property: the resource type of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @param targetResourceType the targetResourceType value to set. + * @return the MetricAlertPropertiesPatch object itself. + */ + public MetricAlertPropertiesPatch withTargetResourceType(String targetResourceType) { + this.targetResourceType = targetResourceType; + return this; + } + + /** + * Get the targetResourceRegion property: the region of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @return the targetResourceRegion value. + */ + public String targetResourceRegion() { + return this.targetResourceRegion; + } + + /** + * Set the targetResourceRegion property: the region of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @param targetResourceRegion the targetResourceRegion value to set. + * @return the MetricAlertPropertiesPatch object itself. + */ + public MetricAlertPropertiesPatch withTargetResourceRegion(String targetResourceRegion) { + this.targetResourceRegion = targetResourceRegion; + return this; + } + + /** + * Get the criteria property: defines the specific alert criteria information. + * + * @return the criteria value. + */ + public MetricAlertCriteria criteria() { + return this.criteria; + } + + /** + * Set the criteria property: defines the specific alert criteria information. + * + * @param criteria the criteria value to set. + * @return the MetricAlertPropertiesPatch object itself. + */ + public MetricAlertPropertiesPatch withCriteria(MetricAlertCriteria criteria) { + this.criteria = criteria; + return this; + } + + /** + * Get the autoMitigate property: the flag that indicates whether the alert should be auto resolved or not. The + * default is true. + * + * @return the autoMitigate value. + */ + public Boolean autoMitigate() { + return this.autoMitigate; + } + + /** + * Set the autoMitigate property: the flag that indicates whether the alert should be auto resolved or not. The + * default is true. + * + * @param autoMitigate the autoMitigate value to set. + * @return the MetricAlertPropertiesPatch object itself. + */ + public MetricAlertPropertiesPatch withAutoMitigate(Boolean autoMitigate) { + this.autoMitigate = autoMitigate; + return this; + } + + /** + * Get the actions property: the array of actions that are performed when the alert rule becomes active, and when an + * alert condition is resolved. + * + * @return the actions value. + */ + public List actions() { + return this.actions; + } + + /** + * Set the actions property: the array of actions that are performed when the alert rule becomes active, and when an + * alert condition is resolved. + * + * @param actions the actions value to set. + * @return the MetricAlertPropertiesPatch object itself. + */ + public MetricAlertPropertiesPatch withActions(List actions) { + this.actions = actions; + return this; + } + + /** + * Get the lastUpdatedTime property: Last time the rule was updated in ISO8601 format. + * + * @return the lastUpdatedTime value. + */ + public OffsetDateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + + /** + * Get the isMigrated property: the value indicating whether this alert rule is migrated. + * + * @return the isMigrated value. + */ + public Boolean isMigrated() { + return this.isMigrated; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (criteria() != null) { + criteria().validate(); + } + if (actions() != null) { + actions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertResourceInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertResourceInner.java new file mode 100644 index 0000000000000..631c692284f02 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertResourceInner.java @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertAction; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertCriteria; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** The metric alert resource. */ +@Fluent +public final class MetricAlertResourceInner extends Resource { + /* + * The alert rule properties of the resource. + */ + @JsonProperty(value = "properties", required = true) + private MetricAlertProperties innerProperties = new MetricAlertProperties(); + + /** Creates an instance of MetricAlertResourceInner class. */ + public MetricAlertResourceInner() { + } + + /** + * Get the innerProperties property: The alert rule properties of the resource. + * + * @return the innerProperties value. + */ + private MetricAlertProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public MetricAlertResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MetricAlertResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the description property: the description of the metric alert that will be included in the alert email. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: the description of the metric alert that will be included in the alert email. + * + * @param description the description value to set. + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the severity property: Alert severity {0, 1, 2, 3, 4}. + * + * @return the severity value. + */ + public int severity() { + return this.innerProperties() == null ? 0 : this.innerProperties().severity(); + } + + /** + * Set the severity property: Alert severity {0, 1, 2, 3, 4}. + * + * @param severity the severity value to set. + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withSeverity(int severity) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertProperties(); + } + this.innerProperties().withSeverity(severity); + return this; + } + + /** + * Get the enabled property: the flag that indicates whether the metric alert is enabled. + * + * @return the enabled value. + */ + public boolean enabled() { + return this.innerProperties() == null ? false : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: the flag that indicates whether the metric alert is enabled. + * + * @param enabled the enabled value to set. + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withEnabled(boolean enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertProperties(); + } + this.innerProperties().withEnabled(enabled); + return this; + } + + /** + * Get the scopes property: the list of resource id's that this metric alert is scoped to. + * + * @return the scopes value. + */ + public List scopes() { + return this.innerProperties() == null ? null : this.innerProperties().scopes(); + } + + /** + * Set the scopes property: the list of resource id's that this metric alert is scoped to. + * + * @param scopes the scopes value to set. + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withScopes(List scopes) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertProperties(); + } + this.innerProperties().withScopes(scopes); + return this; + } + + /** + * Get the evaluationFrequency property: how often the metric alert is evaluated represented in ISO 8601 duration + * format. + * + * @return the evaluationFrequency value. + */ + public Duration evaluationFrequency() { + return this.innerProperties() == null ? null : this.innerProperties().evaluationFrequency(); + } + + /** + * Set the evaluationFrequency property: how often the metric alert is evaluated represented in ISO 8601 duration + * format. + * + * @param evaluationFrequency the evaluationFrequency value to set. + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withEvaluationFrequency(Duration evaluationFrequency) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertProperties(); + } + this.innerProperties().withEvaluationFrequency(evaluationFrequency); + return this; + } + + /** + * Get the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert + * activity based on the threshold. + * + * @return the windowSize value. + */ + public Duration windowSize() { + return this.innerProperties() == null ? null : this.innerProperties().windowSize(); + } + + /** + * Set the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert + * activity based on the threshold. + * + * @param windowSize the windowSize value to set. + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withWindowSize(Duration windowSize) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertProperties(); + } + this.innerProperties().withWindowSize(windowSize); + return this; + } + + /** + * Get the targetResourceType property: 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. + * + * @return the targetResourceType value. + */ + public String targetResourceType() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceType(); + } + + /** + * Set the targetResourceType property: 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. + * + * @param targetResourceType the targetResourceType value to set. + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withTargetResourceType(String targetResourceType) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertProperties(); + } + this.innerProperties().withTargetResourceType(targetResourceType); + return this; + } + + /** + * Get the targetResourceRegion property: 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. + * + * @return the targetResourceRegion value. + */ + public String targetResourceRegion() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceRegion(); + } + + /** + * Set the targetResourceRegion property: 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. + * + * @param targetResourceRegion the targetResourceRegion value to set. + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withTargetResourceRegion(String targetResourceRegion) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertProperties(); + } + this.innerProperties().withTargetResourceRegion(targetResourceRegion); + return this; + } + + /** + * Get the criteria property: defines the specific alert criteria information. + * + * @return the criteria value. + */ + public MetricAlertCriteria criteria() { + return this.innerProperties() == null ? null : this.innerProperties().criteria(); + } + + /** + * Set the criteria property: defines the specific alert criteria information. + * + * @param criteria the criteria value to set. + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withCriteria(MetricAlertCriteria criteria) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertProperties(); + } + this.innerProperties().withCriteria(criteria); + return this; + } + + /** + * Get the autoMitigate property: the flag that indicates whether the alert should be auto resolved or not. The + * default is true. + * + * @return the autoMitigate value. + */ + public Boolean autoMitigate() { + return this.innerProperties() == null ? null : this.innerProperties().autoMitigate(); + } + + /** + * Set the autoMitigate property: the flag that indicates whether the alert should be auto resolved or not. The + * default is true. + * + * @param autoMitigate the autoMitigate value to set. + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withAutoMitigate(Boolean autoMitigate) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertProperties(); + } + this.innerProperties().withAutoMitigate(autoMitigate); + return this; + } + + /** + * Get the actions property: the array of actions that are performed when the alert rule becomes active, and when an + * alert condition is resolved. + * + * @return the actions value. + */ + public List actions() { + return this.innerProperties() == null ? null : this.innerProperties().actions(); + } + + /** + * Set the actions property: the array of actions that are performed when the alert rule becomes active, and when an + * alert condition is resolved. + * + * @param actions the actions value to set. + * @return the MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner withActions(List actions) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertProperties(); + } + this.innerProperties().withActions(actions); + return this; + } + + /** + * Get the lastUpdatedTime property: Last time the rule was updated in ISO8601 format. + * + * @return the lastUpdatedTime value. + */ + public OffsetDateTime lastUpdatedTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedTime(); + } + + /** + * Get the isMigrated property: the value indicating whether this alert rule is migrated. + * + * @return the isMigrated value. + */ + public Boolean isMigrated() { + return this.innerProperties() == null ? null : this.innerProperties().isMigrated(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model MetricAlertResourceInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricAlertResourceInner.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertStatusCollectionInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertStatusCollectionInner.java new file mode 100644 index 0000000000000..88b6aaf0e96b6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertStatusCollectionInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of alert rule resources. */ +@Fluent +public final class MetricAlertStatusCollectionInner { + /* + * the values for the alert rule resources. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of MetricAlertStatusCollectionInner class. */ + public MetricAlertStatusCollectionInner() { + } + + /** + * Get the value property: the values for the alert rule resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: the values for the alert rule resources. + * + * @param value the value value to set. + * @return the MetricAlertStatusCollectionInner object itself. + */ + public MetricAlertStatusCollectionInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricBaselinesProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricBaselinesProperties.java new file mode 100644 index 0000000000000..6b5e9acd8c638 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricBaselinesProperties.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.TimeSeriesBaseline; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.util.List; + +/** The response to a metric baselines query. */ +@Fluent +public final class MetricBaselinesProperties { + /* + * 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. + */ + @JsonProperty(value = "timespan", required = true) + private String timespan; + + /* + * 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. + */ + @JsonProperty(value = "interval", required = true) + private Duration interval; + + /* + * The namespace of the metrics been queried. + */ + @JsonProperty(value = "namespace") + private String namespace; + + /* + * The baseline for each time series that was queried. + */ + @JsonProperty(value = "baselines", required = true) + private List baselines; + + /** Creates an instance of MetricBaselinesProperties class. */ + public MetricBaselinesProperties() { + } + + /** + * Get the timespan property: 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. + * + * @return the timespan value. + */ + public String timespan() { + return this.timespan; + } + + /** + * Set the timespan property: 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. + * + * @param timespan the timespan value to set. + * @return the MetricBaselinesProperties object itself. + */ + public MetricBaselinesProperties withTimespan(String timespan) { + this.timespan = timespan; + return this; + } + + /** + * Get the interval property: 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. + * + * @return the interval value. + */ + public Duration interval() { + return this.interval; + } + + /** + * Set the interval property: 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. + * + * @param interval the interval value to set. + * @return the MetricBaselinesProperties object itself. + */ + public MetricBaselinesProperties withInterval(Duration interval) { + this.interval = interval; + return this; + } + + /** + * Get the namespace property: The namespace of the metrics been queried. + * + * @return the namespace value. + */ + public String namespace() { + return this.namespace; + } + + /** + * Set the namespace property: The namespace of the metrics been queried. + * + * @param namespace the namespace value to set. + * @return the MetricBaselinesProperties object itself. + */ + public MetricBaselinesProperties withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * Get the baselines property: The baseline for each time series that was queried. + * + * @return the baselines value. + */ + public List baselines() { + return this.baselines; + } + + /** + * Set the baselines property: The baseline for each time series that was queried. + * + * @param baselines the baselines value to set. + * @return the MetricBaselinesProperties object itself. + */ + public MetricBaselinesProperties withBaselines(List baselines) { + this.baselines = baselines; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (timespan() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property timespan in model MetricBaselinesProperties")); + } + if (interval() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property interval in model MetricBaselinesProperties")); + } + if (baselines() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property baselines in model MetricBaselinesProperties")); + } else { + baselines().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricBaselinesProperties.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricDefinitionInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricDefinitionInner.java new file mode 100644 index 0000000000000..c7405a2ee0358 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricDefinitionInner.java @@ -0,0 +1,378 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.models.AggregationType; +import com.azure.resourcemanager.monitor.generated.models.MetricAvailability; +import com.azure.resourcemanager.monitor.generated.models.MetricClass; +import com.azure.resourcemanager.monitor.generated.models.MetricUnit; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Metric definition class specifies the metadata for a metric. */ +@Fluent +public final class MetricDefinitionInner { + /* + * Flag to indicate whether the dimension is required. + */ + @JsonProperty(value = "isDimensionRequired") + private Boolean isDimensionRequired; + + /* + * the resource identifier of the resource that emitted the metric. + */ + @JsonProperty(value = "resourceId") + private String resourceId; + + /* + * the namespace the metric belongs to. + */ + @JsonProperty(value = "namespace") + private String namespace; + + /* + * the name and the display name of the metric, i.e. it is a localizable string. + */ + @JsonProperty(value = "name") + private LocalizableStringInner name; + + /* + * Detailed description of this metric. + */ + @JsonProperty(value = "displayDescription") + private String displayDescription; + + /* + * Custom category name for this metric. + */ + @JsonProperty(value = "category") + private String category; + + /* + * The class of the metric. + */ + @JsonProperty(value = "metricClass") + private MetricClass metricClass; + + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit") + private MetricUnit unit; + + /* + * the primary aggregation type value defining how to use the values for display. + */ + @JsonProperty(value = "primaryAggregationType") + private AggregationType primaryAggregationType; + + /* + * the collection of what aggregation types are supported. + */ + @JsonProperty(value = "supportedAggregationTypes") + private List supportedAggregationTypes; + + /* + * the collection of what aggregation intervals are available to be queried. + */ + @JsonProperty(value = "metricAvailabilities") + private List metricAvailabilities; + + /* + * the resource identifier of the metric definition. + */ + @JsonProperty(value = "id") + private String id; + + /* + * the name and the display name of the dimension, i.e. it is a localizable string. + */ + @JsonProperty(value = "dimensions") + private List dimensions; + + /** Creates an instance of MetricDefinitionInner class. */ + public MetricDefinitionInner() { + } + + /** + * Get the isDimensionRequired property: Flag to indicate whether the dimension is required. + * + * @return the isDimensionRequired value. + */ + public Boolean isDimensionRequired() { + return this.isDimensionRequired; + } + + /** + * Set the isDimensionRequired property: Flag to indicate whether the dimension is required. + * + * @param isDimensionRequired the isDimensionRequired value to set. + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withIsDimensionRequired(Boolean isDimensionRequired) { + this.isDimensionRequired = isDimensionRequired; + return this; + } + + /** + * Get the resourceId property: the resource identifier of the resource that emitted the metric. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: the resource identifier of the resource that emitted the metric. + * + * @param resourceId the resourceId value to set. + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the namespace property: the namespace the metric belongs to. + * + * @return the namespace value. + */ + public String namespace() { + return this.namespace; + } + + /** + * Set the namespace property: the namespace the metric belongs to. + * + * @param namespace the namespace value to set. + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * Get the name property: the name and the display name of the metric, i.e. it is a localizable string. + * + * @return the name value. + */ + public LocalizableStringInner name() { + return this.name; + } + + /** + * Set the name property: the name and the display name of the metric, i.e. it is a localizable string. + * + * @param name the name value to set. + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withName(LocalizableStringInner name) { + this.name = name; + return this; + } + + /** + * Get the displayDescription property: Detailed description of this metric. + * + * @return the displayDescription value. + */ + public String displayDescription() { + return this.displayDescription; + } + + /** + * Set the displayDescription property: Detailed description of this metric. + * + * @param displayDescription the displayDescription value to set. + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withDisplayDescription(String displayDescription) { + this.displayDescription = displayDescription; + return this; + } + + /** + * Get the category property: Custom category name for this metric. + * + * @return the category value. + */ + public String category() { + return this.category; + } + + /** + * Set the category property: Custom category name for this metric. + * + * @param category the category value to set. + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withCategory(String category) { + this.category = category; + return this; + } + + /** + * Get the metricClass property: The class of the metric. + * + * @return the metricClass value. + */ + public MetricClass metricClass() { + return this.metricClass; + } + + /** + * Set the metricClass property: The class of the metric. + * + * @param metricClass the metricClass value to set. + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withMetricClass(MetricClass metricClass) { + this.metricClass = metricClass; + return this; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public MetricUnit unit() { + return this.unit; + } + + /** + * Set the unit property: The unit of the metric. + * + * @param unit the unit value to set. + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withUnit(MetricUnit unit) { + this.unit = unit; + return this; + } + + /** + * Get the primaryAggregationType property: the primary aggregation type value defining how to use the values for + * display. + * + * @return the primaryAggregationType value. + */ + public AggregationType primaryAggregationType() { + return this.primaryAggregationType; + } + + /** + * Set the primaryAggregationType property: the primary aggregation type value defining how to use the values for + * display. + * + * @param primaryAggregationType the primaryAggregationType value to set. + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withPrimaryAggregationType(AggregationType primaryAggregationType) { + this.primaryAggregationType = primaryAggregationType; + return this; + } + + /** + * Get the supportedAggregationTypes property: the collection of what aggregation types are supported. + * + * @return the supportedAggregationTypes value. + */ + public List supportedAggregationTypes() { + return this.supportedAggregationTypes; + } + + /** + * Set the supportedAggregationTypes property: the collection of what aggregation types are supported. + * + * @param supportedAggregationTypes the supportedAggregationTypes value to set. + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withSupportedAggregationTypes(List supportedAggregationTypes) { + this.supportedAggregationTypes = supportedAggregationTypes; + return this; + } + + /** + * Get the metricAvailabilities property: the collection of what aggregation intervals are available to be queried. + * + * @return the metricAvailabilities value. + */ + public List metricAvailabilities() { + return this.metricAvailabilities; + } + + /** + * Set the metricAvailabilities property: the collection of what aggregation intervals are available to be queried. + * + * @param metricAvailabilities the metricAvailabilities value to set. + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withMetricAvailabilities(List metricAvailabilities) { + this.metricAvailabilities = metricAvailabilities; + return this; + } + + /** + * Get the id property: the resource identifier of the metric definition. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: the resource identifier of the metric definition. + * + * @param id the id value to set. + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the dimensions property: the name and the display name of the dimension, i.e. it is a localizable string. + * + * @return the dimensions value. + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Set the dimensions property: the name and the display name of the dimension, i.e. it is a localizable string. + * + * @param dimensions the dimensions value to set. + * @return the MetricDefinitionInner object itself. + */ + public MetricDefinitionInner withDimensions(List dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() != null) { + name().validate(); + } + if (metricAvailabilities() != null) { + metricAvailabilities().forEach(e -> e.validate()); + } + if (dimensions() != null) { + dimensions().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricInner.java new file mode 100644 index 0000000000000..e0dbc4a4e7c48 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricInner.java @@ -0,0 +1,266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.MetricUnit; +import com.azure.resourcemanager.monitor.generated.models.TimeSeriesElement; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The result data of a query. */ +@Fluent +public final class MetricInner { + /* + * the metric Id. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * the resource type of the metric resource. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /* + * the name and the display name of the metric, i.e. it is localizable string. + */ + @JsonProperty(value = "name", required = true) + private LocalizableStringInner name; + + /* + * Detailed description of this metric. + */ + @JsonProperty(value = "displayDescription") + private String displayDescription; + + /* + * 'Success' or the error details on query failures for this metric. + */ + @JsonProperty(value = "errorCode") + private String errorCode; + + /* + * Error message encountered querying this specific metric. + */ + @JsonProperty(value = "errorMessage") + private String errorMessage; + + /* + * The unit of the metric. + */ + @JsonProperty(value = "unit", required = true) + private MetricUnit unit; + + /* + * the time series returned when a data query is performed. + */ + @JsonProperty(value = "timeseries", required = true) + private List timeseries; + + /** Creates an instance of MetricInner class. */ + public MetricInner() { + } + + /** + * Get the id property: the metric Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: the metric Id. + * + * @param id the id value to set. + * @return the MetricInner object itself. + */ + public MetricInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the type property: the resource type of the metric resource. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: the resource type of the metric resource. + * + * @param type the type value to set. + * @return the MetricInner object itself. + */ + public MetricInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the name property: the name and the display name of the metric, i.e. it is localizable string. + * + * @return the name value. + */ + public LocalizableStringInner name() { + return this.name; + } + + /** + * Set the name property: the name and the display name of the metric, i.e. it is localizable string. + * + * @param name the name value to set. + * @return the MetricInner object itself. + */ + public MetricInner withName(LocalizableStringInner name) { + this.name = name; + return this; + } + + /** + * Get the displayDescription property: Detailed description of this metric. + * + * @return the displayDescription value. + */ + public String displayDescription() { + return this.displayDescription; + } + + /** + * Set the displayDescription property: Detailed description of this metric. + * + * @param displayDescription the displayDescription value to set. + * @return the MetricInner object itself. + */ + public MetricInner withDisplayDescription(String displayDescription) { + this.displayDescription = displayDescription; + return this; + } + + /** + * Get the errorCode property: 'Success' or the error details on query failures for this metric. + * + * @return the errorCode value. + */ + public String errorCode() { + return this.errorCode; + } + + /** + * Set the errorCode property: 'Success' or the error details on query failures for this metric. + * + * @param errorCode the errorCode value to set. + * @return the MetricInner object itself. + */ + public MetricInner withErrorCode(String errorCode) { + this.errorCode = errorCode; + return this; + } + + /** + * Get the errorMessage property: Error message encountered querying this specific metric. + * + * @return the errorMessage value. + */ + public String errorMessage() { + return this.errorMessage; + } + + /** + * Set the errorMessage property: Error message encountered querying this specific metric. + * + * @param errorMessage the errorMessage value to set. + * @return the MetricInner object itself. + */ + public MetricInner withErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + return this; + } + + /** + * Get the unit property: The unit of the metric. + * + * @return the unit value. + */ + public MetricUnit unit() { + return this.unit; + } + + /** + * Set the unit property: The unit of the metric. + * + * @param unit the unit value to set. + * @return the MetricInner object itself. + */ + public MetricInner withUnit(MetricUnit unit) { + this.unit = unit; + return this; + } + + /** + * Get the timeseries property: the time series returned when a data query is performed. + * + * @return the timeseries value. + */ + public List timeseries() { + return this.timeseries; + } + + /** + * Set the timeseries property: the time series returned when a data query is performed. + * + * @param timeseries the timeseries value to set. + * @return the MetricInner object itself. + */ + public MetricInner withTimeseries(List timeseries) { + this.timeseries = timeseries; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property id in model MetricInner")); + } + if (type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model MetricInner")); + } + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model MetricInner")); + } else { + name().validate(); + } + if (unit() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property unit in model MetricInner")); + } + if (timeseries() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property timeseries in model MetricInner")); + } else { + timeseries().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricInner.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricNamespaceInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricNamespaceInner.java new file mode 100644 index 0000000000000..43f3686b7d973 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricNamespaceInner.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.models.MetricNamespaceName; +import com.azure.resourcemanager.monitor.generated.models.NamespaceClassification; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Metric namespace class specifies the metadata for a metric namespace. */ +@Fluent +public final class MetricNamespaceInner { + /* + * The ID of the metric namespace. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The type of the namespace. + */ + @JsonProperty(value = "type") + private String type; + + /* + * The escaped name of the namespace. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Kind of namespace + */ + @JsonProperty(value = "classification") + private NamespaceClassification classification; + + /* + * Properties which include the fully qualified namespace name. + */ + @JsonProperty(value = "properties") + private MetricNamespaceName properties; + + /** Creates an instance of MetricNamespaceInner class. */ + public MetricNamespaceInner() { + } + + /** + * Get the id property: The ID of the metric namespace. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The ID of the metric namespace. + * + * @param id the id value to set. + * @return the MetricNamespaceInner object itself. + */ + public MetricNamespaceInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the type property: The type of the namespace. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The type of the namespace. + * + * @param type the type value to set. + * @return the MetricNamespaceInner object itself. + */ + public MetricNamespaceInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the name property: The escaped name of the namespace. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The escaped name of the namespace. + * + * @param name the name value to set. + * @return the MetricNamespaceInner object itself. + */ + public MetricNamespaceInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the classification property: Kind of namespace. + * + * @return the classification value. + */ + public NamespaceClassification classification() { + return this.classification; + } + + /** + * Set the classification property: Kind of namespace. + * + * @param classification the classification value to set. + * @return the MetricNamespaceInner object itself. + */ + public MetricNamespaceInner withClassification(NamespaceClassification classification) { + this.classification = classification; + return this; + } + + /** + * Get the properties property: Properties which include the fully qualified namespace name. + * + * @return the properties value. + */ + public MetricNamespaceName properties() { + return this.properties; + } + + /** + * Set the properties property: Properties which include the fully qualified namespace name. + * + * @param properties the properties value to set. + * @return the MetricNamespaceInner object itself. + */ + public MetricNamespaceInner withProperties(MetricNamespaceName properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/OperationAutoGeneratedInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/OperationAutoGeneratedInner.java new file mode 100644 index 0000000000000..9d42dccbcbd47 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/OperationAutoGeneratedInner.java @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.models.ActionType; +import com.azure.resourcemanager.monitor.generated.models.OperationDisplayAutoGenerated; +import com.azure.resourcemanager.monitor.generated.models.Origin; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * REST API Operation + * + *

Details of a REST API operation, returned from the Resource Provider Operations API. + */ +@Fluent +public final class OperationAutoGeneratedInner { + /* + * The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action" + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for + * ARM/control-plane operations. + */ + @JsonProperty(value = "isDataAction", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isDataAction; + + /* + * Localized display information for this particular operation. + */ + @JsonProperty(value = "display") + private OperationDisplayAutoGenerated display; + + /* + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + * value is "user,system" + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private Origin origin; + + /* + * Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + */ + @JsonProperty(value = "actionType", access = JsonProperty.Access.WRITE_ONLY) + private ActionType actionType; + + /** Creates an instance of OperationAutoGeneratedInner class. */ + public OperationAutoGeneratedInner() { + } + + /** + * Get the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + public Boolean isDataAction() { + return this.isDataAction; + } + + /** + * Get the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + public OperationDisplayAutoGenerated display() { + return this.display; + } + + /** + * Set the display property: Localized display information for this particular operation. + * + * @param display the display value to set. + * @return the OperationAutoGeneratedInner object itself. + */ + public OperationAutoGeneratedInner withDisplay(OperationDisplayAutoGenerated display) { + this.display = display; + return this; + } + + /** + * Get the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + public Origin origin() { + return this.origin; + } + + /** + * Get the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + public ActionType actionType() { + return this.actionType; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/OperationListResultInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/OperationListResultInner.java new file mode 100644 index 0000000000000..50f16740ec0d8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/OperationListResultInner.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.models.Operation; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * 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. + */ +@Fluent +public final class OperationListResultInner { + /* + * List of operations supported by the Microsoft.Insights provider. + */ + @JsonProperty(value = "value") + private List value; + + /* + * URL to get the next set of operation list results if there are any. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of OperationListResultInner class. */ + public OperationListResultInner() { + } + + /** + * Get the value property: List of operations supported by the Microsoft.Insights provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of operations supported by the Microsoft.Insights provider. + * + * @param value the value value to set. + * @return the OperationListResultInner object itself. + */ + public OperationListResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of operation list results if there are any. + * + * @param nextLink the nextLink value to set. + * @return the OperationListResultInner object itself. + */ + public OperationListResultInner withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/OperationStatusInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/OperationStatusInner.java new file mode 100644 index 0000000000000..2e8c466ebd1bd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/OperationStatusInner.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.exception.ManagementError; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The status of operation. */ +@Fluent +public final class OperationStatusInner { + /* + * The operation Id. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The operation name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Start time of the job in standard ISO8601 format. + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * End time of the job in standard ISO8601 format. + */ + @JsonProperty(value = "endTime") + private OffsetDateTime endTime; + + /* + * The status of the operation. + */ + @JsonProperty(value = "status") + private String status; + + /* + * The error detail of the operation if any. + */ + @JsonProperty(value = "error") + private ManagementError error; + + /** Creates an instance of OperationStatusInner class. */ + public OperationStatusInner() { + } + + /** + * Get the id property: The operation Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The operation Id. + * + * @param id the id value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the name property: The operation name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The operation name. + * + * @param name the name value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the startTime property: Start time of the job in standard ISO8601 format. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Start time of the job in standard ISO8601 format. + * + * @param startTime the startTime value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: End time of the job in standard ISO8601 format. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: End time of the job in standard ISO8601 format. + * + * @param endTime the endTime value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the status property: The status of the operation. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The status of the operation. + * + * @param status the status value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the error property: The error detail of the operation if any. + * + * @return the error value. + */ + public ManagementError error() { + return this.error; + } + + /** + * Set the error property: The error detail of the operation if any. + * + * @param error the error value to set. + * @return the OperationStatusInner object itself. + */ + public OperationStatusInner withError(ManagementError error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PredictiveResponseInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PredictiveResponseInner.java new file mode 100644 index 0000000000000..d7cabca442827 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PredictiveResponseInner.java @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.models.PredictiveValue; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.util.List; + +/** The response to a metrics query. */ +@Fluent +public final class PredictiveResponseInner { + /* + * 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. + */ + @JsonProperty(value = "timespan") + private String timespan; + + /* + * 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. + */ + @JsonProperty(value = "interval") + private Duration interval; + + /* + * The metrics being queried + */ + @JsonProperty(value = "metricName") + private String metricName; + + /* + * resource of the predictive metric. + */ + @JsonProperty(value = "targetResourceId") + private String targetResourceId; + + /* + * the value of the collection. + */ + @JsonProperty(value = "data") + private List data; + + /** Creates an instance of PredictiveResponseInner class. */ + public PredictiveResponseInner() { + } + + /** + * Get the timespan property: 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. + * + * @return the timespan value. + */ + public String timespan() { + return this.timespan; + } + + /** + * Set the timespan property: 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. + * + * @param timespan the timespan value to set. + * @return the PredictiveResponseInner object itself. + */ + public PredictiveResponseInner withTimespan(String timespan) { + this.timespan = timespan; + return this; + } + + /** + * Get the interval property: 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. + * + * @return the interval value. + */ + public Duration interval() { + return this.interval; + } + + /** + * Set the interval property: 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. + * + * @param interval the interval value to set. + * @return the PredictiveResponseInner object itself. + */ + public PredictiveResponseInner withInterval(Duration interval) { + this.interval = interval; + return this; + } + + /** + * Get the metricName property: The metrics being queried. + * + * @return the metricName value. + */ + public String metricName() { + return this.metricName; + } + + /** + * Set the metricName property: The metrics being queried. + * + * @param metricName the metricName value to set. + * @return the PredictiveResponseInner object itself. + */ + public PredictiveResponseInner withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * Get the targetResourceId property: resource of the predictive metric. + * + * @return the targetResourceId value. + */ + public String targetResourceId() { + return this.targetResourceId; + } + + /** + * Set the targetResourceId property: resource of the predictive metric. + * + * @param targetResourceId the targetResourceId value to set. + * @return the PredictiveResponseInner object itself. + */ + public PredictiveResponseInner withTargetResourceId(String targetResourceId) { + this.targetResourceId = targetResourceId; + return this; + } + + /** + * Get the data property: the value of the collection. + * + * @return the data value. + */ + public List data() { + return this.data; + } + + /** + * Set the data property: the value of the collection. + * + * @param data the data value to set. + * @return the PredictiveResponseInner object itself. + */ + public PredictiveResponseInner withData(List data) { + this.data = data; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (data() != null) { + data().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateEndpointConnectionInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 0000000000000..27508083fc275 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpoint; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkServiceConnectionState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Private Endpoint Connection resource. */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private PrivateEndpointConnectionProperties innerProperties; + + /** Creates an instance of PrivateEndpointConnectionInner class. */ + public PrivateEndpointConnectionInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateEndpointConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the privateEndpoint property: The resource of private end point. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Set the privateEndpoint property: The resource of private end point. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateEndpoint(privateEndpoint); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateEndpointConnectionListResultInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateEndpointConnectionListResultInner.java new file mode 100644 index 0000000000000..6488fd2615d1f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateEndpointConnectionListResultInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** List of private endpoint connection associated with the specified storage account. */ +@Fluent +public final class PrivateEndpointConnectionListResultInner { + /* + * Array of private endpoint connections + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of PrivateEndpointConnectionListResultInner class. */ + public PrivateEndpointConnectionListResultInner() { + } + + /** + * Get the value property: Array of private endpoint connections. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of private endpoint connections. + * + * @param value the value value to set. + * @return the PrivateEndpointConnectionListResultInner object itself. + */ + public PrivateEndpointConnectionListResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateEndpointConnectionProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateEndpointConnectionProperties.java new file mode 100644 index 0000000000000..770de01988aa7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateEndpointConnectionProperties.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpoint; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkServiceConnectionState; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of the PrivateEndpointConnectProperties. */ +@Fluent +public final class PrivateEndpointConnectionProperties { + /* + * The resource of private end point. + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpoint privateEndpoint; + + /* + * A collection of information about the state of the connection between service consumer and provider. + */ + @JsonProperty(value = "privateLinkServiceConnectionState", required = true) + private PrivateLinkServiceConnectionState privateLinkServiceConnectionState; + + /* + * The provisioning state of the private endpoint connection resource. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private PrivateEndpointConnectionProvisioningState provisioningState; + + /** Creates an instance of PrivateEndpointConnectionProperties class. */ + public PrivateEndpointConnectionProperties() { + } + + /** + * Get the privateEndpoint property: The resource of private end point. + * + * @return the privateEndpoint value. + */ + public PrivateEndpoint privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: The resource of private end point. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: A collection of information about the state of the connection + * between service consumer and provider. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property privateLinkServiceConnectionState in model" + + " PrivateEndpointConnectionProperties")); + } else { + privateLinkServiceConnectionState().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionProperties.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateLinkResourceInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateLinkResourceInner.java new file mode 100644 index 0000000000000..5b19d268a3958 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateLinkResourceInner.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A private link resource. */ +@Fluent +public final class PrivateLinkResourceInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private PrivateLinkResourceProperties innerProperties; + + /** Creates an instance of PrivateLinkResourceInner class. */ + public PrivateLinkResourceInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateLinkResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.innerProperties() == null ? null : this.innerProperties().groupId(); + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.innerProperties() == null ? null : this.innerProperties().requiredMembers(); + } + + /** + * Get the requiredZoneNames property: The private link resource Private link DNS zone name. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.innerProperties() == null ? null : this.innerProperties().requiredZoneNames(); + } + + /** + * Set the requiredZoneNames property: The private link resource Private link DNS zone name. + * + * @param requiredZoneNames the requiredZoneNames value to set. + * @return the PrivateLinkResourceInner object itself. + */ + public PrivateLinkResourceInner withRequiredZoneNames(List requiredZoneNames) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateLinkResourceProperties(); + } + this.innerProperties().withRequiredZoneNames(requiredZoneNames); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateLinkResourceListResultInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateLinkResourceListResultInner.java new file mode 100644 index 0000000000000..6ffbc769288a8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateLinkResourceListResultInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Fluent +public final class PrivateLinkResourceListResultInner { + /* + * Array of private link resources + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of PrivateLinkResourceListResultInner class. */ + public PrivateLinkResourceListResultInner() { + } + + /** + * Get the value property: Array of private link resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: Array of private link resources. + * + * @param value the value value to set. + * @return the PrivateLinkResourceListResultInner object itself. + */ + public PrivateLinkResourceListResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateLinkResourceProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateLinkResourceProperties.java new file mode 100644 index 0000000000000..a809a2ac46c25 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateLinkResourceProperties.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a private link resource. */ +@Fluent +public final class PrivateLinkResourceProperties { + /* + * The private link resource group id. + */ + @JsonProperty(value = "groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The private link resource required member names. + */ + @JsonProperty(value = "requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /* + * The private link resource Private link DNS zone name. + */ + @JsonProperty(value = "requiredZoneNames") + private List requiredZoneNames; + + /** Creates an instance of PrivateLinkResourceProperties class. */ + public PrivateLinkResourceProperties() { + } + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Get the requiredZoneNames property: The private link resource Private link DNS zone name. + * + * @return the requiredZoneNames value. + */ + public List requiredZoneNames() { + return this.requiredZoneNames; + } + + /** + * Set the requiredZoneNames property: The private link resource Private link DNS zone name. + * + * @param requiredZoneNames the requiredZoneNames value to set. + * @return the PrivateLinkResourceProperties object itself. + */ + public PrivateLinkResourceProperties withRequiredZoneNames(List requiredZoneNames) { + this.requiredZoneNames = requiredZoneNames; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ResponseInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ResponseInner.java new file mode 100644 index 0000000000000..06f460536c357 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ResponseInner.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.util.List; + +/** The response to a metrics query. */ +@Fluent +public final class ResponseInner { + /* + * The integer value representing the relative cost of the query. + */ + @JsonProperty(value = "cost") + private Integer cost; + + /* + * 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. + */ + @JsonProperty(value = "timespan", required = true) + private String timespan; + + /* + * 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. + */ + @JsonProperty(value = "interval") + private Duration interval; + + /* + * The namespace of the metrics being queried + */ + @JsonProperty(value = "namespace") + private String namespace; + + /* + * The region of the resource being queried for metrics. + */ + @JsonProperty(value = "resourceregion") + private String resourceRegion; + + /* + * the value of the collection. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** Creates an instance of ResponseInner class. */ + public ResponseInner() { + } + + /** + * Get the cost property: The integer value representing the relative cost of the query. + * + * @return the cost value. + */ + public Integer cost() { + return this.cost; + } + + /** + * Set the cost property: The integer value representing the relative cost of the query. + * + * @param cost the cost value to set. + * @return the ResponseInner object itself. + */ + public ResponseInner withCost(Integer cost) { + this.cost = cost; + return this; + } + + /** + * Get the timespan property: 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. + * + * @return the timespan value. + */ + public String timespan() { + return this.timespan; + } + + /** + * Set the timespan property: 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. + * + * @param timespan the timespan value to set. + * @return the ResponseInner object itself. + */ + public ResponseInner withTimespan(String timespan) { + this.timespan = timespan; + return this; + } + + /** + * Get the interval property: 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. + * + * @return the interval value. + */ + public Duration interval() { + return this.interval; + } + + /** + * Set the interval property: 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. + * + * @param interval the interval value to set. + * @return the ResponseInner object itself. + */ + public ResponseInner withInterval(Duration interval) { + this.interval = interval; + return this; + } + + /** + * Get the namespace property: The namespace of the metrics being queried. + * + * @return the namespace value. + */ + public String namespace() { + return this.namespace; + } + + /** + * Set the namespace property: The namespace of the metrics being queried. + * + * @param namespace the namespace value to set. + * @return the ResponseInner object itself. + */ + public ResponseInner withNamespace(String namespace) { + this.namespace = namespace; + return this; + } + + /** + * Get the resourceRegion property: The region of the resource being queried for metrics. + * + * @return the resourceRegion value. + */ + public String resourceRegion() { + return this.resourceRegion; + } + + /** + * Set the resourceRegion property: The region of the resource being queried for metrics. + * + * @param resourceRegion the resourceRegion value to set. + * @return the ResponseInner object itself. + */ + public ResponseInner withResourceRegion(String resourceRegion) { + this.resourceRegion = resourceRegion; + return this; + } + + /** + * Get the value property: the value of the collection. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: the value of the collection. + * + * @param value the value value to set. + * @return the ResponseInner object itself. + */ + public ResponseInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (timespan() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property timespan in model ResponseInner")); + } + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model ResponseInner")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ResponseInner.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScheduledQueryRuleProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScheduledQueryRuleProperties.java new file mode 100644 index 0000000000000..4623f686fc27f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScheduledQueryRuleProperties.java @@ -0,0 +1,572 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.models.Actions; +import com.azure.resourcemanager.monitor.generated.models.AlertSeverity; +import com.azure.resourcemanager.monitor.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.monitor.generated.models.RuleResolveConfiguration; +import com.azure.resourcemanager.monitor.generated.models.ScheduledQueryRuleCriteria; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.util.List; + +/** scheduled query rule Definition. */ +@Fluent +public final class ScheduledQueryRuleProperties { + /* + * The api-version used when creating this alert rule + */ + @JsonProperty(value = "createdWithApiVersion", access = JsonProperty.Access.WRITE_ONLY) + private String createdWithApiVersion; + + /* + * True if alert rule is legacy Log Analytic rule + */ + @JsonProperty(value = "isLegacyLogAnalyticsRule", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isLegacyLogAnalyticsRule; + + /* + * The description of the scheduled query rule. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The display name of the alert rule + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only + * for rules of the kind LogAlert. + */ + @JsonProperty(value = "severity") + private AlertSeverity severity; + + /* + * The flag which indicates whether this scheduled query rule is enabled. Value should be true or false + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /* + * This determines if traffic is allowed over public network. By default it is enabled. + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccess publicNetworkAccess; + + /* + * The list of resource id's that this scheduled query rule is scoped to. + */ + @JsonProperty(value = "scopes") + private List scopes; + + /* + * How often the scheduled query rule is evaluated represented in ISO 8601 duration format. Relevant and required + * only for rules of the kind LogAlert. + */ + @JsonProperty(value = "evaluationFrequency") + private Duration evaluationFrequency; + + /* + * The period of time (in ISO 8601 duration format) on which the Alert query will be executed (bin size). Relevant + * and required only for rules of the kind LogAlert. + */ + @JsonProperty(value = "windowSize") + private Duration windowSize; + + /* + * If specified then overrides the query time range (default is WindowSize*NumberOfEvaluationPeriods). Relevant + * only for rules of the kind LogAlert. + */ + @JsonProperty(value = "overrideQueryTimeRange") + private Duration overrideQueryTimeRange; + + /* + * List of resource type of the target resource(s) on which the alert is created/updated. For example if the scope + * is a resource group and targetResourceTypes is Microsoft.Compute/virtualMachines, then a different alert will be + * fired for each virtual machine in the resource group which meet the alert criteria. Relevant only for rules of + * the kind LogAlert + */ + @JsonProperty(value = "targetResourceTypes") + private List targetResourceTypes; + + /* + * The rule criteria that defines the conditions of the scheduled query rule. + */ + @JsonProperty(value = "criteria") + private ScheduledQueryRuleCriteria criteria; + + /* + * Mute actions for the chosen period of time (in ISO 8601 duration format) after the alert is fired. Relevant only + * for rules of the kind LogAlert. + */ + @JsonProperty(value = "muteActionsDuration") + private Duration muteActionsDuration; + + /* + * Actions to invoke when the alert fires. + */ + @JsonProperty(value = "actions") + private Actions actions; + + /* + * The flag which indicates whether this scheduled query rule has been configured to be stored in the customer's + * storage. The default is false. + */ + @JsonProperty(value = "isWorkspaceAlertsStorageConfigured", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isWorkspaceAlertsStorageConfigured; + + /* + * The flag which indicates whether this scheduled query rule should be stored in the customer's storage. The + * default is false. Relevant only for rules of the kind LogAlert. + */ + @JsonProperty(value = "checkWorkspaceAlertsStorageConfigured") + private Boolean checkWorkspaceAlertsStorageConfigured; + + /* + * The flag which indicates whether the provided query should be validated or not. The default is false. Relevant + * only for rules of the kind LogAlert. + */ + @JsonProperty(value = "skipQueryValidation") + private Boolean skipQueryValidation; + + /* + * The flag that indicates whether the alert should be automatically resolved or not. The default is true. Relevant + * only for rules of the kind LogAlert. + */ + @JsonProperty(value = "autoMitigate") + private Boolean autoMitigate; + + /* + * Defines the configuration for resolving fired alerts. Relevant only for rules of the kind LogAlert. + */ + @JsonProperty(value = "ruleResolveConfiguration") + private RuleResolveConfiguration ruleResolveConfiguration; + + /** Creates an instance of ScheduledQueryRuleProperties class. */ + public ScheduledQueryRuleProperties() { + } + + /** + * Get the createdWithApiVersion property: The api-version used when creating this alert rule. + * + * @return the createdWithApiVersion value. + */ + public String createdWithApiVersion() { + return this.createdWithApiVersion; + } + + /** + * Get the isLegacyLogAnalyticsRule property: True if alert rule is legacy Log Analytic rule. + * + * @return the isLegacyLogAnalyticsRule value. + */ + public Boolean isLegacyLogAnalyticsRule() { + return this.isLegacyLogAnalyticsRule; + } + + /** + * Get the description property: The description of the scheduled query rule. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the scheduled query rule. + * + * @param description the description value to set. + * @return the ScheduledQueryRuleProperties object itself. + */ + public ScheduledQueryRuleProperties withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the displayName property: The display name of the alert rule. + * + * @return the displayName value. + */ + public String displayName() { + return this.displayName; + } + + /** + * Set the displayName property: The display name of the alert rule. + * + * @param displayName the displayName value to set. + * @return the ScheduledQueryRuleProperties object itself. + */ + public ScheduledQueryRuleProperties withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the severity property: Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. + * Relevant and required only for rules of the kind LogAlert. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.severity; + } + + /** + * Set the severity property: Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. + * Relevant and required only for rules of the kind LogAlert. + * + * @param severity the severity value to set. + * @return the ScheduledQueryRuleProperties object itself. + */ + public ScheduledQueryRuleProperties withSeverity(AlertSeverity severity) { + this.severity = severity; + return this; + } + + /** + * Get the enabled property: The flag which indicates whether this scheduled query rule is enabled. Value should be + * true or false. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: The flag which indicates whether this scheduled query rule is enabled. Value should be + * true or false. + * + * @param enabled the enabled value to set. + * @return the ScheduledQueryRuleProperties object itself. + */ + public ScheduledQueryRuleProperties withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the publicNetworkAccess property: This determines if traffic is allowed over public network. By default it is + * enabled. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: This determines if traffic is allowed over public network. By default it is + * enabled. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the ScheduledQueryRuleProperties object itself. + */ + public ScheduledQueryRuleProperties withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the scopes property: The list of resource id's that this scheduled query rule is scoped to. + * + * @return the scopes value. + */ + public List scopes() { + return this.scopes; + } + + /** + * Set the scopes property: The list of resource id's that this scheduled query rule is scoped to. + * + * @param scopes the scopes value to set. + * @return the ScheduledQueryRuleProperties object itself. + */ + public ScheduledQueryRuleProperties withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Get the evaluationFrequency property: How often the scheduled query rule is evaluated represented in ISO 8601 + * duration format. Relevant and required only for rules of the kind LogAlert. + * + * @return the evaluationFrequency value. + */ + public Duration evaluationFrequency() { + return this.evaluationFrequency; + } + + /** + * Set the evaluationFrequency property: How often the scheduled query rule is evaluated represented in ISO 8601 + * duration format. Relevant and required only for rules of the kind LogAlert. + * + * @param evaluationFrequency the evaluationFrequency value to set. + * @return the ScheduledQueryRuleProperties object itself. + */ + public ScheduledQueryRuleProperties withEvaluationFrequency(Duration evaluationFrequency) { + this.evaluationFrequency = evaluationFrequency; + return this; + } + + /** + * Get the windowSize property: The period of time (in ISO 8601 duration format) on which the Alert query will be + * executed (bin size). Relevant and required only for rules of the kind LogAlert. + * + * @return the windowSize value. + */ + public Duration windowSize() { + return this.windowSize; + } + + /** + * Set the windowSize property: The period of time (in ISO 8601 duration format) on which the Alert query will be + * executed (bin size). Relevant and required only for rules of the kind LogAlert. + * + * @param windowSize the windowSize value to set. + * @return the ScheduledQueryRuleProperties object itself. + */ + public ScheduledQueryRuleProperties withWindowSize(Duration windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * Get the overrideQueryTimeRange property: If specified then overrides the query time range (default is + * WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + * + * @return the overrideQueryTimeRange value. + */ + public Duration overrideQueryTimeRange() { + return this.overrideQueryTimeRange; + } + + /** + * Set the overrideQueryTimeRange property: If specified then overrides the query time range (default is + * WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + * + * @param overrideQueryTimeRange the overrideQueryTimeRange value to set. + * @return the ScheduledQueryRuleProperties object itself. + */ + public ScheduledQueryRuleProperties withOverrideQueryTimeRange(Duration overrideQueryTimeRange) { + this.overrideQueryTimeRange = overrideQueryTimeRange; + return this; + } + + /** + * Get the targetResourceTypes property: List of resource type of the target resource(s) on which the alert is + * created/updated. For example if the scope is a resource group and targetResourceTypes is + * Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual machine in the resource + * group which meet the alert criteria. Relevant only for rules of the kind LogAlert. + * + * @return the targetResourceTypes value. + */ + public List targetResourceTypes() { + return this.targetResourceTypes; + } + + /** + * Set the targetResourceTypes property: List of resource type of the target resource(s) on which the alert is + * created/updated. For example if the scope is a resource group and targetResourceTypes is + * Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual machine in the resource + * group which meet the alert criteria. Relevant only for rules of the kind LogAlert. + * + * @param targetResourceTypes the targetResourceTypes value to set. + * @return the ScheduledQueryRuleProperties object itself. + */ + public ScheduledQueryRuleProperties withTargetResourceTypes(List targetResourceTypes) { + this.targetResourceTypes = targetResourceTypes; + return this; + } + + /** + * Get the criteria property: The rule criteria that defines the conditions of the scheduled query rule. + * + * @return the criteria value. + */ + public ScheduledQueryRuleCriteria criteria() { + return this.criteria; + } + + /** + * Set the criteria property: The rule criteria that defines the conditions of the scheduled query rule. + * + * @param criteria the criteria value to set. + * @return the ScheduledQueryRuleProperties object itself. + */ + public ScheduledQueryRuleProperties withCriteria(ScheduledQueryRuleCriteria criteria) { + this.criteria = criteria; + return this; + } + + /** + * Get the muteActionsDuration property: Mute actions for the chosen period of time (in ISO 8601 duration format) + * after the alert is fired. Relevant only for rules of the kind LogAlert. + * + * @return the muteActionsDuration value. + */ + public Duration muteActionsDuration() { + return this.muteActionsDuration; + } + + /** + * Set the muteActionsDuration property: Mute actions for the chosen period of time (in ISO 8601 duration format) + * after the alert is fired. Relevant only for rules of the kind LogAlert. + * + * @param muteActionsDuration the muteActionsDuration value to set. + * @return the ScheduledQueryRuleProperties object itself. + */ + public ScheduledQueryRuleProperties withMuteActionsDuration(Duration muteActionsDuration) { + this.muteActionsDuration = muteActionsDuration; + return this; + } + + /** + * Get the actions property: Actions to invoke when the alert fires. + * + * @return the actions value. + */ + public Actions actions() { + return this.actions; + } + + /** + * Set the actions property: Actions to invoke when the alert fires. + * + * @param actions the actions value to set. + * @return the ScheduledQueryRuleProperties object itself. + */ + public ScheduledQueryRuleProperties withActions(Actions actions) { + this.actions = actions; + return this; + } + + /** + * Get the isWorkspaceAlertsStorageConfigured property: The flag which indicates whether this scheduled query rule + * has been configured to be stored in the customer's storage. The default is false. + * + * @return the isWorkspaceAlertsStorageConfigured value. + */ + public Boolean isWorkspaceAlertsStorageConfigured() { + return this.isWorkspaceAlertsStorageConfigured; + } + + /** + * Get the checkWorkspaceAlertsStorageConfigured property: The flag which indicates whether this scheduled query + * rule should be stored in the customer's storage. The default is false. Relevant only for rules of the kind + * LogAlert. + * + * @return the checkWorkspaceAlertsStorageConfigured value. + */ + public Boolean checkWorkspaceAlertsStorageConfigured() { + return this.checkWorkspaceAlertsStorageConfigured; + } + + /** + * Set the checkWorkspaceAlertsStorageConfigured property: The flag which indicates whether this scheduled query + * rule should be stored in the customer's storage. The default is false. Relevant only for rules of the kind + * LogAlert. + * + * @param checkWorkspaceAlertsStorageConfigured the checkWorkspaceAlertsStorageConfigured value to set. + * @return the ScheduledQueryRuleProperties object itself. + */ + public ScheduledQueryRuleProperties withCheckWorkspaceAlertsStorageConfigured( + Boolean checkWorkspaceAlertsStorageConfigured) { + this.checkWorkspaceAlertsStorageConfigured = checkWorkspaceAlertsStorageConfigured; + return this; + } + + /** + * Get the skipQueryValidation property: The flag which indicates whether the provided query should be validated or + * not. The default is false. Relevant only for rules of the kind LogAlert. + * + * @return the skipQueryValidation value. + */ + public Boolean skipQueryValidation() { + return this.skipQueryValidation; + } + + /** + * Set the skipQueryValidation property: The flag which indicates whether the provided query should be validated or + * not. The default is false. Relevant only for rules of the kind LogAlert. + * + * @param skipQueryValidation the skipQueryValidation value to set. + * @return the ScheduledQueryRuleProperties object itself. + */ + public ScheduledQueryRuleProperties withSkipQueryValidation(Boolean skipQueryValidation) { + this.skipQueryValidation = skipQueryValidation; + return this; + } + + /** + * Get the autoMitigate property: The flag that indicates whether the alert should be automatically resolved or not. + * The default is true. Relevant only for rules of the kind LogAlert. + * + * @return the autoMitigate value. + */ + public Boolean autoMitigate() { + return this.autoMitigate; + } + + /** + * Set the autoMitigate property: The flag that indicates whether the alert should be automatically resolved or not. + * The default is true. Relevant only for rules of the kind LogAlert. + * + * @param autoMitigate the autoMitigate value to set. + * @return the ScheduledQueryRuleProperties object itself. + */ + public ScheduledQueryRuleProperties withAutoMitigate(Boolean autoMitigate) { + this.autoMitigate = autoMitigate; + return this; + } + + /** + * Get the ruleResolveConfiguration property: Defines the configuration for resolving fired alerts. Relevant only + * for rules of the kind LogAlert. + * + * @return the ruleResolveConfiguration value. + */ + public RuleResolveConfiguration ruleResolveConfiguration() { + return this.ruleResolveConfiguration; + } + + /** + * Set the ruleResolveConfiguration property: Defines the configuration for resolving fired alerts. Relevant only + * for rules of the kind LogAlert. + * + * @param ruleResolveConfiguration the ruleResolveConfiguration value to set. + * @return the ScheduledQueryRuleProperties object itself. + */ + public ScheduledQueryRuleProperties withRuleResolveConfiguration( + RuleResolveConfiguration ruleResolveConfiguration) { + this.ruleResolveConfiguration = ruleResolveConfiguration; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (criteria() != null) { + criteria().validate(); + } + if (actions() != null) { + actions().validate(); + } + if (ruleResolveConfiguration() != null) { + ruleResolveConfiguration().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScheduledQueryRuleResourceInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScheduledQueryRuleResourceInner.java new file mode 100644 index 0000000000000..ce3ea51e389d1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScheduledQueryRuleResourceInner.java @@ -0,0 +1,618 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.Actions; +import com.azure.resourcemanager.monitor.generated.models.AlertSeverity; +import com.azure.resourcemanager.monitor.generated.models.Identity; +import com.azure.resourcemanager.monitor.generated.models.Kind; +import com.azure.resourcemanager.monitor.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.monitor.generated.models.RuleResolveConfiguration; +import com.azure.resourcemanager.monitor.generated.models.ScheduledQueryRuleCriteria; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +/** The scheduled query rule resource. */ +@Fluent +public final class ScheduledQueryRuleResourceInner extends Resource { + /* + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /* + * Indicates the type of scheduled query rule. The default is LogAlert. + */ + @JsonProperty(value = "kind") + private Kind kind; + + /* + * 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. + */ + @JsonProperty(value = "etag", access = JsonProperty.Access.WRITE_ONLY) + private String etag; + + /* + * SystemData of ScheduledQueryRule. + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /* + * The rule properties of the resource. + */ + @JsonProperty(value = "properties", required = true) + private ScheduledQueryRuleProperties innerProperties = new ScheduledQueryRuleProperties(); + + /** Creates an instance of ScheduledQueryRuleResourceInner class. */ + public ScheduledQueryRuleResourceInner() { + } + + /** + * Get the identity property: The identity of the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the resource. + * + * @param identity the identity value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get the kind property: Indicates the type of scheduled query rule. The default is LogAlert. + * + * @return the kind value. + */ + public Kind kind() { + return this.kind; + } + + /** + * Set the kind property: Indicates the type of scheduled query rule. The default is LogAlert. + * + * @param kind the kind value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withKind(Kind kind) { + this.kind = kind; + return this; + } + + /** + * Get the etag property: 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. + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Get the systemData property: SystemData of ScheduledQueryRule. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the innerProperties property: The rule properties of the resource. + * + * @return the innerProperties value. + */ + private ScheduledQueryRuleProperties innerProperties() { + return this.innerProperties; + } + + /** {@inheritDoc} */ + @Override + public ScheduledQueryRuleResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ScheduledQueryRuleResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Get the createdWithApiVersion property: The api-version used when creating this alert rule. + * + * @return the createdWithApiVersion value. + */ + public String createdWithApiVersion() { + return this.innerProperties() == null ? null : this.innerProperties().createdWithApiVersion(); + } + + /** + * Get the isLegacyLogAnalyticsRule property: True if alert rule is legacy Log Analytic rule. + * + * @return the isLegacyLogAnalyticsRule value. + */ + public Boolean isLegacyLogAnalyticsRule() { + return this.innerProperties() == null ? null : this.innerProperties().isLegacyLogAnalyticsRule(); + } + + /** + * Get the description property: The description of the scheduled query rule. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of the scheduled query rule. + * + * @param description the description value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the displayName property: The display name of the alert rule. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The display name of the alert rule. + * + * @param displayName the displayName value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the severity property: Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. + * Relevant and required only for rules of the kind LogAlert. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.innerProperties() == null ? null : this.innerProperties().severity(); + } + + /** + * Set the severity property: Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. + * Relevant and required only for rules of the kind LogAlert. + * + * @param severity the severity value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withSeverity(AlertSeverity severity) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withSeverity(severity); + return this; + } + + /** + * Get the enabled property: The flag which indicates whether this scheduled query rule is enabled. Value should be + * true or false. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: The flag which indicates whether this scheduled query rule is enabled. Value should be + * true or false. + * + * @param enabled the enabled value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withEnabled(Boolean enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withEnabled(enabled); + return this; + } + + /** + * Get the publicNetworkAccess property: This determines if traffic is allowed over public network. By default it is + * enabled. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: This determines if traffic is allowed over public network. By default it is + * enabled. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Get the scopes property: The list of resource id's that this scheduled query rule is scoped to. + * + * @return the scopes value. + */ + public List scopes() { + return this.innerProperties() == null ? null : this.innerProperties().scopes(); + } + + /** + * Set the scopes property: The list of resource id's that this scheduled query rule is scoped to. + * + * @param scopes the scopes value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withScopes(List scopes) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withScopes(scopes); + return this; + } + + /** + * Get the evaluationFrequency property: How often the scheduled query rule is evaluated represented in ISO 8601 + * duration format. Relevant and required only for rules of the kind LogAlert. + * + * @return the evaluationFrequency value. + */ + public Duration evaluationFrequency() { + return this.innerProperties() == null ? null : this.innerProperties().evaluationFrequency(); + } + + /** + * Set the evaluationFrequency property: How often the scheduled query rule is evaluated represented in ISO 8601 + * duration format. Relevant and required only for rules of the kind LogAlert. + * + * @param evaluationFrequency the evaluationFrequency value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withEvaluationFrequency(Duration evaluationFrequency) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withEvaluationFrequency(evaluationFrequency); + return this; + } + + /** + * Get the windowSize property: The period of time (in ISO 8601 duration format) on which the Alert query will be + * executed (bin size). Relevant and required only for rules of the kind LogAlert. + * + * @return the windowSize value. + */ + public Duration windowSize() { + return this.innerProperties() == null ? null : this.innerProperties().windowSize(); + } + + /** + * Set the windowSize property: The period of time (in ISO 8601 duration format) on which the Alert query will be + * executed (bin size). Relevant and required only for rules of the kind LogAlert. + * + * @param windowSize the windowSize value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withWindowSize(Duration windowSize) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withWindowSize(windowSize); + return this; + } + + /** + * Get the overrideQueryTimeRange property: If specified then overrides the query time range (default is + * WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + * + * @return the overrideQueryTimeRange value. + */ + public Duration overrideQueryTimeRange() { + return this.innerProperties() == null ? null : this.innerProperties().overrideQueryTimeRange(); + } + + /** + * Set the overrideQueryTimeRange property: If specified then overrides the query time range (default is + * WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + * + * @param overrideQueryTimeRange the overrideQueryTimeRange value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withOverrideQueryTimeRange(Duration overrideQueryTimeRange) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withOverrideQueryTimeRange(overrideQueryTimeRange); + return this; + } + + /** + * Get the targetResourceTypes property: List of resource type of the target resource(s) on which the alert is + * created/updated. For example if the scope is a resource group and targetResourceTypes is + * Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual machine in the resource + * group which meet the alert criteria. Relevant only for rules of the kind LogAlert. + * + * @return the targetResourceTypes value. + */ + public List targetResourceTypes() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceTypes(); + } + + /** + * Set the targetResourceTypes property: List of resource type of the target resource(s) on which the alert is + * created/updated. For example if the scope is a resource group and targetResourceTypes is + * Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual machine in the resource + * group which meet the alert criteria. Relevant only for rules of the kind LogAlert. + * + * @param targetResourceTypes the targetResourceTypes value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withTargetResourceTypes(List targetResourceTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withTargetResourceTypes(targetResourceTypes); + return this; + } + + /** + * Get the criteria property: The rule criteria that defines the conditions of the scheduled query rule. + * + * @return the criteria value. + */ + public ScheduledQueryRuleCriteria criteria() { + return this.innerProperties() == null ? null : this.innerProperties().criteria(); + } + + /** + * Set the criteria property: The rule criteria that defines the conditions of the scheduled query rule. + * + * @param criteria the criteria value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withCriteria(ScheduledQueryRuleCriteria criteria) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withCriteria(criteria); + return this; + } + + /** + * Get the muteActionsDuration property: Mute actions for the chosen period of time (in ISO 8601 duration format) + * after the alert is fired. Relevant only for rules of the kind LogAlert. + * + * @return the muteActionsDuration value. + */ + public Duration muteActionsDuration() { + return this.innerProperties() == null ? null : this.innerProperties().muteActionsDuration(); + } + + /** + * Set the muteActionsDuration property: Mute actions for the chosen period of time (in ISO 8601 duration format) + * after the alert is fired. Relevant only for rules of the kind LogAlert. + * + * @param muteActionsDuration the muteActionsDuration value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withMuteActionsDuration(Duration muteActionsDuration) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withMuteActionsDuration(muteActionsDuration); + return this; + } + + /** + * Get the actions property: Actions to invoke when the alert fires. + * + * @return the actions value. + */ + public Actions actions() { + return this.innerProperties() == null ? null : this.innerProperties().actions(); + } + + /** + * Set the actions property: Actions to invoke when the alert fires. + * + * @param actions the actions value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withActions(Actions actions) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withActions(actions); + return this; + } + + /** + * Get the isWorkspaceAlertsStorageConfigured property: The flag which indicates whether this scheduled query rule + * has been configured to be stored in the customer's storage. The default is false. + * + * @return the isWorkspaceAlertsStorageConfigured value. + */ + public Boolean isWorkspaceAlertsStorageConfigured() { + return this.innerProperties() == null ? null : this.innerProperties().isWorkspaceAlertsStorageConfigured(); + } + + /** + * Get the checkWorkspaceAlertsStorageConfigured property: The flag which indicates whether this scheduled query + * rule should be stored in the customer's storage. The default is false. Relevant only for rules of the kind + * LogAlert. + * + * @return the checkWorkspaceAlertsStorageConfigured value. + */ + public Boolean checkWorkspaceAlertsStorageConfigured() { + return this.innerProperties() == null ? null : this.innerProperties().checkWorkspaceAlertsStorageConfigured(); + } + + /** + * Set the checkWorkspaceAlertsStorageConfigured property: The flag which indicates whether this scheduled query + * rule should be stored in the customer's storage. The default is false. Relevant only for rules of the kind + * LogAlert. + * + * @param checkWorkspaceAlertsStorageConfigured the checkWorkspaceAlertsStorageConfigured value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withCheckWorkspaceAlertsStorageConfigured( + Boolean checkWorkspaceAlertsStorageConfigured) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withCheckWorkspaceAlertsStorageConfigured(checkWorkspaceAlertsStorageConfigured); + return this; + } + + /** + * Get the skipQueryValidation property: The flag which indicates whether the provided query should be validated or + * not. The default is false. Relevant only for rules of the kind LogAlert. + * + * @return the skipQueryValidation value. + */ + public Boolean skipQueryValidation() { + return this.innerProperties() == null ? null : this.innerProperties().skipQueryValidation(); + } + + /** + * Set the skipQueryValidation property: The flag which indicates whether the provided query should be validated or + * not. The default is false. Relevant only for rules of the kind LogAlert. + * + * @param skipQueryValidation the skipQueryValidation value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withSkipQueryValidation(Boolean skipQueryValidation) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withSkipQueryValidation(skipQueryValidation); + return this; + } + + /** + * Get the autoMitigate property: The flag that indicates whether the alert should be automatically resolved or not. + * The default is true. Relevant only for rules of the kind LogAlert. + * + * @return the autoMitigate value. + */ + public Boolean autoMitigate() { + return this.innerProperties() == null ? null : this.innerProperties().autoMitigate(); + } + + /** + * Set the autoMitigate property: The flag that indicates whether the alert should be automatically resolved or not. + * The default is true. Relevant only for rules of the kind LogAlert. + * + * @param autoMitigate the autoMitigate value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withAutoMitigate(Boolean autoMitigate) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withAutoMitigate(autoMitigate); + return this; + } + + /** + * Get the ruleResolveConfiguration property: Defines the configuration for resolving fired alerts. Relevant only + * for rules of the kind LogAlert. + * + * @return the ruleResolveConfiguration value. + */ + public RuleResolveConfiguration ruleResolveConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().ruleResolveConfiguration(); + } + + /** + * Set the ruleResolveConfiguration property: Defines the configuration for resolving fired alerts. Relevant only + * for rules of the kind LogAlert. + * + * @param ruleResolveConfiguration the ruleResolveConfiguration value to set. + * @return the ScheduledQueryRuleResourceInner object itself. + */ + public ScheduledQueryRuleResourceInner withRuleResolveConfiguration( + RuleResolveConfiguration ruleResolveConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withRuleResolveConfiguration(ruleResolveConfiguration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model ScheduledQueryRuleResourceInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ScheduledQueryRuleResourceInner.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScopedResourceInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScopedResourceInner.java new file mode 100644 index 0000000000000..4fceda8cc59af --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScopedResourceInner.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private link scoped resource. */ +@Fluent +public final class ScopedResourceInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private ScopedResourceProperties innerProperties; + + /* + * System data + */ + @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) + private SystemData systemData; + + /** Creates an instance of ScopedResourceInner class. */ + public ScopedResourceInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ScopedResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the systemData property: System data. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the linkedResourceId property: The resource id of the scoped Azure monitor resource. + * + * @return the linkedResourceId value. + */ + public String linkedResourceId() { + return this.innerProperties() == null ? null : this.innerProperties().linkedResourceId(); + } + + /** + * Set the linkedResourceId property: The resource id of the scoped Azure monitor resource. + * + * @param linkedResourceId the linkedResourceId value to set. + * @return the ScopedResourceInner object itself. + */ + public ScopedResourceInner withLinkedResourceId(String linkedResourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new ScopedResourceProperties(); + } + this.innerProperties().withLinkedResourceId(linkedResourceId); + return this; + } + + /** + * Get the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScopedResourceProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScopedResourceProperties.java new file mode 100644 index 0000000000000..4ab2517b61fa2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScopedResourceProperties.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a private link scoped resource. */ +@Fluent +public final class ScopedResourceProperties { + /* + * The resource id of the scoped Azure monitor resource. + */ + @JsonProperty(value = "linkedResourceId") + private String linkedResourceId; + + /* + * State of the private endpoint connection. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** Creates an instance of ScopedResourceProperties class. */ + public ScopedResourceProperties() { + } + + /** + * Get the linkedResourceId property: The resource id of the scoped Azure monitor resource. + * + * @return the linkedResourceId value. + */ + public String linkedResourceId() { + return this.linkedResourceId; + } + + /** + * Set the linkedResourceId property: The resource id of the scoped Azure monitor resource. + * + * @param linkedResourceId the linkedResourceId value to set. + * @return the ScopedResourceProperties object itself. + */ + public ScopedResourceProperties withLinkedResourceId(String linkedResourceId) { + this.linkedResourceId = linkedResourceId; + return this; + } + + /** + * Get the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/SingleMetricBaselineInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/SingleMetricBaselineInner.java new file mode 100644 index 0000000000000..94f2cd5c71d2c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/SingleMetricBaselineInner.java @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.TimeSeriesBaseline; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.util.List; + +/** The baseline results of a single metric. */ +@Fluent +public final class SingleMetricBaselineInner { + /* + * The metric baseline Id. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * The resource type of the metric baseline resource. + */ + @JsonProperty(value = "type", required = true) + private String type; + + /* + * The name of the metric for which the baselines were retrieved. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The metric baseline properties of the metric. + */ + @JsonProperty(value = "properties", required = true) + private MetricBaselinesProperties innerProperties = new MetricBaselinesProperties(); + + /** Creates an instance of SingleMetricBaselineInner class. */ + public SingleMetricBaselineInner() { + } + + /** + * Get the id property: The metric baseline Id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The metric baseline Id. + * + * @param id the id value to set. + * @return the SingleMetricBaselineInner object itself. + */ + public SingleMetricBaselineInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the type property: The resource type of the metric baseline resource. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The resource type of the metric baseline resource. + * + * @param type the type value to set. + * @return the SingleMetricBaselineInner object itself. + */ + public SingleMetricBaselineInner withType(String type) { + this.type = type; + return this; + } + + /** + * Get the name property: The name of the metric for which the baselines were retrieved. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the metric for which the baselines were retrieved. + * + * @param name the name value to set. + * @return the SingleMetricBaselineInner object itself. + */ + public SingleMetricBaselineInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the innerProperties property: The metric baseline properties of the metric. + * + * @return the innerProperties value. + */ + private MetricBaselinesProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the timespan property: 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. + * + * @return the timespan value. + */ + public String timespan() { + return this.innerProperties() == null ? null : this.innerProperties().timespan(); + } + + /** + * Set the timespan property: 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. + * + * @param timespan the timespan value to set. + * @return the SingleMetricBaselineInner object itself. + */ + public SingleMetricBaselineInner withTimespan(String timespan) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricBaselinesProperties(); + } + this.innerProperties().withTimespan(timespan); + return this; + } + + /** + * Get the interval property: 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. + * + * @return the interval value. + */ + public Duration interval() { + return this.innerProperties() == null ? null : this.innerProperties().interval(); + } + + /** + * Set the interval property: 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. + * + * @param interval the interval value to set. + * @return the SingleMetricBaselineInner object itself. + */ + public SingleMetricBaselineInner withInterval(Duration interval) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricBaselinesProperties(); + } + this.innerProperties().withInterval(interval); + return this; + } + + /** + * Get the namespace property: The namespace of the metrics been queried. + * + * @return the namespace value. + */ + public String namespace() { + return this.innerProperties() == null ? null : this.innerProperties().namespace(); + } + + /** + * Set the namespace property: The namespace of the metrics been queried. + * + * @param namespace the namespace value to set. + * @return the SingleMetricBaselineInner object itself. + */ + public SingleMetricBaselineInner withNamespace(String namespace) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricBaselinesProperties(); + } + this.innerProperties().withNamespace(namespace); + return this; + } + + /** + * Get the baselines property: The baseline for each time series that was queried. + * + * @return the baselines value. + */ + public List baselines() { + return this.innerProperties() == null ? null : this.innerProperties().baselines(); + } + + /** + * Set the baselines property: The baseline for each time series that was queried. + * + * @param baselines the baselines value to set. + * @return the SingleMetricBaselineInner object itself. + */ + public SingleMetricBaselineInner withBaselines(List baselines) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricBaselinesProperties(); + } + this.innerProperties().withBaselines(baselines); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model SingleMetricBaselineInner")); + } + if (type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model SingleMetricBaselineInner")); + } + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model SingleMetricBaselineInner")); + } + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property innerProperties in model SingleMetricBaselineInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SingleMetricBaselineInner.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/TestNotificationDetailsResponseInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/TestNotificationDetailsResponseInner.java new file mode 100644 index 0000000000000..394c0d9e16109 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/TestNotificationDetailsResponseInner.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.ActionDetail; +import com.azure.resourcemanager.monitor.generated.models.Context; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The details of the test notification results. */ +@Fluent +public final class TestNotificationDetailsResponseInner { + /* + * The context info + */ + @JsonProperty(value = "context") + private Context context; + + /* + * The overall state + */ + @JsonProperty(value = "state", required = true) + private String state; + + /* + * The completed time + */ + @JsonProperty(value = "completedTime") + private String completedTime; + + /* + * The created time + */ + @JsonProperty(value = "createdTime") + private String createdTime; + + /* + * The list of action detail + */ + @JsonProperty(value = "actionDetails") + private List actionDetails; + + /** Creates an instance of TestNotificationDetailsResponseInner class. */ + public TestNotificationDetailsResponseInner() { + } + + /** + * Get the context property: The context info. + * + * @return the context value. + */ + public Context context() { + return this.context; + } + + /** + * Set the context property: The context info. + * + * @param context the context value to set. + * @return the TestNotificationDetailsResponseInner object itself. + */ + public TestNotificationDetailsResponseInner withContext(Context context) { + this.context = context; + return this; + } + + /** + * Get the state property: The overall state. + * + * @return the state value. + */ + public String state() { + return this.state; + } + + /** + * Set the state property: The overall state. + * + * @param state the state value to set. + * @return the TestNotificationDetailsResponseInner object itself. + */ + public TestNotificationDetailsResponseInner withState(String state) { + this.state = state; + return this; + } + + /** + * Get the completedTime property: The completed time. + * + * @return the completedTime value. + */ + public String completedTime() { + return this.completedTime; + } + + /** + * Set the completedTime property: The completed time. + * + * @param completedTime the completedTime value to set. + * @return the TestNotificationDetailsResponseInner object itself. + */ + public TestNotificationDetailsResponseInner withCompletedTime(String completedTime) { + this.completedTime = completedTime; + return this; + } + + /** + * Get the createdTime property: The created time. + * + * @return the createdTime value. + */ + public String createdTime() { + return this.createdTime; + } + + /** + * Set the createdTime property: The created time. + * + * @param createdTime the createdTime value to set. + * @return the TestNotificationDetailsResponseInner object itself. + */ + public TestNotificationDetailsResponseInner withCreatedTime(String createdTime) { + this.createdTime = createdTime; + return this; + } + + /** + * Get the actionDetails property: The list of action detail. + * + * @return the actionDetails value. + */ + public List actionDetails() { + return this.actionDetails; + } + + /** + * Set the actionDetails property: The list of action detail. + * + * @param actionDetails the actionDetails value to set. + * @return the TestNotificationDetailsResponseInner object itself. + */ + public TestNotificationDetailsResponseInner withActionDetails(List actionDetails) { + this.actionDetails = actionDetails; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (context() != null) { + context().validate(); + } + if (state() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property state in model TestNotificationDetailsResponseInner")); + } + if (actionDetails() != null) { + actionDetails().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TestNotificationDetailsResponseInner.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/VMInsightsOnboardingStatusInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/VMInsightsOnboardingStatusInner.java new file mode 100644 index 0000000000000..b82c54e463de4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/VMInsightsOnboardingStatusInner.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.monitor.generated.models.DataContainer; +import com.azure.resourcemanager.monitor.generated.models.DataStatus; +import com.azure.resourcemanager.monitor.generated.models.OnboardingStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** VM Insights onboarding status for a resource. */ +@Fluent +public final class VMInsightsOnboardingStatusInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private VMInsightsOnboardingStatusProperties innerProperties; + + /** Creates an instance of VMInsightsOnboardingStatusInner class. */ + public VMInsightsOnboardingStatusInner() { + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private VMInsightsOnboardingStatusProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the resourceId property: Azure Resource Manager identifier of the resource whose onboarding status is being + * represented. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.innerProperties() == null ? null : this.innerProperties().resourceId(); + } + + /** + * Set the resourceId property: Azure Resource Manager identifier of the resource whose onboarding status is being + * represented. + * + * @param resourceId the resourceId value to set. + * @return the VMInsightsOnboardingStatusInner object itself. + */ + public VMInsightsOnboardingStatusInner withResourceId(String resourceId) { + if (this.innerProperties() == null) { + this.innerProperties = new VMInsightsOnboardingStatusProperties(); + } + this.innerProperties().withResourceId(resourceId); + return this; + } + + /** + * Get the onboardingStatus property: 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. + * + * @return the onboardingStatus value. + */ + public OnboardingStatus onboardingStatus() { + return this.innerProperties() == null ? null : this.innerProperties().onboardingStatus(); + } + + /** + * Set the onboardingStatus property: 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. + * + * @param onboardingStatus the onboardingStatus value to set. + * @return the VMInsightsOnboardingStatusInner object itself. + */ + public VMInsightsOnboardingStatusInner withOnboardingStatus(OnboardingStatus onboardingStatus) { + if (this.innerProperties() == null) { + this.innerProperties = new VMInsightsOnboardingStatusProperties(); + } + this.innerProperties().withOnboardingStatus(onboardingStatus); + return this; + } + + /** + * Get the dataStatus property: 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. + * + * @return the dataStatus value. + */ + public DataStatus dataStatus() { + return this.innerProperties() == null ? null : this.innerProperties().dataStatus(); + } + + /** + * Set the dataStatus property: 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. + * + * @param dataStatus the dataStatus value to set. + * @return the VMInsightsOnboardingStatusInner object itself. + */ + public VMInsightsOnboardingStatusInner withDataStatus(DataStatus dataStatus) { + if (this.innerProperties() == null) { + this.innerProperties = new VMInsightsOnboardingStatusProperties(); + } + this.innerProperties().withDataStatus(dataStatus); + return this; + } + + /** + * Get the data property: Containers that currently store VM Insights data for the specified resource. + * + * @return the data value. + */ + public List data() { + return this.innerProperties() == null ? null : this.innerProperties().data(); + } + + /** + * Set the data property: Containers that currently store VM Insights data for the specified resource. + * + * @param data the data value to set. + * @return the VMInsightsOnboardingStatusInner object itself. + */ + public VMInsightsOnboardingStatusInner withData(List data) { + if (this.innerProperties() == null) { + this.innerProperties = new VMInsightsOnboardingStatusProperties(); + } + this.innerProperties().withData(data); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/VMInsightsOnboardingStatusProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/VMInsightsOnboardingStatusProperties.java new file mode 100644 index 0000000000000..daf36116df3e2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/VMInsightsOnboardingStatusProperties.java @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.DataContainer; +import com.azure.resourcemanager.monitor.generated.models.DataStatus; +import com.azure.resourcemanager.monitor.generated.models.OnboardingStatus; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Resource properties. */ +@Fluent +public final class VMInsightsOnboardingStatusProperties { + /* + * Azure Resource Manager identifier of the resource whose onboarding status is being represented. + */ + @JsonProperty(value = "resourceId", required = true) + private String resourceId; + + /* + * 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. + */ + @JsonProperty(value = "onboardingStatus", required = true) + private OnboardingStatus onboardingStatus; + + /* + * 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. + */ + @JsonProperty(value = "dataStatus", required = true) + private DataStatus dataStatus; + + /* + * Containers that currently store VM Insights data for the specified resource. + */ + @JsonProperty(value = "data") + private List data; + + /** Creates an instance of VMInsightsOnboardingStatusProperties class. */ + public VMInsightsOnboardingStatusProperties() { + } + + /** + * Get the resourceId property: Azure Resource Manager identifier of the resource whose onboarding status is being + * represented. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: Azure Resource Manager identifier of the resource whose onboarding status is being + * represented. + * + * @param resourceId the resourceId value to set. + * @return the VMInsightsOnboardingStatusProperties object itself. + */ + public VMInsightsOnboardingStatusProperties withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the onboardingStatus property: 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. + * + * @return the onboardingStatus value. + */ + public OnboardingStatus onboardingStatus() { + return this.onboardingStatus; + } + + /** + * Set the onboardingStatus property: 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. + * + * @param onboardingStatus the onboardingStatus value to set. + * @return the VMInsightsOnboardingStatusProperties object itself. + */ + public VMInsightsOnboardingStatusProperties withOnboardingStatus(OnboardingStatus onboardingStatus) { + this.onboardingStatus = onboardingStatus; + return this; + } + + /** + * Get the dataStatus property: 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. + * + * @return the dataStatus value. + */ + public DataStatus dataStatus() { + return this.dataStatus; + } + + /** + * Set the dataStatus property: 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. + * + * @param dataStatus the dataStatus value to set. + * @return the VMInsightsOnboardingStatusProperties object itself. + */ + public VMInsightsOnboardingStatusProperties withDataStatus(DataStatus dataStatus) { + this.dataStatus = dataStatus; + return this; + } + + /** + * Get the data property: Containers that currently store VM Insights data for the specified resource. + * + * @return the data value. + */ + public List data() { + return this.data; + } + + /** + * Set the data property: Containers that currently store VM Insights data for the specified resource. + * + * @param data the data value to set. + * @return the VMInsightsOnboardingStatusProperties object itself. + */ + public VMInsightsOnboardingStatusProperties withData(List data) { + this.data = data; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (resourceId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property resourceId in model VMInsightsOnboardingStatusProperties")); + } + if (onboardingStatus() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property onboardingStatus in model VMInsightsOnboardingStatusProperties")); + } + if (dataStatus() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property dataStatus in model VMInsightsOnboardingStatusProperties")); + } + if (data() != null) { + data().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VMInsightsOnboardingStatusProperties.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/WorkspaceInfoProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/WorkspaceInfoProperties.java new file mode 100644 index 0000000000000..6dced97d83cdf --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/WorkspaceInfoProperties.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Resource properties. */ +@Fluent +public final class WorkspaceInfoProperties { + /* + * Log Analytics workspace identifier. + */ + @JsonProperty(value = "customerId", required = true) + private String customerId; + + /** Creates an instance of WorkspaceInfoProperties class. */ + public WorkspaceInfoProperties() { + } + + /** + * Get the customerId property: Log Analytics workspace identifier. + * + * @return the customerId value. + */ + public String customerId() { + return this.customerId; + } + + /** + * Set the customerId property: Log Analytics workspace identifier. + * + * @param customerId the customerId value to set. + * @return the WorkspaceInfoProperties object itself. + */ + public WorkspaceInfoProperties withCustomerId(String customerId) { + this.customerId = customerId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (customerId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property customerId in model WorkspaceInfoProperties")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceInfoProperties.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/package-info.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/package-info.java new file mode 100644 index 0000000000000..f47cfdde9d782 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the inner data models for MonitorClient. Monitor Management Client. */ +package com.azure.resourcemanager.monitor.generated.fluent.models; diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/package-info.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/package-info.java new file mode 100644 index 0000000000000..42ea0995be6e7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the service clients for MonitorClient. Monitor Management Client. */ +package com.azure.resourcemanager.monitor.generated.fluent; diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActionGroupResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActionGroupResourceImpl.java new file mode 100644 index 0000000000000..7638877ce0993 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActionGroupResourceImpl.java @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.ActionGroupResourceInner; +import com.azure.resourcemanager.monitor.generated.models.ActionGroupPatchBody; +import com.azure.resourcemanager.monitor.generated.models.ActionGroupResource; +import com.azure.resourcemanager.monitor.generated.models.ArmRoleReceiver; +import com.azure.resourcemanager.monitor.generated.models.AutomationRunbookReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureAppPushReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureFunctionReceiver; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +import com.azure.resourcemanager.monitor.generated.models.EnableRequest; +import com.azure.resourcemanager.monitor.generated.models.EventHubReceiver; +import com.azure.resourcemanager.monitor.generated.models.ItsmReceiver; +import com.azure.resourcemanager.monitor.generated.models.LogicAppReceiver; +import com.azure.resourcemanager.monitor.generated.models.NotificationRequestBody; +import com.azure.resourcemanager.monitor.generated.models.SmsReceiver; +import com.azure.resourcemanager.monitor.generated.models.TestNotificationDetailsResponse; +import com.azure.resourcemanager.monitor.generated.models.VoiceReceiver; +import com.azure.resourcemanager.monitor.generated.models.WebhookReceiver; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ActionGroupResourceImpl + implements ActionGroupResource, ActionGroupResource.Definition, ActionGroupResource.Update { + private ActionGroupResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String groupShortName() { + return this.innerModel().groupShortName(); + } + + public boolean enabled() { + return this.innerModel().enabled(); + } + + public List emailReceivers() { + List inner = this.innerModel().emailReceivers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List smsReceivers() { + List inner = this.innerModel().smsReceivers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List webhookReceivers() { + List inner = this.innerModel().webhookReceivers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List itsmReceivers() { + List inner = this.innerModel().itsmReceivers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List azureAppPushReceivers() { + List inner = this.innerModel().azureAppPushReceivers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List automationRunbookReceivers() { + List inner = this.innerModel().automationRunbookReceivers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List voiceReceivers() { + List inner = this.innerModel().voiceReceivers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List logicAppReceivers() { + List inner = this.innerModel().logicAppReceivers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List azureFunctionReceivers() { + List inner = this.innerModel().azureFunctionReceivers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List armRoleReceivers() { + List inner = this.innerModel().armRoleReceivers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List eventHubReceivers() { + List inner = this.innerModel().eventHubReceivers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ActionGroupResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String actionGroupName; + + private ActionGroupPatchBody updateActionGroupPatch; + + public ActionGroupResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ActionGroupResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getActionGroups() + .createOrUpdateWithResponse(resourceGroupName, actionGroupName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ActionGroupResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getActionGroups() + .createOrUpdateWithResponse(resourceGroupName, actionGroupName, this.innerModel(), context) + .getValue(); + return this; + } + + ActionGroupResourceImpl(String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new ActionGroupResourceInner(); + this.serviceManager = serviceManager; + this.actionGroupName = name; + } + + public ActionGroupResourceImpl update() { + this.updateActionGroupPatch = new ActionGroupPatchBody(); + return this; + } + + public ActionGroupResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getActionGroups() + .updateWithResponse(resourceGroupName, actionGroupName, updateActionGroupPatch, Context.NONE) + .getValue(); + return this; + } + + public ActionGroupResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getActionGroups() + .updateWithResponse(resourceGroupName, actionGroupName, updateActionGroupPatch, context) + .getValue(); + return this; + } + + ActionGroupResourceImpl( + ActionGroupResourceInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.actionGroupName = Utils.getValueFromIdByName(innerObject.id(), "actionGroups"); + } + + public ActionGroupResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getActionGroups() + .getByResourceGroupWithResponse(resourceGroupName, actionGroupName, Context.NONE) + .getValue(); + return this; + } + + public ActionGroupResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getActionGroups() + .getByResourceGroupWithResponse(resourceGroupName, actionGroupName, context) + .getValue(); + return this; + } + + public TestNotificationDetailsResponse createNotificationsAtActionGroupResourceLevel( + NotificationRequestBody notificationRequest) { + return serviceManager + .actionGroups() + .createNotificationsAtActionGroupResourceLevel(resourceGroupName, actionGroupName, notificationRequest); + } + + public TestNotificationDetailsResponse createNotificationsAtActionGroupResourceLevel( + NotificationRequestBody notificationRequest, Context context) { + return serviceManager + .actionGroups() + .createNotificationsAtActionGroupResourceLevel( + resourceGroupName, actionGroupName, notificationRequest, context); + } + + public Response enableReceiverWithResponse(EnableRequest enableRequest, Context context) { + return serviceManager + .actionGroups() + .enableReceiverWithResponse(resourceGroupName, actionGroupName, enableRequest, context); + } + + public void enableReceiver(EnableRequest enableRequest) { + serviceManager.actionGroups().enableReceiver(resourceGroupName, actionGroupName, enableRequest); + } + + public ActionGroupResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ActionGroupResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ActionGroupResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateActionGroupPatch.withTags(tags); + return this; + } + } + + public ActionGroupResourceImpl withGroupShortName(String groupShortName) { + this.innerModel().withGroupShortName(groupShortName); + return this; + } + + public ActionGroupResourceImpl withEnabled(boolean enabled) { + this.innerModel().withEnabled(enabled); + return this; + } + + public ActionGroupResourceImpl withEmailReceivers(List emailReceivers) { + this.innerModel().withEmailReceivers(emailReceivers); + return this; + } + + public ActionGroupResourceImpl withSmsReceivers(List smsReceivers) { + this.innerModel().withSmsReceivers(smsReceivers); + return this; + } + + public ActionGroupResourceImpl withWebhookReceivers(List webhookReceivers) { + this.innerModel().withWebhookReceivers(webhookReceivers); + return this; + } + + public ActionGroupResourceImpl withItsmReceivers(List itsmReceivers) { + this.innerModel().withItsmReceivers(itsmReceivers); + return this; + } + + public ActionGroupResourceImpl withAzureAppPushReceivers(List azureAppPushReceivers) { + this.innerModel().withAzureAppPushReceivers(azureAppPushReceivers); + return this; + } + + public ActionGroupResourceImpl withAutomationRunbookReceivers( + List automationRunbookReceivers) { + this.innerModel().withAutomationRunbookReceivers(automationRunbookReceivers); + return this; + } + + public ActionGroupResourceImpl withVoiceReceivers(List voiceReceivers) { + this.innerModel().withVoiceReceivers(voiceReceivers); + return this; + } + + public ActionGroupResourceImpl withLogicAppReceivers(List logicAppReceivers) { + this.innerModel().withLogicAppReceivers(logicAppReceivers); + return this; + } + + public ActionGroupResourceImpl withAzureFunctionReceivers(List azureFunctionReceivers) { + this.innerModel().withAzureFunctionReceivers(azureFunctionReceivers); + return this; + } + + public ActionGroupResourceImpl withArmRoleReceivers(List armRoleReceivers) { + this.innerModel().withArmRoleReceivers(armRoleReceivers); + return this; + } + + public ActionGroupResourceImpl withEventHubReceivers(List eventHubReceivers) { + this.innerModel().withEventHubReceivers(eventHubReceivers); + return this; + } + + public ActionGroupResourceImpl withEnabled(Boolean enabled) { + this.updateActionGroupPatch.withEnabled(enabled); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActionGroupsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActionGroupsClientImpl.java new file mode 100644 index 0000000000000..3cd51ecb75542 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActionGroupsClientImpl.java @@ -0,0 +1,2592 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.monitor.generated.fluent.ActionGroupsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.ActionGroupResourceInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.TestNotificationDetailsResponseInner; +import com.azure.resourcemanager.monitor.generated.models.ActionGroupList; +import com.azure.resourcemanager.monitor.generated.models.ActionGroupPatchBody; +import com.azure.resourcemanager.monitor.generated.models.EnableRequest; +import com.azure.resourcemanager.monitor.generated.models.NotificationRequestBody; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ActionGroupsClient. */ +public final class ActionGroupsClientImpl implements ActionGroupsClient { + /** The proxy service used to perform REST calls. */ + private final ActionGroupsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of ActionGroupsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ActionGroupsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(ActionGroupsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientActionGroups to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientActionG") + public interface ActionGroupsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/actionGroups/{actionGroupName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("actionGroupName") String actionGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ActionGroupResourceInner actionGroup, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/actionGroups/{actionGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("actionGroupName") String actionGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/actionGroups/{actionGroupName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("actionGroupName") String actionGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/actionGroups/{actionGroupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("actionGroupName") String actionGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ActionGroupPatchBody actionGroupPatch, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/createNotifications") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> postTestNotifications( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") NotificationRequestBody notificationRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/createNotifications") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createNotificationsAtResourceGroupLevel( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") NotificationRequestBody notificationRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/actionGroups/{actionGroupName}/createNotifications") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createNotificationsAtActionGroupResourceLevel( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("actionGroupName") String actionGroupName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") NotificationRequestBody notificationRequest, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/notificationStatus/{notificationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getTestNotifications( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("notificationId") String notificationId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/notificationStatus/{notificationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getTestNotificationsAtResourceGroupLevel( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("notificationId") String notificationId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/actionGroups/{actionGroupName}/notificationStatus/{notificationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getTestNotificationsAtActionGroupResourceLevel( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("actionGroupName") String actionGroupName, + @PathParam("notificationId") String notificationId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/actionGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/actionGroups") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/actionGroups/{actionGroupName}/subscribe") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> enableReceiver( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("actionGroupName") String actionGroupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") EnableRequest enableRequest, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (actionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter actionGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (actionGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter actionGroup is required and cannot be null.")); + } else { + actionGroup.validate(); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + actionGroupName, + this.client.getSubscriptionId(), + apiVersion, + actionGroup, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (actionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter actionGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (actionGroup == null) { + return Mono.error(new IllegalArgumentException("Parameter actionGroup is required and cannot be null.")); + } else { + actionGroup.validate(); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + actionGroupName, + this.client.getSubscriptionId(), + apiVersion, + actionGroup, + accept, + context); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup) { + return createOrUpdateWithResponseAsync(resourceGroupName, actionGroupName, actionGroup) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, actionGroupName, actionGroup, context).block(); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param actionGroup The action group to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ActionGroupResourceInner createOrUpdate( + String resourceGroupName, String actionGroupName, ActionGroupResourceInner actionGroup) { + return createOrUpdateWithResponse(resourceGroupName, actionGroupName, actionGroup, Context.NONE).getValue(); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String actionGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (actionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter actionGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + actionGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String actionGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (actionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter actionGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + actionGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String actionGroupName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, actionGroupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String actionGroupName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, actionGroupName, context).block(); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ActionGroupResourceInner getByResourceGroup(String resourceGroupName, String actionGroupName) { + return getByResourceGroupWithResponse(resourceGroupName, actionGroupName, Context.NONE).getValue(); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String actionGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (actionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter actionGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + actionGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String actionGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (actionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter actionGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + actionGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String actionGroupName) { + return deleteWithResponseAsync(resourceGroupName, actionGroupName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String actionGroupName, Context context) { + return deleteWithResponseAsync(resourceGroupName, actionGroupName, context).block(); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String actionGroupName) { + deleteWithResponse(resourceGroupName, actionGroupName, Context.NONE); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (actionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter actionGroupName is required and cannot be null.")); + } + if (actionGroupPatch == null) { + return Mono + .error(new IllegalArgumentException("Parameter actionGroupPatch is required and cannot be null.")); + } else { + actionGroupPatch.validate(); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + actionGroupName, + apiVersion, + actionGroupPatch, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (actionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter actionGroupName is required and cannot be null.")); + } + if (actionGroupPatch == null) { + return Mono + .error(new IllegalArgumentException("Parameter actionGroupPatch is required and cannot be null.")); + } else { + actionGroupPatch.validate(); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + actionGroupName, + apiVersion, + actionGroupPatch, + accept, + context); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch) { + return updateWithResponseAsync(resourceGroupName, actionGroupName, actionGroupPatch) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch, Context context) { + return updateWithResponseAsync(resourceGroupName, actionGroupName, actionGroupPatch, context).block(); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param actionGroupPatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ActionGroupResourceInner update( + String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch) { + return updateWithResponse(resourceGroupName, actionGroupName, actionGroupPatch, Context.NONE).getValue(); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> postTestNotificationsWithResponseAsync( + NotificationRequestBody notificationRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (notificationRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationRequest is required and cannot be null.")); + } else { + notificationRequest.validate(); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .postTestNotifications( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + apiVersion, + notificationRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> postTestNotificationsWithResponseAsync( + NotificationRequestBody notificationRequest, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (notificationRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationRequest is required and cannot be null.")); + } else { + notificationRequest.validate(); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .postTestNotifications( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + apiVersion, + notificationRequest, + accept, + context); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TestNotificationDetailsResponseInner> + beginPostTestNotificationsAsync(NotificationRequestBody notificationRequest) { + Mono>> mono = postTestNotificationsWithResponseAsync(notificationRequest); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TestNotificationDetailsResponseInner.class, + TestNotificationDetailsResponseInner.class, + this.client.getContext()); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TestNotificationDetailsResponseInner> + beginPostTestNotificationsAsync(NotificationRequestBody notificationRequest, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = postTestNotificationsWithResponseAsync(notificationRequest, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TestNotificationDetailsResponseInner.class, + TestNotificationDetailsResponseInner.class, + context); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TestNotificationDetailsResponseInner> + beginPostTestNotifications(NotificationRequestBody notificationRequest) { + return this.beginPostTestNotificationsAsync(notificationRequest).getSyncPoller(); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TestNotificationDetailsResponseInner> + beginPostTestNotifications(NotificationRequestBody notificationRequest, Context context) { + return this.beginPostTestNotificationsAsync(notificationRequest, context).getSyncPoller(); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono postTestNotificationsAsync( + NotificationRequestBody notificationRequest) { + return beginPostTestNotificationsAsync(notificationRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono postTestNotificationsAsync( + NotificationRequestBody notificationRequest, Context context) { + return beginPostTestNotificationsAsync(notificationRequest, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestNotificationDetailsResponseInner postTestNotifications(NotificationRequestBody notificationRequest) { + return postTestNotificationsAsync(notificationRequest).block(); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestNotificationDetailsResponseInner postTestNotifications( + NotificationRequestBody notificationRequest, Context context) { + return postTestNotificationsAsync(notificationRequest, context).block(); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createNotificationsAtResourceGroupLevelWithResponseAsync( + String resourceGroupName, NotificationRequestBody notificationRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (notificationRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationRequest is required and cannot be null.")); + } else { + notificationRequest.validate(); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createNotificationsAtResourceGroupLevel( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + notificationRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createNotificationsAtResourceGroupLevelWithResponseAsync( + String resourceGroupName, NotificationRequestBody notificationRequest, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (notificationRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationRequest is required and cannot be null.")); + } else { + notificationRequest.validate(); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createNotificationsAtResourceGroupLevel( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + notificationRequest, + accept, + context); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TestNotificationDetailsResponseInner> + beginCreateNotificationsAtResourceGroupLevelAsync( + String resourceGroupName, NotificationRequestBody notificationRequest) { + Mono>> mono = + createNotificationsAtResourceGroupLevelWithResponseAsync(resourceGroupName, notificationRequest); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TestNotificationDetailsResponseInner.class, + TestNotificationDetailsResponseInner.class, + this.client.getContext()); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TestNotificationDetailsResponseInner> + beginCreateNotificationsAtResourceGroupLevelAsync( + String resourceGroupName, NotificationRequestBody notificationRequest, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createNotificationsAtResourceGroupLevelWithResponseAsync(resourceGroupName, notificationRequest, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TestNotificationDetailsResponseInner.class, + TestNotificationDetailsResponseInner.class, + context); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TestNotificationDetailsResponseInner> + beginCreateNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest) { + return this + .beginCreateNotificationsAtResourceGroupLevelAsync(resourceGroupName, notificationRequest) + .getSyncPoller(); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TestNotificationDetailsResponseInner> + beginCreateNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest, Context context) { + return this + .beginCreateNotificationsAtResourceGroupLevelAsync(resourceGroupName, notificationRequest, context) + .getSyncPoller(); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createNotificationsAtResourceGroupLevelAsync( + String resourceGroupName, NotificationRequestBody notificationRequest) { + return beginCreateNotificationsAtResourceGroupLevelAsync(resourceGroupName, notificationRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createNotificationsAtResourceGroupLevelAsync( + String resourceGroupName, NotificationRequestBody notificationRequest, Context context) { + return beginCreateNotificationsAtResourceGroupLevelAsync(resourceGroupName, notificationRequest, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestNotificationDetailsResponseInner createNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest) { + return createNotificationsAtResourceGroupLevelAsync(resourceGroupName, notificationRequest).block(); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestNotificationDetailsResponseInner createNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest, Context context) { + return createNotificationsAtResourceGroupLevelAsync(resourceGroupName, notificationRequest, context).block(); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createNotificationsAtActionGroupResourceLevelWithResponseAsync( + String resourceGroupName, String actionGroupName, NotificationRequestBody notificationRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (actionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter actionGroupName is required and cannot be null.")); + } + if (notificationRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationRequest is required and cannot be null.")); + } else { + notificationRequest.validate(); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createNotificationsAtActionGroupResourceLevel( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + actionGroupName, + apiVersion, + notificationRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createNotificationsAtActionGroupResourceLevelWithResponseAsync( + String resourceGroupName, + String actionGroupName, + NotificationRequestBody notificationRequest, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (actionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter actionGroupName is required and cannot be null.")); + } + if (notificationRequest == null) { + return Mono + .error(new IllegalArgumentException("Parameter notificationRequest is required and cannot be null.")); + } else { + notificationRequest.validate(); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createNotificationsAtActionGroupResourceLevel( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + actionGroupName, + apiVersion, + notificationRequest, + accept, + context); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TestNotificationDetailsResponseInner> + beginCreateNotificationsAtActionGroupResourceLevelAsync( + String resourceGroupName, String actionGroupName, NotificationRequestBody notificationRequest) { + Mono>> mono = + createNotificationsAtActionGroupResourceLevelWithResponseAsync( + resourceGroupName, actionGroupName, notificationRequest); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TestNotificationDetailsResponseInner.class, + TestNotificationDetailsResponseInner.class, + this.client.getContext()); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TestNotificationDetailsResponseInner> + beginCreateNotificationsAtActionGroupResourceLevelAsync( + String resourceGroupName, + String actionGroupName, + NotificationRequestBody notificationRequest, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createNotificationsAtActionGroupResourceLevelWithResponseAsync( + resourceGroupName, actionGroupName, notificationRequest, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TestNotificationDetailsResponseInner.class, + TestNotificationDetailsResponseInner.class, + context); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TestNotificationDetailsResponseInner> + beginCreateNotificationsAtActionGroupResourceLevel( + String resourceGroupName, String actionGroupName, NotificationRequestBody notificationRequest) { + return this + .beginCreateNotificationsAtActionGroupResourceLevelAsync( + resourceGroupName, actionGroupName, notificationRequest) + .getSyncPoller(); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TestNotificationDetailsResponseInner> + beginCreateNotificationsAtActionGroupResourceLevel( + String resourceGroupName, + String actionGroupName, + NotificationRequestBody notificationRequest, + Context context) { + return this + .beginCreateNotificationsAtActionGroupResourceLevelAsync( + resourceGroupName, actionGroupName, notificationRequest, context) + .getSyncPoller(); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createNotificationsAtActionGroupResourceLevelAsync( + String resourceGroupName, String actionGroupName, NotificationRequestBody notificationRequest) { + return beginCreateNotificationsAtActionGroupResourceLevelAsync( + resourceGroupName, actionGroupName, notificationRequest) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createNotificationsAtActionGroupResourceLevelAsync( + String resourceGroupName, + String actionGroupName, + NotificationRequestBody notificationRequest, + Context context) { + return beginCreateNotificationsAtActionGroupResourceLevelAsync( + resourceGroupName, actionGroupName, notificationRequest, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestNotificationDetailsResponseInner createNotificationsAtActionGroupResourceLevel( + String resourceGroupName, String actionGroupName, NotificationRequestBody notificationRequest) { + return createNotificationsAtActionGroupResourceLevelAsync( + resourceGroupName, actionGroupName, notificationRequest) + .block(); + } + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestNotificationDetailsResponseInner createNotificationsAtActionGroupResourceLevel( + String resourceGroupName, + String actionGroupName, + NotificationRequestBody notificationRequest, + Context context) { + return createNotificationsAtActionGroupResourceLevelAsync( + resourceGroupName, actionGroupName, notificationRequest, context) + .block(); + } + + /** + * Get the test notifications by the notification id. + * + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getTestNotificationsWithResponseAsync( + String notificationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (notificationId == null) { + return Mono.error(new IllegalArgumentException("Parameter notificationId is required and cannot be null.")); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getTestNotifications( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + notificationId, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the test notifications by the notification id. + * + * @param notificationId The notification id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getTestNotificationsWithResponseAsync( + String notificationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (notificationId == null) { + return Mono.error(new IllegalArgumentException("Parameter notificationId is required and cannot be null.")); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getTestNotifications( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + notificationId, + apiVersion, + accept, + context); + } + + /** + * Get the test notifications by the notification id. + * + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getTestNotificationsAsync(String notificationId) { + return getTestNotificationsWithResponseAsync(notificationId).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the test notifications by the notification id. + * + * @param notificationId The notification id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestNotificationsWithResponse( + String notificationId, Context context) { + return getTestNotificationsWithResponseAsync(notificationId, context).block(); + } + + /** + * Get the test notifications by the notification id. + * + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestNotificationDetailsResponseInner getTestNotifications(String notificationId) { + return getTestNotificationsWithResponse(notificationId, Context.NONE).getValue(); + } + + /** + * Get the test notifications by the notification id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getTestNotificationsAtResourceGroupLevelWithResponseAsync(String resourceGroupName, String notificationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (notificationId == null) { + return Mono.error(new IllegalArgumentException("Parameter notificationId is required and cannot be null.")); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getTestNotificationsAtResourceGroupLevel( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + notificationId, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the test notifications by the notification id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationId The notification id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getTestNotificationsAtResourceGroupLevelWithResponseAsync( + String resourceGroupName, String notificationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (notificationId == null) { + return Mono.error(new IllegalArgumentException("Parameter notificationId is required and cannot be null.")); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getTestNotificationsAtResourceGroupLevel( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + notificationId, + apiVersion, + accept, + context); + } + + /** + * Get the test notifications by the notification id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getTestNotificationsAtResourceGroupLevelAsync( + String resourceGroupName, String notificationId) { + return getTestNotificationsAtResourceGroupLevelWithResponseAsync(resourceGroupName, notificationId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the test notifications by the notification id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationId The notification id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestNotificationsAtResourceGroupLevelWithResponse( + String resourceGroupName, String notificationId, Context context) { + return getTestNotificationsAtResourceGroupLevelWithResponseAsync(resourceGroupName, notificationId, context) + .block(); + } + + /** + * Get the test notifications by the notification id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestNotificationDetailsResponseInner getTestNotificationsAtResourceGroupLevel( + String resourceGroupName, String notificationId) { + return getTestNotificationsAtResourceGroupLevelWithResponse(resourceGroupName, notificationId, Context.NONE) + .getValue(); + } + + /** + * Get the test notifications by the notification id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getTestNotificationsAtActionGroupResourceLevelWithResponseAsync( + String resourceGroupName, String actionGroupName, String notificationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (actionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter actionGroupName is required and cannot be null.")); + } + if (notificationId == null) { + return Mono.error(new IllegalArgumentException("Parameter notificationId is required and cannot be null.")); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getTestNotificationsAtActionGroupResourceLevel( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + actionGroupName, + notificationId, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the test notifications by the notification id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationId The notification id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + getTestNotificationsAtActionGroupResourceLevelWithResponseAsync( + String resourceGroupName, String actionGroupName, String notificationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (actionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter actionGroupName is required and cannot be null.")); + } + if (notificationId == null) { + return Mono.error(new IllegalArgumentException("Parameter notificationId is required and cannot be null.")); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getTestNotificationsAtActionGroupResourceLevel( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + actionGroupName, + notificationId, + apiVersion, + accept, + context); + } + + /** + * Get the test notifications by the notification id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getTestNotificationsAtActionGroupResourceLevelAsync( + String resourceGroupName, String actionGroupName, String notificationId) { + return getTestNotificationsAtActionGroupResourceLevelWithResponseAsync( + resourceGroupName, actionGroupName, notificationId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the test notifications by the notification id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationId The notification id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getTestNotificationsAtActionGroupResourceLevelWithResponse( + String resourceGroupName, String actionGroupName, String notificationId, Context context) { + return getTestNotificationsAtActionGroupResourceLevelWithResponseAsync( + resourceGroupName, actionGroupName, notificationId, context) + .block(); + } + + /** + * Get the test notifications by the notification id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestNotificationDetailsResponseInner getTestNotificationsAtActionGroupResourceLevel( + String resourceGroupName, String actionGroupName, String notificationId) { + return getTestNotificationsAtActionGroupResourceLevelWithResponse( + resourceGroupName, actionGroupName, notificationId, Context.NONE) + .getValue(); + } + + /** + * Get a list of all action groups in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a subscription along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of all action groups in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a subscription along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Get a list of all action groups in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * Get a list of all action groups in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * Get a list of all action groups in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get a list of all action groups in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a subscription as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a resource group along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a resource group along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName)); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context)); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a resource group as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param enableRequest The receiver to re-enable. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> enableReceiverWithResponseAsync( + String resourceGroupName, String actionGroupName, EnableRequest enableRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (actionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter actionGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (enableRequest == null) { + return Mono.error(new IllegalArgumentException("Parameter enableRequest is required and cannot be null.")); + } else { + enableRequest.validate(); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .enableReceiver( + this.client.getEndpoint(), + resourceGroupName, + actionGroupName, + this.client.getSubscriptionId(), + apiVersion, + enableRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param enableRequest The receiver to re-enable. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> enableReceiverWithResponseAsync( + String resourceGroupName, String actionGroupName, EnableRequest enableRequest, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (actionGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter actionGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (enableRequest == null) { + return Mono.error(new IllegalArgumentException("Parameter enableRequest is required and cannot be null.")); + } else { + enableRequest.validate(); + } + final String apiVersion = "2022-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .enableReceiver( + this.client.getEndpoint(), + resourceGroupName, + actionGroupName, + this.client.getSubscriptionId(), + apiVersion, + enableRequest, + accept, + context); + } + + /** + * 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param enableRequest The receiver to re-enable. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono enableReceiverAsync( + String resourceGroupName, String actionGroupName, EnableRequest enableRequest) { + return enableReceiverWithResponseAsync(resourceGroupName, actionGroupName, enableRequest) + .flatMap(ignored -> Mono.empty()); + } + + /** + * 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param enableRequest The receiver to re-enable. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response enableReceiverWithResponse( + String resourceGroupName, String actionGroupName, EnableRequest enableRequest, Context context) { + return enableReceiverWithResponseAsync(resourceGroupName, actionGroupName, enableRequest, context).block(); + } + + /** + * 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param enableRequest The receiver to re-enable. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void enableReceiver(String resourceGroupName, String actionGroupName, EnableRequest enableRequest) { + enableReceiverWithResponse(resourceGroupName, actionGroupName, enableRequest, Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActionGroupsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActionGroupsImpl.java new file mode 100644 index 0000000000000..7904cfc18529f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActionGroupsImpl.java @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.ActionGroupsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.ActionGroupResourceInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.TestNotificationDetailsResponseInner; +import com.azure.resourcemanager.monitor.generated.models.ActionGroupResource; +import com.azure.resourcemanager.monitor.generated.models.ActionGroups; +import com.azure.resourcemanager.monitor.generated.models.EnableRequest; +import com.azure.resourcemanager.monitor.generated.models.NotificationRequestBody; +import com.azure.resourcemanager.monitor.generated.models.TestNotificationDetailsResponse; + +public final class ActionGroupsImpl implements ActionGroups { + private static final ClientLogger LOGGER = new ClientLogger(ActionGroupsImpl.class); + + private final ActionGroupsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public ActionGroupsImpl( + ActionGroupsClient innerClient, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String actionGroupName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, actionGroupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ActionGroupResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ActionGroupResource getByResourceGroup(String resourceGroupName, String actionGroupName) { + ActionGroupResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, actionGroupName); + if (inner != null) { + return new ActionGroupResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse( + String resourceGroupName, String actionGroupName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, actionGroupName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String actionGroupName) { + this.serviceClient().delete(resourceGroupName, actionGroupName); + } + + public TestNotificationDetailsResponse postTestNotifications(NotificationRequestBody notificationRequest) { + TestNotificationDetailsResponseInner inner = this.serviceClient().postTestNotifications(notificationRequest); + if (inner != null) { + return new TestNotificationDetailsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public TestNotificationDetailsResponse postTestNotifications( + NotificationRequestBody notificationRequest, Context context) { + TestNotificationDetailsResponseInner inner = + this.serviceClient().postTestNotifications(notificationRequest, context); + if (inner != null) { + return new TestNotificationDetailsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public TestNotificationDetailsResponse createNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest) { + TestNotificationDetailsResponseInner inner = + this.serviceClient().createNotificationsAtResourceGroupLevel(resourceGroupName, notificationRequest); + if (inner != null) { + return new TestNotificationDetailsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public TestNotificationDetailsResponse createNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest, Context context) { + TestNotificationDetailsResponseInner inner = + this + .serviceClient() + .createNotificationsAtResourceGroupLevel(resourceGroupName, notificationRequest, context); + if (inner != null) { + return new TestNotificationDetailsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public TestNotificationDetailsResponse createNotificationsAtActionGroupResourceLevel( + String resourceGroupName, String actionGroupName, NotificationRequestBody notificationRequest) { + TestNotificationDetailsResponseInner inner = + this + .serviceClient() + .createNotificationsAtActionGroupResourceLevel(resourceGroupName, actionGroupName, notificationRequest); + if (inner != null) { + return new TestNotificationDetailsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public TestNotificationDetailsResponse createNotificationsAtActionGroupResourceLevel( + String resourceGroupName, + String actionGroupName, + NotificationRequestBody notificationRequest, + Context context) { + TestNotificationDetailsResponseInner inner = + this + .serviceClient() + .createNotificationsAtActionGroupResourceLevel( + resourceGroupName, actionGroupName, notificationRequest, context); + if (inner != null) { + return new TestNotificationDetailsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getTestNotificationsWithResponse( + String notificationId, Context context) { + Response inner = + this.serviceClient().getTestNotificationsWithResponse(notificationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TestNotificationDetailsResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TestNotificationDetailsResponse getTestNotifications(String notificationId) { + TestNotificationDetailsResponseInner inner = this.serviceClient().getTestNotifications(notificationId); + if (inner != null) { + return new TestNotificationDetailsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getTestNotificationsAtResourceGroupLevelWithResponse( + String resourceGroupName, String notificationId, Context context) { + Response inner = + this + .serviceClient() + .getTestNotificationsAtResourceGroupLevelWithResponse(resourceGroupName, notificationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TestNotificationDetailsResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TestNotificationDetailsResponse getTestNotificationsAtResourceGroupLevel( + String resourceGroupName, String notificationId) { + TestNotificationDetailsResponseInner inner = + this.serviceClient().getTestNotificationsAtResourceGroupLevel(resourceGroupName, notificationId); + if (inner != null) { + return new TestNotificationDetailsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getTestNotificationsAtActionGroupResourceLevelWithResponse( + String resourceGroupName, String actionGroupName, String notificationId, Context context) { + Response inner = + this + .serviceClient() + .getTestNotificationsAtActionGroupResourceLevelWithResponse( + resourceGroupName, actionGroupName, notificationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new TestNotificationDetailsResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public TestNotificationDetailsResponse getTestNotificationsAtActionGroupResourceLevel( + String resourceGroupName, String actionGroupName, String notificationId) { + TestNotificationDetailsResponseInner inner = + this + .serviceClient() + .getTestNotificationsAtActionGroupResourceLevel(resourceGroupName, actionGroupName, notificationId); + if (inner != null) { + return new TestNotificationDetailsResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ActionGroupResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ActionGroupResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ActionGroupResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ActionGroupResourceImpl(inner1, this.manager())); + } + + public Response enableReceiverWithResponse( + String resourceGroupName, String actionGroupName, EnableRequest enableRequest, Context context) { + return this + .serviceClient() + .enableReceiverWithResponse(resourceGroupName, actionGroupName, enableRequest, context); + } + + public void enableReceiver(String resourceGroupName, String actionGroupName, EnableRequest enableRequest) { + this.serviceClient().enableReceiver(resourceGroupName, actionGroupName, enableRequest); + } + + public ActionGroupResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String actionGroupName = Utils.getValueFromIdByName(id, "actionGroups"); + if (actionGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'actionGroups'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, actionGroupName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String actionGroupName = Utils.getValueFromIdByName(id, "actionGroups"); + if (actionGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'actionGroups'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, actionGroupName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String actionGroupName = Utils.getValueFromIdByName(id, "actionGroups"); + if (actionGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'actionGroups'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, actionGroupName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String actionGroupName = Utils.getValueFromIdByName(id, "actionGroups"); + if (actionGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'actionGroups'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, actionGroupName, context); + } + + private ActionGroupsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + public ActionGroupResourceImpl define(String name) { + return new ActionGroupResourceImpl(name, this.manager()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogAlertResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogAlertResourceImpl.java new file mode 100644 index 0000000000000..bf196108d5221 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogAlertResourceImpl.java @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.ActivityLogAlertResourceInner; +import com.azure.resourcemanager.monitor.generated.models.ActionList; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertAllOfCondition; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertResource; +import com.azure.resourcemanager.monitor.generated.models.AlertRulePatchObject; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ActivityLogAlertResourceImpl + implements ActivityLogAlertResource, ActivityLogAlertResource.Definition, ActivityLogAlertResource.Update { + private ActivityLogAlertResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public List scopes() { + List inner = this.innerModel().scopes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ActivityLogAlertAllOfCondition condition() { + return this.innerModel().condition(); + } + + public ActionList actions() { + return this.innerModel().actions(); + } + + public Boolean enabled() { + return this.innerModel().enabled(); + } + + public String description() { + return this.innerModel().description(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ActivityLogAlertResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String activityLogAlertName; + + private AlertRulePatchObject updateActivityLogAlertRulePatch; + + public ActivityLogAlertResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ActivityLogAlertResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getActivityLogAlerts() + .createOrUpdateWithResponse(resourceGroupName, activityLogAlertName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ActivityLogAlertResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getActivityLogAlerts() + .createOrUpdateWithResponse(resourceGroupName, activityLogAlertName, this.innerModel(), context) + .getValue(); + return this; + } + + ActivityLogAlertResourceImpl( + String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new ActivityLogAlertResourceInner(); + this.serviceManager = serviceManager; + this.activityLogAlertName = name; + } + + public ActivityLogAlertResourceImpl update() { + this.updateActivityLogAlertRulePatch = new AlertRulePatchObject(); + return this; + } + + public ActivityLogAlertResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getActivityLogAlerts() + .updateWithResponse( + resourceGroupName, activityLogAlertName, updateActivityLogAlertRulePatch, Context.NONE) + .getValue(); + return this; + } + + public ActivityLogAlertResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getActivityLogAlerts() + .updateWithResponse(resourceGroupName, activityLogAlertName, updateActivityLogAlertRulePatch, context) + .getValue(); + return this; + } + + ActivityLogAlertResourceImpl( + ActivityLogAlertResourceInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.activityLogAlertName = Utils.getValueFromIdByName(innerObject.id(), "activityLogAlerts"); + } + + public ActivityLogAlertResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getActivityLogAlerts() + .getByResourceGroupWithResponse(resourceGroupName, activityLogAlertName, Context.NONE) + .getValue(); + return this; + } + + public ActivityLogAlertResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getActivityLogAlerts() + .getByResourceGroupWithResponse(resourceGroupName, activityLogAlertName, context) + .getValue(); + return this; + } + + public ActivityLogAlertResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ActivityLogAlertResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ActivityLogAlertResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateActivityLogAlertRulePatch.withTags(tags); + return this; + } + } + + public ActivityLogAlertResourceImpl withScopes(List scopes) { + this.innerModel().withScopes(scopes); + return this; + } + + public ActivityLogAlertResourceImpl withCondition(ActivityLogAlertAllOfCondition condition) { + this.innerModel().withCondition(condition); + return this; + } + + public ActivityLogAlertResourceImpl withActions(ActionList actions) { + this.innerModel().withActions(actions); + return this; + } + + public ActivityLogAlertResourceImpl withEnabled(Boolean enabled) { + if (isInCreateMode()) { + this.innerModel().withEnabled(enabled); + return this; + } else { + this.updateActivityLogAlertRulePatch.withEnabled(enabled); + return this; + } + } + + public ActivityLogAlertResourceImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogAlertsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogAlertsClientImpl.java new file mode 100644 index 0000000000000..37fa3e0d2e87b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogAlertsClientImpl.java @@ -0,0 +1,1282 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.ActivityLogAlertsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.ActivityLogAlertResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AlertRuleList; +import com.azure.resourcemanager.monitor.generated.models.AlertRulePatchObject; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ActivityLogAlertsClient. */ +public final class ActivityLogAlertsClientImpl implements ActivityLogAlertsClient { + /** The proxy service used to perform REST calls. */ + private final ActivityLogAlertsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of ActivityLogAlertsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ActivityLogAlertsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(ActivityLogAlertsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientActivityLogAlerts to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientActivit") + public interface ActivityLogAlertsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/activityLogAlerts/{activityLogAlertName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("activityLogAlertName") String activityLogAlertName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ActivityLogAlertResourceInner activityLogAlertRule, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/activityLogAlerts/{activityLogAlertName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("activityLogAlertName") String activityLogAlertName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/activityLogAlerts/{activityLogAlertName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("activityLogAlertName") String activityLogAlertName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/activityLogAlerts/{activityLogAlertName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("activityLogAlertName") String activityLogAlertName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AlertRulePatchObject activityLogAlertRulePatch, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/activityLogAlerts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/activityLogAlerts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionIdNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Create a new Activity Log Alert rule or update an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param activityLogAlertRule The Activity Log Alert rule to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlertRule) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (activityLogAlertName == null) { + return Mono + .error(new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null.")); + } + if (activityLogAlertRule == null) { + return Mono + .error(new IllegalArgumentException("Parameter activityLogAlertRule is required and cannot be null.")); + } else { + activityLogAlertRule.validate(); + } + final String apiVersion = "2020-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + activityLogAlertName, + apiVersion, + activityLogAlertRule, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a new Activity Log Alert rule or update an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param activityLogAlertRule The Activity Log Alert rule to create or use for the update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String activityLogAlertName, + ActivityLogAlertResourceInner activityLogAlertRule, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (activityLogAlertName == null) { + return Mono + .error(new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null.")); + } + if (activityLogAlertRule == null) { + return Mono + .error(new IllegalArgumentException("Parameter activityLogAlertRule is required and cannot be null.")); + } else { + activityLogAlertRule.validate(); + } + final String apiVersion = "2020-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + activityLogAlertName, + apiVersion, + activityLogAlertRule, + accept, + context); + } + + /** + * Create a new Activity Log Alert rule or update an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param activityLogAlertRule The Activity Log Alert rule to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlertRule) { + return createOrUpdateWithResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlertRule) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create a new Activity Log Alert rule or update an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param activityLogAlertRule The Activity Log Alert rule to create or use for the update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String activityLogAlertName, + ActivityLogAlertResourceInner activityLogAlertRule, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlertRule, context) + .block(); + } + + /** + * Create a new Activity Log Alert rule or update an existing one. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param activityLogAlertRule The Activity Log Alert rule to create or use for the update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ActivityLogAlertResourceInner createOrUpdate( + String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlertRule) { + return createOrUpdateWithResponse(resourceGroupName, activityLogAlertName, activityLogAlertRule, Context.NONE) + .getValue(); + } + + /** + * Get an Activity Log Alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String activityLogAlertName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (activityLogAlertName == null) { + return Mono + .error(new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null.")); + } + final String apiVersion = "2020-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + activityLogAlertName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get an Activity Log Alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String activityLogAlertName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (activityLogAlertName == null) { + return Mono + .error(new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null.")); + } + final String apiVersion = "2020-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + activityLogAlertName, + apiVersion, + accept, + context); + } + + /** + * Get an Activity Log Alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String activityLogAlertName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, activityLogAlertName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get an Activity Log Alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String activityLogAlertName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, activityLogAlertName, context).block(); + } + + /** + * Get an Activity Log Alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ActivityLogAlertResourceInner getByResourceGroup(String resourceGroupName, String activityLogAlertName) { + return getByResourceGroupWithResponse(resourceGroupName, activityLogAlertName, Context.NONE).getValue(); + } + + /** + * Delete an Activity Log Alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String activityLogAlertName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (activityLogAlertName == null) { + return Mono + .error(new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null.")); + } + final String apiVersion = "2020-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + activityLogAlertName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete an Activity Log Alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String activityLogAlertName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (activityLogAlertName == null) { + return Mono + .error(new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null.")); + } + final String apiVersion = "2020-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + activityLogAlertName, + apiVersion, + accept, + context); + } + + /** + * Delete an Activity Log Alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String activityLogAlertName) { + return deleteWithResponseAsync(resourceGroupName, activityLogAlertName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete an Activity Log Alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String activityLogAlertName, Context context) { + return deleteWithResponseAsync(resourceGroupName, activityLogAlertName, context).block(); + } + + /** + * Delete an Activity Log Alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String activityLogAlertName) { + deleteWithResponse(resourceGroupName, activityLogAlertName, Context.NONE); + } + + /** + * Updates 'tags' and 'enabled' fields in an existing Alert rule. This method is used to update the Alert rule tags, + * and to enable or disable the Alert rule. To update other fields use CreateOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param activityLogAlertRulePatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String activityLogAlertName, AlertRulePatchObject activityLogAlertRulePatch) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (activityLogAlertName == null) { + return Mono + .error(new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null.")); + } + if (activityLogAlertRulePatch == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter activityLogAlertRulePatch is required and cannot be null.")); + } else { + activityLogAlertRulePatch.validate(); + } + final String apiVersion = "2020-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + activityLogAlertName, + apiVersion, + activityLogAlertRulePatch, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates 'tags' and 'enabled' fields in an existing Alert rule. This method is used to update the Alert rule tags, + * and to enable or disable the Alert rule. To update other fields use CreateOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param activityLogAlertRulePatch Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String activityLogAlertName, + AlertRulePatchObject activityLogAlertRulePatch, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (activityLogAlertName == null) { + return Mono + .error(new IllegalArgumentException("Parameter activityLogAlertName is required and cannot be null.")); + } + if (activityLogAlertRulePatch == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter activityLogAlertRulePatch is required and cannot be null.")); + } else { + activityLogAlertRulePatch.validate(); + } + final String apiVersion = "2020-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + activityLogAlertName, + apiVersion, + activityLogAlertRulePatch, + accept, + context); + } + + /** + * Updates 'tags' and 'enabled' fields in an existing Alert rule. This method is used to update the Alert rule tags, + * and to enable or disable the Alert rule. To update other fields use CreateOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param activityLogAlertRulePatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String activityLogAlertName, AlertRulePatchObject activityLogAlertRulePatch) { + return updateWithResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlertRulePatch) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates 'tags' and 'enabled' fields in an existing Alert rule. This method is used to update the Alert rule tags, + * and to enable or disable the Alert rule. To update other fields use CreateOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param activityLogAlertRulePatch Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String activityLogAlertName, + AlertRulePatchObject activityLogAlertRulePatch, + Context context) { + return updateWithResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlertRulePatch, context) + .block(); + } + + /** + * Updates 'tags' and 'enabled' fields in an existing Alert rule. This method is used to update the Alert rule tags, + * and to enable or disable the Alert rule. To update other fields use CreateOrUpdate operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param activityLogAlertRulePatch Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ActivityLogAlertResourceInner update( + String resourceGroupName, String activityLogAlertName, AlertRulePatchObject activityLogAlertRulePatch) { + return updateWithResponse(resourceGroupName, activityLogAlertName, activityLogAlertRulePatch, Context.NONE) + .getValue(); + } + + /** + * Get a list of all Activity Log Alert rules in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of all Activity Log Alert rules in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a subscription along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get a list of all Activity Log Alert rules in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionIdNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of all Activity Log Alert rules in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a subscription as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionIdNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of all Activity Log Alert rules in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a subscription as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get a list of all Activity Log Alert rules in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a subscription as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get a list of all Activity Log Alert rules in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a resource group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2020-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of all Activity Log Alert rules in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a resource group along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2020-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get a list of all Activity Log Alert rules in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Get a list of all Activity Log Alert rules in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a resource group as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Get a list of all Activity Log Alert rules in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Get a list of all Activity Log Alert rules in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Activity Log Alert rules along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionIdNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionIdNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Activity Log Alert rules along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionIdNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionIdNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Activity Log Alert rules along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Activity Log Alert rules along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogAlertsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogAlertsImpl.java new file mode 100644 index 0000000000000..6b5d40e45a81b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogAlertsImpl.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.ActivityLogAlertsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.ActivityLogAlertResourceInner; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertResource; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlerts; + +public final class ActivityLogAlertsImpl implements ActivityLogAlerts { + private static final ClientLogger LOGGER = new ClientLogger(ActivityLogAlertsImpl.class); + + private final ActivityLogAlertsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public ActivityLogAlertsImpl( + ActivityLogAlertsClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String activityLogAlertName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, activityLogAlertName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ActivityLogAlertResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ActivityLogAlertResource getByResourceGroup(String resourceGroupName, String activityLogAlertName) { + ActivityLogAlertResourceInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, activityLogAlertName); + if (inner != null) { + return new ActivityLogAlertResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse( + String resourceGroupName, String activityLogAlertName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, activityLogAlertName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String activityLogAlertName) { + this.serviceClient().delete(resourceGroupName, activityLogAlertName); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ActivityLogAlertResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ActivityLogAlertResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ActivityLogAlertResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ActivityLogAlertResourceImpl(inner1, this.manager())); + } + + public ActivityLogAlertResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String activityLogAlertName = Utils.getValueFromIdByName(id, "activityLogAlerts"); + if (activityLogAlertName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'activityLogAlerts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, activityLogAlertName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String activityLogAlertName = Utils.getValueFromIdByName(id, "activityLogAlerts"); + if (activityLogAlertName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'activityLogAlerts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, activityLogAlertName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String activityLogAlertName = Utils.getValueFromIdByName(id, "activityLogAlerts"); + if (activityLogAlertName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'activityLogAlerts'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, activityLogAlertName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String activityLogAlertName = Utils.getValueFromIdByName(id, "activityLogAlerts"); + if (activityLogAlertName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'activityLogAlerts'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, activityLogAlertName, context); + } + + private ActivityLogAlertsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + public ActivityLogAlertResourceImpl define(String name) { + return new ActivityLogAlertResourceImpl(name, this.manager()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogsClientImpl.java new file mode 100644 index 0000000000000..8688bcdecb31d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogsClientImpl.java @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.ActivityLogsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.EventDataInner; +import com.azure.resourcemanager.monitor.generated.models.EventDataCollection; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ActivityLogsClient. */ +public final class ActivityLogsClientImpl implements ActivityLogsClient { + /** The proxy service used to perform REST calls. */ + private final ActivityLogsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of ActivityLogsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ActivityLogsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(ActivityLogsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientActivityLogs to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientActivit") + public interface ActivityLogsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/eventtypes/management/values") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @QueryParam("$select") String select, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Provides the list of records from the activity logs. + * + * @param filter Reduces the set of data collected.<br>This argument is required and it also requires at least + * the start date/time.<br>The **$filter** argument is very restricted and allows only the following + * patterns.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br><br>**NOTE**: No other + * syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>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*. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of events along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, String select) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + filter, + select, + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Provides the list of records from the activity logs. + * + * @param filter Reduces the set of data collected.<br>This argument is required and it also requires at least + * the start date/time.<br>The **$filter** argument is very restricted and allows only the following + * patterns.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br><br>**NOTE**: No other + * syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>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*. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of events along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, String select, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (filter == null) { + return Mono.error(new IllegalArgumentException("Parameter filter is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2015-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), apiVersion, filter, select, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Provides the list of records from the activity logs. + * + * @param filter Reduces the set of data collected.<br>This argument is required and it also requires at least + * the start date/time.<br>The **$filter** argument is very restricted and allows only the following + * patterns.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br><br>**NOTE**: No other + * syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>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*. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of events as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, String select) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, select), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Provides the list of records from the activity logs. + * + * @param filter Reduces the set of data collected.<br>This argument is required and it also requires at least + * the start date/time.<br>The **$filter** argument is very restricted and allows only the following + * patterns.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br><br>**NOTE**: No other + * syntax is allowed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of events as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter) { + final String select = null; + return new PagedFlux<>( + () -> listSinglePageAsync(filter, select), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Provides the list of records from the activity logs. + * + * @param filter Reduces the set of data collected.<br>This argument is required and it also requires at least + * the start date/time.<br>The **$filter** argument is very restricted and allows only the following + * patterns.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br><br>**NOTE**: No other + * syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>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*. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of events as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, String select, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, select, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Provides the list of records from the activity logs. + * + * @param filter Reduces the set of data collected.<br>This argument is required and it also requires at least + * the start date/time.<br>The **$filter** argument is very restricted and allows only the following + * patterns.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br><br>**NOTE**: No other + * syntax is allowed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of events as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter) { + final String select = null; + return new PagedIterable<>(listAsync(filter, select)); + } + + /** + * Provides the list of records from the activity logs. + * + * @param filter Reduces the set of data collected.<br>This argument is required and it also requires at least + * the start date/time.<br>The **$filter** argument is very restricted and allows only the following + * patterns.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br><br>**NOTE**: No other + * syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>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*. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of events as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, String select, Context context) { + return new PagedIterable<>(listAsync(filter, select, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of events along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of events along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogsImpl.java new file mode 100644 index 0000000000000..c8e4b72d7dcb5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogsImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.ActivityLogsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.EventDataInner; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogs; +import com.azure.resourcemanager.monitor.generated.models.EventData; + +public final class ActivityLogsImpl implements ActivityLogs { + private static final ClientLogger LOGGER = new ClientLogger(ActivityLogsImpl.class); + + private final ActivityLogsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public ActivityLogsImpl( + ActivityLogsClient innerClient, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String filter) { + PagedIterable inner = this.serviceClient().list(filter); + return Utils.mapPage(inner, inner1 -> new EventDataImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, String select, Context context) { + PagedIterable inner = this.serviceClient().list(filter, select, context); + return Utils.mapPage(inner, inner1 -> new EventDataImpl(inner1, this.manager())); + } + + private ActivityLogsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRuleIncidentsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRuleIncidentsClientImpl.java new file mode 100644 index 0000000000000..fdc14793a0a3a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRuleIncidentsClientImpl.java @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.AlertRuleIncidentsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.IncidentInner; +import com.azure.resourcemanager.monitor.generated.models.IncidentListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AlertRuleIncidentsClient. */ +public final class AlertRuleIncidentsClientImpl implements AlertRuleIncidentsClient { + /** The proxy service used to perform REST calls. */ + private final AlertRuleIncidentsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of AlertRuleIncidentsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AlertRuleIncidentsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(AlertRuleIncidentsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientAlertRuleIncidents to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientAlertRu") + public interface AlertRuleIncidentsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules" + + "/{ruleName}/incidents/{incidentName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ruleName") String ruleName, + @PathParam("incidentName") String incidentName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/microsoft.insights/alertrules" + + "/{ruleName}/incidents") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByAlertRule( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ruleName") String ruleName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets an incident associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param incidentName The name of the incident to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident associated to an alert rule along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String ruleName, String incidentName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (incidentName == null) { + return Mono.error(new IllegalArgumentException("Parameter incidentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + ruleName, + incidentName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an incident associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param incidentName The name of the incident to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident associated to an alert rule along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String ruleName, String incidentName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (incidentName == null) { + return Mono.error(new IllegalArgumentException("Parameter incidentName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + ruleName, + incidentName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets an incident associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param incidentName The name of the incident to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident associated to an alert rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String ruleName, String incidentName) { + return getWithResponseAsync(resourceGroupName, ruleName, incidentName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an incident associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param incidentName The name of the incident to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident associated to an alert rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String ruleName, String incidentName, Context context) { + return getWithResponseAsync(resourceGroupName, ruleName, incidentName, context).block(); + } + + /** + * Gets an incident associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param incidentName The name of the incident to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident associated to an alert rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public IncidentInner get(String resourceGroupName, String ruleName, String incidentName) { + return getWithResponse(resourceGroupName, ruleName, incidentName, Context.NONE).getValue(); + } + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of incidents associated to an alert rule along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAlertRuleSinglePageAsync( + String resourceGroupName, String ruleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByAlertRule( + this.client.getEndpoint(), + resourceGroupName, + ruleName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of incidents associated to an alert rule along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByAlertRuleSinglePageAsync( + String resourceGroupName, String ruleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByAlertRule( + this.client.getEndpoint(), + resourceGroupName, + ruleName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of incidents associated to an alert rule as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAlertRuleAsync(String resourceGroupName, String ruleName) { + return new PagedFlux<>(() -> listByAlertRuleSinglePageAsync(resourceGroupName, ruleName)); + } + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of incidents associated to an alert rule as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByAlertRuleAsync(String resourceGroupName, String ruleName, Context context) { + return new PagedFlux<>(() -> listByAlertRuleSinglePageAsync(resourceGroupName, ruleName, context)); + } + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of incidents associated to an alert rule as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAlertRule(String resourceGroupName, String ruleName) { + return new PagedIterable<>(listByAlertRuleAsync(resourceGroupName, ruleName)); + } + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of incidents associated to an alert rule as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByAlertRule(String resourceGroupName, String ruleName, Context context) { + return new PagedIterable<>(listByAlertRuleAsync(resourceGroupName, ruleName, context)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRuleIncidentsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRuleIncidentsImpl.java new file mode 100644 index 0000000000000..1cff6ce9e0ae3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRuleIncidentsImpl.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.AlertRuleIncidentsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.IncidentInner; +import com.azure.resourcemanager.monitor.generated.models.AlertRuleIncidents; +import com.azure.resourcemanager.monitor.generated.models.Incident; + +public final class AlertRuleIncidentsImpl implements AlertRuleIncidents { + private static final ClientLogger LOGGER = new ClientLogger(AlertRuleIncidentsImpl.class); + + private final AlertRuleIncidentsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public AlertRuleIncidentsImpl( + AlertRuleIncidentsClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String ruleName, String incidentName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, ruleName, incidentName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new IncidentImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public Incident get(String resourceGroupName, String ruleName, String incidentName) { + IncidentInner inner = this.serviceClient().get(resourceGroupName, ruleName, incidentName); + if (inner != null) { + return new IncidentImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByAlertRule(String resourceGroupName, String ruleName) { + PagedIterable inner = this.serviceClient().listByAlertRule(resourceGroupName, ruleName); + return Utils.mapPage(inner, inner1 -> new IncidentImpl(inner1, this.manager())); + } + + public PagedIterable listByAlertRule(String resourceGroupName, String ruleName, Context context) { + PagedIterable inner = this.serviceClient().listByAlertRule(resourceGroupName, ruleName, context); + return Utils.mapPage(inner, inner1 -> new IncidentImpl(inner1, this.manager())); + } + + private AlertRuleIncidentsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRuleResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRuleResourceImpl.java new file mode 100644 index 0000000000000..6ddb50e51c6bc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRuleResourceImpl.java @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.AlertRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AlertRuleResource; +import com.azure.resourcemanager.monitor.generated.models.AlertRuleResourcePatch; +import com.azure.resourcemanager.monitor.generated.models.RuleAction; +import com.azure.resourcemanager.monitor.generated.models.RuleCondition; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class AlertRuleResourceImpl + implements AlertRuleResource, AlertRuleResource.Definition, AlertRuleResource.Update { + private AlertRuleResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String namePropertiesName() { + return this.innerModel().namePropertiesName(); + } + + public String description() { + return this.innerModel().description(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public boolean isEnabled() { + return this.innerModel().isEnabled(); + } + + public RuleCondition condition() { + return this.innerModel().condition(); + } + + public RuleAction action() { + return this.innerModel().action(); + } + + public List actions() { + List inner = this.innerModel().actions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime lastUpdatedTime() { + return this.innerModel().lastUpdatedTime(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public AlertRuleResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String ruleName; + + private AlertRuleResourcePatch updateAlertRulesResource; + + public AlertRuleResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public AlertRuleResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getAlertRules() + .createOrUpdateWithResponse(resourceGroupName, ruleName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public AlertRuleResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAlertRules() + .createOrUpdateWithResponse(resourceGroupName, ruleName, this.innerModel(), context) + .getValue(); + return this; + } + + AlertRuleResourceImpl(String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new AlertRuleResourceInner(); + this.serviceManager = serviceManager; + this.ruleName = name; + } + + public AlertRuleResourceImpl update() { + this.updateAlertRulesResource = new AlertRuleResourcePatch(); + return this; + } + + public AlertRuleResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAlertRules() + .updateWithResponse(resourceGroupName, ruleName, updateAlertRulesResource, Context.NONE) + .getValue(); + return this; + } + + public AlertRuleResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAlertRules() + .updateWithResponse(resourceGroupName, ruleName, updateAlertRulesResource, context) + .getValue(); + return this; + } + + AlertRuleResourceImpl( + AlertRuleResourceInner innerObject, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourcegroups"); + this.ruleName = Utils.getValueFromIdByName(innerObject.id(), "alertrules"); + } + + public AlertRuleResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAlertRules() + .getByResourceGroupWithResponse(resourceGroupName, ruleName, Context.NONE) + .getValue(); + return this; + } + + public AlertRuleResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAlertRules() + .getByResourceGroupWithResponse(resourceGroupName, ruleName, context) + .getValue(); + return this; + } + + public AlertRuleResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public AlertRuleResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public AlertRuleResourceImpl withNamePropertiesName(String namePropertiesName) { + this.innerModel().withNamePropertiesName(namePropertiesName); + return this; + } + + public AlertRuleResourceImpl withIsEnabled(boolean isEnabled) { + if (isInCreateMode()) { + this.innerModel().withIsEnabled(isEnabled); + return this; + } else { + this.updateAlertRulesResource.withIsEnabled(isEnabled); + return this; + } + } + + public AlertRuleResourceImpl withCondition(RuleCondition condition) { + if (isInCreateMode()) { + this.innerModel().withCondition(condition); + return this; + } else { + this.updateAlertRulesResource.withCondition(condition); + return this; + } + } + + public AlertRuleResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateAlertRulesResource.withTags(tags); + return this; + } + } + + public AlertRuleResourceImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateAlertRulesResource.withDescription(description); + return this; + } + } + + public AlertRuleResourceImpl withProvisioningState(String provisioningState) { + if (isInCreateMode()) { + this.innerModel().withProvisioningState(provisioningState); + return this; + } else { + this.updateAlertRulesResource.withProvisioningState(provisioningState); + return this; + } + } + + public AlertRuleResourceImpl withAction(RuleAction action) { + if (isInCreateMode()) { + this.innerModel().withAction(action); + return this; + } else { + this.updateAlertRulesResource.withAction(action); + return this; + } + } + + public AlertRuleResourceImpl withActions(List actions) { + if (isInCreateMode()) { + this.innerModel().withActions(actions); + return this; + } else { + this.updateAlertRulesResource.withActions(actions); + return this; + } + } + + public AlertRuleResourceImpl withName(String name) { + this.updateAlertRulesResource.withName(name); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRulesClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRulesClientImpl.java new file mode 100644 index 0000000000000..dc979c2ed0a3f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRulesClientImpl.java @@ -0,0 +1,1038 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.AlertRulesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.AlertRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AlertRuleResourceCollection; +import com.azure.resourcemanager.monitor.generated.models.AlertRuleResourcePatch; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AlertRulesClient. */ +public final class AlertRulesClientImpl implements AlertRulesClient { + /** The proxy service used to perform REST calls. */ + private final AlertRulesService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of AlertRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AlertRulesClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(AlertRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientAlertRules to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientAlertRu") + public interface AlertRulesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules" + + "/{ruleName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ruleName") String ruleName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") AlertRuleResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules" + + "/{ruleName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ruleName") String ruleName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules" + + "/{ruleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ruleName") String ruleName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights/alertrules" + + "/{ruleName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ruleName") String ruleName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AlertRuleResourcePatch alertRulesResource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/alertrules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/alertrules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates or updates a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the alert rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String ruleName, AlertRuleResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + ruleName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the alert rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String ruleName, AlertRuleResourceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + ruleName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Creates or updates a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the alert rule resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String ruleName, AlertRuleResourceInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, ruleName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the alert rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String ruleName, AlertRuleResourceInner parameters, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, ruleName, parameters, context).block(); + } + + /** + * Creates or updates a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the alert rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AlertRuleResourceInner createOrUpdate( + String resourceGroupName, String ruleName, AlertRuleResourceInner parameters) { + return createOrUpdateWithResponse(resourceGroupName, ruleName, parameters, Context.NONE).getValue(); + } + + /** + * Deletes a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String ruleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + ruleName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String ruleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + ruleName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String ruleName) { + return deleteWithResponseAsync(resourceGroupName, ruleName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String ruleName, Context context) { + return deleteWithResponseAsync(resourceGroupName, ruleName, context).block(); + } + + /** + * Deletes a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String ruleName) { + deleteWithResponse(resourceGroupName, ruleName, Context.NONE); + } + + /** + * Gets a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a classic metric alert rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String ruleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + ruleName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a classic metric alert rule along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String ruleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + ruleName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a classic metric alert rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String ruleName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, ruleName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a classic metric alert rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, ruleName, context).block(); + } + + /** + * Gets a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a classic metric alert rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AlertRuleResourceInner getByResourceGroup(String resourceGroupName, String ruleName) { + return getByResourceGroupWithResponse(resourceGroupName, ruleName, Context.NONE).getValue(); + } + + /** + * Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param alertRulesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the alert rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (alertRulesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter alertRulesResource is required and cannot be null.")); + } else { + alertRulesResource.validate(); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + alertRulesResource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param alertRulesResource Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the alert rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (alertRulesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter alertRulesResource is required and cannot be null.")); + } else { + alertRulesResource.validate(); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + alertRulesResource, + accept, + context); + } + + /** + * Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param alertRulesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the alert rule resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource) { + return updateWithResponseAsync(resourceGroupName, ruleName, alertRulesResource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param alertRulesResource Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the alert rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource, Context context) { + return updateWithResponseAsync(resourceGroupName, ruleName, alertRulesResource, context).block(); + } + + /** + * Updates an existing classic metric AlertRuleResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param alertRulesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the alert rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AlertRuleResourceInner update( + String resourceGroupName, String ruleName, AlertRuleResourcePatch alertRulesResource) { + return updateWithResponse(resourceGroupName, ruleName, alertRulesResource, Context.NONE).getValue(); + } + + /** + * List the classic metric alert rules within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the classic metric alert rules within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List the classic metric alert rules within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName)); + } + + /** + * List the classic metric alert rules within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context)); + } + + /** + * List the classic metric alert rules within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List the classic metric alert rules within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List the classic metric alert rules within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the classic metric alert rules within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List the classic metric alert rules within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * List the classic metric alert rules within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * List the classic metric alert rules within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the classic metric alert rules within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRulesImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRulesImpl.java new file mode 100644 index 0000000000000..7dc6dfc2460c4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRulesImpl.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.AlertRulesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.AlertRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AlertRuleResource; +import com.azure.resourcemanager.monitor.generated.models.AlertRules; + +public final class AlertRulesImpl implements AlertRules { + private static final ClientLogger LOGGER = new ClientLogger(AlertRulesImpl.class); + + private final AlertRulesClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public AlertRulesImpl( + AlertRulesClient innerClient, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response deleteByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, ruleName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String ruleName) { + this.serviceClient().delete(resourceGroupName, ruleName); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, ruleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AlertRuleResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AlertRuleResource getByResourceGroup(String resourceGroupName, String ruleName) { + AlertRuleResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, ruleName); + if (inner != null) { + return new AlertRuleResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new AlertRuleResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new AlertRuleResourceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new AlertRuleResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new AlertRuleResourceImpl(inner1, this.manager())); + } + + public AlertRuleResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourcegroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id))); + } + String ruleName = Utils.getValueFromIdByName(id, "alertrules"); + if (ruleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'alertrules'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, ruleName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourcegroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id))); + } + String ruleName = Utils.getValueFromIdByName(id, "alertrules"); + if (ruleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'alertrules'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, ruleName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourcegroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id))); + } + String ruleName = Utils.getValueFromIdByName(id, "alertrules"); + if (ruleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'alertrules'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, ruleName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourcegroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id))); + } + String ruleName = Utils.getValueFromIdByName(id, "alertrules"); + if (ruleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'alertrules'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, ruleName, context); + } + + private AlertRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + public AlertRuleResourceImpl define(String name) { + return new AlertRuleResourceImpl(name, this.manager()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AutoscaleSettingResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AutoscaleSettingResourceImpl.java new file mode 100644 index 0000000000000..08a996ac8f545 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AutoscaleSettingResourceImpl.java @@ -0,0 +1,300 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.AutoscaleSettingResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleNotification; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleProfile; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleSettingResource; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleSettingResourcePatch; +import com.azure.resourcemanager.monitor.generated.models.PredictiveAutoscalePolicy; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class AutoscaleSettingResourceImpl + implements AutoscaleSettingResource, AutoscaleSettingResource.Definition, AutoscaleSettingResource.Update { + private AutoscaleSettingResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public List profiles() { + List inner = this.innerModel().profiles(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List notifications() { + List inner = this.innerModel().notifications(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean enabled() { + return this.innerModel().enabled(); + } + + public PredictiveAutoscalePolicy predictiveAutoscalePolicy() { + return this.innerModel().predictiveAutoscalePolicy(); + } + + public String namePropertiesName() { + return this.innerModel().namePropertiesName(); + } + + public String targetResourceUri() { + return this.innerModel().targetResourceUri(); + } + + public String targetResourceLocation() { + return this.innerModel().targetResourceLocation(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public AutoscaleSettingResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String autoscaleSettingName; + + private AutoscaleSettingResourcePatch updateAutoscaleSettingResource; + + public AutoscaleSettingResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public AutoscaleSettingResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getAutoscaleSettings() + .createOrUpdateWithResponse(resourceGroupName, autoscaleSettingName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public AutoscaleSettingResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAutoscaleSettings() + .createOrUpdateWithResponse(resourceGroupName, autoscaleSettingName, this.innerModel(), context) + .getValue(); + return this; + } + + AutoscaleSettingResourceImpl( + String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new AutoscaleSettingResourceInner(); + this.serviceManager = serviceManager; + this.autoscaleSettingName = name; + } + + public AutoscaleSettingResourceImpl update() { + this.updateAutoscaleSettingResource = new AutoscaleSettingResourcePatch(); + return this; + } + + public AutoscaleSettingResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAutoscaleSettings() + .updateWithResponse( + resourceGroupName, autoscaleSettingName, updateAutoscaleSettingResource, Context.NONE) + .getValue(); + return this; + } + + public AutoscaleSettingResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAutoscaleSettings() + .updateWithResponse(resourceGroupName, autoscaleSettingName, updateAutoscaleSettingResource, context) + .getValue(); + return this; + } + + AutoscaleSettingResourceImpl( + AutoscaleSettingResourceInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourcegroups"); + this.autoscaleSettingName = Utils.getValueFromIdByName(innerObject.id(), "autoscalesettings"); + } + + public AutoscaleSettingResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAutoscaleSettings() + .getByResourceGroupWithResponse(resourceGroupName, autoscaleSettingName, Context.NONE) + .getValue(); + return this; + } + + public AutoscaleSettingResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAutoscaleSettings() + .getByResourceGroupWithResponse(resourceGroupName, autoscaleSettingName, context) + .getValue(); + return this; + } + + public AutoscaleSettingResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public AutoscaleSettingResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public AutoscaleSettingResourceImpl withProfiles(List profiles) { + if (isInCreateMode()) { + this.innerModel().withProfiles(profiles); + return this; + } else { + this.updateAutoscaleSettingResource.withProfiles(profiles); + return this; + } + } + + public AutoscaleSettingResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateAutoscaleSettingResource.withTags(tags); + return this; + } + } + + public AutoscaleSettingResourceImpl withNotifications(List notifications) { + if (isInCreateMode()) { + this.innerModel().withNotifications(notifications); + return this; + } else { + this.updateAutoscaleSettingResource.withNotifications(notifications); + return this; + } + } + + public AutoscaleSettingResourceImpl withEnabled(Boolean enabled) { + if (isInCreateMode()) { + this.innerModel().withEnabled(enabled); + return this; + } else { + this.updateAutoscaleSettingResource.withEnabled(enabled); + return this; + } + } + + public AutoscaleSettingResourceImpl withPredictiveAutoscalePolicy( + PredictiveAutoscalePolicy predictiveAutoscalePolicy) { + if (isInCreateMode()) { + this.innerModel().withPredictiveAutoscalePolicy(predictiveAutoscalePolicy); + return this; + } else { + this.updateAutoscaleSettingResource.withPredictiveAutoscalePolicy(predictiveAutoscalePolicy); + return this; + } + } + + public AutoscaleSettingResourceImpl withNamePropertiesName(String namePropertiesName) { + this.innerModel().withNamePropertiesName(namePropertiesName); + return this; + } + + public AutoscaleSettingResourceImpl withTargetResourceUri(String targetResourceUri) { + if (isInCreateMode()) { + this.innerModel().withTargetResourceUri(targetResourceUri); + return this; + } else { + this.updateAutoscaleSettingResource.withTargetResourceUri(targetResourceUri); + return this; + } + } + + public AutoscaleSettingResourceImpl withTargetResourceLocation(String targetResourceLocation) { + if (isInCreateMode()) { + this.innerModel().withTargetResourceLocation(targetResourceLocation); + return this; + } else { + this.updateAutoscaleSettingResource.withTargetResourceLocation(targetResourceLocation); + return this; + } + } + + public AutoscaleSettingResourceImpl withName(String name) { + this.updateAutoscaleSettingResource.withName(name); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AutoscaleSettingsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AutoscaleSettingsClientImpl.java new file mode 100644 index 0000000000000..dc4cbb7ef2601 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AutoscaleSettingsClientImpl.java @@ -0,0 +1,1266 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.AutoscaleSettingsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.AutoscaleSettingResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleSettingResourceCollection; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleSettingResourcePatch; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AutoscaleSettingsClient. */ +public final class AutoscaleSettingsClientImpl implements AutoscaleSettingsClient { + /** The proxy service used to perform REST calls. */ + private final AutoscaleSettingsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of AutoscaleSettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AutoscaleSettingsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(AutoscaleSettingsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientAutoscaleSettings to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientAutosca") + public interface AutoscaleSettingsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/autoscalesettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/autoscalesettings/{autoscaleSettingName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("autoscaleSettingName") String autoscaleSettingName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") AutoscaleSettingResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/autoscalesettings/{autoscaleSettingName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("autoscaleSettingName") String autoscaleSettingName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/autoscalesettings/{autoscaleSettingName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("autoscaleSettingName") String autoscaleSettingName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/autoscalesettings/{autoscaleSettingName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("autoscaleSettingName") String autoscaleSettingName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AutoscaleSettingResourcePatch autoscaleSettingResource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/autoscalesettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the autoscale settings for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the autoscale settings for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the autoscale settings for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists the autoscale settings for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the autoscale settings for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists the autoscale settings for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Creates or updates an autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the autoscale setting resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (autoscaleSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter autoscaleSettingName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + autoscaleSettingName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param parameters Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the autoscale setting resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String autoscaleSettingName, + AutoscaleSettingResourceInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (autoscaleSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter autoscaleSettingName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + autoscaleSettingName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Creates or updates an autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the autoscale setting resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourceInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, autoscaleSettingName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates an autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param parameters Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the autoscale setting resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String autoscaleSettingName, + AutoscaleSettingResourceInner parameters, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, autoscaleSettingName, parameters, context).block(); + } + + /** + * Creates or updates an autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the autoscale setting resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AutoscaleSettingResourceInner createOrUpdate( + String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourceInner parameters) { + return createOrUpdateWithResponse(resourceGroupName, autoscaleSettingName, parameters, Context.NONE).getValue(); + } + + /** + * Deletes and autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String autoscaleSettingName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (autoscaleSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter autoscaleSettingName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + autoscaleSettingName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes and autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String autoscaleSettingName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (autoscaleSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter autoscaleSettingName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + autoscaleSettingName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Deletes and autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String autoscaleSettingName) { + return deleteWithResponseAsync(resourceGroupName, autoscaleSettingName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes and autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String autoscaleSettingName, Context context) { + return deleteWithResponseAsync(resourceGroupName, autoscaleSettingName, context).block(); + } + + /** + * Deletes and autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String autoscaleSettingName) { + deleteWithResponse(resourceGroupName, autoscaleSettingName, Context.NONE); + } + + /** + * Gets an autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an autoscale setting along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String autoscaleSettingName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (autoscaleSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter autoscaleSettingName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + autoscaleSettingName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets an autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an autoscale setting along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String autoscaleSettingName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (autoscaleSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter autoscaleSettingName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + autoscaleSettingName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets an autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an autoscale setting on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String autoscaleSettingName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, autoscaleSettingName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets an autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an autoscale setting along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String autoscaleSettingName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, autoscaleSettingName, context).block(); + } + + /** + * Gets an autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an autoscale setting. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AutoscaleSettingResourceInner getByResourceGroup(String resourceGroupName, String autoscaleSettingName) { + return getByResourceGroupWithResponse(resourceGroupName, autoscaleSettingName, Context.NONE).getValue(); + } + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param autoscaleSettingResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the autoscale setting resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (autoscaleSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter autoscaleSettingName is required and cannot be null.")); + } + if (autoscaleSettingResource == null) { + return Mono + .error( + new IllegalArgumentException("Parameter autoscaleSettingResource is required and cannot be null.")); + } else { + autoscaleSettingResource.validate(); + } + final String apiVersion = "2022-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + autoscaleSettingName, + apiVersion, + autoscaleSettingResource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param autoscaleSettingResource Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the autoscale setting resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String autoscaleSettingName, + AutoscaleSettingResourcePatch autoscaleSettingResource, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (autoscaleSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter autoscaleSettingName is required and cannot be null.")); + } + if (autoscaleSettingResource == null) { + return Mono + .error( + new IllegalArgumentException("Parameter autoscaleSettingResource is required and cannot be null.")); + } else { + autoscaleSettingResource.validate(); + } + final String apiVersion = "2022-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + autoscaleSettingName, + apiVersion, + autoscaleSettingResource, + accept, + context); + } + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param autoscaleSettingResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the autoscale setting resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource) { + return updateWithResponseAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param autoscaleSettingResource Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the autoscale setting resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String autoscaleSettingName, + AutoscaleSettingResourcePatch autoscaleSettingResource, + Context context) { + return updateWithResponseAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource, context) + .block(); + } + + /** + * Updates an existing AutoscaleSettingsResource. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param autoscaleSettingResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the autoscale setting resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AutoscaleSettingResourceInner update( + String resourceGroupName, String autoscaleSettingName, AutoscaleSettingResourcePatch autoscaleSettingResource) { + return updateWithResponse(resourceGroupName, autoscaleSettingName, autoscaleSettingResource, Context.NONE) + .getValue(); + } + + /** + * Lists the autoscale settings for a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the autoscale settings for a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists the autoscale settings for a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists the autoscale settings for a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists the autoscale settings for a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists the autoscale settings for a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AutoscaleSettingsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AutoscaleSettingsImpl.java new file mode 100644 index 0000000000000..f93d31985cb51 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AutoscaleSettingsImpl.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.AutoscaleSettingsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.AutoscaleSettingResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleSettingResource; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleSettings; + +public final class AutoscaleSettingsImpl implements AutoscaleSettings { + private static final ClientLogger LOGGER = new ClientLogger(AutoscaleSettingsImpl.class); + + private final AutoscaleSettingsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public AutoscaleSettingsImpl( + AutoscaleSettingsClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new AutoscaleSettingResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new AutoscaleSettingResourceImpl(inner1, this.manager())); + } + + public Response deleteByResourceGroupWithResponse( + String resourceGroupName, String autoscaleSettingName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, autoscaleSettingName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String autoscaleSettingName) { + this.serviceClient().delete(resourceGroupName, autoscaleSettingName); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String autoscaleSettingName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, autoscaleSettingName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AutoscaleSettingResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AutoscaleSettingResource getByResourceGroup(String resourceGroupName, String autoscaleSettingName) { + AutoscaleSettingResourceInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, autoscaleSettingName); + if (inner != null) { + return new AutoscaleSettingResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new AutoscaleSettingResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new AutoscaleSettingResourceImpl(inner1, this.manager())); + } + + public AutoscaleSettingResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourcegroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id))); + } + String autoscaleSettingName = Utils.getValueFromIdByName(id, "autoscalesettings"); + if (autoscaleSettingName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'autoscalesettings'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, autoscaleSettingName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourcegroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id))); + } + String autoscaleSettingName = Utils.getValueFromIdByName(id, "autoscalesettings"); + if (autoscaleSettingName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'autoscalesettings'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, autoscaleSettingName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourcegroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id))); + } + String autoscaleSettingName = Utils.getValueFromIdByName(id, "autoscalesettings"); + if (autoscaleSettingName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'autoscalesettings'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, autoscaleSettingName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourcegroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourcegroups'.", id))); + } + String autoscaleSettingName = Utils.getValueFromIdByName(id, "autoscalesettings"); + if (autoscaleSettingName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'autoscalesettings'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, autoscaleSettingName, context); + } + + private AutoscaleSettingsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + public AutoscaleSettingResourceImpl define(String name) { + return new AutoscaleSettingResourceImpl(name, this.manager()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AzureMonitorPrivateLinkScopeImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AzureMonitorPrivateLinkScopeImpl.java new file mode 100644 index 0000000000000..f8b6ea10ac0ff --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AzureMonitorPrivateLinkScopeImpl.java @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.AzureMonitorPrivateLinkScopeInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.monitor.generated.models.AccessModeSettings; +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorPrivateLinkScope; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.monitor.generated.models.TagsResource; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +public final class AzureMonitorPrivateLinkScopeImpl + implements AzureMonitorPrivateLinkScope, + AzureMonitorPrivateLinkScope.Definition, + AzureMonitorPrivateLinkScope.Update { + private AzureMonitorPrivateLinkScopeInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public AccessModeSettings accessModeSettings() { + return this.innerModel().accessModeSettings(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public AzureMonitorPrivateLinkScopeInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String scopeName; + + private TagsResource updatePrivateLinkScopeTags; + + public AzureMonitorPrivateLinkScopeImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public AzureMonitorPrivateLinkScope create() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateLinkScopes() + .createOrUpdateWithResponse(resourceGroupName, scopeName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public AzureMonitorPrivateLinkScope create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateLinkScopes() + .createOrUpdateWithResponse(resourceGroupName, scopeName, this.innerModel(), context) + .getValue(); + return this; + } + + AzureMonitorPrivateLinkScopeImpl( + String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new AzureMonitorPrivateLinkScopeInner(); + this.serviceManager = serviceManager; + this.scopeName = name; + } + + public AzureMonitorPrivateLinkScopeImpl update() { + this.updatePrivateLinkScopeTags = new TagsResource(); + return this; + } + + public AzureMonitorPrivateLinkScope apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateLinkScopes() + .updateTagsWithResponse(resourceGroupName, scopeName, updatePrivateLinkScopeTags, Context.NONE) + .getValue(); + return this; + } + + public AzureMonitorPrivateLinkScope apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateLinkScopes() + .updateTagsWithResponse(resourceGroupName, scopeName, updatePrivateLinkScopeTags, context) + .getValue(); + return this; + } + + AzureMonitorPrivateLinkScopeImpl( + AzureMonitorPrivateLinkScopeInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.scopeName = Utils.getValueFromIdByName(innerObject.id(), "privateLinkScopes"); + } + + public AzureMonitorPrivateLinkScope refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateLinkScopes() + .getByResourceGroupWithResponse(resourceGroupName, scopeName, Context.NONE) + .getValue(); + return this; + } + + public AzureMonitorPrivateLinkScope refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateLinkScopes() + .getByResourceGroupWithResponse(resourceGroupName, scopeName, context) + .getValue(); + return this; + } + + public AzureMonitorPrivateLinkScopeImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public AzureMonitorPrivateLinkScopeImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public AzureMonitorPrivateLinkScopeImpl withAccessModeSettings(AccessModeSettings accessModeSettings) { + this.innerModel().withAccessModeSettings(accessModeSettings); + return this; + } + + public AzureMonitorPrivateLinkScopeImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updatePrivateLinkScopeTags.withTags(tags); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AzureMonitorWorkspaceResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AzureMonitorWorkspaceResourceImpl.java new file mode 100644 index 0000000000000..c504816e15bfb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AzureMonitorWorkspaceResourceImpl.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.AzureMonitorWorkspaceResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorWorkspaceDefaultIngestionSettings; +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorWorkspaceMetrics; +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorWorkspaceResource; +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorWorkspaceResourceForUpdate; +import com.azure.resourcemanager.monitor.generated.models.ProvisioningState; +import java.util.Collections; +import java.util.Map; + +public final class AzureMonitorWorkspaceResourceImpl + implements AzureMonitorWorkspaceResource, + AzureMonitorWorkspaceResource.Definition, + AzureMonitorWorkspaceResource.Update { + private AzureMonitorWorkspaceResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String accountId() { + return this.innerModel().accountId(); + } + + public AzureMonitorWorkspaceMetrics metrics() { + return this.innerModel().metrics(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public AzureMonitorWorkspaceDefaultIngestionSettings defaultIngestionSettings() { + return this.innerModel().defaultIngestionSettings(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public AzureMonitorWorkspaceResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String azureMonitorWorkspaceName; + + private AzureMonitorWorkspaceResourceForUpdate updateAzureMonitorWorkspaceProperties; + + public AzureMonitorWorkspaceResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public AzureMonitorWorkspaceResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getAzureMonitorWorkspaces() + .createWithResponse(resourceGroupName, azureMonitorWorkspaceName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public AzureMonitorWorkspaceResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAzureMonitorWorkspaces() + .createWithResponse(resourceGroupName, azureMonitorWorkspaceName, this.innerModel(), context) + .getValue(); + return this; + } + + AzureMonitorWorkspaceResourceImpl( + String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new AzureMonitorWorkspaceResourceInner(); + this.serviceManager = serviceManager; + this.azureMonitorWorkspaceName = name; + } + + public AzureMonitorWorkspaceResourceImpl update() { + this.updateAzureMonitorWorkspaceProperties = new AzureMonitorWorkspaceResourceForUpdate(); + return this; + } + + public AzureMonitorWorkspaceResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getAzureMonitorWorkspaces() + .updateWithResponse( + resourceGroupName, azureMonitorWorkspaceName, updateAzureMonitorWorkspaceProperties, Context.NONE) + .getValue(); + return this; + } + + public AzureMonitorWorkspaceResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAzureMonitorWorkspaces() + .updateWithResponse( + resourceGroupName, azureMonitorWorkspaceName, updateAzureMonitorWorkspaceProperties, context) + .getValue(); + return this; + } + + AzureMonitorWorkspaceResourceImpl( + AzureMonitorWorkspaceResourceInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.azureMonitorWorkspaceName = Utils.getValueFromIdByName(innerObject.id(), "accounts"); + } + + public AzureMonitorWorkspaceResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getAzureMonitorWorkspaces() + .getByResourceGroupWithResponse(resourceGroupName, azureMonitorWorkspaceName, Context.NONE) + .getValue(); + return this; + } + + public AzureMonitorWorkspaceResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getAzureMonitorWorkspaces() + .getByResourceGroupWithResponse(resourceGroupName, azureMonitorWorkspaceName, context) + .getValue(); + return this; + } + + public AzureMonitorWorkspaceResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public AzureMonitorWorkspaceResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public AzureMonitorWorkspaceResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateAzureMonitorWorkspaceProperties.withTags(tags); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AzureMonitorWorkspacesClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AzureMonitorWorkspacesClientImpl.java new file mode 100644 index 0000000000000..8f7fd0281837d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AzureMonitorWorkspacesClientImpl.java @@ -0,0 +1,1295 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.AzureMonitorWorkspacesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.AzureMonitorWorkspaceResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorWorkspaceResourceForUpdate; +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorWorkspaceResourceListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AzureMonitorWorkspacesClient. */ +public final class AzureMonitorWorkspacesClientImpl implements AzureMonitorWorkspacesClient { + /** The proxy service used to perform REST calls. */ + private final AzureMonitorWorkspacesService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of AzureMonitorWorkspacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AzureMonitorWorkspacesClientImpl(MonitorClientImpl client) { + this.service = + RestProxy + .create(AzureMonitorWorkspacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientAzureMonitorWorkspaces to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientAzureMo") + public interface AzureMonitorWorkspacesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Monitor/accounts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts" + + "/{azureMonitorWorkspaceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts" + + "/{azureMonitorWorkspaceName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AzureMonitorWorkspaceResourceInner azureMonitorWorkspaceProperties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts" + + "/{azureMonitorWorkspaceName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") AzureMonitorWorkspaceResourceForUpdate azureMonitorWorkspaceProperties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Monitor/accounts" + + "/{azureMonitorWorkspaceName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("azureMonitorWorkspaceName") String azureMonitorWorkspaceName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all workspaces in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-06-03-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all workspaces in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-06-03-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all workspaces in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all workspaces in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all workspaces in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all workspaces in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists all workspaces in the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-06-03-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all workspaces in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-06-03-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all workspaces in the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all workspaces in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all workspaces in the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all workspaces in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Returns the specific Azure Monitor workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String azureMonitorWorkspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (azureMonitorWorkspaceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureMonitorWorkspaceName is required and cannot be null.")); + } + final String apiVersion = "2021-06-03-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + azureMonitorWorkspaceName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns the specific Azure Monitor workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String azureMonitorWorkspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (azureMonitorWorkspaceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureMonitorWorkspaceName is required and cannot be null.")); + } + final String apiVersion = "2021-06-03-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + azureMonitorWorkspaceName, + apiVersion, + accept, + context); + } + + /** + * Returns the specific Azure Monitor workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String azureMonitorWorkspaceName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns the specific Azure Monitor workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String azureMonitorWorkspaceName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, context).block(); + } + + /** + * Returns the specific Azure Monitor workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureMonitorWorkspaceResourceInner getByResourceGroup( + String resourceGroupName, String azureMonitorWorkspaceName) { + return getByResourceGroupWithResponse(resourceGroupName, azureMonitorWorkspaceName, Context.NONE).getValue(); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param azureMonitorWorkspaceProperties Properties that need to be specified to create a new workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String azureMonitorWorkspaceName, + AzureMonitorWorkspaceResourceInner azureMonitorWorkspaceProperties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (azureMonitorWorkspaceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureMonitorWorkspaceName is required and cannot be null.")); + } + if (azureMonitorWorkspaceProperties == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureMonitorWorkspaceProperties is required and cannot be null.")); + } else { + azureMonitorWorkspaceProperties.validate(); + } + final String apiVersion = "2021-06-03-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + azureMonitorWorkspaceName, + apiVersion, + azureMonitorWorkspaceProperties, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param azureMonitorWorkspaceProperties Properties that need to be specified to create a new workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String azureMonitorWorkspaceName, + AzureMonitorWorkspaceResourceInner azureMonitorWorkspaceProperties, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (azureMonitorWorkspaceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureMonitorWorkspaceName is required and cannot be null.")); + } + if (azureMonitorWorkspaceProperties == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureMonitorWorkspaceProperties is required and cannot be null.")); + } else { + azureMonitorWorkspaceProperties.validate(); + } + final String apiVersion = "2021-06-03-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + azureMonitorWorkspaceName, + apiVersion, + azureMonitorWorkspaceProperties, + accept, + context); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param azureMonitorWorkspaceProperties Properties that need to be specified to create a new workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, + String azureMonitorWorkspaceName, + AzureMonitorWorkspaceResourceInner azureMonitorWorkspaceProperties) { + return createWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, azureMonitorWorkspaceProperties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param azureMonitorWorkspaceProperties Properties that need to be specified to create a new workspace. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String azureMonitorWorkspaceName, + AzureMonitorWorkspaceResourceInner azureMonitorWorkspaceProperties, + Context context) { + return createWithResponseAsync( + resourceGroupName, azureMonitorWorkspaceName, azureMonitorWorkspaceProperties, context) + .block(); + } + + /** + * Create or update a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param azureMonitorWorkspaceProperties Properties that need to be specified to create a new workspace. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureMonitorWorkspaceResourceInner create( + String resourceGroupName, + String azureMonitorWorkspaceName, + AzureMonitorWorkspaceResourceInner azureMonitorWorkspaceProperties) { + return createWithResponse( + resourceGroupName, azureMonitorWorkspaceName, azureMonitorWorkspaceProperties, Context.NONE) + .getValue(); + } + + /** + * Updates part of a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param azureMonitorWorkspaceProperties The payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String azureMonitorWorkspaceName, + AzureMonitorWorkspaceResourceForUpdate azureMonitorWorkspaceProperties) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (azureMonitorWorkspaceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureMonitorWorkspaceName is required and cannot be null.")); + } + if (azureMonitorWorkspaceProperties != null) { + azureMonitorWorkspaceProperties.validate(); + } + final String apiVersion = "2021-06-03-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + azureMonitorWorkspaceName, + apiVersion, + azureMonitorWorkspaceProperties, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates part of a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param azureMonitorWorkspaceProperties The payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String azureMonitorWorkspaceName, + AzureMonitorWorkspaceResourceForUpdate azureMonitorWorkspaceProperties, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (azureMonitorWorkspaceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureMonitorWorkspaceName is required and cannot be null.")); + } + if (azureMonitorWorkspaceProperties != null) { + azureMonitorWorkspaceProperties.validate(); + } + final String apiVersion = "2021-06-03-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + azureMonitorWorkspaceName, + apiVersion, + azureMonitorWorkspaceProperties, + accept, + context); + } + + /** + * Updates part of a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String azureMonitorWorkspaceName) { + final AzureMonitorWorkspaceResourceForUpdate azureMonitorWorkspaceProperties = null; + return updateWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, azureMonitorWorkspaceProperties) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates part of a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param azureMonitorWorkspaceProperties The payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String azureMonitorWorkspaceName, + AzureMonitorWorkspaceResourceForUpdate azureMonitorWorkspaceProperties, + Context context) { + return updateWithResponseAsync( + resourceGroupName, azureMonitorWorkspaceName, azureMonitorWorkspaceProperties, context) + .block(); + } + + /** + * Updates part of a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureMonitorWorkspaceResourceInner update(String resourceGroupName, String azureMonitorWorkspaceName) { + final AzureMonitorWorkspaceResourceForUpdate azureMonitorWorkspaceProperties = null; + return updateWithResponse( + resourceGroupName, azureMonitorWorkspaceName, azureMonitorWorkspaceProperties, Context.NONE) + .getValue(); + } + + /** + * Delete a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String azureMonitorWorkspaceName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (azureMonitorWorkspaceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureMonitorWorkspaceName is required and cannot be null.")); + } + final String apiVersion = "2021-06-03-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + azureMonitorWorkspaceName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String azureMonitorWorkspaceName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (azureMonitorWorkspaceName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureMonitorWorkspaceName is required and cannot be null.")); + } + final String apiVersion = "2021-06-03-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + azureMonitorWorkspaceName, + apiVersion, + accept, + context); + } + + /** + * Delete a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String azureMonitorWorkspaceName) { + return deleteWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String azureMonitorWorkspaceName, Context context) { + return deleteWithResponseAsync(resourceGroupName, azureMonitorWorkspaceName, context).block(); + } + + /** + * Delete a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String azureMonitorWorkspaceName) { + deleteWithResponse(resourceGroupName, azureMonitorWorkspaceName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AzureMonitorWorkspacesImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AzureMonitorWorkspacesImpl.java new file mode 100644 index 0000000000000..0074499f8956a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AzureMonitorWorkspacesImpl.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.AzureMonitorWorkspacesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.AzureMonitorWorkspaceResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorWorkspaceResource; +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorWorkspaces; + +public final class AzureMonitorWorkspacesImpl implements AzureMonitorWorkspaces { + private static final ClientLogger LOGGER = new ClientLogger(AzureMonitorWorkspacesImpl.class); + + private final AzureMonitorWorkspacesClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public AzureMonitorWorkspacesImpl( + AzureMonitorWorkspacesClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new AzureMonitorWorkspaceResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new AzureMonitorWorkspaceResourceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new AzureMonitorWorkspaceResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new AzureMonitorWorkspaceResourceImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String azureMonitorWorkspaceName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, azureMonitorWorkspaceName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AzureMonitorWorkspaceResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AzureMonitorWorkspaceResource getByResourceGroup( + String resourceGroupName, String azureMonitorWorkspaceName) { + AzureMonitorWorkspaceResourceInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, azureMonitorWorkspaceName); + if (inner != null) { + return new AzureMonitorWorkspaceResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse( + String resourceGroupName, String azureMonitorWorkspaceName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, azureMonitorWorkspaceName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String azureMonitorWorkspaceName) { + this.serviceClient().delete(resourceGroupName, azureMonitorWorkspaceName); + } + + public AzureMonitorWorkspaceResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String azureMonitorWorkspaceName = Utils.getValueFromIdByName(id, "accounts"); + if (azureMonitorWorkspaceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this + .getByResourceGroupWithResponse(resourceGroupName, azureMonitorWorkspaceName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String azureMonitorWorkspaceName = Utils.getValueFromIdByName(id, "accounts"); + if (azureMonitorWorkspaceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, azureMonitorWorkspaceName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String azureMonitorWorkspaceName = Utils.getValueFromIdByName(id, "accounts"); + if (azureMonitorWorkspaceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, azureMonitorWorkspaceName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String azureMonitorWorkspaceName = Utils.getValueFromIdByName(id, "accounts"); + if (azureMonitorWorkspaceName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'accounts'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, azureMonitorWorkspaceName, context); + } + + private AzureMonitorWorkspacesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + public AzureMonitorWorkspaceResourceImpl define(String name) { + return new AzureMonitorWorkspaceResourceImpl(name, this.manager()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/BaselinesClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/BaselinesClientImpl.java new file mode 100644 index 0000000000000..13751b9a5ae0e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/BaselinesClientImpl.java @@ -0,0 +1,458 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.BaselinesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.SingleMetricBaselineInner; +import com.azure.resourcemanager.monitor.generated.models.MetricBaselinesResponse; +import com.azure.resourcemanager.monitor.generated.models.ResultType; +import java.time.Duration; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in BaselinesClient. */ +public final class BaselinesClientImpl implements BaselinesClient { + /** The proxy service used to perform REST calls. */ + private final BaselinesService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of BaselinesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + BaselinesClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(BaselinesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientBaselines to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientBaselin") + public interface BaselinesService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.Insights/metricBaselines") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("metricnames") String metricnames, + @QueryParam("metricnamespace") String metricnamespace, + @QueryParam("timespan") String timespan, + @QueryParam("interval") Duration interval, + @QueryParam("aggregation") String aggregation, + @QueryParam("sensitivities") String sensitivities, + @QueryParam("$filter") String filter, + @QueryParam("resultType") ResultType resultType, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @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'**. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @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' "**. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of metric baselines along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceUri, + String metricnames, + String metricnamespace, + String timespan, + Duration interval, + String aggregation, + String sensitivities, + String filter, + ResultType resultType) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String apiVersion = "2019-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceUri, + metricnames, + metricnamespace, + timespan, + interval, + aggregation, + sensitivities, + filter, + resultType, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @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'**. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @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' "**. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of metric baselines along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceUri, + String metricnames, + String metricnamespace, + String timespan, + Duration interval, + String aggregation, + String sensitivities, + String filter, + ResultType resultType, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String apiVersion = "2019-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + resourceUri, + metricnames, + metricnamespace, + timespan, + interval, + aggregation, + sensitivities, + filter, + resultType, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @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'**. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @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' "**. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of metric baselines as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceUri, + String metricnames, + String metricnamespace, + String timespan, + Duration interval, + String aggregation, + String sensitivities, + String filter, + ResultType resultType) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + resourceUri, + metricnames, + metricnamespace, + timespan, + interval, + aggregation, + sensitivities, + filter, + resultType)); + } + + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of metric baselines as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri) { + final String metricnames = null; + final String metricnamespace = null; + final String timespan = null; + final Duration interval = null; + final String aggregation = null; + final String sensitivities = null; + final String filter = null; + final ResultType resultType = null; + return new PagedFlux<>( + () -> + listSinglePageAsync( + resourceUri, + metricnames, + metricnamespace, + timespan, + interval, + aggregation, + sensitivities, + filter, + resultType)); + } + + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @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'**. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @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' "**. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of metric baselines as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceUri, + String metricnames, + String metricnamespace, + String timespan, + Duration interval, + String aggregation, + String sensitivities, + String filter, + ResultType resultType, + Context context) { + return new PagedFlux<>( + () -> + listSinglePageAsync( + resourceUri, + metricnames, + metricnamespace, + timespan, + interval, + aggregation, + sensitivities, + filter, + resultType, + context)); + } + + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of metric baselines as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri) { + final String metricnames = null; + final String metricnamespace = null; + final String timespan = null; + final Duration interval = null; + final String aggregation = null; + final String sensitivities = null; + final String filter = null; + final ResultType resultType = null; + return new PagedIterable<>( + listAsync( + resourceUri, + metricnames, + metricnamespace, + timespan, + interval, + aggregation, + sensitivities, + filter, + resultType)); + } + + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @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'**. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @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' "**. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of metric baselines as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceUri, + String metricnames, + String metricnamespace, + String timespan, + Duration interval, + String aggregation, + String sensitivities, + String filter, + ResultType resultType, + Context context) { + return new PagedIterable<>( + listAsync( + resourceUri, + metricnames, + metricnamespace, + timespan, + interval, + aggregation, + sensitivities, + filter, + resultType, + context)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/BaselinesImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/BaselinesImpl.java new file mode 100644 index 0000000000000..80268ab77bd58 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/BaselinesImpl.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.BaselinesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.SingleMetricBaselineInner; +import com.azure.resourcemanager.monitor.generated.models.Baselines; +import com.azure.resourcemanager.monitor.generated.models.ResultType; +import com.azure.resourcemanager.monitor.generated.models.SingleMetricBaseline; +import java.time.Duration; + +public final class BaselinesImpl implements Baselines { + private static final ClientLogger LOGGER = new ClientLogger(BaselinesImpl.class); + + private final BaselinesClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public BaselinesImpl( + BaselinesClient innerClient, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return Utils.mapPage(inner, inner1 -> new SingleMetricBaselineImpl(inner1, this.manager())); + } + + public PagedIterable list( + String resourceUri, + String metricnames, + String metricnamespace, + String timespan, + Duration interval, + String aggregation, + String sensitivities, + String filter, + ResultType resultType, + Context context) { + PagedIterable inner = + this + .serviceClient() + .list( + resourceUri, + metricnames, + metricnamespace, + timespan, + interval, + aggregation, + sensitivities, + filter, + resultType, + context); + return Utils.mapPage(inner, inner1 -> new SingleMetricBaselineImpl(inner1, this.manager())); + } + + private BaselinesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointResourceImpl.java new file mode 100644 index 0000000000000..884b193291612 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointResourceImpl.java @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionEndpointResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointConfigurationAccess; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointLogsIngestion; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointNetworkAcls; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointResource; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionEndpointProvisioningState; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionEndpointResourceKind; +import com.azure.resourcemanager.monitor.generated.models.ResourceForUpdate; +import java.util.Collections; +import java.util.Map; + +public final class DataCollectionEndpointResourceImpl + implements DataCollectionEndpointResource, + DataCollectionEndpointResource.Definition, + DataCollectionEndpointResource.Update { + private DataCollectionEndpointResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public KnownDataCollectionEndpointResourceKind kind() { + return this.innerModel().kind(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String description() { + return this.innerModel().description(); + } + + public String immutableId() { + return this.innerModel().immutableId(); + } + + public DataCollectionEndpointConfigurationAccess configurationAccess() { + return this.innerModel().configurationAccess(); + } + + public DataCollectionEndpointLogsIngestion logsIngestion() { + return this.innerModel().logsIngestion(); + } + + public DataCollectionEndpointNetworkAcls networkAcls() { + return this.innerModel().networkAcls(); + } + + public KnownDataCollectionEndpointProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DataCollectionEndpointResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String dataCollectionEndpointName; + + private ResourceForUpdate updateBody; + + public DataCollectionEndpointResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public DataCollectionEndpointResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionEndpoints() + .createWithResponse(resourceGroupName, dataCollectionEndpointName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DataCollectionEndpointResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionEndpoints() + .createWithResponse(resourceGroupName, dataCollectionEndpointName, this.innerModel(), context) + .getValue(); + return this; + } + + DataCollectionEndpointResourceImpl( + String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new DataCollectionEndpointResourceInner(); + this.serviceManager = serviceManager; + this.dataCollectionEndpointName = name; + } + + public DataCollectionEndpointResourceImpl update() { + this.updateBody = new ResourceForUpdate(); + return this; + } + + public DataCollectionEndpointResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionEndpoints() + .updateWithResponse(resourceGroupName, dataCollectionEndpointName, updateBody, Context.NONE) + .getValue(); + return this; + } + + public DataCollectionEndpointResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionEndpoints() + .updateWithResponse(resourceGroupName, dataCollectionEndpointName, updateBody, context) + .getValue(); + return this; + } + + DataCollectionEndpointResourceImpl( + DataCollectionEndpointResourceInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.dataCollectionEndpointName = Utils.getValueFromIdByName(innerObject.id(), "dataCollectionEndpoints"); + } + + public DataCollectionEndpointResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionEndpoints() + .getByResourceGroupWithResponse(resourceGroupName, dataCollectionEndpointName, Context.NONE) + .getValue(); + return this; + } + + public DataCollectionEndpointResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionEndpoints() + .getByResourceGroupWithResponse(resourceGroupName, dataCollectionEndpointName, context) + .getValue(); + return this; + } + + public DataCollectionEndpointResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DataCollectionEndpointResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DataCollectionEndpointResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public DataCollectionEndpointResourceImpl withKind(KnownDataCollectionEndpointResourceKind kind) { + this.innerModel().withKind(kind); + return this; + } + + public DataCollectionEndpointResourceImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public DataCollectionEndpointResourceImpl withImmutableId(String immutableId) { + this.innerModel().withImmutableId(immutableId); + return this; + } + + public DataCollectionEndpointResourceImpl withConfigurationAccess( + DataCollectionEndpointConfigurationAccess configurationAccess) { + this.innerModel().withConfigurationAccess(configurationAccess); + return this; + } + + public DataCollectionEndpointResourceImpl withLogsIngestion(DataCollectionEndpointLogsIngestion logsIngestion) { + this.innerModel().withLogsIngestion(logsIngestion); + return this; + } + + public DataCollectionEndpointResourceImpl withNetworkAcls(DataCollectionEndpointNetworkAcls networkAcls) { + this.innerModel().withNetworkAcls(networkAcls); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointsClientImpl.java new file mode 100644 index 0000000000000..5f7ec57bd4e55 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointsClientImpl.java @@ -0,0 +1,1264 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.DataCollectionEndpointsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionEndpointResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointResourceListResult; +import com.azure.resourcemanager.monitor.generated.models.ResourceForUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DataCollectionEndpointsClient. */ +public final class DataCollectionEndpointsClientImpl implements DataCollectionEndpointsClient { + /** The proxy service used to perform REST calls. */ + private final DataCollectionEndpointsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of DataCollectionEndpointsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DataCollectionEndpointsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy + .create(DataCollectionEndpointsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientDataCollectionEndpoints to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientDataCol") + public interface DataCollectionEndpointsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/dataCollectionEndpoints") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionEndpoints") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/dataCollectionEndpoints/{dataCollectionEndpointName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataCollectionEndpointName") String dataCollectionEndpointName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/dataCollectionEndpoints/{dataCollectionEndpointName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataCollectionEndpointName") String dataCollectionEndpointName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DataCollectionEndpointResourceInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/dataCollectionEndpoints/{dataCollectionEndpointName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataCollectionEndpointName") String dataCollectionEndpointName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourceForUpdate body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/dataCollectionEndpoints/{dataCollectionEndpointName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataCollectionEndpointName") String dataCollectionEndpointName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all data collection endpoints in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all data collection endpoints in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all data collection endpoints in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all data collection endpoints in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all data collection endpoints in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all data collection endpoints in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists all data collection endpoints in the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all data collection endpoints in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all data collection endpoints in the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all data collection endpoints in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all data collection endpoints in the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all data collection endpoints in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Returns the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String dataCollectionEndpointName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionEndpointName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter dataCollectionEndpointName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionEndpointName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String dataCollectionEndpointName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionEndpointName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter dataCollectionEndpointName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionEndpointName, + apiVersion, + accept, + context); + } + + /** + * Returns the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String dataCollectionEndpointName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, dataCollectionEndpointName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String dataCollectionEndpointName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, dataCollectionEndpointName, context).block(); + } + + /** + * Returns the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataCollectionEndpointResourceInner getByResourceGroup( + String resourceGroupName, String dataCollectionEndpointName) { + return getByResourceGroupWithResponse(resourceGroupName, dataCollectionEndpointName, Context.NONE).getValue(); + } + + /** + * Creates or updates a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param body The payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, String dataCollectionEndpointName, DataCollectionEndpointResourceInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionEndpointName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter dataCollectionEndpointName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionEndpointName, + apiVersion, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param body The payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String dataCollectionEndpointName, + DataCollectionEndpointResourceInner body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionEndpointName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter dataCollectionEndpointName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionEndpointName, + apiVersion, + body, + accept, + context); + } + + /** + * Creates or updates a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String dataCollectionEndpointName) { + final DataCollectionEndpointResourceInner body = null; + return createWithResponseAsync(resourceGroupName, dataCollectionEndpointName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param body The payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String dataCollectionEndpointName, + DataCollectionEndpointResourceInner body, + Context context) { + return createWithResponseAsync(resourceGroupName, dataCollectionEndpointName, body, context).block(); + } + + /** + * Creates or updates a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataCollectionEndpointResourceInner create(String resourceGroupName, String dataCollectionEndpointName) { + final DataCollectionEndpointResourceInner body = null; + return createWithResponse(resourceGroupName, dataCollectionEndpointName, body, Context.NONE).getValue(); + } + + /** + * Updates part of a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param body The payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String dataCollectionEndpointName, ResourceForUpdate body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionEndpointName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter dataCollectionEndpointName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionEndpointName, + apiVersion, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates part of a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param body The payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String dataCollectionEndpointName, ResourceForUpdate body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionEndpointName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter dataCollectionEndpointName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionEndpointName, + apiVersion, + body, + accept, + context); + } + + /** + * Updates part of a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String dataCollectionEndpointName) { + final ResourceForUpdate body = null; + return updateWithResponseAsync(resourceGroupName, dataCollectionEndpointName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates part of a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param body The payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String dataCollectionEndpointName, ResourceForUpdate body, Context context) { + return updateWithResponseAsync(resourceGroupName, dataCollectionEndpointName, body, context).block(); + } + + /** + * Updates part of a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataCollectionEndpointResourceInner update(String resourceGroupName, String dataCollectionEndpointName) { + final ResourceForUpdate body = null; + return updateWithResponse(resourceGroupName, dataCollectionEndpointName, body, Context.NONE).getValue(); + } + + /** + * Deletes a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String dataCollectionEndpointName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionEndpointName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter dataCollectionEndpointName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionEndpointName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String dataCollectionEndpointName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionEndpointName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter dataCollectionEndpointName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionEndpointName, + apiVersion, + accept, + context); + } + + /** + * Deletes a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String dataCollectionEndpointName) { + return deleteWithResponseAsync(resourceGroupName, dataCollectionEndpointName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse( + String resourceGroupName, String dataCollectionEndpointName, Context context) { + return deleteWithResponseAsync(resourceGroupName, dataCollectionEndpointName, context).block(); + } + + /** + * Deletes a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String dataCollectionEndpointName) { + deleteWithResponse(resourceGroupName, dataCollectionEndpointName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointsImpl.java new file mode 100644 index 0000000000000..ef321be0112a4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointsImpl.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.DataCollectionEndpointsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionEndpointResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointResource; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpoints; + +public final class DataCollectionEndpointsImpl implements DataCollectionEndpoints { + private static final ClientLogger LOGGER = new ClientLogger(DataCollectionEndpointsImpl.class); + + private final DataCollectionEndpointsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public DataCollectionEndpointsImpl( + DataCollectionEndpointsClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new DataCollectionEndpointResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new DataCollectionEndpointResourceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new DataCollectionEndpointResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new DataCollectionEndpointResourceImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String dataCollectionEndpointName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, dataCollectionEndpointName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DataCollectionEndpointResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DataCollectionEndpointResource getByResourceGroup( + String resourceGroupName, String dataCollectionEndpointName) { + DataCollectionEndpointResourceInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, dataCollectionEndpointName); + if (inner != null) { + return new DataCollectionEndpointResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse( + String resourceGroupName, String dataCollectionEndpointName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, dataCollectionEndpointName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String dataCollectionEndpointName) { + this.serviceClient().delete(resourceGroupName, dataCollectionEndpointName); + } + + public DataCollectionEndpointResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String dataCollectionEndpointName = Utils.getValueFromIdByName(id, "dataCollectionEndpoints"); + if (dataCollectionEndpointName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'dataCollectionEndpoints'.", + id))); + } + return this + .getByResourceGroupWithResponse(resourceGroupName, dataCollectionEndpointName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String dataCollectionEndpointName = Utils.getValueFromIdByName(id, "dataCollectionEndpoints"); + if (dataCollectionEndpointName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'dataCollectionEndpoints'.", + id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, dataCollectionEndpointName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String dataCollectionEndpointName = Utils.getValueFromIdByName(id, "dataCollectionEndpoints"); + if (dataCollectionEndpointName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'dataCollectionEndpoints'.", + id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, dataCollectionEndpointName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String dataCollectionEndpointName = Utils.getValueFromIdByName(id, "dataCollectionEndpoints"); + if (dataCollectionEndpointName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'dataCollectionEndpoints'.", + id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, dataCollectionEndpointName, context); + } + + private DataCollectionEndpointsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + public DataCollectionEndpointResourceImpl define(String name) { + return new DataCollectionEndpointResourceImpl(name, this.manager()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationProxyOnlyResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationProxyOnlyResourceImpl.java new file mode 100644 index 0000000000000..297d4311ae5ad --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationProxyOnlyResourceImpl.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleAssociationProxyOnlyResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleAssociationMetadata; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleAssociationProxyOnlyResource; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionRuleAssociationProvisioningState; + +public final class DataCollectionRuleAssociationProxyOnlyResourceImpl + implements DataCollectionRuleAssociationProxyOnlyResource, + DataCollectionRuleAssociationProxyOnlyResource.Definition { + private DataCollectionRuleAssociationProxyOnlyResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + DataCollectionRuleAssociationProxyOnlyResourceImpl( + DataCollectionRuleAssociationProxyOnlyResourceInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String description() { + return this.innerModel().description(); + } + + public String dataCollectionRuleId() { + return this.innerModel().dataCollectionRuleId(); + } + + public String dataCollectionEndpointId() { + return this.innerModel().dataCollectionEndpointId(); + } + + public KnownDataCollectionRuleAssociationProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public DataCollectionRuleAssociationMetadata metadata() { + return this.innerModel().metadata(); + } + + public DataCollectionRuleAssociationProxyOnlyResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String resourceUri; + + private String associationName; + + public DataCollectionRuleAssociationProxyOnlyResourceImpl withExistingResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + public DataCollectionRuleAssociationProxyOnlyResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRuleAssociations() + .createWithResponse(resourceUri, associationName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DataCollectionRuleAssociationProxyOnlyResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRuleAssociations() + .createWithResponse(resourceUri, associationName, this.innerModel(), context) + .getValue(); + return this; + } + + DataCollectionRuleAssociationProxyOnlyResourceImpl( + String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new DataCollectionRuleAssociationProxyOnlyResourceInner(); + this.serviceManager = serviceManager; + this.associationName = name; + } + + public DataCollectionRuleAssociationProxyOnlyResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRuleAssociations() + .getWithResponse(resourceUri, associationName, Context.NONE) + .getValue(); + return this; + } + + public DataCollectionRuleAssociationProxyOnlyResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRuleAssociations() + .getWithResponse(resourceUri, associationName, context) + .getValue(); + return this; + } + + public DataCollectionRuleAssociationProxyOnlyResourceImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public DataCollectionRuleAssociationProxyOnlyResourceImpl withDataCollectionRuleId(String dataCollectionRuleId) { + this.innerModel().withDataCollectionRuleId(dataCollectionRuleId); + return this; + } + + public DataCollectionRuleAssociationProxyOnlyResourceImpl withDataCollectionEndpointId( + String dataCollectionEndpointId) { + this.innerModel().withDataCollectionEndpointId(dataCollectionEndpointId); + return this; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationsClientImpl.java new file mode 100644 index 0000000000000..2cc38986ccaee --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationsClientImpl.java @@ -0,0 +1,1289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.DataCollectionRuleAssociationsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleAssociationProxyOnlyResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleAssociationProxyOnlyResourceListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DataCollectionRuleAssociationsClient. */ +public final class DataCollectionRuleAssociationsClientImpl implements DataCollectionRuleAssociationsClient { + /** The proxy service used to perform REST calls. */ + private final DataCollectionRuleAssociationsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of DataCollectionRuleAssociationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DataCollectionRuleAssociationsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy + .create( + DataCollectionRuleAssociationsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientDataCollectionRuleAssociations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientDataCol") + public interface DataCollectionRuleAssociationsService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResource( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/dataCollectionRules/{dataCollectionRuleName}/associations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByRule( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataCollectionRuleName") String dataCollectionRuleName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/dataCollectionEndpoints/{dataCollectionEndpointName}/associations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDataCollectionEndpoint( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataCollectionEndpointName") String dataCollectionEndpointName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("associationName") String associationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("associationName") String associationName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DataCollectionRuleAssociationProxyOnlyResourceInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @PathParam("associationName") String associationName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByRuleNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByDataCollectionEndpointNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists associations for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceSinglePageAsync( + String resourceUri) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResource(this.client.getEndpoint(), resourceUri, apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists associations for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceSinglePageAsync( + String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResource(this.client.getEndpoint(), resourceUri, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists associations for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceAsync(String resourceUri) { + return new PagedFlux<>( + () -> listByResourceSinglePageAsync(resourceUri), nextLink -> listByResourceNextSinglePageAsync(nextLink)); + } + + /** + * Lists associations for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceAsync( + String resourceUri, Context context) { + return new PagedFlux<>( + () -> listByResourceSinglePageAsync(resourceUri, context), + nextLink -> listByResourceNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists associations for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResource(String resourceUri) { + return new PagedIterable<>(listByResourceAsync(resourceUri)); + } + + /** + * Lists associations for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResource( + String resourceUri, Context context) { + return new PagedIterable<>(listByResourceAsync(resourceUri, context)); + } + + /** + * Lists associations for the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByRuleSinglePageAsync( + String resourceGroupName, String dataCollectionRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter dataCollectionRuleName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByRule( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionRuleName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists associations for the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByRuleSinglePageAsync( + String resourceGroupName, String dataCollectionRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter dataCollectionRuleName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByRule( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionRuleName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists associations for the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByRuleAsync( + String resourceGroupName, String dataCollectionRuleName) { + return new PagedFlux<>( + () -> listByRuleSinglePageAsync(resourceGroupName, dataCollectionRuleName), + nextLink -> listByRuleNextSinglePageAsync(nextLink)); + } + + /** + * Lists associations for the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByRuleAsync( + String resourceGroupName, String dataCollectionRuleName, Context context) { + return new PagedFlux<>( + () -> listByRuleSinglePageAsync(resourceGroupName, dataCollectionRuleName, context), + nextLink -> listByRuleNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists associations for the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByRule( + String resourceGroupName, String dataCollectionRuleName) { + return new PagedIterable<>(listByRuleAsync(resourceGroupName, dataCollectionRuleName)); + } + + /** + * Lists associations for the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByRule( + String resourceGroupName, String dataCollectionRuleName, Context context) { + return new PagedIterable<>(listByRuleAsync(resourceGroupName, dataCollectionRuleName, context)); + } + + /** + * Lists associations for the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByDataCollectionEndpointSinglePageAsync(String resourceGroupName, String dataCollectionEndpointName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionEndpointName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter dataCollectionEndpointName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByDataCollectionEndpoint( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionEndpointName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists associations for the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByDataCollectionEndpointSinglePageAsync( + String resourceGroupName, String dataCollectionEndpointName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionEndpointName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter dataCollectionEndpointName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDataCollectionEndpoint( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionEndpointName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists associations for the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDataCollectionEndpointAsync( + String resourceGroupName, String dataCollectionEndpointName) { + return new PagedFlux<>( + () -> listByDataCollectionEndpointSinglePageAsync(resourceGroupName, dataCollectionEndpointName), + nextLink -> listByDataCollectionEndpointNextSinglePageAsync(nextLink)); + } + + /** + * Lists associations for the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByDataCollectionEndpointAsync( + String resourceGroupName, String dataCollectionEndpointName, Context context) { + return new PagedFlux<>( + () -> listByDataCollectionEndpointSinglePageAsync(resourceGroupName, dataCollectionEndpointName, context), + nextLink -> listByDataCollectionEndpointNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists associations for the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDataCollectionEndpoint( + String resourceGroupName, String dataCollectionEndpointName) { + return new PagedIterable<>(listByDataCollectionEndpointAsync(resourceGroupName, dataCollectionEndpointName)); + } + + /** + * Lists associations for the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByDataCollectionEndpoint( + String resourceGroupName, String dataCollectionEndpointName, Context context) { + return new PagedIterable<>( + listByDataCollectionEndpointAsync(resourceGroupName, dataCollectionEndpointName, context)); + } + + /** + * Returns the specified association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of generic ARM proxy resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceUri, String associationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (associationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter associationName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.get(this.client.getEndpoint(), resourceUri, associationName, apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns the specified association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of generic ARM proxy resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceUri, String associationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (associationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter associationName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), resourceUri, associationName, apiVersion, accept, context); + } + + /** + * Returns the specified association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of generic ARM proxy resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceUri, String associationName) { + return getWithResponseAsync(resourceUri, associationName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns the specified association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of generic ARM proxy resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceUri, String associationName, Context context) { + return getWithResponseAsync(resourceUri, associationName, context).block(); + } + + /** + * Returns the specified association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of generic ARM proxy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataCollectionRuleAssociationProxyOnlyResourceInner get(String resourceUri, String associationName) { + return getWithResponse(resourceUri, associationName, Context.NONE).getValue(); + } + + /** + * Creates or updates an association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @param body The payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of generic ARM proxy resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceUri, String associationName, DataCollectionRuleAssociationProxyOnlyResourceInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (associationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter associationName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), resourceUri, associationName, apiVersion, body, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @param body The payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of generic ARM proxy resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceUri, + String associationName, + DataCollectionRuleAssociationProxyOnlyResourceInner body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (associationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter associationName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create(this.client.getEndpoint(), resourceUri, associationName, apiVersion, body, accept, context); + } + + /** + * Creates or updates an association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of generic ARM proxy resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceUri, String associationName) { + final DataCollectionRuleAssociationProxyOnlyResourceInner body = null; + return createWithResponseAsync(resourceUri, associationName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates an association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @param body The payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of generic ARM proxy resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceUri, + String associationName, + DataCollectionRuleAssociationProxyOnlyResourceInner body, + Context context) { + return createWithResponseAsync(resourceUri, associationName, body, context).block(); + } + + /** + * Creates or updates an association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of generic ARM proxy resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataCollectionRuleAssociationProxyOnlyResourceInner create(String resourceUri, String associationName) { + final DataCollectionRuleAssociationProxyOnlyResourceInner body = null; + return createWithResponse(resourceUri, associationName, body, Context.NONE).getValue(); + } + + /** + * Deletes an association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceUri, String associationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (associationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter associationName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete(this.client.getEndpoint(), resourceUri, associationName, apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes an association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceUri, String associationName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (associationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter associationName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), resourceUri, associationName, apiVersion, accept, context); + } + + /** + * Deletes an association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceUri, String associationName) { + return deleteWithResponseAsync(resourceUri, associationName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes an association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceUri, String associationName, Context context) { + return deleteWithResponseAsync(resourceUri, associationName, context).block(); + } + + /** + * Deletes an association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceUri, String associationName) { + deleteWithResponse(resourceUri, associationName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByResourceNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByRuleNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByRuleNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByRuleNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByRuleNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByDataCollectionEndpointNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.listByDataCollectionEndpointNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + listByDataCollectionEndpointNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByDataCollectionEndpointNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationsImpl.java new file mode 100644 index 0000000000000..de1865476259d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationsImpl.java @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.DataCollectionRuleAssociationsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleAssociationProxyOnlyResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleAssociationProxyOnlyResource; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleAssociations; + +public final class DataCollectionRuleAssociationsImpl implements DataCollectionRuleAssociations { + private static final ClientLogger LOGGER = new ClientLogger(DataCollectionRuleAssociationsImpl.class); + + private final DataCollectionRuleAssociationsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public DataCollectionRuleAssociationsImpl( + DataCollectionRuleAssociationsClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByResource(String resourceUri) { + PagedIterable inner = + this.serviceClient().listByResource(resourceUri); + return Utils + .mapPage(inner, inner1 -> new DataCollectionRuleAssociationProxyOnlyResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResource( + String resourceUri, Context context) { + PagedIterable inner = + this.serviceClient().listByResource(resourceUri, context); + return Utils + .mapPage(inner, inner1 -> new DataCollectionRuleAssociationProxyOnlyResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByRule( + String resourceGroupName, String dataCollectionRuleName) { + PagedIterable inner = + this.serviceClient().listByRule(resourceGroupName, dataCollectionRuleName); + return Utils + .mapPage(inner, inner1 -> new DataCollectionRuleAssociationProxyOnlyResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByRule( + String resourceGroupName, String dataCollectionRuleName, Context context) { + PagedIterable inner = + this.serviceClient().listByRule(resourceGroupName, dataCollectionRuleName, context); + return Utils + .mapPage(inner, inner1 -> new DataCollectionRuleAssociationProxyOnlyResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByDataCollectionEndpoint( + String resourceGroupName, String dataCollectionEndpointName) { + PagedIterable inner = + this.serviceClient().listByDataCollectionEndpoint(resourceGroupName, dataCollectionEndpointName); + return Utils + .mapPage(inner, inner1 -> new DataCollectionRuleAssociationProxyOnlyResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByDataCollectionEndpoint( + String resourceGroupName, String dataCollectionEndpointName, Context context) { + PagedIterable inner = + this.serviceClient().listByDataCollectionEndpoint(resourceGroupName, dataCollectionEndpointName, context); + return Utils + .mapPage(inner, inner1 -> new DataCollectionRuleAssociationProxyOnlyResourceImpl(inner1, this.manager())); + } + + public Response getWithResponse( + String resourceUri, String associationName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceUri, associationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DataCollectionRuleAssociationProxyOnlyResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DataCollectionRuleAssociationProxyOnlyResource get(String resourceUri, String associationName) { + DataCollectionRuleAssociationProxyOnlyResourceInner inner = + this.serviceClient().get(resourceUri, associationName); + if (inner != null) { + return new DataCollectionRuleAssociationProxyOnlyResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse( + String resourceUri, String associationName, Context context) { + return this.serviceClient().deleteWithResponse(resourceUri, associationName, context); + } + + public void deleteByResourceGroup(String resourceUri, String associationName) { + this.serviceClient().delete(resourceUri, associationName); + } + + public DataCollectionRuleAssociationProxyOnlyResource getById(String id) { + String resourceUri = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", + "resourceUri"); + if (resourceUri == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String associationName = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", + "associationName"); + if (associationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'dataCollectionRuleAssociations'.", + id))); + } + return this.getWithResponse(resourceUri, associationName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceUri = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", + "resourceUri"); + if (resourceUri == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String associationName = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", + "associationName"); + if (associationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'dataCollectionRuleAssociations'.", + id))); + } + return this.getWithResponse(resourceUri, associationName, context); + } + + public void deleteById(String id) { + String resourceUri = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", + "resourceUri"); + if (resourceUri == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String associationName = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", + "associationName"); + if (associationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'dataCollectionRuleAssociations'.", + id))); + } + this.deleteByResourceGroupWithResponse(resourceUri, associationName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceUri = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", + "resourceUri"); + if (resourceUri == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String associationName = + Utils + .getValueFromIdByParameterName( + id, + "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}", + "associationName"); + if (associationName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment" + + " 'dataCollectionRuleAssociations'.", + id))); + } + return this.deleteByResourceGroupWithResponse(resourceUri, associationName, context); + } + + private DataCollectionRuleAssociationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + public DataCollectionRuleAssociationProxyOnlyResourceImpl define(String name) { + return new DataCollectionRuleAssociationProxyOnlyResourceImpl(name, this.manager()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleResourceImpl.java new file mode 100644 index 0000000000000..0e8ee158332fc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleResourceImpl.java @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleDataSources; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleDestinations; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleMetadata; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleResource; +import com.azure.resourcemanager.monitor.generated.models.DataFlow; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionRuleProvisioningState; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionRuleResourceKind; +import com.azure.resourcemanager.monitor.generated.models.ResourceForUpdate; +import com.azure.resourcemanager.monitor.generated.models.StreamDeclaration; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class DataCollectionRuleResourceImpl + implements DataCollectionRuleResource, DataCollectionRuleResource.Definition, DataCollectionRuleResource.Update { + private DataCollectionRuleResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public KnownDataCollectionRuleResourceKind kind() { + return this.innerModel().kind(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String description() { + return this.innerModel().description(); + } + + public String immutableId() { + return this.innerModel().immutableId(); + } + + public String dataCollectionEndpointId() { + return this.innerModel().dataCollectionEndpointId(); + } + + public DataCollectionRuleMetadata metadata() { + return this.innerModel().metadata(); + } + + public Map streamDeclarations() { + Map inner = this.innerModel().streamDeclarations(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public DataCollectionRuleDataSources dataSources() { + return this.innerModel().dataSources(); + } + + public DataCollectionRuleDestinations destinations() { + return this.innerModel().destinations(); + } + + public List dataFlows() { + List inner = this.innerModel().dataFlows(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public KnownDataCollectionRuleProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public DataCollectionRuleResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String dataCollectionRuleName; + + private ResourceForUpdate updateBody; + + public DataCollectionRuleResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public DataCollectionRuleResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRules() + .createWithResponse(resourceGroupName, dataCollectionRuleName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DataCollectionRuleResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRules() + .createWithResponse(resourceGroupName, dataCollectionRuleName, this.innerModel(), context) + .getValue(); + return this; + } + + DataCollectionRuleResourceImpl( + String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new DataCollectionRuleResourceInner(); + this.serviceManager = serviceManager; + this.dataCollectionRuleName = name; + } + + public DataCollectionRuleResourceImpl update() { + this.updateBody = new ResourceForUpdate(); + return this; + } + + public DataCollectionRuleResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRules() + .updateWithResponse(resourceGroupName, dataCollectionRuleName, updateBody, Context.NONE) + .getValue(); + return this; + } + + public DataCollectionRuleResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRules() + .updateWithResponse(resourceGroupName, dataCollectionRuleName, updateBody, context) + .getValue(); + return this; + } + + DataCollectionRuleResourceImpl( + DataCollectionRuleResourceInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.dataCollectionRuleName = Utils.getValueFromIdByName(innerObject.id(), "dataCollectionRules"); + } + + public DataCollectionRuleResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRules() + .getByResourceGroupWithResponse(resourceGroupName, dataCollectionRuleName, Context.NONE) + .getValue(); + return this; + } + + public DataCollectionRuleResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRules() + .getByResourceGroupWithResponse(resourceGroupName, dataCollectionRuleName, context) + .getValue(); + return this; + } + + public DataCollectionRuleResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DataCollectionRuleResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DataCollectionRuleResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public DataCollectionRuleResourceImpl withKind(KnownDataCollectionRuleResourceKind kind) { + this.innerModel().withKind(kind); + return this; + } + + public DataCollectionRuleResourceImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public DataCollectionRuleResourceImpl withDataCollectionEndpointId(String dataCollectionEndpointId) { + this.innerModel().withDataCollectionEndpointId(dataCollectionEndpointId); + return this; + } + + public DataCollectionRuleResourceImpl withStreamDeclarations(Map streamDeclarations) { + this.innerModel().withStreamDeclarations(streamDeclarations); + return this; + } + + public DataCollectionRuleResourceImpl withDataSources(DataCollectionRuleDataSources dataSources) { + this.innerModel().withDataSources(dataSources); + return this; + } + + public DataCollectionRuleResourceImpl withDestinations(DataCollectionRuleDestinations destinations) { + this.innerModel().withDestinations(destinations); + return this; + } + + public DataCollectionRuleResourceImpl withDataFlows(List dataFlows) { + this.innerModel().withDataFlows(dataFlows); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRulesClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRulesClientImpl.java new file mode 100644 index 0000000000000..0ba7403aeb308 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRulesClientImpl.java @@ -0,0 +1,1251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.DataCollectionRulesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleResourceListResult; +import com.azure.resourcemanager.monitor.generated.models.ResourceForUpdate; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DataCollectionRulesClient. */ +public final class DataCollectionRulesClientImpl implements DataCollectionRulesClient { + /** The proxy service used to perform REST calls. */ + private final DataCollectionRulesService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of DataCollectionRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DataCollectionRulesClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(DataCollectionRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientDataCollectionRules to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientDataCol") + public interface DataCollectionRulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/dataCollectionRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/dataCollectionRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/dataCollectionRules/{dataCollectionRuleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataCollectionRuleName") String dataCollectionRuleName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/dataCollectionRules/{dataCollectionRuleName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> create( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataCollectionRuleName") String dataCollectionRuleName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") DataCollectionRuleResourceInner body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/dataCollectionRules/{dataCollectionRuleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataCollectionRuleName") String dataCollectionRuleName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ResourceForUpdate body, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/dataCollectionRules/{dataCollectionRuleName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("dataCollectionRuleName") String dataCollectionRuleName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all data collection rules in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all data collection rules in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all data collection rules in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Lists all data collection rules in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all data collection rules in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Lists all data collection rules in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Lists all data collection rules in the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all data collection rules in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists all data collection rules in the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Lists all data collection rules in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists all data collection rules in the specified subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists all data collection rules in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Returns the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String dataCollectionRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter dataCollectionRuleName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionRuleName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String dataCollectionRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter dataCollectionRuleName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionRuleName, + apiVersion, + accept, + context); + } + + /** + * Returns the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String dataCollectionRuleName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, dataCollectionRuleName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String dataCollectionRuleName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, dataCollectionRuleName, context).block(); + } + + /** + * Returns the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataCollectionRuleResourceInner getByResourceGroup(String resourceGroupName, String dataCollectionRuleName) { + return getByResourceGroupWithResponse(resourceGroupName, dataCollectionRuleName, Context.NONE).getValue(); + } + + /** + * Creates or updates a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param body The payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, String dataCollectionRuleName, DataCollectionRuleResourceInner body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter dataCollectionRuleName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionRuleName, + apiVersion, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param body The payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createWithResponseAsync( + String resourceGroupName, + String dataCollectionRuleName, + DataCollectionRuleResourceInner body, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter dataCollectionRuleName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionRuleName, + apiVersion, + body, + accept, + context); + } + + /** + * Creates or updates a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String dataCollectionRuleName) { + final DataCollectionRuleResourceInner body = null; + return createWithResponseAsync(resourceGroupName, dataCollectionRuleName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param body The payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createWithResponse( + String resourceGroupName, + String dataCollectionRuleName, + DataCollectionRuleResourceInner body, + Context context) { + return createWithResponseAsync(resourceGroupName, dataCollectionRuleName, body, context).block(); + } + + /** + * Creates or updates a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataCollectionRuleResourceInner create(String resourceGroupName, String dataCollectionRuleName) { + final DataCollectionRuleResourceInner body = null; + return createWithResponse(resourceGroupName, dataCollectionRuleName, body, Context.NONE).getValue(); + } + + /** + * Updates part of a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param body The payload. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String dataCollectionRuleName, ResourceForUpdate body) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter dataCollectionRuleName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionRuleName, + apiVersion, + body, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates part of a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param body The payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String dataCollectionRuleName, ResourceForUpdate body, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter dataCollectionRuleName is required and cannot be null.")); + } + if (body != null) { + body.validate(); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionRuleName, + apiVersion, + body, + accept, + context); + } + + /** + * Updates part of a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync(String resourceGroupName, String dataCollectionRuleName) { + final ResourceForUpdate body = null; + return updateWithResponseAsync(resourceGroupName, dataCollectionRuleName, body) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates part of a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param body The payload. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String dataCollectionRuleName, ResourceForUpdate body, Context context) { + return updateWithResponseAsync(resourceGroupName, dataCollectionRuleName, body, context).block(); + } + + /** + * Updates part of a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DataCollectionRuleResourceInner update(String resourceGroupName, String dataCollectionRuleName) { + final ResourceForUpdate body = null; + return updateWithResponse(resourceGroupName, dataCollectionRuleName, body, Context.NONE).getValue(); + } + + /** + * Deletes a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String dataCollectionRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter dataCollectionRuleName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionRuleName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync( + String resourceGroupName, String dataCollectionRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (dataCollectionRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter dataCollectionRuleName is required and cannot be null.")); + } + final String apiVersion = "2021-09-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + dataCollectionRuleName, + apiVersion, + accept, + context); + } + + /** + * Deletes a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String dataCollectionRuleName) { + return deleteWithResponseAsync(resourceGroupName, dataCollectionRuleName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String dataCollectionRuleName, Context context) { + return deleteWithResponseAsync(resourceGroupName, dataCollectionRuleName, context).block(); + } + + /** + * Deletes a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String dataCollectionRuleName) { + deleteWithResponse(resourceGroupName, dataCollectionRuleName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources along with {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRulesImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRulesImpl.java new file mode 100644 index 0000000000000..76f8447ede6f7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRulesImpl.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.DataCollectionRulesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleResource; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRules; + +public final class DataCollectionRulesImpl implements DataCollectionRules { + private static final ClientLogger LOGGER = new ClientLogger(DataCollectionRulesImpl.class); + + private final DataCollectionRulesClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public DataCollectionRulesImpl( + DataCollectionRulesClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new DataCollectionRuleResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new DataCollectionRuleResourceImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new DataCollectionRuleResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new DataCollectionRuleResourceImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String dataCollectionRuleName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, dataCollectionRuleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DataCollectionRuleResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DataCollectionRuleResource getByResourceGroup(String resourceGroupName, String dataCollectionRuleName) { + DataCollectionRuleResourceInner inner = + this.serviceClient().getByResourceGroup(resourceGroupName, dataCollectionRuleName); + if (inner != null) { + return new DataCollectionRuleResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse( + String resourceGroupName, String dataCollectionRuleName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, dataCollectionRuleName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String dataCollectionRuleName) { + this.serviceClient().delete(resourceGroupName, dataCollectionRuleName); + } + + public DataCollectionRuleResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String dataCollectionRuleName = Utils.getValueFromIdByName(id, "dataCollectionRules"); + if (dataCollectionRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'dataCollectionRules'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, dataCollectionRuleName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String dataCollectionRuleName = Utils.getValueFromIdByName(id, "dataCollectionRules"); + if (dataCollectionRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'dataCollectionRules'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, dataCollectionRuleName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String dataCollectionRuleName = Utils.getValueFromIdByName(id, "dataCollectionRules"); + if (dataCollectionRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'dataCollectionRules'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, dataCollectionRuleName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String dataCollectionRuleName = Utils.getValueFromIdByName(id, "dataCollectionRules"); + if (dataCollectionRuleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'dataCollectionRules'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, dataCollectionRuleName, context); + } + + private DataCollectionRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + public DataCollectionRuleResourceImpl define(String name) { + return new DataCollectionRuleResourceImpl(name, this.manager()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoriesClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoriesClientImpl.java new file mode 100644 index 0000000000000..28b5986dc0c06 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoriesClientImpl.java @@ -0,0 +1,326 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.DiagnosticSettingsCategoriesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsCategoryResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsCategoryResourceCollection; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DiagnosticSettingsCategoriesClient. */ +public final class DiagnosticSettingsCategoriesClientImpl implements DiagnosticSettingsCategoriesClient { + /** The proxy service used to perform REST calls. */ + private final DiagnosticSettingsCategoriesService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of DiagnosticSettingsCategoriesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DiagnosticSettingsCategoriesClientImpl(MonitorClientImpl client) { + this.service = + RestProxy + .create( + DiagnosticSettingsCategoriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientDiagnosticSettingsCategories to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientDiagnos") + public interface DiagnosticSettingsCategoriesService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @PathParam("name") String name, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostic settings category for the specified resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceUri, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), resourceUri, apiVersion, name, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostic settings category for the specified resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceUri, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), resourceUri, apiVersion, name, accept, context); + } + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostic settings category for the specified resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri, String name) { + return getWithResponseAsync(resourceUri, name).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostic settings category for the specified resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceUri, String name, Context context) { + return getWithResponseAsync(resourceUri, name, context).block(); + } + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostic settings category for the specified resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiagnosticSettingsCategoryResourceInner get(String resourceUri, String name) { + return getWithResponse(resourceUri, name, Context.NONE).getValue(); + } + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of diagnostic setting category resources along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceUri) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), resourceUri, apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of diagnostic setting category resources along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), resourceUri, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of diagnostic setting category resources as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri)); + } + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of diagnostic setting category resources as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri, context)); + } + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of diagnostic setting category resources as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri) { + return new PagedIterable<>(listAsync(resourceUri)); + } + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of diagnostic setting category resources as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri, Context context) { + return new PagedIterable<>(listAsync(resourceUri, context)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoriesImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoriesImpl.java new file mode 100644 index 0000000000000..c0cb828b92c71 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoriesImpl.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.DiagnosticSettingsCategoriesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsCategoryResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsCategories; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsCategoryResource; + +public final class DiagnosticSettingsCategoriesImpl implements DiagnosticSettingsCategories { + private static final ClientLogger LOGGER = new ClientLogger(DiagnosticSettingsCategoriesImpl.class); + + private final DiagnosticSettingsCategoriesClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public DiagnosticSettingsCategoriesImpl( + DiagnosticSettingsCategoriesClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceUri, String name, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceUri, name, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DiagnosticSettingsCategoryResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DiagnosticSettingsCategoryResource get(String resourceUri, String name) { + DiagnosticSettingsCategoryResourceInner inner = this.serviceClient().get(resourceUri, name); + if (inner != null) { + return new DiagnosticSettingsCategoryResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return Utils.mapPage(inner, inner1 -> new DiagnosticSettingsCategoryResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceUri, Context context) { + PagedIterable inner = this.serviceClient().list(resourceUri, context); + return Utils.mapPage(inner, inner1 -> new DiagnosticSettingsCategoryResourceImpl(inner1, this.manager())); + } + + private DiagnosticSettingsCategoriesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoryResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoryResourceImpl.java new file mode 100644 index 0000000000000..c3eb1489ef9b1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoryResourceImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsCategoryResourceInner; +import com.azure.resourcemanager.monitor.generated.models.CategoryType; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsCategoryResource; +import java.util.Collections; +import java.util.List; + +public final class DiagnosticSettingsCategoryResourceImpl implements DiagnosticSettingsCategoryResource { + private DiagnosticSettingsCategoryResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + DiagnosticSettingsCategoryResourceImpl( + DiagnosticSettingsCategoryResourceInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public CategoryType categoryType() { + return this.innerModel().categoryType(); + } + + public List categoryGroups() { + List inner = this.innerModel().categoryGroups(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public DiagnosticSettingsCategoryResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsOperationsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsOperationsClientImpl.java new file mode 100644 index 0000000000000..407652031cd61 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsOperationsClientImpl.java @@ -0,0 +1,594 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.DiagnosticSettingsOperationsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsResourceCollection; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DiagnosticSettingsOperationsClient. */ +public final class DiagnosticSettingsOperationsClientImpl implements DiagnosticSettingsOperationsClient { + /** The proxy service used to perform REST calls. */ + private final DiagnosticSettingsOperationsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of DiagnosticSettingsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DiagnosticSettingsOperationsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy + .create( + DiagnosticSettingsOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientDiagnosticSettingsOperations to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientDiagnos") + public interface DiagnosticSettingsOperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @PathParam("name") String name, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @PathParam("name") String name, + @BodyParam("application/json") DiagnosticSettingsResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @PathParam("name") String name, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings for the specified resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String resourceUri, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.get(this.client.getEndpoint(), resourceUri, apiVersion, name, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings for the specified resource along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceUri, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.get(this.client.getEndpoint(), resourceUri, apiVersion, name, accept, context); + } + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings for the specified resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceUri, String name) { + return getWithResponseAsync(resourceUri, name).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings for the specified resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String resourceUri, String name, Context context) { + return getWithResponseAsync(resourceUri, name, context).block(); + } + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings for the specified resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiagnosticSettingsResourceInner get(String resourceUri, String name) { + return getWithResponse(resourceUri, name, Context.NONE).getValue(); + } + + /** + * Creates or updates diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostic setting resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceUri, String name, DiagnosticSettingsResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), resourceUri, apiVersion, name, parameters, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param parameters Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostic setting resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceUri, String name, DiagnosticSettingsResourceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate(this.client.getEndpoint(), resourceUri, apiVersion, name, parameters, accept, context); + } + + /** + * Creates or updates diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostic setting resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceUri, String name, DiagnosticSettingsResourceInner parameters) { + return createOrUpdateWithResponseAsync(resourceUri, name, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param parameters Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostic setting resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceUri, String name, DiagnosticSettingsResourceInner parameters, Context context) { + return createOrUpdateWithResponseAsync(resourceUri, name, parameters, context).block(); + } + + /** + * Creates or updates diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostic setting resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiagnosticSettingsResourceInner createOrUpdate( + String resourceUri, String name, DiagnosticSettingsResourceInner parameters) { + return createOrUpdateWithResponse(resourceUri, name, parameters, Context.NONE).getValue(); + } + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceUri, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.delete(this.client.getEndpoint(), resourceUri, apiVersion, name, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceUri, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.delete(this.client.getEndpoint(), resourceUri, apiVersion, name, accept, context); + } + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceUri, String name) { + return deleteWithResponseAsync(resourceUri, name).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceUri, String name, Context context) { + return deleteWithResponseAsync(resourceUri, name, context).block(); + } + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceUri, String name) { + deleteWithResponse(resourceUri, name, Context.NONE); + } + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings list for the specified resource along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceUri) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), resourceUri, apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings list for the specified resource along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String apiVersion = "2021-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), resourceUri, apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings list for the specified resource as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri)); + } + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings list for the specified resource as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri, context)); + } + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings list for the specified resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri) { + return new PagedIterable<>(listAsync(resourceUri)); + } + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings list for the specified resource as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri, Context context) { + return new PagedIterable<>(listAsync(resourceUri, context)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsOperationsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsOperationsImpl.java new file mode 100644 index 0000000000000..30147c8a038be --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsOperationsImpl.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.DiagnosticSettingsOperationsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsOperations; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsResource; + +public final class DiagnosticSettingsOperationsImpl implements DiagnosticSettingsOperations { + private static final ClientLogger LOGGER = new ClientLogger(DiagnosticSettingsOperationsImpl.class); + + private final DiagnosticSettingsOperationsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public DiagnosticSettingsOperationsImpl( + DiagnosticSettingsOperationsClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse(String resourceUri, String name, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceUri, name, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DiagnosticSettingsResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public DiagnosticSettingsResource get(String resourceUri, String name) { + DiagnosticSettingsResourceInner inner = this.serviceClient().get(resourceUri, name); + if (inner != null) { + return new DiagnosticSettingsResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse(String resourceUri, String name, Context context) { + return this.serviceClient().deleteWithResponse(resourceUri, name, context); + } + + public void deleteByResourceGroup(String resourceUri, String name) { + this.serviceClient().delete(resourceUri, name); + } + + public PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return Utils.mapPage(inner, inner1 -> new DiagnosticSettingsResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceUri, Context context) { + PagedIterable inner = this.serviceClient().list(resourceUri, context); + return Utils.mapPage(inner, inner1 -> new DiagnosticSettingsResourceImpl(inner1, this.manager())); + } + + public DiagnosticSettingsResource getById(String id) { + String resourceUri = + Utils + .getValueFromIdByParameterName( + id, "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String name = + Utils + .getValueFromIdByParameterName( + id, "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", "name"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'diagnosticSettings'.", id))); + } + return this.getWithResponse(resourceUri, name, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceUri = + Utils + .getValueFromIdByParameterName( + id, "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String name = + Utils + .getValueFromIdByParameterName( + id, "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", "name"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'diagnosticSettings'.", id))); + } + return this.getWithResponse(resourceUri, name, context); + } + + public void deleteById(String id) { + String resourceUri = + Utils + .getValueFromIdByParameterName( + id, "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String name = + Utils + .getValueFromIdByParameterName( + id, "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", "name"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'diagnosticSettings'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceUri, name, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceUri = + Utils + .getValueFromIdByParameterName( + id, "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", "resourceUri"); + if (resourceUri == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'resourceUri'.", id))); + } + String name = + Utils + .getValueFromIdByParameterName( + id, "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", "name"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'diagnosticSettings'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceUri, name, context); + } + + private DiagnosticSettingsOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + public DiagnosticSettingsResourceImpl define(String name) { + return new DiagnosticSettingsResourceImpl(name, this.manager()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsResourceImpl.java new file mode 100644 index 0000000000000..3b3887af770c8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsResourceImpl.java @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsResource; +import com.azure.resourcemanager.monitor.generated.models.LogSettings; +import com.azure.resourcemanager.monitor.generated.models.MetricSettings; +import java.util.Collections; +import java.util.List; + +public final class DiagnosticSettingsResourceImpl + implements DiagnosticSettingsResource, DiagnosticSettingsResource.Definition, DiagnosticSettingsResource.Update { + private DiagnosticSettingsResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String storageAccountId() { + return this.innerModel().storageAccountId(); + } + + public String serviceBusRuleId() { + return this.innerModel().serviceBusRuleId(); + } + + public String eventHubAuthorizationRuleId() { + return this.innerModel().eventHubAuthorizationRuleId(); + } + + public String eventHubName() { + return this.innerModel().eventHubName(); + } + + public List metrics() { + List inner = this.innerModel().metrics(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List logs() { + List inner = this.innerModel().logs(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String workspaceId() { + return this.innerModel().workspaceId(); + } + + public String marketplacePartnerId() { + return this.innerModel().marketplacePartnerId(); + } + + public String logAnalyticsDestinationType() { + return this.innerModel().logAnalyticsDestinationType(); + } + + public DiagnosticSettingsResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String resourceUri; + + private String name; + + public DiagnosticSettingsResourceImpl withExistingResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + public DiagnosticSettingsResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getDiagnosticSettingsOperations() + .createOrUpdateWithResponse(resourceUri, name, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DiagnosticSettingsResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDiagnosticSettingsOperations() + .createOrUpdateWithResponse(resourceUri, name, this.innerModel(), context) + .getValue(); + return this; + } + + DiagnosticSettingsResourceImpl( + String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new DiagnosticSettingsResourceInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public DiagnosticSettingsResourceImpl update() { + return this; + } + + public DiagnosticSettingsResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDiagnosticSettingsOperations() + .createOrUpdateWithResponse(resourceUri, name, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DiagnosticSettingsResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDiagnosticSettingsOperations() + .createOrUpdateWithResponse(resourceUri, name, this.innerModel(), context) + .getValue(); + return this; + } + + DiagnosticSettingsResourceImpl( + DiagnosticSettingsResourceInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceUri = + Utils + .getValueFromIdByParameterName( + innerObject.id(), + "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", + "resourceUri"); + this.name = + Utils + .getValueFromIdByParameterName( + innerObject.id(), "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}", "name"); + } + + public DiagnosticSettingsResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDiagnosticSettingsOperations() + .getWithResponse(resourceUri, name, Context.NONE) + .getValue(); + return this; + } + + public DiagnosticSettingsResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDiagnosticSettingsOperations() + .getWithResponse(resourceUri, name, context) + .getValue(); + return this; + } + + public DiagnosticSettingsResourceImpl withStorageAccountId(String storageAccountId) { + this.innerModel().withStorageAccountId(storageAccountId); + return this; + } + + public DiagnosticSettingsResourceImpl withServiceBusRuleId(String serviceBusRuleId) { + this.innerModel().withServiceBusRuleId(serviceBusRuleId); + return this; + } + + public DiagnosticSettingsResourceImpl withEventHubAuthorizationRuleId(String eventHubAuthorizationRuleId) { + this.innerModel().withEventHubAuthorizationRuleId(eventHubAuthorizationRuleId); + return this; + } + + public DiagnosticSettingsResourceImpl withEventHubName(String eventHubName) { + this.innerModel().withEventHubName(eventHubName); + return this; + } + + public DiagnosticSettingsResourceImpl withMetrics(List metrics) { + this.innerModel().withMetrics(metrics); + return this; + } + + public DiagnosticSettingsResourceImpl withLogs(List logs) { + this.innerModel().withLogs(logs); + return this; + } + + public DiagnosticSettingsResourceImpl withWorkspaceId(String workspaceId) { + this.innerModel().withWorkspaceId(workspaceId); + return this; + } + + public DiagnosticSettingsResourceImpl withMarketplacePartnerId(String marketplacePartnerId) { + this.innerModel().withMarketplacePartnerId(marketplacePartnerId); + return this; + } + + public DiagnosticSettingsResourceImpl withLogAnalyticsDestinationType(String logAnalyticsDestinationType) { + this.innerModel().withLogAnalyticsDestinationType(logAnalyticsDestinationType); + return this; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/EventCategoriesClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/EventCategoriesClientImpl.java new file mode 100644 index 0000000000000..cc870a7dd715e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/EventCategoriesClientImpl.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.EventCategoriesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.LocalizableStringInner; +import com.azure.resourcemanager.monitor.generated.models.EventCategoryCollection; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in EventCategoriesClient. */ +public final class EventCategoriesClientImpl implements EventCategoriesClient { + /** The proxy service used to perform REST calls. */ + private final EventCategoriesService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of EventCategoriesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + EventCategoriesClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(EventCategoriesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientEventCategories to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientEventCa") + public interface EventCategoriesService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Insights/eventcategories") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2015-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy along with + * {@link PagedResponse} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2015-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Get the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy as paginated + * response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * Get the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy as paginated + * response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * Get the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/EventCategoriesImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/EventCategoriesImpl.java new file mode 100644 index 0000000000000..6c71602d69dca --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/EventCategoriesImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.EventCategoriesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.LocalizableStringInner; +import com.azure.resourcemanager.monitor.generated.models.EventCategories; +import com.azure.resourcemanager.monitor.generated.models.LocalizableString; + +public final class EventCategoriesImpl implements EventCategories { + private static final ClientLogger LOGGER = new ClientLogger(EventCategoriesImpl.class); + + private final EventCategoriesClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public EventCategoriesImpl( + EventCategoriesClient innerClient, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new LocalizableStringImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new LocalizableStringImpl(inner1, this.manager())); + } + + private EventCategoriesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/EventDataImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/EventDataImpl.java new file mode 100644 index 0000000000000..a8f7b714df645 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/EventDataImpl.java @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.EventDataInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.LocalizableStringInner; +import com.azure.resourcemanager.monitor.generated.models.EventData; +import com.azure.resourcemanager.monitor.generated.models.EventLevel; +import com.azure.resourcemanager.monitor.generated.models.HttpRequestInfo; +import com.azure.resourcemanager.monitor.generated.models.LocalizableString; +import com.azure.resourcemanager.monitor.generated.models.SenderAuthorization; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class EventDataImpl implements EventData { + private EventDataInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + EventDataImpl( + EventDataInner innerObject, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public SenderAuthorization authorization() { + return this.innerModel().authorization(); + } + + public Map claims() { + Map inner = this.innerModel().claims(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String caller() { + return this.innerModel().caller(); + } + + public String description() { + return this.innerModel().description(); + } + + public String id() { + return this.innerModel().id(); + } + + public String eventDataId() { + return this.innerModel().eventDataId(); + } + + public String correlationId() { + return this.innerModel().correlationId(); + } + + public LocalizableString eventName() { + LocalizableStringInner inner = this.innerModel().eventName(); + if (inner != null) { + return new LocalizableStringImpl(inner, this.manager()); + } else { + return null; + } + } + + public LocalizableString category() { + LocalizableStringInner inner = this.innerModel().category(); + if (inner != null) { + return new LocalizableStringImpl(inner, this.manager()); + } else { + return null; + } + } + + public HttpRequestInfo httpRequest() { + return this.innerModel().httpRequest(); + } + + public EventLevel level() { + return this.innerModel().level(); + } + + public String resourceGroupName() { + return this.innerModel().resourceGroupName(); + } + + public LocalizableString resourceProviderName() { + LocalizableStringInner inner = this.innerModel().resourceProviderName(); + if (inner != null) { + return new LocalizableStringImpl(inner, this.manager()); + } else { + return null; + } + } + + public String resourceId() { + return this.innerModel().resourceId(); + } + + public LocalizableString resourceType() { + LocalizableStringInner inner = this.innerModel().resourceType(); + if (inner != null) { + return new LocalizableStringImpl(inner, this.manager()); + } else { + return null; + } + } + + public String operationId() { + return this.innerModel().operationId(); + } + + public LocalizableString operationName() { + LocalizableStringInner inner = this.innerModel().operationName(); + if (inner != null) { + return new LocalizableStringImpl(inner, this.manager()); + } else { + return null; + } + } + + public Map properties() { + Map inner = this.innerModel().properties(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public LocalizableString status() { + LocalizableStringInner inner = this.innerModel().status(); + if (inner != null) { + return new LocalizableStringImpl(inner, this.manager()); + } else { + return null; + } + } + + public LocalizableString subStatus() { + LocalizableStringInner inner = this.innerModel().subStatus(); + if (inner != null) { + return new LocalizableStringImpl(inner, this.manager()); + } else { + return null; + } + } + + public OffsetDateTime eventTimestamp() { + return this.innerModel().eventTimestamp(); + } + + public OffsetDateTime submissionTimestamp() { + return this.innerModel().submissionTimestamp(); + } + + public String subscriptionId() { + return this.innerModel().subscriptionId(); + } + + public String tenantId() { + return this.innerModel().tenantId(); + } + + public EventDataInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/IncidentImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/IncidentImpl.java new file mode 100644 index 0000000000000..2996626b7ea47 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/IncidentImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.IncidentInner; +import com.azure.resourcemanager.monitor.generated.models.Incident; +import java.time.OffsetDateTime; + +public final class IncidentImpl implements Incident { + private IncidentInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + IncidentImpl(IncidentInner innerObject, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public String ruleName() { + return this.innerModel().ruleName(); + } + + public Boolean isActive() { + return this.innerModel().isActive(); + } + + public OffsetDateTime activatedTime() { + return this.innerModel().activatedTime(); + } + + public OffsetDateTime resolvedTime() { + return this.innerModel().resolvedTime(); + } + + public IncidentInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LocalizableStringImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LocalizableStringImpl.java new file mode 100644 index 0000000000000..768fbbadfb5f8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LocalizableStringImpl.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.LocalizableStringInner; +import com.azure.resourcemanager.monitor.generated.models.LocalizableString; + +public final class LocalizableStringImpl implements LocalizableString { + private LocalizableStringInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + LocalizableStringImpl( + LocalizableStringInner innerObject, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String value() { + return this.innerModel().value(); + } + + public String localizedValue() { + return this.innerModel().localizedValue(); + } + + public LocalizableStringInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LogProfileResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LogProfileResourceImpl.java new file mode 100644 index 0000000000000..84dfaa26ca839 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LogProfileResourceImpl.java @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.LogProfileResourceInner; +import com.azure.resourcemanager.monitor.generated.models.LogProfileResource; +import com.azure.resourcemanager.monitor.generated.models.LogProfileResourcePatch; +import com.azure.resourcemanager.monitor.generated.models.RetentionPolicy; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class LogProfileResourceImpl + implements LogProfileResource, LogProfileResource.Definition, LogProfileResource.Update { + private LogProfileResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String storageAccountId() { + return this.innerModel().storageAccountId(); + } + + public String serviceBusRuleId() { + return this.innerModel().serviceBusRuleId(); + } + + public List locations() { + List inner = this.innerModel().locations(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List categories() { + List inner = this.innerModel().categories(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public RetentionPolicy retentionPolicy() { + return this.innerModel().retentionPolicy(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public LogProfileResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String logProfileName; + + private LogProfileResourcePatch updateLogProfilesResource; + + public LogProfileResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getLogProfiles() + .createOrUpdateWithResponse(logProfileName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public LogProfileResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLogProfiles() + .createOrUpdateWithResponse(logProfileName, this.innerModel(), context) + .getValue(); + return this; + } + + LogProfileResourceImpl(String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new LogProfileResourceInner(); + this.serviceManager = serviceManager; + this.logProfileName = name; + } + + public LogProfileResourceImpl update() { + this.updateLogProfilesResource = new LogProfileResourcePatch(); + return this; + } + + public LogProfileResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getLogProfiles() + .updateWithResponse(logProfileName, updateLogProfilesResource, Context.NONE) + .getValue(); + return this; + } + + public LogProfileResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getLogProfiles() + .updateWithResponse(logProfileName, updateLogProfilesResource, context) + .getValue(); + return this; + } + + LogProfileResourceImpl( + LogProfileResourceInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.logProfileName = Utils.getValueFromIdByName(innerObject.id(), "logprofiles"); + } + + public LogProfileResource refresh() { + this.innerObject = + serviceManager.serviceClient().getLogProfiles().getWithResponse(logProfileName, Context.NONE).getValue(); + return this; + } + + public LogProfileResource refresh(Context context) { + this.innerObject = + serviceManager.serviceClient().getLogProfiles().getWithResponse(logProfileName, context).getValue(); + return this; + } + + public LogProfileResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public LogProfileResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public LogProfileResourceImpl withLocations(List locations) { + if (isInCreateMode()) { + this.innerModel().withLocations(locations); + return this; + } else { + this.updateLogProfilesResource.withLocations(locations); + return this; + } + } + + public LogProfileResourceImpl withCategories(List categories) { + if (isInCreateMode()) { + this.innerModel().withCategories(categories); + return this; + } else { + this.updateLogProfilesResource.withCategories(categories); + return this; + } + } + + public LogProfileResourceImpl withRetentionPolicy(RetentionPolicy retentionPolicy) { + if (isInCreateMode()) { + this.innerModel().withRetentionPolicy(retentionPolicy); + return this; + } else { + this.updateLogProfilesResource.withRetentionPolicy(retentionPolicy); + return this; + } + } + + public LogProfileResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateLogProfilesResource.withTags(tags); + return this; + } + } + + public LogProfileResourceImpl withStorageAccountId(String storageAccountId) { + if (isInCreateMode()) { + this.innerModel().withStorageAccountId(storageAccountId); + return this; + } else { + this.updateLogProfilesResource.withStorageAccountId(storageAccountId); + return this; + } + } + + public LogProfileResourceImpl withServiceBusRuleId(String serviceBusRuleId) { + if (isInCreateMode()) { + this.innerModel().withServiceBusRuleId(serviceBusRuleId); + return this; + } else { + this.updateLogProfilesResource.withServiceBusRuleId(serviceBusRuleId); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LogProfilesClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LogProfilesClientImpl.java new file mode 100644 index 0000000000000..7e67159c9961e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LogProfilesClientImpl.java @@ -0,0 +1,783 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.LogProfilesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.LogProfileResourceInner; +import com.azure.resourcemanager.monitor.generated.models.LogProfileCollection; +import com.azure.resourcemanager.monitor.generated.models.LogProfileResourcePatch; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LogProfilesClient. */ +public final class LogProfilesClientImpl implements LogProfilesClient { + /** The proxy service used to perform REST calls. */ + private final LogProfilesService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of LogProfilesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LogProfilesClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(LogProfilesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientLogProfiles to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientLogProf") + public interface LogProfilesService { + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("logProfileName") String logProfileName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("logProfileName") String logProfileName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("logProfileName") String logProfileName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") LogProfileResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles/{logProfileName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("logProfileName") String logProfileName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") LogProfileResourcePatch logProfilesResource, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/logprofiles") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Deletes the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String logProfileName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (logProfileName == null) { + return Mono.error(new IllegalArgumentException("Parameter logProfileName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2016-03-01"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + logProfileName, + apiVersion, + this.client.getSubscriptionId(), + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the log profile. + * + * @param logProfileName The name of the log profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String logProfileName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (logProfileName == null) { + return Mono.error(new IllegalArgumentException("Parameter logProfileName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2016-03-01"; + context = this.client.mergeContext(context); + return service + .delete(this.client.getEndpoint(), logProfileName, apiVersion, this.client.getSubscriptionId(), context); + } + + /** + * Deletes the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String logProfileName) { + return deleteWithResponseAsync(logProfileName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes the log profile. + * + * @param logProfileName The name of the log profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String logProfileName, Context context) { + return deleteWithResponseAsync(logProfileName, context).block(); + } + + /** + * Deletes the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String logProfileName) { + deleteWithResponse(logProfileName, Context.NONE); + } + + /** + * Gets the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String logProfileName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (logProfileName == null) { + return Mono.error(new IllegalArgumentException("Parameter logProfileName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + logProfileName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the log profile. + * + * @param logProfileName The name of the log profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync(String logProfileName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (logProfileName == null) { + return Mono.error(new IllegalArgumentException("Parameter logProfileName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + logProfileName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Gets the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String logProfileName) { + return getWithResponseAsync(logProfileName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the log profile. + * + * @param logProfileName The name of the log profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse(String logProfileName, Context context) { + return getWithResponseAsync(logProfileName, context).block(); + } + + /** + * Gets the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogProfileResourceInner get(String logProfileName) { + return getWithResponse(logProfileName, Context.NONE).getValue(); + } + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param logProfileName The name of the log profile. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String logProfileName, LogProfileResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (logProfileName == null) { + return Mono.error(new IllegalArgumentException("Parameter logProfileName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + logProfileName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param logProfileName The name of the log profile. + * @param parameters Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String logProfileName, LogProfileResourceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (logProfileName == null) { + return Mono.error(new IllegalArgumentException("Parameter logProfileName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + logProfileName, + apiVersion, + this.client.getSubscriptionId(), + parameters, + accept, + context); + } + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param logProfileName The name of the log profile. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String logProfileName, LogProfileResourceInner parameters) { + return createOrUpdateWithResponseAsync(logProfileName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param logProfileName The name of the log profile. + * @param parameters Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String logProfileName, LogProfileResourceInner parameters, Context context) { + return createOrUpdateWithResponseAsync(logProfileName, parameters, context).block(); + } + + /** + * Create or update a log profile in Azure Monitoring REST API. + * + * @param logProfileName The name of the log profile. + * @param parameters Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogProfileResourceInner createOrUpdate(String logProfileName, LogProfileResourceInner parameters) { + return createOrUpdateWithResponse(logProfileName, parameters, Context.NONE).getValue(); + } + + /** + * Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. + * + * @param logProfileName The name of the log profile. + * @param logProfilesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String logProfileName, LogProfileResourcePatch logProfilesResource) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (logProfileName == null) { + return Mono.error(new IllegalArgumentException("Parameter logProfileName is required and cannot be null.")); + } + if (logProfilesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter logProfilesResource is required and cannot be null.")); + } else { + logProfilesResource.validate(); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + logProfileName, + apiVersion, + logProfilesResource, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. + * + * @param logProfileName The name of the log profile. + * @param logProfilesResource Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String logProfileName, LogProfileResourcePatch logProfilesResource, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (logProfileName == null) { + return Mono.error(new IllegalArgumentException("Parameter logProfileName is required and cannot be null.")); + } + if (logProfilesResource == null) { + return Mono + .error(new IllegalArgumentException("Parameter logProfilesResource is required and cannot be null.")); + } else { + logProfilesResource.validate(); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + logProfileName, + apiVersion, + logProfilesResource, + accept, + context); + } + + /** + * Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. + * + * @param logProfileName The name of the log profile. + * @param logProfilesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String logProfileName, LogProfileResourcePatch logProfilesResource) { + return updateWithResponseAsync(logProfileName, logProfilesResource) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. + * + * @param logProfileName The name of the log profile. + * @param logProfilesResource Parameters supplied to the operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String logProfileName, LogProfileResourcePatch logProfilesResource, Context context) { + return updateWithResponseAsync(logProfileName, logProfilesResource, context).block(); + } + + /** + * Updates an existing LogProfilesResource. To update other fields use the CreateOrUpdate method. + * + * @param logProfileName The name of the log profile. + * @param logProfilesResource Parameters supplied to the operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogProfileResourceInner update(String logProfileName, LogProfileResourcePatch logProfilesResource) { + return updateWithResponse(logProfileName, logProfilesResource, Context.NONE).getValue(); + } + + /** + * List the log profiles. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of log profiles along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List the log profiles. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of log profiles along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2016-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List the log profiles. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of log profiles as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * List the log profiles. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of log profiles as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * List the log profiles. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of log profiles as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List the log profiles. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of log profiles as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LogProfilesImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LogProfilesImpl.java new file mode 100644 index 0000000000000..7a82b8a2ce1b3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LogProfilesImpl.java @@ -0,0 +1,125 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.LogProfilesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.LogProfileResourceInner; +import com.azure.resourcemanager.monitor.generated.models.LogProfileResource; +import com.azure.resourcemanager.monitor.generated.models.LogProfiles; + +public final class LogProfilesImpl implements LogProfiles { + private static final ClientLogger LOGGER = new ClientLogger(LogProfilesImpl.class); + + private final LogProfilesClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public LogProfilesImpl( + LogProfilesClient innerClient, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response deleteWithResponse(String logProfileName, Context context) { + return this.serviceClient().deleteWithResponse(logProfileName, context); + } + + public void delete(String logProfileName) { + this.serviceClient().delete(logProfileName); + } + + public Response getWithResponse(String logProfileName, Context context) { + Response inner = this.serviceClient().getWithResponse(logProfileName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new LogProfileResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public LogProfileResource get(String logProfileName) { + LogProfileResourceInner inner = this.serviceClient().get(logProfileName); + if (inner != null) { + return new LogProfileResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new LogProfileResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new LogProfileResourceImpl(inner1, this.manager())); + } + + public LogProfileResource getById(String id) { + String logProfileName = Utils.getValueFromIdByName(id, "logprofiles"); + if (logProfileName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'logprofiles'.", id))); + } + return this.getWithResponse(logProfileName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String logProfileName = Utils.getValueFromIdByName(id, "logprofiles"); + if (logProfileName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'logprofiles'.", id))); + } + return this.getWithResponse(logProfileName, context); + } + + public void deleteById(String id) { + String logProfileName = Utils.getValueFromIdByName(id, "logprofiles"); + if (logProfileName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'logprofiles'.", id))); + } + this.deleteWithResponse(logProfileName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String logProfileName = Utils.getValueFromIdByName(id, "logprofiles"); + if (logProfileName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'logprofiles'.", id))); + } + return this.deleteWithResponse(logProfileName, context); + } + + private LogProfilesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + public LogProfileResourceImpl define(String name) { + return new LogProfileResourceImpl(name, this.manager()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetadataValueImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetadataValueImpl.java new file mode 100644 index 0000000000000..4f1bc4adb81ce --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetadataValueImpl.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.LocalizableStringInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetadataValueInner; +import com.azure.resourcemanager.monitor.generated.models.LocalizableString; +import com.azure.resourcemanager.monitor.generated.models.MetadataValue; + +public final class MetadataValueImpl implements MetadataValue { + private MetadataValueInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + MetadataValueImpl( + MetadataValueInner innerObject, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public LocalizableString name() { + LocalizableStringInner inner = this.innerModel().name(); + if (inner != null) { + return new LocalizableStringImpl(inner, this.manager()); + } else { + return null; + } + } + + public String value() { + return this.innerModel().value(); + } + + public MetadataValueInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertResourceImpl.java new file mode 100644 index 0000000000000..5c5cb9d8de661 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertResourceImpl.java @@ -0,0 +1,357 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricAlertResourceInner; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertAction; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertCriteria; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertResource; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertResourcePatch; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class MetricAlertResourceImpl + implements MetricAlertResource, MetricAlertResource.Definition, MetricAlertResource.Update { + private MetricAlertResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public String description() { + return this.innerModel().description(); + } + + public int severity() { + return this.innerModel().severity(); + } + + public boolean enabled() { + return this.innerModel().enabled(); + } + + public List scopes() { + List inner = this.innerModel().scopes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Duration evaluationFrequency() { + return this.innerModel().evaluationFrequency(); + } + + public Duration windowSize() { + return this.innerModel().windowSize(); + } + + public String targetResourceType() { + return this.innerModel().targetResourceType(); + } + + public String targetResourceRegion() { + return this.innerModel().targetResourceRegion(); + } + + public MetricAlertCriteria criteria() { + return this.innerModel().criteria(); + } + + public Boolean autoMitigate() { + return this.innerModel().autoMitigate(); + } + + public List actions() { + List inner = this.innerModel().actions(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public OffsetDateTime lastUpdatedTime() { + return this.innerModel().lastUpdatedTime(); + } + + public Boolean isMigrated() { + return this.innerModel().isMigrated(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public MetricAlertResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String ruleName; + + private MetricAlertResourcePatch updateParameters; + + public MetricAlertResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public MetricAlertResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getMetricAlerts() + .createOrUpdateWithResponse(resourceGroupName, ruleName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public MetricAlertResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMetricAlerts() + .createOrUpdateWithResponse(resourceGroupName, ruleName, this.innerModel(), context) + .getValue(); + return this; + } + + MetricAlertResourceImpl(String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new MetricAlertResourceInner(); + this.serviceManager = serviceManager; + this.ruleName = name; + } + + public MetricAlertResourceImpl update() { + this.updateParameters = new MetricAlertResourcePatch(); + return this; + } + + public MetricAlertResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getMetricAlerts() + .updateWithResponse(resourceGroupName, ruleName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public MetricAlertResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMetricAlerts() + .updateWithResponse(resourceGroupName, ruleName, updateParameters, context) + .getValue(); + return this; + } + + MetricAlertResourceImpl( + MetricAlertResourceInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.ruleName = Utils.getValueFromIdByName(innerObject.id(), "metricAlerts"); + } + + public MetricAlertResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getMetricAlerts() + .getByResourceGroupWithResponse(resourceGroupName, ruleName, Context.NONE) + .getValue(); + return this; + } + + public MetricAlertResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getMetricAlerts() + .getByResourceGroupWithResponse(resourceGroupName, ruleName, context) + .getValue(); + return this; + } + + public MetricAlertResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public MetricAlertResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public MetricAlertResourceImpl withSeverity(int severity) { + this.innerModel().withSeverity(severity); + return this; + } + + public MetricAlertResourceImpl withEnabled(boolean enabled) { + this.innerModel().withEnabled(enabled); + return this; + } + + public MetricAlertResourceImpl withScopes(List scopes) { + if (isInCreateMode()) { + this.innerModel().withScopes(scopes); + return this; + } else { + this.updateParameters.withScopes(scopes); + return this; + } + } + + public MetricAlertResourceImpl withEvaluationFrequency(Duration evaluationFrequency) { + if (isInCreateMode()) { + this.innerModel().withEvaluationFrequency(evaluationFrequency); + return this; + } else { + this.updateParameters.withEvaluationFrequency(evaluationFrequency); + return this; + } + } + + public MetricAlertResourceImpl withWindowSize(Duration windowSize) { + if (isInCreateMode()) { + this.innerModel().withWindowSize(windowSize); + return this; + } else { + this.updateParameters.withWindowSize(windowSize); + return this; + } + } + + public MetricAlertResourceImpl withCriteria(MetricAlertCriteria criteria) { + if (isInCreateMode()) { + this.innerModel().withCriteria(criteria); + return this; + } else { + this.updateParameters.withCriteria(criteria); + return this; + } + } + + public MetricAlertResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public MetricAlertResourceImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateParameters.withDescription(description); + return this; + } + } + + public MetricAlertResourceImpl withTargetResourceType(String targetResourceType) { + if (isInCreateMode()) { + this.innerModel().withTargetResourceType(targetResourceType); + return this; + } else { + this.updateParameters.withTargetResourceType(targetResourceType); + return this; + } + } + + public MetricAlertResourceImpl withTargetResourceRegion(String targetResourceRegion) { + if (isInCreateMode()) { + this.innerModel().withTargetResourceRegion(targetResourceRegion); + return this; + } else { + this.updateParameters.withTargetResourceRegion(targetResourceRegion); + return this; + } + } + + public MetricAlertResourceImpl withAutoMitigate(Boolean autoMitigate) { + if (isInCreateMode()) { + this.innerModel().withAutoMitigate(autoMitigate); + return this; + } else { + this.updateParameters.withAutoMitigate(autoMitigate); + return this; + } + } + + public MetricAlertResourceImpl withActions(List actions) { + if (isInCreateMode()) { + this.innerModel().withActions(actions); + return this; + } else { + this.updateParameters.withActions(actions); + return this; + } + } + + public MetricAlertResourceImpl withSeverity(Integer severity) { + this.updateParameters.withSeverity(severity); + return this; + } + + public MetricAlertResourceImpl withEnabled(Boolean enabled) { + this.updateParameters.withEnabled(enabled); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertStatusCollectionImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertStatusCollectionImpl.java new file mode 100644 index 0000000000000..a0241d700fe6e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertStatusCollectionImpl.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricAlertStatusCollectionInner; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertStatus; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertStatusCollection; +import java.util.Collections; +import java.util.List; + +public final class MetricAlertStatusCollectionImpl implements MetricAlertStatusCollection { + private MetricAlertStatusCollectionInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + MetricAlertStatusCollectionImpl( + MetricAlertStatusCollectionInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public MetricAlertStatusCollectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsClientImpl.java new file mode 100644 index 0000000000000..bf9f4c2474ea4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsClientImpl.java @@ -0,0 +1,1036 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.MetricAlertsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricAlertResourceInner; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertResourceCollection; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertResourcePatch; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MetricAlertsClient. */ +public final class MetricAlertsClientImpl implements MetricAlertsClient { + /** The proxy service used to perform REST calls. */ + private final MetricAlertsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of MetricAlertsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MetricAlertsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(MetricAlertsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientMetricAlerts to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientMetricA") + public interface MetricAlertsService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/metricAlerts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/metricAlerts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/metricAlerts/{ruleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ruleName") String ruleName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/metricAlerts/{ruleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ruleName") String ruleName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MetricAlertResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/metricAlerts/{ruleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ruleName") String ruleName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") MetricAlertResourcePatch parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/metricAlerts/{ruleName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ruleName") String ruleName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieve alert rule definitions in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieve alert rule definitions in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieve alert rule definitions in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * Retrieve alert rule definitions in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * Retrieve alert rule definitions in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Retrieve alert rule definitions in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync(String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2018-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources along with {@link PagedResponse} on successful completion + * of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2018-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName)); + } + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context)); + } + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String ruleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + final String apiVersion = "2018-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String ruleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + final String apiVersion = "2018-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + accept, + context); + } + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String ruleName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, ruleName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, ruleName, context).block(); + } + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetricAlertResourceInner getByResourceGroup(String resourceGroupName, String ruleName) { + return getByResourceGroupWithResponse(resourceGroupName, ruleName, Context.NONE).getValue(); + } + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String ruleName, MetricAlertResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2018-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String ruleName, MetricAlertResourceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2018-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + parameters, + accept, + context); + } + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String ruleName, MetricAlertResourceInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, ruleName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String ruleName, MetricAlertResourceInner parameters, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, ruleName, parameters, context).block(); + } + + /** + * Create or update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetricAlertResourceInner createOrUpdate( + String resourceGroupName, String ruleName, MetricAlertResourceInner parameters) { + return createOrUpdateWithResponse(resourceGroupName, ruleName, parameters, Context.NONE).getValue(); + } + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2018-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2018-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + parameters, + accept, + context); + } + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters) { + return updateWithResponseAsync(resourceGroupName, ruleName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, ruleName, parameters, context).block(); + } + + /** + * Update an metric alert definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetricAlertResourceInner update( + String resourceGroupName, String ruleName, MetricAlertResourcePatch parameters) { + return updateWithResponse(resourceGroupName, ruleName, parameters, Context.NONE).getValue(); + } + + /** + * Delete an alert rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String ruleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + final String apiVersion = "2018-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete an alert rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String ruleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + final String apiVersion = "2018-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + accept, + context); + } + + /** + * Delete an alert rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String ruleName) { + return deleteWithResponseAsync(resourceGroupName, ruleName).flatMap(ignored -> Mono.empty()); + } + + /** + * Delete an alert rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String ruleName, Context context) { + return deleteWithResponseAsync(resourceGroupName, ruleName, context).block(); + } + + /** + * Delete an alert rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String ruleName) { + deleteWithResponse(resourceGroupName, ruleName, Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsImpl.java new file mode 100644 index 0000000000000..fa53eb9b3dccd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsImpl.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.MetricAlertsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricAlertResourceInner; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertResource; +import com.azure.resourcemanager.monitor.generated.models.MetricAlerts; + +public final class MetricAlertsImpl implements MetricAlerts { + private static final ClientLogger LOGGER = new ClientLogger(MetricAlertsImpl.class); + + private final MetricAlertsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public MetricAlertsImpl( + MetricAlertsClient innerClient, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new MetricAlertResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new MetricAlertResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new MetricAlertResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new MetricAlertResourceImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, ruleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MetricAlertResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MetricAlertResource getByResourceGroup(String resourceGroupName, String ruleName) { + MetricAlertResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, ruleName); + if (inner != null) { + return new MetricAlertResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, ruleName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String ruleName) { + this.serviceClient().delete(resourceGroupName, ruleName); + } + + public MetricAlertResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String ruleName = Utils.getValueFromIdByName(id, "metricAlerts"); + if (ruleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'metricAlerts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, ruleName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String ruleName = Utils.getValueFromIdByName(id, "metricAlerts"); + if (ruleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'metricAlerts'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, ruleName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String ruleName = Utils.getValueFromIdByName(id, "metricAlerts"); + if (ruleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'metricAlerts'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, ruleName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String ruleName = Utils.getValueFromIdByName(id, "metricAlerts"); + if (ruleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'metricAlerts'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, ruleName, context); + } + + private MetricAlertsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + public MetricAlertResourceImpl define(String name) { + return new MetricAlertResourceImpl(name, this.manager()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsStatusClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsStatusClientImpl.java new file mode 100644 index 0000000000000..009b8b5ab8c13 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsStatusClientImpl.java @@ -0,0 +1,390 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.MetricAlertsStatusClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricAlertStatusCollectionInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MetricAlertsStatusClient. */ +public final class MetricAlertsStatusClientImpl implements MetricAlertsStatusClient { + /** The proxy service used to perform REST calls. */ + private final MetricAlertsStatusService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of MetricAlertsStatusClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MetricAlertsStatusClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(MetricAlertsStatusService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientMetricAlertsStatus to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientMetricA") + public interface MetricAlertsStatusService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/metricAlerts/{ruleName}/status") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ruleName") String ruleName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/metricAlerts/{ruleName}/status/{statusName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByName( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ruleName") String ruleName, + @PathParam("statusName") String statusName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceGroupName, String ruleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + final String apiVersion = "2018-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceGroupName, String ruleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + final String apiVersion = "2018-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + accept, + context); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String resourceGroupName, String ruleName) { + return listWithResponseAsync(resourceGroupName, ruleName).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse( + String resourceGroupName, String ruleName, Context context) { + return listWithResponseAsync(resourceGroupName, ruleName, context).block(); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetricAlertStatusCollectionInner list(String resourceGroupName, String ruleName) { + return listWithResponse(resourceGroupName, ruleName, Context.NONE).getValue(); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByNameWithResponseAsync( + String resourceGroupName, String ruleName, String statusName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (statusName == null) { + return Mono.error(new IllegalArgumentException("Parameter statusName is required and cannot be null.")); + } + final String apiVersion = "2018-03-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByName( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + statusName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByNameWithResponseAsync( + String resourceGroupName, String ruleName, String statusName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (statusName == null) { + return Mono.error(new IllegalArgumentException("Parameter statusName is required and cannot be null.")); + } + final String apiVersion = "2018-03-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByName( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + statusName, + apiVersion, + accept, + context); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listByNameAsync( + String resourceGroupName, String ruleName, String statusName) { + return listByNameWithResponseAsync(resourceGroupName, ruleName, statusName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listByNameWithResponse( + String resourceGroupName, String ruleName, String statusName, Context context) { + return listByNameWithResponseAsync(resourceGroupName, ruleName, statusName, context).block(); + } + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public MetricAlertStatusCollectionInner listByName(String resourceGroupName, String ruleName, String statusName) { + return listByNameWithResponse(resourceGroupName, ruleName, statusName, Context.NONE).getValue(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsStatusImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsStatusImpl.java new file mode 100644 index 0000000000000..47441860450f4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsStatusImpl.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.MetricAlertsStatusClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricAlertStatusCollectionInner; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertStatusCollection; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertsStatus; + +public final class MetricAlertsStatusImpl implements MetricAlertsStatus { + private static final ClientLogger LOGGER = new ClientLogger(MetricAlertsStatusImpl.class); + + private final MetricAlertsStatusClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public MetricAlertsStatusImpl( + MetricAlertsStatusClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response listWithResponse( + String resourceGroupName, String ruleName, Context context) { + Response inner = + this.serviceClient().listWithResponse(resourceGroupName, ruleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MetricAlertStatusCollectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MetricAlertStatusCollection list(String resourceGroupName, String ruleName) { + MetricAlertStatusCollectionInner inner = this.serviceClient().list(resourceGroupName, ruleName); + if (inner != null) { + return new MetricAlertStatusCollectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listByNameWithResponse( + String resourceGroupName, String ruleName, String statusName, Context context) { + Response inner = + this.serviceClient().listByNameWithResponse(resourceGroupName, ruleName, statusName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new MetricAlertStatusCollectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public MetricAlertStatusCollection listByName(String resourceGroupName, String ruleName, String statusName) { + MetricAlertStatusCollectionInner inner = + this.serviceClient().listByName(resourceGroupName, ruleName, statusName); + if (inner != null) { + return new MetricAlertStatusCollectionImpl(inner, this.manager()); + } else { + return null; + } + } + + private MetricAlertsStatusClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricDefinitionImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricDefinitionImpl.java new file mode 100644 index 0000000000000..d2b231d44f4cc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricDefinitionImpl.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.LocalizableStringInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.monitor.generated.models.AggregationType; +import com.azure.resourcemanager.monitor.generated.models.LocalizableString; +import com.azure.resourcemanager.monitor.generated.models.MetricAvailability; +import com.azure.resourcemanager.monitor.generated.models.MetricClass; +import com.azure.resourcemanager.monitor.generated.models.MetricDefinition; +import com.azure.resourcemanager.monitor.generated.models.MetricUnit; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class MetricDefinitionImpl implements MetricDefinition { + private MetricDefinitionInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + MetricDefinitionImpl( + MetricDefinitionInner innerObject, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Boolean isDimensionRequired() { + return this.innerModel().isDimensionRequired(); + } + + public String resourceId() { + return this.innerModel().resourceId(); + } + + public String namespace() { + return this.innerModel().namespace(); + } + + public LocalizableString name() { + LocalizableStringInner inner = this.innerModel().name(); + if (inner != null) { + return new LocalizableStringImpl(inner, this.manager()); + } else { + return null; + } + } + + public String displayDescription() { + return this.innerModel().displayDescription(); + } + + public String category() { + return this.innerModel().category(); + } + + public MetricClass metricClass() { + return this.innerModel().metricClass(); + } + + public MetricUnit unit() { + return this.innerModel().unit(); + } + + public AggregationType primaryAggregationType() { + return this.innerModel().primaryAggregationType(); + } + + public List supportedAggregationTypes() { + List inner = this.innerModel().supportedAggregationTypes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List metricAvailabilities() { + List inner = this.innerModel().metricAvailabilities(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String id() { + return this.innerModel().id(); + } + + public List dimensions() { + List inner = this.innerModel().dimensions(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new LocalizableStringImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public MetricDefinitionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricDefinitionsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricDefinitionsClientImpl.java new file mode 100644 index 0000000000000..1c7f4869a4931 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricDefinitionsClientImpl.java @@ -0,0 +1,218 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.MetricDefinitionsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.monitor.generated.models.MetricDefinitionCollection; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MetricDefinitionsClient. */ +public final class MetricDefinitionsClientImpl implements MetricDefinitionsClient { + /** The proxy service used to perform REST calls. */ + private final MetricDefinitionsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of MetricDefinitionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MetricDefinitionsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(MetricDefinitionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientMetricDefinitions to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientMetricD") + public interface MetricDefinitionsService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.Insights/metricDefinitions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @QueryParam("metricnamespace") String metricnamespace, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @param metricnamespace Metric namespace to query metric definitions for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric definitions along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceUri, String metricnamespace) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String apiVersion = "2018-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.list(this.client.getEndpoint(), resourceUri, apiVersion, metricnamespace, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric definitions along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceUri, String metricnamespace, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String apiVersion = "2018-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), resourceUri, apiVersion, metricnamespace, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @param metricnamespace Metric namespace to query metric definitions for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric definitions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri, String metricnamespace) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri, metricnamespace)); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric definitions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri) { + final String metricnamespace = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri, metricnamespace)); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric definitions as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri, String metricnamespace, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri, metricnamespace, context)); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri) { + final String metricnamespace = null; + return new PagedIterable<>(listAsync(resourceUri, metricnamespace)); + } + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric definitions as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri, String metricnamespace, Context context) { + return new PagedIterable<>(listAsync(resourceUri, metricnamespace, context)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricDefinitionsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricDefinitionsImpl.java new file mode 100644 index 0000000000000..3e3b38107cc0e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricDefinitionsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.MetricDefinitionsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricDefinitionInner; +import com.azure.resourcemanager.monitor.generated.models.MetricDefinition; +import com.azure.resourcemanager.monitor.generated.models.MetricDefinitions; + +public final class MetricDefinitionsImpl implements MetricDefinitions { + private static final ClientLogger LOGGER = new ClientLogger(MetricDefinitionsImpl.class); + + private final MetricDefinitionsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public MetricDefinitionsImpl( + MetricDefinitionsClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceUri, String metricnamespace, Context context) { + PagedIterable inner = this.serviceClient().list(resourceUri, metricnamespace, context); + return Utils.mapPage(inner, inner1 -> new MetricDefinitionImpl(inner1, this.manager())); + } + + private MetricDefinitionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricImpl.java new file mode 100644 index 0000000000000..5877f1f7b1dc5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.LocalizableStringInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.monitor.generated.models.LocalizableString; +import com.azure.resourcemanager.monitor.generated.models.Metric; +import com.azure.resourcemanager.monitor.generated.models.MetricUnit; +import com.azure.resourcemanager.monitor.generated.models.TimeSeriesElement; +import java.util.Collections; +import java.util.List; + +public final class MetricImpl implements Metric { + private MetricInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + MetricImpl(MetricInner innerObject, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public LocalizableString name() { + LocalizableStringInner inner = this.innerModel().name(); + if (inner != null) { + return new LocalizableStringImpl(inner, this.manager()); + } else { + return null; + } + } + + public String displayDescription() { + return this.innerModel().displayDescription(); + } + + public String errorCode() { + return this.innerModel().errorCode(); + } + + public String errorMessage() { + return this.innerModel().errorMessage(); + } + + public MetricUnit unit() { + return this.innerModel().unit(); + } + + public List timeseries() { + List inner = this.innerModel().timeseries(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public MetricInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricNamespaceImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricNamespaceImpl.java new file mode 100644 index 0000000000000..f16989591e61f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricNamespaceImpl.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricNamespaceInner; +import com.azure.resourcemanager.monitor.generated.models.MetricNamespace; +import com.azure.resourcemanager.monitor.generated.models.MetricNamespaceName; +import com.azure.resourcemanager.monitor.generated.models.NamespaceClassification; + +public final class MetricNamespaceImpl implements MetricNamespace { + private MetricNamespaceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + MetricNamespaceImpl( + MetricNamespaceInner innerObject, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public String name() { + return this.innerModel().name(); + } + + public NamespaceClassification classification() { + return this.innerModel().classification(); + } + + public MetricNamespaceName properties() { + return this.innerModel().properties(); + } + + public MetricNamespaceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricNamespacesClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricNamespacesClientImpl.java new file mode 100644 index 0000000000000..f9d88f0b83d3e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricNamespacesClientImpl.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.MetricNamespacesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricNamespaceInner; +import com.azure.resourcemanager.monitor.generated.models.MetricNamespaceCollection; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MetricNamespacesClient. */ +public final class MetricNamespacesClientImpl implements MetricNamespacesClient { + /** The proxy service used to perform REST calls. */ + private final MetricNamespacesService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of MetricNamespacesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MetricNamespacesClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(MetricNamespacesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientMetricNamespaces to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientMetricN") + public interface MetricNamespacesService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/microsoft.insights/metricNamespaces") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("api-version") String apiVersion, + @QueryParam("startTime") String startTime, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @param startTime The ISO 8601 conform Date start time from which to query for metric namespaces. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric namespaces along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceUri, String startTime) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String apiVersion = "2017-12-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), resourceUri, apiVersion, startTime, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @param startTime The ISO 8601 conform Date start time from which to query for metric namespaces. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric namespaces along with {@link PagedResponse} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceUri, String startTime, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String apiVersion = "2017-12-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), resourceUri, apiVersion, startTime, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @param startTime The ISO 8601 conform Date start time from which to query for metric namespaces. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric namespaces as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri, String startTime) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri, startTime)); + } + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric namespaces as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri) { + final String startTime = null; + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri, startTime)); + } + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @param startTime The ISO 8601 conform Date start time from which to query for metric namespaces. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric namespaces as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceUri, String startTime, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceUri, startTime, context)); + } + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric namespaces as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri) { + final String startTime = null; + return new PagedIterable<>(listAsync(resourceUri, startTime)); + } + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @param startTime The ISO 8601 conform Date start time from which to query for metric namespaces. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric namespaces as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceUri, String startTime, Context context) { + return new PagedIterable<>(listAsync(resourceUri, startTime, context)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricNamespacesImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricNamespacesImpl.java new file mode 100644 index 0000000000000..2cf947f833f04 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricNamespacesImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.MetricNamespacesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricNamespaceInner; +import com.azure.resourcemanager.monitor.generated.models.MetricNamespace; +import com.azure.resourcemanager.monitor.generated.models.MetricNamespaces; + +public final class MetricNamespacesImpl implements MetricNamespaces { + private static final ClientLogger LOGGER = new ClientLogger(MetricNamespacesImpl.class); + + private final MetricNamespacesClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public MetricNamespacesImpl( + MetricNamespacesClient innerClient, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceUri) { + PagedIterable inner = this.serviceClient().list(resourceUri); + return Utils.mapPage(inner, inner1 -> new MetricNamespaceImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceUri, String startTime, Context context) { + PagedIterable inner = this.serviceClient().list(resourceUri, startTime, context); + return Utils.mapPage(inner, inner1 -> new MetricNamespaceImpl(inner1, this.manager())); + } + + private MetricNamespacesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricsOperationsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricsOperationsClientImpl.java new file mode 100644 index 0000000000000..fb662290bc3b3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricsOperationsClientImpl.java @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.MetricsOperationsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.ResponseInner; +import com.azure.resourcemanager.monitor.generated.models.ResultType; +import java.time.Duration; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MetricsOperationsClient. */ +public final class MetricsOperationsClientImpl implements MetricsOperationsClient { + /** The proxy service used to perform REST calls. */ + private final MetricsOperationsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of MetricsOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MetricsOperationsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(MetricsOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientMetricsOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientMetrics") + public interface MetricsOperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.Insights/metrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @QueryParam("timespan") String timespan, + @QueryParam("interval") Duration interval, + @QueryParam("metricnames") String metricnames, + @QueryParam("aggregation") String aggregation, + @QueryParam("top") Integer top, + @QueryParam("orderby") String orderBy, + @QueryParam("$filter") String filter, + @QueryParam("resultType") ResultType resultType, + @QueryParam("api-version") String apiVersion, + @QueryParam("metricnamespace") String metricnamespace, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * **Lists the metric values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @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'**. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param top The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. + * @param orderBy The aggregation to use for sorting results and the direction of the sort. Only one order can be + * specified. Examples: sum asc. + * @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' "**. + * @param resultType Reduces the set of data collected. The syntax allowed depends on the operation. See the + * operation's description for details. + * @param metricnamespace Metric namespace to query metric definitions for. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a metrics query along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceUri, + String timespan, + Duration interval, + String metricnames, + String aggregation, + Integer top, + String orderBy, + String filter, + ResultType resultType, + String metricnamespace) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String apiVersion = "2018-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + resourceUri, + timespan, + interval, + metricnames, + aggregation, + top, + orderBy, + filter, + resultType, + apiVersion, + metricnamespace, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * **Lists the metric values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @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'**. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param top The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. + * @param orderBy The aggregation to use for sorting results and the direction of the sort. Only one order can be + * specified. Examples: sum asc. + * @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' "**. + * @param resultType Reduces the set of data collected. The syntax allowed depends on the operation. See the + * operation's description for details. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a metrics query along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + String resourceUri, + String timespan, + Duration interval, + String metricnames, + String aggregation, + Integer top, + String orderBy, + String filter, + ResultType resultType, + String metricnamespace, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String apiVersion = "2018-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + resourceUri, + timespan, + interval, + metricnames, + aggregation, + top, + orderBy, + filter, + resultType, + apiVersion, + metricnamespace, + accept, + context); + } + + /** + * **Lists the metric values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a metrics query on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String resourceUri) { + final String timespan = null; + final Duration interval = null; + final String metricnames = null; + final String aggregation = null; + final Integer top = null; + final String orderBy = null; + final String filter = null; + final ResultType resultType = null; + final String metricnamespace = null; + return listWithResponseAsync( + resourceUri, + timespan, + interval, + metricnames, + aggregation, + top, + orderBy, + filter, + resultType, + metricnamespace) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * **Lists the metric values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @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'**. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param top The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. + * @param orderBy The aggregation to use for sorting results and the direction of the sort. Only one order can be + * specified. Examples: sum asc. + * @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' "**. + * @param resultType Reduces the set of data collected. The syntax allowed depends on the operation. See the + * operation's description for details. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a metrics query along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse( + String resourceUri, + String timespan, + Duration interval, + String metricnames, + String aggregation, + Integer top, + String orderBy, + String filter, + ResultType resultType, + String metricnamespace, + Context context) { + return listWithResponseAsync( + resourceUri, + timespan, + interval, + metricnames, + aggregation, + top, + orderBy, + filter, + resultType, + metricnamespace, + context) + .block(); + } + + /** + * **Lists the metric values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a metrics query. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ResponseInner list(String resourceUri) { + final String timespan = null; + final Duration interval = null; + final String metricnames = null; + final String aggregation = null; + final Integer top = null; + final String orderBy = null; + final String filter = null; + final ResultType resultType = null; + final String metricnamespace = null; + return listWithResponse( + resourceUri, + timespan, + interval, + metricnames, + aggregation, + top, + orderBy, + filter, + resultType, + metricnamespace, + Context.NONE) + .getValue(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricsOperationsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricsOperationsImpl.java new file mode 100644 index 0000000000000..5d897e4ead25a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricsOperationsImpl.java @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.MetricsOperationsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.ResponseInner; +import com.azure.resourcemanager.monitor.generated.models.MetricsOperations; +import com.azure.resourcemanager.monitor.generated.models.ResponseModel; +import com.azure.resourcemanager.monitor.generated.models.ResultType; +import java.time.Duration; + +public final class MetricsOperationsImpl implements MetricsOperations { + private static final ClientLogger LOGGER = new ClientLogger(MetricsOperationsImpl.class); + + private final MetricsOperationsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public MetricsOperationsImpl( + MetricsOperationsClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response listWithResponse( + String resourceUri, + String timespan, + Duration interval, + String metricnames, + String aggregation, + Integer top, + String orderBy, + String filter, + ResultType resultType, + String metricnamespace, + Context context) { + Response inner = + this + .serviceClient() + .listWithResponse( + resourceUri, + timespan, + interval, + metricnames, + aggregation, + top, + orderBy, + filter, + resultType, + metricnamespace, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ResponseModelImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ResponseModel list(String resourceUri) { + ResponseInner inner = this.serviceClient().list(resourceUri); + if (inner != null) { + return new ResponseModelImpl(inner, this.manager()); + } else { + return null; + } + } + + private MetricsOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorClientBuilder.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorClientBuilder.java new file mode 100644 index 0000000000000..7c04412aa8c48 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorClientBuilder.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ServiceClientBuilder; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpPipelineBuilder; +import com.azure.core.http.policy.RetryPolicy; +import com.azure.core.http.policy.UserAgentPolicy; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.serializer.SerializerFactory; +import com.azure.core.util.serializer.SerializerAdapter; +import java.time.Duration; + +/** A builder for creating a new instance of the MonitorClientImpl type. */ +@ServiceClientBuilder(serviceClients = {MonitorClientImpl.class}) +public final class MonitorClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the MonitorClientBuilder. + */ + public MonitorClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MonitorClientBuilder. + */ + public MonitorClientBuilder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /* + * The environment to connect to + */ + private AzureEnvironment environment; + + /** + * Sets The environment to connect to. + * + * @param environment the environment value. + * @return the MonitorClientBuilder. + */ + public MonitorClientBuilder environment(AzureEnvironment environment) { + this.environment = environment; + return this; + } + + /* + * The HTTP pipeline to send requests through + */ + private HttpPipeline pipeline; + + /** + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. + * @return the MonitorClientBuilder. + */ + public MonitorClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; + return this; + } + + /* + * The default poll interval for long-running operation + */ + private Duration defaultPollInterval; + + /** + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. + * @return the MonitorClientBuilder. + */ + public MonitorClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; + return this; + } + + /* + * The serializer to serialize an object into a string + */ + private SerializerAdapter serializerAdapter; + + /** + * Sets The serializer to serialize an object into a string. + * + * @param serializerAdapter the serializerAdapter value. + * @return the MonitorClientBuilder. + */ + public MonitorClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MonitorClientImpl with the provided parameters. + * + * @return an instance of MonitorClientImpl. + */ + public MonitorClientImpl buildClient() { + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = + (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval = + (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = + (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + MonitorClientImpl client = + new MonitorClientImpl( + localPipeline, + localSerializerAdapter, + localDefaultPollInterval, + localEnvironment, + subscriptionId, + localEndpoint); + return client; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorClientImpl.java new file mode 100644 index 0000000000000..bcb19d87a061f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorClientImpl.java @@ -0,0 +1,697 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaders; +import com.azure.core.http.HttpPipeline; +import com.azure.core.http.HttpResponse; +import com.azure.core.http.rest.Response; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.management.polling.PollerFactory; +import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.AsyncPollResponse; +import com.azure.core.util.polling.LongRunningOperationStatus; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.serializer.SerializerAdapter; +import com.azure.core.util.serializer.SerializerEncoding; +import com.azure.resourcemanager.monitor.generated.fluent.ActionGroupsClient; +import com.azure.resourcemanager.monitor.generated.fluent.ActivityLogAlertsClient; +import com.azure.resourcemanager.monitor.generated.fluent.ActivityLogsClient; +import com.azure.resourcemanager.monitor.generated.fluent.AlertRuleIncidentsClient; +import com.azure.resourcemanager.monitor.generated.fluent.AlertRulesClient; +import com.azure.resourcemanager.monitor.generated.fluent.AutoscaleSettingsClient; +import com.azure.resourcemanager.monitor.generated.fluent.AzureMonitorWorkspacesClient; +import com.azure.resourcemanager.monitor.generated.fluent.BaselinesClient; +import com.azure.resourcemanager.monitor.generated.fluent.DataCollectionEndpointsClient; +import com.azure.resourcemanager.monitor.generated.fluent.DataCollectionRuleAssociationsClient; +import com.azure.resourcemanager.monitor.generated.fluent.DataCollectionRulesClient; +import com.azure.resourcemanager.monitor.generated.fluent.DiagnosticSettingsCategoriesClient; +import com.azure.resourcemanager.monitor.generated.fluent.DiagnosticSettingsOperationsClient; +import com.azure.resourcemanager.monitor.generated.fluent.EventCategoriesClient; +import com.azure.resourcemanager.monitor.generated.fluent.LogProfilesClient; +import com.azure.resourcemanager.monitor.generated.fluent.MetricAlertsClient; +import com.azure.resourcemanager.monitor.generated.fluent.MetricAlertsStatusClient; +import com.azure.resourcemanager.monitor.generated.fluent.MetricDefinitionsClient; +import com.azure.resourcemanager.monitor.generated.fluent.MetricNamespacesClient; +import com.azure.resourcemanager.monitor.generated.fluent.MetricsOperationsClient; +import com.azure.resourcemanager.monitor.generated.fluent.MonitorClient; +import com.azure.resourcemanager.monitor.generated.fluent.MonitorOperationsClient; +import com.azure.resourcemanager.monitor.generated.fluent.OperationsClient; +import com.azure.resourcemanager.monitor.generated.fluent.PredictiveMetricsClient; +import com.azure.resourcemanager.monitor.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.monitor.generated.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.monitor.generated.fluent.PrivateLinkScopeOperationStatusClient; +import com.azure.resourcemanager.monitor.generated.fluent.PrivateLinkScopedResourcesClient; +import com.azure.resourcemanager.monitor.generated.fluent.PrivateLinkScopesClient; +import com.azure.resourcemanager.monitor.generated.fluent.ScheduledQueryRulesClient; +import com.azure.resourcemanager.monitor.generated.fluent.TenantActivityLogsClient; +import com.azure.resourcemanager.monitor.generated.fluent.VMInsightsClient; +import java.io.IOException; +import java.lang.reflect.Type; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.time.Duration; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** Initializes a new instance of the MonitorClientImpl type. */ +@ServiceClient(builder = MonitorClientBuilder.class) +public final class MonitorClientImpl implements MonitorClient { + /** The ID of the target subscription. */ + private final String subscriptionId; + + /** + * Gets The ID of the target subscription. + * + * @return the subscriptionId value. + */ + public String getSubscriptionId() { + return this.subscriptionId; + } + + /** server parameter. */ + private final String endpoint; + + /** + * Gets server parameter. + * + * @return the endpoint value. + */ + public String getEndpoint() { + return this.endpoint; + } + + /** The HTTP pipeline to send requests through. */ + private final HttpPipeline httpPipeline; + + /** + * Gets The HTTP pipeline to send requests through. + * + * @return the httpPipeline value. + */ + public HttpPipeline getHttpPipeline() { + return this.httpPipeline; + } + + /** The serializer to serialize an object into a string. */ + private final SerializerAdapter serializerAdapter; + + /** + * Gets The serializer to serialize an object into a string. + * + * @return the serializerAdapter value. + */ + SerializerAdapter getSerializerAdapter() { + return this.serializerAdapter; + } + + /** The default poll interval for long-running operation. */ + private final Duration defaultPollInterval; + + /** + * Gets The default poll interval for long-running operation. + * + * @return the defaultPollInterval value. + */ + public Duration getDefaultPollInterval() { + return this.defaultPollInterval; + } + + /** The AutoscaleSettingsClient object to access its operations. */ + private final AutoscaleSettingsClient autoscaleSettings; + + /** + * Gets the AutoscaleSettingsClient object to access its operations. + * + * @return the AutoscaleSettingsClient object. + */ + public AutoscaleSettingsClient getAutoscaleSettings() { + return this.autoscaleSettings; + } + + /** The PredictiveMetricsClient object to access its operations. */ + private final PredictiveMetricsClient predictiveMetrics; + + /** + * Gets the PredictiveMetricsClient object to access its operations. + * + * @return the PredictiveMetricsClient object. + */ + public PredictiveMetricsClient getPredictiveMetrics() { + return this.predictiveMetrics; + } + + /** The OperationsClient object to access its operations. */ + private final OperationsClient operations; + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + public OperationsClient getOperations() { + return this.operations; + } + + /** The AlertRuleIncidentsClient object to access its operations. */ + private final AlertRuleIncidentsClient alertRuleIncidents; + + /** + * Gets the AlertRuleIncidentsClient object to access its operations. + * + * @return the AlertRuleIncidentsClient object. + */ + public AlertRuleIncidentsClient getAlertRuleIncidents() { + return this.alertRuleIncidents; + } + + /** The AlertRulesClient object to access its operations. */ + private final AlertRulesClient alertRules; + + /** + * Gets the AlertRulesClient object to access its operations. + * + * @return the AlertRulesClient object. + */ + public AlertRulesClient getAlertRules() { + return this.alertRules; + } + + /** The LogProfilesClient object to access its operations. */ + private final LogProfilesClient logProfiles; + + /** + * Gets the LogProfilesClient object to access its operations. + * + * @return the LogProfilesClient object. + */ + public LogProfilesClient getLogProfiles() { + return this.logProfiles; + } + + /** The DiagnosticSettingsOperationsClient object to access its operations. */ + private final DiagnosticSettingsOperationsClient diagnosticSettingsOperations; + + /** + * Gets the DiagnosticSettingsOperationsClient object to access its operations. + * + * @return the DiagnosticSettingsOperationsClient object. + */ + public DiagnosticSettingsOperationsClient getDiagnosticSettingsOperations() { + return this.diagnosticSettingsOperations; + } + + /** The DiagnosticSettingsCategoriesClient object to access its operations. */ + private final DiagnosticSettingsCategoriesClient diagnosticSettingsCategories; + + /** + * Gets the DiagnosticSettingsCategoriesClient object to access its operations. + * + * @return the DiagnosticSettingsCategoriesClient object. + */ + public DiagnosticSettingsCategoriesClient getDiagnosticSettingsCategories() { + return this.diagnosticSettingsCategories; + } + + /** The ActionGroupsClient object to access its operations. */ + private final ActionGroupsClient actionGroups; + + /** + * Gets the ActionGroupsClient object to access its operations. + * + * @return the ActionGroupsClient object. + */ + public ActionGroupsClient getActionGroups() { + return this.actionGroups; + } + + /** The ActivityLogsClient object to access its operations. */ + private final ActivityLogsClient activityLogs; + + /** + * Gets the ActivityLogsClient object to access its operations. + * + * @return the ActivityLogsClient object. + */ + public ActivityLogsClient getActivityLogs() { + return this.activityLogs; + } + + /** The EventCategoriesClient object to access its operations. */ + private final EventCategoriesClient eventCategories; + + /** + * Gets the EventCategoriesClient object to access its operations. + * + * @return the EventCategoriesClient object. + */ + public EventCategoriesClient getEventCategories() { + return this.eventCategories; + } + + /** The TenantActivityLogsClient object to access its operations. */ + private final TenantActivityLogsClient tenantActivityLogs; + + /** + * Gets the TenantActivityLogsClient object to access its operations. + * + * @return the TenantActivityLogsClient object. + */ + public TenantActivityLogsClient getTenantActivityLogs() { + return this.tenantActivityLogs; + } + + /** The MetricDefinitionsClient object to access its operations. */ + private final MetricDefinitionsClient metricDefinitions; + + /** + * Gets the MetricDefinitionsClient object to access its operations. + * + * @return the MetricDefinitionsClient object. + */ + public MetricDefinitionsClient getMetricDefinitions() { + return this.metricDefinitions; + } + + /** The MetricsOperationsClient object to access its operations. */ + private final MetricsOperationsClient metricsOperations; + + /** + * Gets the MetricsOperationsClient object to access its operations. + * + * @return the MetricsOperationsClient object. + */ + public MetricsOperationsClient getMetricsOperations() { + return this.metricsOperations; + } + + /** The BaselinesClient object to access its operations. */ + private final BaselinesClient baselines; + + /** + * Gets the BaselinesClient object to access its operations. + * + * @return the BaselinesClient object. + */ + public BaselinesClient getBaselines() { + return this.baselines; + } + + /** The MetricAlertsClient object to access its operations. */ + private final MetricAlertsClient metricAlerts; + + /** + * Gets the MetricAlertsClient object to access its operations. + * + * @return the MetricAlertsClient object. + */ + public MetricAlertsClient getMetricAlerts() { + return this.metricAlerts; + } + + /** The MetricAlertsStatusClient object to access its operations. */ + private final MetricAlertsStatusClient metricAlertsStatus; + + /** + * Gets the MetricAlertsStatusClient object to access its operations. + * + * @return the MetricAlertsStatusClient object. + */ + public MetricAlertsStatusClient getMetricAlertsStatus() { + return this.metricAlertsStatus; + } + + /** The ScheduledQueryRulesClient object to access its operations. */ + private final ScheduledQueryRulesClient scheduledQueryRules; + + /** + * Gets the ScheduledQueryRulesClient object to access its operations. + * + * @return the ScheduledQueryRulesClient object. + */ + public ScheduledQueryRulesClient getScheduledQueryRules() { + return this.scheduledQueryRules; + } + + /** The MetricNamespacesClient object to access its operations. */ + private final MetricNamespacesClient metricNamespaces; + + /** + * Gets the MetricNamespacesClient object to access its operations. + * + * @return the MetricNamespacesClient object. + */ + public MetricNamespacesClient getMetricNamespaces() { + return this.metricNamespaces; + } + + /** The VMInsightsClient object to access its operations. */ + private final VMInsightsClient vMInsights; + + /** + * Gets the VMInsightsClient object to access its operations. + * + * @return the VMInsightsClient object. + */ + public VMInsightsClient getVMInsights() { + return this.vMInsights; + } + + /** The PrivateLinkScopesClient object to access its operations. */ + private final PrivateLinkScopesClient privateLinkScopes; + + /** + * Gets the PrivateLinkScopesClient object to access its operations. + * + * @return the PrivateLinkScopesClient object. + */ + public PrivateLinkScopesClient getPrivateLinkScopes() { + return this.privateLinkScopes; + } + + /** The PrivateLinkScopeOperationStatusClient object to access its operations. */ + private final PrivateLinkScopeOperationStatusClient privateLinkScopeOperationStatus; + + /** + * Gets the PrivateLinkScopeOperationStatusClient object to access its operations. + * + * @return the PrivateLinkScopeOperationStatusClient object. + */ + public PrivateLinkScopeOperationStatusClient getPrivateLinkScopeOperationStatus() { + return this.privateLinkScopeOperationStatus; + } + + /** The PrivateLinkResourcesClient object to access its operations. */ + private final PrivateLinkResourcesClient privateLinkResources; + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + public PrivateLinkResourcesClient getPrivateLinkResources() { + return this.privateLinkResources; + } + + /** The PrivateEndpointConnectionsClient object to access its operations. */ + private final PrivateEndpointConnectionsClient privateEndpointConnections; + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + public PrivateEndpointConnectionsClient getPrivateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** The PrivateLinkScopedResourcesClient object to access its operations. */ + private final PrivateLinkScopedResourcesClient privateLinkScopedResources; + + /** + * Gets the PrivateLinkScopedResourcesClient object to access its operations. + * + * @return the PrivateLinkScopedResourcesClient object. + */ + public PrivateLinkScopedResourcesClient getPrivateLinkScopedResources() { + return this.privateLinkScopedResources; + } + + /** The ActivityLogAlertsClient object to access its operations. */ + private final ActivityLogAlertsClient activityLogAlerts; + + /** + * Gets the ActivityLogAlertsClient object to access its operations. + * + * @return the ActivityLogAlertsClient object. + */ + public ActivityLogAlertsClient getActivityLogAlerts() { + return this.activityLogAlerts; + } + + /** The DataCollectionEndpointsClient object to access its operations. */ + private final DataCollectionEndpointsClient dataCollectionEndpoints; + + /** + * Gets the DataCollectionEndpointsClient object to access its operations. + * + * @return the DataCollectionEndpointsClient object. + */ + public DataCollectionEndpointsClient getDataCollectionEndpoints() { + return this.dataCollectionEndpoints; + } + + /** The DataCollectionRuleAssociationsClient object to access its operations. */ + private final DataCollectionRuleAssociationsClient dataCollectionRuleAssociations; + + /** + * Gets the DataCollectionRuleAssociationsClient object to access its operations. + * + * @return the DataCollectionRuleAssociationsClient object. + */ + public DataCollectionRuleAssociationsClient getDataCollectionRuleAssociations() { + return this.dataCollectionRuleAssociations; + } + + /** The DataCollectionRulesClient object to access its operations. */ + private final DataCollectionRulesClient dataCollectionRules; + + /** + * Gets the DataCollectionRulesClient object to access its operations. + * + * @return the DataCollectionRulesClient object. + */ + public DataCollectionRulesClient getDataCollectionRules() { + return this.dataCollectionRules; + } + + /** The AzureMonitorWorkspacesClient object to access its operations. */ + private final AzureMonitorWorkspacesClient azureMonitorWorkspaces; + + /** + * Gets the AzureMonitorWorkspacesClient object to access its operations. + * + * @return the AzureMonitorWorkspacesClient object. + */ + public AzureMonitorWorkspacesClient getAzureMonitorWorkspaces() { + return this.azureMonitorWorkspaces; + } + + /** The MonitorOperationsClient object to access its operations. */ + private final MonitorOperationsClient monitorOperations; + + /** + * Gets the MonitorOperationsClient object to access its operations. + * + * @return the MonitorOperationsClient object. + */ + public MonitorOperationsClient getMonitorOperations() { + return this.monitorOperations; + } + + /** + * Initializes an instance of MonitorClient client. + * + * @param httpPipeline The HTTP pipeline to send requests through. + * @param serializerAdapter The serializer to serialize an object into a string. + * @param defaultPollInterval The default poll interval for long-running operation. + * @param environment The Azure environment. + * @param subscriptionId The ID of the target subscription. + * @param endpoint server parameter. + */ + MonitorClientImpl( + HttpPipeline httpPipeline, + SerializerAdapter serializerAdapter, + Duration defaultPollInterval, + AzureEnvironment environment, + String subscriptionId, + String endpoint) { + this.httpPipeline = httpPipeline; + this.serializerAdapter = serializerAdapter; + this.defaultPollInterval = defaultPollInterval; + this.subscriptionId = subscriptionId; + this.endpoint = endpoint; + this.autoscaleSettings = new AutoscaleSettingsClientImpl(this); + this.predictiveMetrics = new PredictiveMetricsClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.alertRuleIncidents = new AlertRuleIncidentsClientImpl(this); + this.alertRules = new AlertRulesClientImpl(this); + this.logProfiles = new LogProfilesClientImpl(this); + this.diagnosticSettingsOperations = new DiagnosticSettingsOperationsClientImpl(this); + this.diagnosticSettingsCategories = new DiagnosticSettingsCategoriesClientImpl(this); + this.actionGroups = new ActionGroupsClientImpl(this); + this.activityLogs = new ActivityLogsClientImpl(this); + this.eventCategories = new EventCategoriesClientImpl(this); + this.tenantActivityLogs = new TenantActivityLogsClientImpl(this); + this.metricDefinitions = new MetricDefinitionsClientImpl(this); + this.metricsOperations = new MetricsOperationsClientImpl(this); + this.baselines = new BaselinesClientImpl(this); + this.metricAlerts = new MetricAlertsClientImpl(this); + this.metricAlertsStatus = new MetricAlertsStatusClientImpl(this); + this.scheduledQueryRules = new ScheduledQueryRulesClientImpl(this); + this.metricNamespaces = new MetricNamespacesClientImpl(this); + this.vMInsights = new VMInsightsClientImpl(this); + this.privateLinkScopes = new PrivateLinkScopesClientImpl(this); + this.privateLinkScopeOperationStatus = new PrivateLinkScopeOperationStatusClientImpl(this); + this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + this.privateLinkScopedResources = new PrivateLinkScopedResourcesClientImpl(this); + this.activityLogAlerts = new ActivityLogAlertsClientImpl(this); + this.dataCollectionEndpoints = new DataCollectionEndpointsClientImpl(this); + this.dataCollectionRuleAssociations = new DataCollectionRuleAssociationsClientImpl(this); + this.dataCollectionRules = new DataCollectionRulesClientImpl(this); + this.azureMonitorWorkspaces = new AzureMonitorWorkspacesClientImpl(this); + this.monitorOperations = new MonitorOperationsClientImpl(this); + } + + /** + * Gets default client context. + * + * @return the default client context. + */ + public Context getContext() { + return Context.NONE; + } + + /** + * Merges default client context with provided context. + * + * @param context the context to be merged with default client context. + * @return the merged context. + */ + public Context mergeContext(Context context) { + return CoreUtils.mergeContexts(this.getContext(), context); + } + + /** + * Gets long running operation result. + * + * @param activationResponse the response of activation operation. + * @param httpPipeline the http pipeline. + * @param pollResultType type of poll result. + * @param finalResultType type of final result. + * @param context the context shared by all requests. + * @param type of poll result. + * @param type of final result. + * @return poller flux for poll result and final result. + */ + public PollerFlux, U> getLroResult( + Mono>> activationResponse, + HttpPipeline httpPipeline, + Type pollResultType, + Type finalResultType, + Context context) { + return PollerFactory + .create( + serializerAdapter, + httpPipeline, + pollResultType, + finalResultType, + defaultPollInterval, + activationResponse, + context); + } + + /** + * Gets the final result, or an error, based on last async poll response. + * + * @param response the last async poll response. + * @param type of poll result. + * @param type of final result. + * @return the final result, or an error. + */ + public Mono getLroFinalResultOrError(AsyncPollResponse, U> response) { + if (response.getStatus() != LongRunningOperationStatus.SUCCESSFULLY_COMPLETED) { + String errorMessage; + ManagementError managementError = null; + HttpResponse errorResponse = null; + PollResult.Error lroError = response.getValue().getError(); + if (lroError != null) { + errorResponse = + new HttpResponseImpl( + lroError.getResponseStatusCode(), lroError.getResponseHeaders(), lroError.getResponseBody()); + + errorMessage = response.getValue().getError().getMessage(); + String errorBody = response.getValue().getError().getResponseBody(); + if (errorBody != null) { + // try to deserialize error body to ManagementError + try { + managementError = + this + .getSerializerAdapter() + .deserialize(errorBody, ManagementError.class, SerializerEncoding.JSON); + if (managementError.getCode() == null || managementError.getMessage() == null) { + managementError = null; + } + } catch (IOException | RuntimeException ioe) { + LOGGER.logThrowableAsWarning(ioe); + } + } + } else { + // fallback to default error message + errorMessage = "Long running operation failed."; + } + if (managementError == null) { + // fallback to default ManagementError + managementError = new ManagementError(response.getStatus().toString(), errorMessage); + } + return Mono.error(new ManagementException(errorMessage, errorResponse, managementError)); + } else { + return response.getFinalResult(); + } + } + + private static final class HttpResponseImpl extends HttpResponse { + private final int statusCode; + + private final byte[] responseBody; + + private final HttpHeaders httpHeaders; + + HttpResponseImpl(int statusCode, HttpHeaders httpHeaders, String responseBody) { + super(null); + this.statusCode = statusCode; + this.httpHeaders = httpHeaders; + this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8); + } + + public int getStatusCode() { + return statusCode; + } + + public String getHeaderValue(String s) { + return httpHeaders.getValue(s); + } + + public HttpHeaders getHeaders() { + return httpHeaders; + } + + public Flux getBody() { + return Flux.just(ByteBuffer.wrap(responseBody)); + } + + public Mono getBodyAsByteArray() { + return Mono.just(responseBody); + } + + public Mono getBodyAsString() { + return Mono.just(new String(responseBody, StandardCharsets.UTF_8)); + } + + public Mono getBodyAsString(Charset charset) { + return Mono.just(new String(responseBody, charset)); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MonitorClientImpl.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorOperationsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorOperationsClientImpl.java new file mode 100644 index 0000000000000..d8fb3762444d2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorOperationsClientImpl.java @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.MonitorOperationsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.OperationAutoGeneratedInner; +import com.azure.resourcemanager.monitor.generated.models.OperationListResultAutoGenerated; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in MonitorOperationsClient. */ +public final class MonitorOperationsClientImpl implements MonitorOperationsClient { + /** The proxy service used to perform REST calls. */ + private final MonitorOperationsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of MonitorOperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MonitorOperationsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(MonitorOperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientMonitorOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientMonitor") + public interface MonitorOperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Monitor/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists available Operations for this Resource Provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2021-06-03-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists available Operations for this Resource Provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2021-06-03-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Lists available Operations for this Resource Provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Lists available Operations for this Resource Provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Lists available Operations for this Resource Provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Lists available Operations for this Resource Provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorOperationsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorOperationsImpl.java new file mode 100644 index 0000000000000..a541909244f6f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorOperationsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.MonitorOperationsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.OperationAutoGeneratedInner; +import com.azure.resourcemanager.monitor.generated.models.MonitorOperations; +import com.azure.resourcemanager.monitor.generated.models.OperationAutoGenerated; + +public final class MonitorOperationsImpl implements MonitorOperations { + private static final ClientLogger LOGGER = new ClientLogger(MonitorOperationsImpl.class); + + private final MonitorOperationsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public MonitorOperationsImpl( + MonitorOperationsClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new OperationAutoGeneratedImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new OperationAutoGeneratedImpl(inner1, this.manager())); + } + + private MonitorOperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationAutoGeneratedImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationAutoGeneratedImpl.java new file mode 100644 index 0000000000000..8d2cb6d92d5ce --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationAutoGeneratedImpl.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.OperationAutoGeneratedInner; +import com.azure.resourcemanager.monitor.generated.models.ActionType; +import com.azure.resourcemanager.monitor.generated.models.OperationAutoGenerated; +import com.azure.resourcemanager.monitor.generated.models.OperationDisplayAutoGenerated; +import com.azure.resourcemanager.monitor.generated.models.Origin; + +public final class OperationAutoGeneratedImpl implements OperationAutoGenerated { + private OperationAutoGeneratedInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + OperationAutoGeneratedImpl( + OperationAutoGeneratedInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public Boolean isDataAction() { + return this.innerModel().isDataAction(); + } + + public OperationDisplayAutoGenerated display() { + return this.innerModel().display(); + } + + public Origin origin() { + return this.innerModel().origin(); + } + + public ActionType actionType() { + return this.innerModel().actionType(); + } + + public OperationAutoGeneratedInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationListResultImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationListResultImpl.java new file mode 100644 index 0000000000000..2b02965ebea2b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationListResultImpl.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.OperationListResultInner; +import com.azure.resourcemanager.monitor.generated.models.Operation; +import com.azure.resourcemanager.monitor.generated.models.OperationListResult; +import java.util.Collections; +import java.util.List; + +public final class OperationListResultImpl implements OperationListResult { + private OperationListResultInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + OperationListResultImpl( + OperationListResultInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public String nextLink() { + return this.innerModel().nextLink(); + } + + public OperationListResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationStatusImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationStatusImpl.java new file mode 100644 index 0000000000000..19d12a5b437a4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationStatusImpl.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.monitor.generated.fluent.models.OperationStatusInner; +import com.azure.resourcemanager.monitor.generated.models.OperationStatus; +import java.time.OffsetDateTime; + +public final class OperationStatusImpl implements OperationStatus { + private OperationStatusInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + OperationStatusImpl( + OperationStatusInner innerObject, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public String status() { + return this.innerModel().status(); + } + + public ManagementError error() { + return this.innerModel().error(); + } + + public OperationStatusInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationsClientImpl.java new file mode 100644 index 0000000000000..6c1277e35a12a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationsClientImpl.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.OperationsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.OperationListResultInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in OperationsClient. */ +public final class OperationsClientImpl implements OperationsClient { + /** The proxy service used to perform REST calls. */ + private final OperationsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientOperations to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientOperati") + public interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Insights/operations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Microsoft.Insights operations along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2015-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Microsoft.Insights operations along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2015-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), apiVersion, accept, context); + } + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Microsoft.Insights operations on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync() { + return listWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Microsoft.Insights operations along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Microsoft.Insights operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationListResultInner list() { + return listWithResponse(Context.NONE).getValue(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationsImpl.java new file mode 100644 index 0000000000000..9fcf1b2a2c606 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationsImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.OperationsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.OperationListResultInner; +import com.azure.resourcemanager.monitor.generated.models.OperationListResult; +import com.azure.resourcemanager.monitor.generated.models.Operations; + +public final class OperationsImpl implements Operations { + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); + + private final OperationsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OperationListResult list() { + OperationListResultInner inner = this.serviceClient().list(); + if (inner != null) { + return new OperationListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private OperationsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PredictiveMetricsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PredictiveMetricsClientImpl.java new file mode 100644 index 0000000000000..e9f0823d24fbd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PredictiveMetricsClientImpl.java @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.PredictiveMetricsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.PredictiveResponseInner; +import java.time.Duration; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PredictiveMetricsClient. */ +public final class PredictiveMetricsClientImpl implements PredictiveMetricsClient { + /** The proxy service used to perform REST calls. */ + private final PredictiveMetricsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of PredictiveMetricsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PredictiveMetricsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(PredictiveMetricsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientPredictiveMetrics to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientPredict") + public interface PredictiveMetricsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/autoscalesettings/{autoscaleSettingName}/predictiveMetrics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("autoscaleSettingName") String autoscaleSettingName, + @QueryParam("timespan") String timespan, + @QueryParam("interval") Duration interval, + @QueryParam("metricNamespace") String metricNamespace, + @QueryParam("metricName") String metricName, + @QueryParam("aggregation") String aggregation, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * get predictive autoscale metric future data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param metricName 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'**. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return predictive autoscale metric future data along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String autoscaleSettingName, + String timespan, + Duration interval, + String metricNamespace, + String metricName, + String aggregation) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (autoscaleSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter autoscaleSettingName is required and cannot be null.")); + } + if (timespan == null) { + return Mono.error(new IllegalArgumentException("Parameter timespan is required and cannot be null.")); + } + if (interval == null) { + return Mono.error(new IllegalArgumentException("Parameter interval is required and cannot be null.")); + } + if (metricNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter metricNamespace is required and cannot be null.")); + } + if (metricName == null) { + return Mono.error(new IllegalArgumentException("Parameter metricName is required and cannot be null.")); + } + if (aggregation == null) { + return Mono.error(new IllegalArgumentException("Parameter aggregation is required and cannot be null.")); + } + final String apiVersion = "2022-10-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + autoscaleSettingName, + timespan, + interval, + metricNamespace, + metricName, + aggregation, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * get predictive autoscale metric future data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param metricName 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'**. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return predictive autoscale metric future data along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String autoscaleSettingName, + String timespan, + Duration interval, + String metricNamespace, + String metricName, + String aggregation, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (autoscaleSettingName == null) { + return Mono + .error(new IllegalArgumentException("Parameter autoscaleSettingName is required and cannot be null.")); + } + if (timespan == null) { + return Mono.error(new IllegalArgumentException("Parameter timespan is required and cannot be null.")); + } + if (interval == null) { + return Mono.error(new IllegalArgumentException("Parameter interval is required and cannot be null.")); + } + if (metricNamespace == null) { + return Mono + .error(new IllegalArgumentException("Parameter metricNamespace is required and cannot be null.")); + } + if (metricName == null) { + return Mono.error(new IllegalArgumentException("Parameter metricName is required and cannot be null.")); + } + if (aggregation == null) { + return Mono.error(new IllegalArgumentException("Parameter aggregation is required and cannot be null.")); + } + final String apiVersion = "2022-10-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + autoscaleSettingName, + timespan, + interval, + metricNamespace, + metricName, + aggregation, + apiVersion, + accept, + context); + } + + /** + * get predictive autoscale metric future data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param metricName 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'**. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return predictive autoscale metric future data on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, + String autoscaleSettingName, + String timespan, + Duration interval, + String metricNamespace, + String metricName, + String aggregation) { + return getWithResponseAsync( + resourceGroupName, autoscaleSettingName, timespan, interval, metricNamespace, metricName, aggregation) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * get predictive autoscale metric future data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param metricName 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'**. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return predictive autoscale metric future data along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String autoscaleSettingName, + String timespan, + Duration interval, + String metricNamespace, + String metricName, + String aggregation, + Context context) { + return getWithResponseAsync( + resourceGroupName, + autoscaleSettingName, + timespan, + interval, + metricNamespace, + metricName, + aggregation, + context) + .block(); + } + + /** + * get predictive autoscale metric future data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param metricName 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'**. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return predictive autoscale metric future data. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PredictiveResponseInner get( + String resourceGroupName, + String autoscaleSettingName, + String timespan, + Duration interval, + String metricNamespace, + String metricName, + String aggregation) { + return getWithResponse( + resourceGroupName, + autoscaleSettingName, + timespan, + interval, + metricNamespace, + metricName, + aggregation, + Context.NONE) + .getValue(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PredictiveMetricsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PredictiveMetricsImpl.java new file mode 100644 index 0000000000000..b416383ebe891 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PredictiveMetricsImpl.java @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.PredictiveMetricsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.PredictiveResponseInner; +import com.azure.resourcemanager.monitor.generated.models.PredictiveMetrics; +import com.azure.resourcemanager.monitor.generated.models.PredictiveResponse; +import java.time.Duration; + +public final class PredictiveMetricsImpl implements PredictiveMetrics { + private static final ClientLogger LOGGER = new ClientLogger(PredictiveMetricsImpl.class); + + private final PredictiveMetricsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public PredictiveMetricsImpl( + PredictiveMetricsClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, + String autoscaleSettingName, + String timespan, + Duration interval, + String metricNamespace, + String metricName, + String aggregation, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse( + resourceGroupName, + autoscaleSettingName, + timespan, + interval, + metricNamespace, + metricName, + aggregation, + context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PredictiveResponseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PredictiveResponse get( + String resourceGroupName, + String autoscaleSettingName, + String timespan, + Duration interval, + String metricNamespace, + String metricName, + String aggregation) { + PredictiveResponseInner inner = + this + .serviceClient() + .get( + resourceGroupName, + autoscaleSettingName, + timespan, + interval, + metricNamespace, + metricName, + aggregation); + if (inner != null) { + return new PredictiveResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + private PredictiveMetricsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PredictiveResponseImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PredictiveResponseImpl.java new file mode 100644 index 0000000000000..e14d97d19f3f3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PredictiveResponseImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.PredictiveResponseInner; +import com.azure.resourcemanager.monitor.generated.models.PredictiveResponse; +import com.azure.resourcemanager.monitor.generated.models.PredictiveValue; +import java.time.Duration; +import java.util.Collections; +import java.util.List; + +public final class PredictiveResponseImpl implements PredictiveResponse { + private PredictiveResponseInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + PredictiveResponseImpl( + PredictiveResponseInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String timespan() { + return this.innerModel().timespan(); + } + + public Duration interval() { + return this.innerModel().interval(); + } + + public String metricName() { + return this.innerModel().metricName(); + } + + public String targetResourceId() { + return this.innerModel().targetResourceId(); + } + + public List data() { + List inner = this.innerModel().data(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PredictiveResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 0000000000000..a82ad93052247 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpoint; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointConnectionProvisioningState; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkServiceConnectionState; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { + private PrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateEndpoint privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public PrivateLinkServiceConnectionState privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public PrivateEndpointConnectionProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String scopeName; + + private String privateEndpointConnectionName; + + public PrivateEndpointConnectionImpl withExistingPrivateLinkScope(String resourceGroupName, String scopeName) { + this.resourceGroupName = resourceGroupName; + this.scopeName = scopeName; + return this; + } + + public PrivateEndpointConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, scopeName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, scopeName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl( + String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnectionImpl update() { + return this; + } + + public PrivateEndpointConnection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, scopeName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, scopeName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl( + PrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.scopeName = Utils.getValueFromIdByName(innerObject.id(), "privateLinkScopes"); + this.privateEndpointConnectionName = Utils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public PrivateEndpointConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, scopeName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, scopeName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateEndpoint(PrivateEndpoint privateEndpoint) { + this.innerModel().withPrivateEndpoint(privateEndpoint); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState) { + this.innerModel().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionListResultImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionListResultImpl.java new file mode 100644 index 0000000000000..47165c4e3e4b9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionListResultImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionListResultInner; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointConnectionListResult; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class PrivateEndpointConnectionListResultImpl implements PrivateEndpointConnectionListResult { + private PrivateEndpointConnectionListResultInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + PrivateEndpointConnectionListResultImpl( + PrivateEndpointConnectionListResultInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public PrivateEndpointConnectionListResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 0000000000000..d6f8cbdc2912f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1048 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.monitor.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionListResultInner; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpointConnectionsClient { + /** The proxy service used to perform REST calls. */ + private final PrivateEndpointConnectionsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy + .create( + PrivateEndpointConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientPrivateEndpointConnections to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientPrivate") + public interface PrivateEndpointConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("scopeName") String scopeName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("scopeName") String scopeName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @BodyParam("application/json") PrivateEndpointConnectionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/privateLinkScopes/{scopeName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("scopeName") String scopeName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/privateLinkScopes/{scopeName}/privateEndpointConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByPrivateLinkScope( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("scopeName") String scopeName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String scopeName, String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + privateEndpointConnectionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + privateEndpointConnectionName, + accept, + context); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String scopeName, String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, scopeName, privateEndpointConnectionName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, scopeName, privateEndpointConnectionName, context).block(); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner get( + String resourceGroupName, String scopeName, String privateEndpointConnectionName) { + return getWithResponse(resourceGroupName, scopeName, privateEndpointConnectionName, Context.NONE).getValue(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String scopeName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + privateEndpointConnectionName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The Private Endpoint Connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String scopeName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + privateEndpointConnectionName, + parameters, + accept, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String scopeName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + this.client.getContext()); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The Private Endpoint Connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String scopeName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, scopeName, privateEndpointConnectionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String scopeName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The Private Endpoint Connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String scopeName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return this + .beginCreateOrUpdateAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters, context) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String scopeName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The Private Endpoint Connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String scopeName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, scopeName, privateEndpointConnectionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The Private Endpoint Connection resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String scopeName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return createOrUpdateAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters).block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param parameters The Private Endpoint Connection resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Private Endpoint Connection resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String scopeName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, scopeName, privateEndpointConnectionName, parameters, context) + .block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String scopeName, String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + privateEndpointConnectionName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + privateEndpointConnectionName, + accept, + context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String scopeName, String privateEndpointConnectionName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, scopeName, privateEndpointConnectionName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, scopeName, privateEndpointConnectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String scopeName, String privateEndpointConnectionName) { + return this.beginDeleteAsync(resourceGroupName, scopeName, privateEndpointConnectionName).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context) { + return this + .beginDeleteAsync(resourceGroupName, scopeName, privateEndpointConnectionName, context) + .getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String scopeName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, scopeName, privateEndpointConnectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, scopeName, privateEndpointConnectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String scopeName, String privateEndpointConnectionName) { + deleteAsync(resourceGroupName, scopeName, privateEndpointConnectionName).block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context) { + deleteAsync(resourceGroupName, scopeName, privateEndpointConnectionName, context).block(); + } + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPrivateLinkScopeWithResponseAsync( + String resourceGroupName, String scopeName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByPrivateLinkScope( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope along with {@link Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPrivateLinkScopeWithResponseAsync( + String resourceGroupName, String scopeName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByPrivateLinkScope( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + accept, + context); + } + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listByPrivateLinkScopeAsync( + String resourceGroupName, String scopeName) { + return listByPrivateLinkScopeWithResponseAsync(resourceGroupName, scopeName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listByPrivateLinkScopeWithResponse( + String resourceGroupName, String scopeName, Context context) { + return listByPrivateLinkScopeWithResponseAsync(resourceGroupName, scopeName, context).block(); + } + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionListResultInner listByPrivateLinkScope(String resourceGroupName, String scopeName) { + return listByPrivateLinkScopeWithResponse(resourceGroupName, scopeName, Context.NONE).getValue(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 0000000000000..d1719f285940b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionListResultInner; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointConnectionListResult; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointConnections; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionsImpl.class); + + private final PrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public PrivateEndpointConnectionsImpl( + PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, scopeName, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateEndpointConnection get( + String resourceGroupName, String scopeName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this.serviceClient().get(resourceGroupName, scopeName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String scopeName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, scopeName, privateEndpointConnectionName); + } + + public void delete( + String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context) { + this.serviceClient().delete(resourceGroupName, scopeName, privateEndpointConnectionName, context); + } + + public Response listByPrivateLinkScopeWithResponse( + String resourceGroupName, String scopeName, Context context) { + Response inner = + this.serviceClient().listByPrivateLinkScopeWithResponse(resourceGroupName, scopeName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateEndpointConnectionListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateEndpointConnectionListResult listByPrivateLinkScope(String resourceGroupName, String scopeName) { + PrivateEndpointConnectionListResultInner inner = + this.serviceClient().listByPrivateLinkScope(resourceGroupName, scopeName); + if (inner != null) { + return new PrivateEndpointConnectionListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public PrivateEndpointConnection getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String scopeName = Utils.getValueFromIdByName(id, "privateLinkScopes"); + if (scopeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkScopes'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .getWithResponse(resourceGroupName, scopeName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String scopeName = Utils.getValueFromIdByName(id, "privateLinkScopes"); + if (scopeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkScopes'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this.getWithResponse(resourceGroupName, scopeName, privateEndpointConnectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String scopeName = Utils.getValueFromIdByName(id, "privateLinkScopes"); + if (scopeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkScopes'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, scopeName, privateEndpointConnectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String scopeName = Utils.getValueFromIdByName(id, "privateLinkScopes"); + if (scopeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkScopes'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, scopeName, privateEndpointConnectionName, context); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionImpl define(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 0000000000000..7b939764f1901 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourceImpl.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkResource; +import java.util.Collections; +import java.util.List; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + PrivateLinkResourceImpl( + PrivateLinkResourceInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String groupId() { + return this.innerModel().groupId(); + } + + public List requiredMembers() { + List inner = this.innerModel().requiredMembers(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List requiredZoneNames() { + List inner = this.innerModel().requiredZoneNames(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourceListResultImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourceListResultImpl.java new file mode 100644 index 0000000000000..3491f17b694d0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourceListResultImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateLinkResourceListResultInner; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkResource; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkResourceListResult; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class PrivateLinkResourceListResultImpl implements PrivateLinkResourceListResult { + private PrivateLinkResourceListResultInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + PrivateLinkResourceListResultImpl( + PrivateLinkResourceListResultInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public PrivateLinkResourceListResultInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourcesClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 0000000000000..c94d61a747e5c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,397 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateLinkResourceListResultInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public final class PrivateLinkResourcesClientImpl implements PrivateLinkResourcesClient { + /** The proxy service used to perform REST calls. */ + private final PrivateLinkResourcesService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesClientImpl(MonitorClientImpl client) { + this.service = + RestProxy + .create(PrivateLinkResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientPrivateLinkResources to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientPrivate") + public interface PrivateLinkResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/privateLinkScopes/{scopeName}/privateLinkResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByPrivateLinkScope( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("scopeName") String scopeName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/privateLinkScopes/{scopeName}/privateLinkResources/{groupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("scopeName") String scopeName, + @PathParam("groupName") String groupName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPrivateLinkScopeWithResponseAsync( + String resourceGroupName, String scopeName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByPrivateLinkScope( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPrivateLinkScopeWithResponseAsync( + String resourceGroupName, String scopeName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByPrivateLinkScope( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + accept, + context); + } + + /** + * Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listByPrivateLinkScopeAsync( + String resourceGroupName, String scopeName) { + return listByPrivateLinkScopeWithResponseAsync(resourceGroupName, scopeName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listByPrivateLinkScopeWithResponse( + String resourceGroupName, String scopeName, Context context) { + return listByPrivateLinkScopeWithResponseAsync(resourceGroupName, scopeName, context).block(); + } + + /** + * Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceListResultInner listByPrivateLinkScope(String resourceGroupName, String scopeName) { + return listByPrivateLinkScopeWithResponse(resourceGroupName, scopeName, Context.NONE).getValue(); + } + + /** + * Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String scopeName, String groupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + groupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope along with {@link + * Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String scopeName, String groupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + groupName, + accept, + context); + } + + /** + * Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String scopeName, String groupName) { + return getWithResponseAsync(resourceGroupName, scopeName, groupName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope along with {@link + * Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String scopeName, String groupName, Context context) { + return getWithResponseAsync(resourceGroupName, scopeName, groupName, context).block(); + } + + /** + * Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceInner get(String resourceGroupName, String scopeName, String groupName) { + return getWithResponse(resourceGroupName, scopeName, groupName, Context.NONE).getValue(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourcesImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 0000000000000..42fdf704992e6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourcesImpl.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateLinkResourceListResultInner; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkResource; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkResourceListResult; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkResources; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkResourcesImpl.class); + + private final PrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public PrivateLinkResourcesImpl( + PrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response listByPrivateLinkScopeWithResponse( + String resourceGroupName, String scopeName, Context context) { + Response inner = + this.serviceClient().listByPrivateLinkScopeWithResponse(resourceGroupName, scopeName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateLinkResourceListResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateLinkResourceListResult listByPrivateLinkScope(String resourceGroupName, String scopeName) { + PrivateLinkResourceListResultInner inner = + this.serviceClient().listByPrivateLinkScope(resourceGroupName, scopeName); + if (inner != null) { + return new PrivateLinkResourceListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String scopeName, String groupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, scopeName, groupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateLinkResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PrivateLinkResource get(String resourceGroupName, String scopeName, String groupName) { + PrivateLinkResourceInner inner = this.serviceClient().get(resourceGroupName, scopeName, groupName); + if (inner != null) { + return new PrivateLinkResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + private PrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopeOperationStatusClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopeOperationStatusClientImpl.java new file mode 100644 index 0000000000000..ea56581aa5548 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopeOperationStatusClientImpl.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.PrivateLinkScopeOperationStatusClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.OperationStatusInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateLinkScopeOperationStatusClient. */ +public final class PrivateLinkScopeOperationStatusClientImpl implements PrivateLinkScopeOperationStatusClient { + /** The proxy service used to perform REST calls. */ + private final PrivateLinkScopeOperationStatusService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of PrivateLinkScopeOperationStatusClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkScopeOperationStatusClientImpl(MonitorClientImpl client) { + this.service = + RestProxy + .create( + PrivateLinkScopeOperationStatusService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientPrivateLinkScopeOperationStatus to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientPrivate") + public interface PrivateLinkScopeOperationStatusService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights" + + "/privateLinkScopeOperationStatuses/{asyncOperationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("asyncOperationId") String asyncOperationId, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get the status of an azure asynchronous operation associated with a private link scope operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param asyncOperationId The operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of an azure asynchronous operation associated with a private link scope operation along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String asyncOperationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (asyncOperationId == null) { + return Mono + .error(new IllegalArgumentException("Parameter asyncOperationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + asyncOperationId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the status of an azure asynchronous operation associated with a private link scope operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param asyncOperationId The operation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of an azure asynchronous operation associated with a private link scope operation along with + * {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String asyncOperationId, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (asyncOperationId == null) { + return Mono + .error(new IllegalArgumentException("Parameter asyncOperationId is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + asyncOperationId, + apiVersion, + this.client.getSubscriptionId(), + accept, + context); + } + + /** + * Get the status of an azure asynchronous operation associated with a private link scope operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param asyncOperationId The operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of an azure asynchronous operation associated with a private link scope operation on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String asyncOperationId) { + return getByResourceGroupWithResponseAsync(resourceGroupName, asyncOperationId) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Get the status of an azure asynchronous operation associated with a private link scope operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param asyncOperationId The operation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of an azure asynchronous operation associated with a private link scope operation along with + * {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String asyncOperationId, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, asyncOperationId, context).block(); + } + + /** + * Get the status of an azure asynchronous operation associated with a private link scope operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param asyncOperationId The operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of an azure asynchronous operation associated with a private link scope operation. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationStatusInner getByResourceGroup(String resourceGroupName, String asyncOperationId) { + return getByResourceGroupWithResponse(resourceGroupName, asyncOperationId, Context.NONE).getValue(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopeOperationStatusImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopeOperationStatusImpl.java new file mode 100644 index 0000000000000..fb7bce5f59cf4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopeOperationStatusImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.PrivateLinkScopeOperationStatusClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.OperationStatusInner; +import com.azure.resourcemanager.monitor.generated.models.OperationStatus; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkScopeOperationStatus; + +public final class PrivateLinkScopeOperationStatusImpl implements PrivateLinkScopeOperationStatus { + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkScopeOperationStatusImpl.class); + + private final PrivateLinkScopeOperationStatusClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public PrivateLinkScopeOperationStatusImpl( + PrivateLinkScopeOperationStatusClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String asyncOperationId, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, asyncOperationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new OperationStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public OperationStatus getByResourceGroup(String resourceGroupName, String asyncOperationId) { + OperationStatusInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, asyncOperationId); + if (inner != null) { + return new OperationStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + private PrivateLinkScopeOperationStatusClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopedResourcesClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopedResourcesClientImpl.java new file mode 100644 index 0000000000000..cfb6597227aab --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopedResourcesClientImpl.java @@ -0,0 +1,1103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.monitor.generated.fluent.PrivateLinkScopedResourcesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.ScopedResourceInner; +import com.azure.resourcemanager.monitor.generated.models.ScopedResourceListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateLinkScopedResourcesClient. */ +public final class PrivateLinkScopedResourcesClientImpl implements PrivateLinkScopedResourcesClient { + /** The proxy service used to perform REST calls. */ + private final PrivateLinkScopedResourcesService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of PrivateLinkScopedResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkScopedResourcesClientImpl(MonitorClientImpl client) { + this.service = + RestProxy + .create( + PrivateLinkScopedResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientPrivateLinkScopedResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientPrivate") + public interface PrivateLinkScopedResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/privateLinkScopes/{scopeName}/scopedResources/{name}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("scopeName") String scopeName, + @PathParam("name") String name, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/privateLinkScopes/{scopeName}/scopedResources/{name}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("scopeName") String scopeName, + @PathParam("name") String name, + @BodyParam("application/json") ScopedResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/privateLinkScopes/{scopeName}/scopedResources/{name}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("scopeName") String scopeName, + @PathParam("name") String name, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/privateLinkScopes/{scopeName}/scopedResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByPrivateLinkScope( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("scopeName") String scopeName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByPrivateLinkScopeNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a scoped resource in a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a scoped resource in a private link scope along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String scopeName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + name, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a scoped resource in a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a scoped resource in a private link scope along with {@link Response} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String scopeName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + name, + accept, + context); + } + + /** + * Gets a scoped resource in a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a scoped resource in a private link scope on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String scopeName, String name) { + return getWithResponseAsync(resourceGroupName, scopeName, name) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Gets a scoped resource in a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a scoped resource in a private link scope along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String scopeName, String name, Context context) { + return getWithResponseAsync(resourceGroupName, scopeName, name, context).block(); + } + + /** + * Gets a scoped resource in a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a scoped resource in a private link scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScopedResourceInner get(String resourceGroupName, String scopeName, String name) { + return getWithResponse(resourceGroupName, scopeName, name, Context.NONE).getValue(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param parameters A private link scoped resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link scoped resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String scopeName, String name, ScopedResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + name, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param parameters A private link scoped resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link scoped resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String scopeName, String name, ScopedResourceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + name, + parameters, + accept, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param parameters A private link scoped resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a private link scoped resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ScopedResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String scopeName, String name, ScopedResourceInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, scopeName, name, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ScopedResourceInner.class, + ScopedResourceInner.class, + this.client.getContext()); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param parameters A private link scoped resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a private link scoped resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, ScopedResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String scopeName, String name, ScopedResourceInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, scopeName, name, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ScopedResourceInner.class, ScopedResourceInner.class, context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param parameters A private link scoped resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a private link scoped resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ScopedResourceInner> beginCreateOrUpdate( + String resourceGroupName, String scopeName, String name, ScopedResourceInner parameters) { + return this.beginCreateOrUpdateAsync(resourceGroupName, scopeName, name, parameters).getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param parameters A private link scoped resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a private link scoped resource. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, ScopedResourceInner> beginCreateOrUpdate( + String resourceGroupName, String scopeName, String name, ScopedResourceInner parameters, Context context) { + return this.beginCreateOrUpdateAsync(resourceGroupName, scopeName, name, parameters, context).getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param parameters A private link scoped resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link scoped resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String scopeName, String name, ScopedResourceInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, scopeName, name, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param parameters A private link scoped resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link scoped resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String scopeName, String name, ScopedResourceInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, scopeName, name, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param parameters A private link scoped resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link scoped resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScopedResourceInner createOrUpdate( + String resourceGroupName, String scopeName, String name, ScopedResourceInner parameters) { + return createOrUpdateAsync(resourceGroupName, scopeName, name, parameters).block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param parameters A private link scoped resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private link scoped resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScopedResourceInner createOrUpdate( + String resourceGroupName, String scopeName, String name, ScopedResourceInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, scopeName, name, parameters, context).block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String scopeName, String name) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + name, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String scopeName, String name, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + if (name == null) { + return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + name, + accept, + context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String scopeName, String name) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, scopeName, name); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String scopeName, String name, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, scopeName, name, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String scopeName, String name) { + return this.beginDeleteAsync(resourceGroupName, scopeName, name).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String scopeName, String name, Context context) { + return this.beginDeleteAsync(resourceGroupName, scopeName, name, context).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String scopeName, String name) { + return beginDeleteAsync(resourceGroupName, scopeName, name) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String scopeName, String name, Context context) { + return beginDeleteAsync(resourceGroupName, scopeName, name, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String scopeName, String name) { + deleteAsync(resourceGroupName, scopeName, name).block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String scopeName, String name, Context context) { + deleteAsync(resourceGroupName, scopeName, name, context).block(); + } + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPrivateLinkScopeSinglePageAsync( + String resourceGroupName, String scopeName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByPrivateLinkScope( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPrivateLinkScopeSinglePageAsync( + String resourceGroupName, String scopeName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByPrivateLinkScope( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPrivateLinkScopeAsync(String resourceGroupName, String scopeName) { + return new PagedFlux<>( + () -> listByPrivateLinkScopeSinglePageAsync(resourceGroupName, scopeName), + nextLink -> listByPrivateLinkScopeNextSinglePageAsync(nextLink)); + } + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByPrivateLinkScopeAsync( + String resourceGroupName, String scopeName, Context context) { + return new PagedFlux<>( + () -> listByPrivateLinkScopeSinglePageAsync(resourceGroupName, scopeName, context), + nextLink -> listByPrivateLinkScopeNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPrivateLinkScope(String resourceGroupName, String scopeName) { + return new PagedIterable<>(listByPrivateLinkScopeAsync(resourceGroupName, scopeName)); + } + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPrivateLinkScope( + String resourceGroupName, String scopeName, Context context) { + return new PagedIterable<>(listByPrivateLinkScopeAsync(resourceGroupName, scopeName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scoped resources in a private link scope along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPrivateLinkScopeNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByPrivateLinkScopeNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of scoped resources in a private link scope along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByPrivateLinkScopeNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByPrivateLinkScopeNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopedResourcesImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopedResourcesImpl.java new file mode 100644 index 0000000000000..80a41f3fbc39e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopedResourcesImpl.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.PrivateLinkScopedResourcesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.ScopedResourceInner; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkScopedResources; +import com.azure.resourcemanager.monitor.generated.models.ScopedResource; + +public final class PrivateLinkScopedResourcesImpl implements PrivateLinkScopedResources { + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkScopedResourcesImpl.class); + + private final PrivateLinkScopedResourcesClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public PrivateLinkScopedResourcesImpl( + PrivateLinkScopedResourcesClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getWithResponse( + String resourceGroupName, String scopeName, String name, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, scopeName, name, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScopedResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ScopedResource get(String resourceGroupName, String scopeName, String name) { + ScopedResourceInner inner = this.serviceClient().get(resourceGroupName, scopeName, name); + if (inner != null) { + return new ScopedResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String scopeName, String name) { + this.serviceClient().delete(resourceGroupName, scopeName, name); + } + + public void delete(String resourceGroupName, String scopeName, String name, Context context) { + this.serviceClient().delete(resourceGroupName, scopeName, name, context); + } + + public PagedIterable listByPrivateLinkScope(String resourceGroupName, String scopeName) { + PagedIterable inner = + this.serviceClient().listByPrivateLinkScope(resourceGroupName, scopeName); + return Utils.mapPage(inner, inner1 -> new ScopedResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByPrivateLinkScope( + String resourceGroupName, String scopeName, Context context) { + PagedIterable inner = + this.serviceClient().listByPrivateLinkScope(resourceGroupName, scopeName, context); + return Utils.mapPage(inner, inner1 -> new ScopedResourceImpl(inner1, this.manager())); + } + + public ScopedResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String scopeName = Utils.getValueFromIdByName(id, "privateLinkScopes"); + if (scopeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkScopes'.", id))); + } + String name = Utils.getValueFromIdByName(id, "scopedResources"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'scopedResources'.", id))); + } + return this.getWithResponse(resourceGroupName, scopeName, name, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String scopeName = Utils.getValueFromIdByName(id, "privateLinkScopes"); + if (scopeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkScopes'.", id))); + } + String name = Utils.getValueFromIdByName(id, "scopedResources"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'scopedResources'.", id))); + } + return this.getWithResponse(resourceGroupName, scopeName, name, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String scopeName = Utils.getValueFromIdByName(id, "privateLinkScopes"); + if (scopeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkScopes'.", id))); + } + String name = Utils.getValueFromIdByName(id, "scopedResources"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'scopedResources'.", id))); + } + this.delete(resourceGroupName, scopeName, name, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String scopeName = Utils.getValueFromIdByName(id, "privateLinkScopes"); + if (scopeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkScopes'.", id))); + } + String name = Utils.getValueFromIdByName(id, "scopedResources"); + if (name == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'scopedResources'.", id))); + } + this.delete(resourceGroupName, scopeName, name, context); + } + + private PrivateLinkScopedResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + public ScopedResourceImpl define(String name) { + return new ScopedResourceImpl(name, this.manager()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopesClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopesClientImpl.java new file mode 100644 index 0000000000000..ef33b9563e0e9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopesClientImpl.java @@ -0,0 +1,1381 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.monitor.generated.fluent.PrivateLinkScopesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.AzureMonitorPrivateLinkScopeInner; +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorPrivateLinkScopeListResult; +import com.azure.resourcemanager.monitor.generated.models.TagsResource; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateLinkScopesClient. */ +public final class PrivateLinkScopesClientImpl implements PrivateLinkScopesClient { + /** The proxy service used to perform REST calls. */ + private final PrivateLinkScopesService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of PrivateLinkScopesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkScopesClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(PrivateLinkScopesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientPrivateLinkScopes to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientPrivate") + public interface PrivateLinkScopesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/microsoft.insights/privateLinkScopes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights" + + "/privateLinkScopes") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights" + + "/privateLinkScopes/{scopeName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("scopeName") String scopeName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights" + + "/privateLinkScopes/{scopeName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("scopeName") String scopeName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights" + + "/privateLinkScopes/{scopeName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("scopeName") String scopeName, + @BodyParam("application/json") AzureMonitorPrivateLinkScopeInner azureMonitorPrivateLinkScopePayload, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/microsoft.insights" + + "/privateLinkScopes/{scopeName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> updateTags( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("scopeName") String scopeName, + @BodyParam("application/json") TagsResource privateLinkScopeTags, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure Monitor PrivateLinkScopes within a subscription along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure Monitor PrivateLinkScopes within a subscription along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure Monitor PrivateLinkScopes within a subscription as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure Monitor PrivateLinkScopes within a subscription as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure Monitor PrivateLinkScopes within a subscription as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure Monitor PrivateLinkScopes within a subscription as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Gets a list of Azure Monitor PrivateLinkScopes within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Monitor PrivateLinkScopes within a resource group along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of Azure Monitor PrivateLinkScopes within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Monitor PrivateLinkScopes within a resource group along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of Azure Monitor PrivateLinkScopes within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Monitor PrivateLinkScopes within a resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of Azure Monitor PrivateLinkScopes within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Monitor PrivateLinkScopes within a resource group as paginated response with {@link + * PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of Azure Monitor PrivateLinkScopes within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Monitor PrivateLinkScopes within a resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Gets a list of Azure Monitor PrivateLinkScopes within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Monitor PrivateLinkScopes within a resource group as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String scopeName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + scopeName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String scopeName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + scopeName, + accept, + context); + } + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String scopeName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, scopeName); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); + } + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String scopeName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, scopeName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String scopeName) { + return this.beginDeleteAsync(resourceGroupName, scopeName).getSyncPoller(); + } + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, Void> beginDelete(String resourceGroupName, String scopeName, Context context) { + return this.beginDeleteAsync(resourceGroupName, scopeName, context).getSyncPoller(); + } + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String scopeName) { + return beginDeleteAsync(resourceGroupName, scopeName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String scopeName, Context context) { + return beginDeleteAsync(resourceGroupName, scopeName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String scopeName) { + deleteAsync(resourceGroupName, scopeName).block(); + } + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String scopeName, Context context) { + deleteAsync(resourceGroupName, scopeName, context).block(); + } + + /** + * Returns a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String scopeName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + scopeName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Returns a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String scopeName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + scopeName, + accept, + context); + } + + /** + * Returns a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync( + String resourceGroupName, String scopeName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, scopeName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Returns a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String scopeName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, scopeName, context).block(); + } + + /** + * Returns a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureMonitorPrivateLinkScopeInner getByResourceGroup(String resourceGroupName, String scopeName) { + return getByResourceGroupWithResponse(resourceGroupName, scopeName, Context.NONE).getValue(); + } + + /** + * Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different value for + * InstrumentationKey nor AppId in the Put operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param azureMonitorPrivateLinkScopePayload Properties that need to be specified to create or update a Azure + * Monitor PrivateLinkScope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String scopeName, + AzureMonitorPrivateLinkScopeInner azureMonitorPrivateLinkScopePayload) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + if (azureMonitorPrivateLinkScopePayload == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureMonitorPrivateLinkScopePayload is required and cannot be null.")); + } else { + azureMonitorPrivateLinkScopePayload.validate(); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + scopeName, + azureMonitorPrivateLinkScopePayload, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different value for + * InstrumentationKey nor AppId in the Put operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param azureMonitorPrivateLinkScopePayload Properties that need to be specified to create or update a Azure + * Monitor PrivateLinkScope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String scopeName, + AzureMonitorPrivateLinkScopeInner azureMonitorPrivateLinkScopePayload, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + if (azureMonitorPrivateLinkScopePayload == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter azureMonitorPrivateLinkScopePayload is required and cannot be null.")); + } else { + azureMonitorPrivateLinkScopePayload.validate(); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + scopeName, + azureMonitorPrivateLinkScopePayload, + accept, + context); + } + + /** + * Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different value for + * InstrumentationKey nor AppId in the Put operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param azureMonitorPrivateLinkScopePayload Properties that need to be specified to create or update a Azure + * Monitor PrivateLinkScope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String scopeName, + AzureMonitorPrivateLinkScopeInner azureMonitorPrivateLinkScopePayload) { + return createOrUpdateWithResponseAsync(resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different value for + * InstrumentationKey nor AppId in the Put operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param azureMonitorPrivateLinkScopePayload Properties that need to be specified to create or update a Azure + * Monitor PrivateLinkScope. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String scopeName, + AzureMonitorPrivateLinkScopeInner azureMonitorPrivateLinkScopePayload, + Context context) { + return createOrUpdateWithResponseAsync( + resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload, context) + .block(); + } + + /** + * Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different value for + * InstrumentationKey nor AppId in the Put operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param azureMonitorPrivateLinkScopePayload Properties that need to be specified to create or update a Azure + * Monitor PrivateLinkScope. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureMonitorPrivateLinkScopeInner createOrUpdate( + String resourceGroupName, + String scopeName, + AzureMonitorPrivateLinkScopeInner azureMonitorPrivateLinkScopePayload) { + return createOrUpdateWithResponse( + resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload, Context.NONE) + .getValue(); + } + + /** + * Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateLinkScopeTags Updated tag information to set into the PrivateLinkScope instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateTagsWithResponseAsync( + String resourceGroupName, String scopeName, TagsResource privateLinkScopeTags) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + if (privateLinkScopeTags == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkScopeTags is required and cannot be null.")); + } else { + privateLinkScopeTags.validate(); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateTags( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + scopeName, + privateLinkScopeTags, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateLinkScopeTags Updated tag information to set into the PrivateLinkScope instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateTagsWithResponseAsync( + String resourceGroupName, String scopeName, TagsResource privateLinkScopeTags, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (scopeName == null) { + return Mono.error(new IllegalArgumentException("Parameter scopeName is required and cannot be null.")); + } + if (privateLinkScopeTags == null) { + return Mono + .error(new IllegalArgumentException("Parameter privateLinkScopeTags is required and cannot be null.")); + } else { + privateLinkScopeTags.validate(); + } + final String apiVersion = "2021-07-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateTags( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + scopeName, + privateLinkScopeTags, + accept, + context); + } + + /** + * Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateLinkScopeTags Updated tag information to set into the PrivateLinkScope instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateTagsAsync( + String resourceGroupName, String scopeName, TagsResource privateLinkScopeTags) { + return updateTagsWithResponseAsync(resourceGroupName, scopeName, privateLinkScopeTags) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateLinkScopeTags Updated tag information to set into the PrivateLinkScope instance. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateTagsWithResponse( + String resourceGroupName, String scopeName, TagsResource privateLinkScopeTags, Context context) { + return updateTagsWithResponseAsync(resourceGroupName, scopeName, privateLinkScopeTags, context).block(); + } + + /** + * Updates an existing PrivateLinkScope's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateLinkScopeTags Updated tag information to set into the PrivateLinkScope instance. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AzureMonitorPrivateLinkScopeInner updateTags( + String resourceGroupName, String scopeName, TagsResource privateLinkScopeTags) { + return updateTagsWithResponse(resourceGroupName, scopeName, privateLinkScopeTags, Context.NONE).getValue(); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the list of Azure Monitor PrivateLinkScope resources along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the list of Azure Monitor PrivateLinkScope resources along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the list of Azure Monitor PrivateLinkScope resources along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return describes the list of Azure Monitor PrivateLinkScope resources along with {@link PagedResponse} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopesImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopesImpl.java new file mode 100644 index 0000000000000..8a5fcaec505c1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopesImpl.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.PrivateLinkScopesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.AzureMonitorPrivateLinkScopeInner; +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorPrivateLinkScope; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkScopes; + +public final class PrivateLinkScopesImpl implements PrivateLinkScopes { + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkScopesImpl.class); + + private final PrivateLinkScopesClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public PrivateLinkScopesImpl( + PrivateLinkScopesClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new AzureMonitorPrivateLinkScopeImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new AzureMonitorPrivateLinkScopeImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new AzureMonitorPrivateLinkScopeImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new AzureMonitorPrivateLinkScopeImpl(inner1, this.manager())); + } + + public void deleteByResourceGroup(String resourceGroupName, String scopeName) { + this.serviceClient().delete(resourceGroupName, scopeName); + } + + public void delete(String resourceGroupName, String scopeName, Context context) { + this.serviceClient().delete(resourceGroupName, scopeName, context); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String scopeName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, scopeName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AzureMonitorPrivateLinkScopeImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public AzureMonitorPrivateLinkScope getByResourceGroup(String resourceGroupName, String scopeName) { + AzureMonitorPrivateLinkScopeInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, scopeName); + if (inner != null) { + return new AzureMonitorPrivateLinkScopeImpl(inner, this.manager()); + } else { + return null; + } + } + + public AzureMonitorPrivateLinkScope getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String scopeName = Utils.getValueFromIdByName(id, "privateLinkScopes"); + if (scopeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkScopes'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, scopeName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String scopeName = Utils.getValueFromIdByName(id, "privateLinkScopes"); + if (scopeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkScopes'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, scopeName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String scopeName = Utils.getValueFromIdByName(id, "privateLinkScopes"); + if (scopeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkScopes'.", id))); + } + this.delete(resourceGroupName, scopeName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String scopeName = Utils.getValueFromIdByName(id, "privateLinkScopes"); + if (scopeName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateLinkScopes'.", id))); + } + this.delete(resourceGroupName, scopeName, context); + } + + private PrivateLinkScopesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + public AzureMonitorPrivateLinkScopeImpl define(String name) { + return new AzureMonitorPrivateLinkScopeImpl(name, this.manager()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ResponseModelImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ResponseModelImpl.java new file mode 100644 index 0000000000000..49847e325bcba --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ResponseModelImpl.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.ResponseInner; +import com.azure.resourcemanager.monitor.generated.models.Metric; +import com.azure.resourcemanager.monitor.generated.models.ResponseModel; +import java.time.Duration; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class ResponseModelImpl implements ResponseModel { + private ResponseInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + ResponseModelImpl( + ResponseInner innerObject, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Integer cost() { + return this.innerModel().cost(); + } + + public String timespan() { + return this.innerModel().timespan(); + } + + public Duration interval() { + return this.innerModel().interval(); + } + + public String namespace() { + return this.innerModel().namespace(); + } + + public String resourceRegion() { + return this.innerModel().resourceRegion(); + } + + public List value() { + List inner = this.innerModel().value(); + if (inner != null) { + return Collections + .unmodifiableList( + inner.stream().map(inner1 -> new MetricImpl(inner1, this.manager())).collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public ResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScheduledQueryRuleResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScheduledQueryRuleResourceImpl.java new file mode 100644 index 0000000000000..848d2bbe43549 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScheduledQueryRuleResourceImpl.java @@ -0,0 +1,484 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.ScheduledQueryRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.Actions; +import com.azure.resourcemanager.monitor.generated.models.AlertSeverity; +import com.azure.resourcemanager.monitor.generated.models.Identity; +import com.azure.resourcemanager.monitor.generated.models.Kind; +import com.azure.resourcemanager.monitor.generated.models.PublicNetworkAccess; +import com.azure.resourcemanager.monitor.generated.models.RuleResolveConfiguration; +import com.azure.resourcemanager.monitor.generated.models.ScheduledQueryRuleCriteria; +import com.azure.resourcemanager.monitor.generated.models.ScheduledQueryRuleResource; +import com.azure.resourcemanager.monitor.generated.models.ScheduledQueryRuleResourcePatch; +import java.time.Duration; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ScheduledQueryRuleResourceImpl + implements ScheduledQueryRuleResource, ScheduledQueryRuleResource.Definition, ScheduledQueryRuleResource.Update { + private ScheduledQueryRuleResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public Identity identity() { + return this.innerModel().identity(); + } + + public Kind kind() { + return this.innerModel().kind(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String createdWithApiVersion() { + return this.innerModel().createdWithApiVersion(); + } + + public Boolean isLegacyLogAnalyticsRule() { + return this.innerModel().isLegacyLogAnalyticsRule(); + } + + public String description() { + return this.innerModel().description(); + } + + public String displayName() { + return this.innerModel().displayName(); + } + + public AlertSeverity severity() { + return this.innerModel().severity(); + } + + public Boolean enabled() { + return this.innerModel().enabled(); + } + + public PublicNetworkAccess publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); + } + + public List scopes() { + List inner = this.innerModel().scopes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Duration evaluationFrequency() { + return this.innerModel().evaluationFrequency(); + } + + public Duration windowSize() { + return this.innerModel().windowSize(); + } + + public Duration overrideQueryTimeRange() { + return this.innerModel().overrideQueryTimeRange(); + } + + public List targetResourceTypes() { + List inner = this.innerModel().targetResourceTypes(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public ScheduledQueryRuleCriteria criteria() { + return this.innerModel().criteria(); + } + + public Duration muteActionsDuration() { + return this.innerModel().muteActionsDuration(); + } + + public Actions actions() { + return this.innerModel().actions(); + } + + public Boolean isWorkspaceAlertsStorageConfigured() { + return this.innerModel().isWorkspaceAlertsStorageConfigured(); + } + + public Boolean checkWorkspaceAlertsStorageConfigured() { + return this.innerModel().checkWorkspaceAlertsStorageConfigured(); + } + + public Boolean skipQueryValidation() { + return this.innerModel().skipQueryValidation(); + } + + public Boolean autoMitigate() { + return this.innerModel().autoMitigate(); + } + + public RuleResolveConfiguration ruleResolveConfiguration() { + return this.innerModel().ruleResolveConfiguration(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ScheduledQueryRuleResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String ruleName; + + private ScheduledQueryRuleResourcePatch updateParameters; + + public ScheduledQueryRuleResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public ScheduledQueryRuleResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getScheduledQueryRules() + .createOrUpdateWithResponse(resourceGroupName, ruleName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public ScheduledQueryRuleResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getScheduledQueryRules() + .createOrUpdateWithResponse(resourceGroupName, ruleName, this.innerModel(), context) + .getValue(); + return this; + } + + ScheduledQueryRuleResourceImpl( + String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new ScheduledQueryRuleResourceInner(); + this.serviceManager = serviceManager; + this.ruleName = name; + } + + public ScheduledQueryRuleResourceImpl update() { + this.updateParameters = new ScheduledQueryRuleResourcePatch(); + return this; + } + + public ScheduledQueryRuleResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getScheduledQueryRules() + .updateWithResponse(resourceGroupName, ruleName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public ScheduledQueryRuleResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getScheduledQueryRules() + .updateWithResponse(resourceGroupName, ruleName, updateParameters, context) + .getValue(); + return this; + } + + ScheduledQueryRuleResourceImpl( + ScheduledQueryRuleResourceInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.ruleName = Utils.getValueFromIdByName(innerObject.id(), "scheduledQueryRules"); + } + + public ScheduledQueryRuleResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getScheduledQueryRules() + .getByResourceGroupWithResponse(resourceGroupName, ruleName, Context.NONE) + .getValue(); + return this; + } + + public ScheduledQueryRuleResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getScheduledQueryRules() + .getByResourceGroupWithResponse(resourceGroupName, ruleName, context) + .getValue(); + return this; + } + + public ScheduledQueryRuleResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public ScheduledQueryRuleResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public ScheduledQueryRuleResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ScheduledQueryRuleResourceImpl withIdentity(Identity identity) { + if (isInCreateMode()) { + this.innerModel().withIdentity(identity); + return this; + } else { + this.updateParameters.withIdentity(identity); + return this; + } + } + + public ScheduledQueryRuleResourceImpl withKind(Kind kind) { + this.innerModel().withKind(kind); + return this; + } + + public ScheduledQueryRuleResourceImpl withDescription(String description) { + if (isInCreateMode()) { + this.innerModel().withDescription(description); + return this; + } else { + this.updateParameters.withDescription(description); + return this; + } + } + + public ScheduledQueryRuleResourceImpl withDisplayName(String displayName) { + if (isInCreateMode()) { + this.innerModel().withDisplayName(displayName); + return this; + } else { + this.updateParameters.withDisplayName(displayName); + return this; + } + } + + public ScheduledQueryRuleResourceImpl withSeverity(AlertSeverity severity) { + if (isInCreateMode()) { + this.innerModel().withSeverity(severity); + return this; + } else { + this.updateParameters.withSeverity(severity); + return this; + } + } + + public ScheduledQueryRuleResourceImpl withEnabled(Boolean enabled) { + if (isInCreateMode()) { + this.innerModel().withEnabled(enabled); + return this; + } else { + this.updateParameters.withEnabled(enabled); + return this; + } + } + + public ScheduledQueryRuleResourceImpl withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (isInCreateMode()) { + this.innerModel().withPublicNetworkAccess(publicNetworkAccess); + return this; + } else { + this.updateParameters.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + } + + public ScheduledQueryRuleResourceImpl withScopes(List scopes) { + if (isInCreateMode()) { + this.innerModel().withScopes(scopes); + return this; + } else { + this.updateParameters.withScopes(scopes); + return this; + } + } + + public ScheduledQueryRuleResourceImpl withEvaluationFrequency(Duration evaluationFrequency) { + if (isInCreateMode()) { + this.innerModel().withEvaluationFrequency(evaluationFrequency); + return this; + } else { + this.updateParameters.withEvaluationFrequency(evaluationFrequency); + return this; + } + } + + public ScheduledQueryRuleResourceImpl withWindowSize(Duration windowSize) { + if (isInCreateMode()) { + this.innerModel().withWindowSize(windowSize); + return this; + } else { + this.updateParameters.withWindowSize(windowSize); + return this; + } + } + + public ScheduledQueryRuleResourceImpl withOverrideQueryTimeRange(Duration overrideQueryTimeRange) { + if (isInCreateMode()) { + this.innerModel().withOverrideQueryTimeRange(overrideQueryTimeRange); + return this; + } else { + this.updateParameters.withOverrideQueryTimeRange(overrideQueryTimeRange); + return this; + } + } + + public ScheduledQueryRuleResourceImpl withTargetResourceTypes(List targetResourceTypes) { + if (isInCreateMode()) { + this.innerModel().withTargetResourceTypes(targetResourceTypes); + return this; + } else { + this.updateParameters.withTargetResourceTypes(targetResourceTypes); + return this; + } + } + + public ScheduledQueryRuleResourceImpl withCriteria(ScheduledQueryRuleCriteria criteria) { + if (isInCreateMode()) { + this.innerModel().withCriteria(criteria); + return this; + } else { + this.updateParameters.withCriteria(criteria); + return this; + } + } + + public ScheduledQueryRuleResourceImpl withMuteActionsDuration(Duration muteActionsDuration) { + if (isInCreateMode()) { + this.innerModel().withMuteActionsDuration(muteActionsDuration); + return this; + } else { + this.updateParameters.withMuteActionsDuration(muteActionsDuration); + return this; + } + } + + public ScheduledQueryRuleResourceImpl withActions(Actions actions) { + if (isInCreateMode()) { + this.innerModel().withActions(actions); + return this; + } else { + this.updateParameters.withActions(actions); + return this; + } + } + + public ScheduledQueryRuleResourceImpl withCheckWorkspaceAlertsStorageConfigured( + Boolean checkWorkspaceAlertsStorageConfigured) { + if (isInCreateMode()) { + this.innerModel().withCheckWorkspaceAlertsStorageConfigured(checkWorkspaceAlertsStorageConfigured); + return this; + } else { + this.updateParameters.withCheckWorkspaceAlertsStorageConfigured(checkWorkspaceAlertsStorageConfigured); + return this; + } + } + + public ScheduledQueryRuleResourceImpl withSkipQueryValidation(Boolean skipQueryValidation) { + if (isInCreateMode()) { + this.innerModel().withSkipQueryValidation(skipQueryValidation); + return this; + } else { + this.updateParameters.withSkipQueryValidation(skipQueryValidation); + return this; + } + } + + public ScheduledQueryRuleResourceImpl withAutoMitigate(Boolean autoMitigate) { + if (isInCreateMode()) { + this.innerModel().withAutoMitigate(autoMitigate); + return this; + } else { + this.updateParameters.withAutoMitigate(autoMitigate); + return this; + } + } + + public ScheduledQueryRuleResourceImpl withRuleResolveConfiguration( + RuleResolveConfiguration ruleResolveConfiguration) { + if (isInCreateMode()) { + this.innerModel().withRuleResolveConfiguration(ruleResolveConfiguration); + return this; + } else { + this.updateParameters.withRuleResolveConfiguration(ruleResolveConfiguration); + return this; + } + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScheduledQueryRulesClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScheduledQueryRulesClientImpl.java new file mode 100644 index 0000000000000..9f7b5ef449718 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScheduledQueryRulesClientImpl.java @@ -0,0 +1,1245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.ScheduledQueryRulesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.ScheduledQueryRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.ScheduledQueryRuleResourceCollection; +import com.azure.resourcemanager.monitor.generated.models.ScheduledQueryRuleResourcePatch; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ScheduledQueryRulesClient. */ +public final class ScheduledQueryRulesClientImpl implements ScheduledQueryRulesClient { + /** The proxy service used to perform REST calls. */ + private final ScheduledQueryRulesService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of ScheduledQueryRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ScheduledQueryRulesClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(ScheduledQueryRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientScheduledQueryRules to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientSchedul") + public interface ScheduledQueryRulesService { + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.Insights/scheduledQueryRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/scheduledQueryRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/scheduledQueryRules/{ruleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ruleName") String ruleName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/scheduledQueryRules/{ruleName}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ruleName") String ruleName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ScheduledQueryRuleResourceInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/scheduledQueryRules/{ruleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> update( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ruleName") String ruleName, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ScheduledQueryRuleResourcePatch parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Insights" + + "/scheduledQueryRules/{ruleName}") + @ExpectedResponses({200, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> delete( + @HostParam("$host") String endpoint, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("ruleName") String ruleName, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listBySubscriptionNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroupNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieve a scheduled query rule definitions in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync() { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieve a scheduled query rule definitions in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2022-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Retrieve a scheduled query rule definitions in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>( + () -> listSinglePageAsync(), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink)); + } + + /** + * Retrieve a scheduled query rule definitions in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(context), nextLink -> listBySubscriptionNextSinglePageAsync(nextLink, context)); + } + + /** + * Retrieve a scheduled query rule definitions in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Retrieve a scheduled query rule definitions in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Retrieve scheduled query rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2022-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieve scheduled query rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2022-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Retrieve scheduled query rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + } + + /** + * Retrieve scheduled query rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>( + () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), + nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + } + + /** + * Retrieve scheduled query rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Retrieve scheduled query rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * Retrieve an scheduled query rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String ruleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + final String apiVersion = "2022-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieve an scheduled query rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String ruleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + final String apiVersion = "2022-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + accept, + context); + } + + /** + * Retrieve an scheduled query rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String ruleName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, ruleName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieve an scheduled query rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, ruleName, context).block(); + } + + /** + * Retrieve an scheduled query rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduledQueryRuleResourceInner getByResourceGroup(String resourceGroupName, String ruleName) { + return getByResourceGroupWithResponse(resourceGroupName, ruleName, Context.NONE).getValue(); + } + + /** + * Creates or updates a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String ruleName, ScheduledQueryRuleResourceInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String ruleName, ScheduledQueryRuleResourceInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String ruleName, ScheduledQueryRuleResourceInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, ruleName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Creates or updates a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String ruleName, ScheduledQueryRuleResourceInner parameters, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, ruleName, parameters, context).block(); + } + + /** + * Creates or updates a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to create or update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduledQueryRuleResourceInner createOrUpdate( + String resourceGroupName, String ruleName, ScheduledQueryRuleResourceInner parameters) { + return createOrUpdateWithResponse(resourceGroupName, ruleName, parameters, Context.NONE).getValue(); + } + + /** + * Update a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String ruleName, ScheduledQueryRuleResourcePatch parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String ruleName, ScheduledQueryRuleResourcePatch parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2022-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + parameters, + accept, + context); + } + + /** + * Update a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String ruleName, ScheduledQueryRuleResourcePatch parameters) { + return updateWithResponseAsync(resourceGroupName, ruleName, parameters) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Update a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String ruleName, ScheduledQueryRuleResourcePatch parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, ruleName, parameters, context).block(); + } + + /** + * Update a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param parameters The parameters of the rule to update. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ScheduledQueryRuleResourceInner update( + String resourceGroupName, String ruleName, ScheduledQueryRuleResourcePatch parameters) { + return updateWithResponse(resourceGroupName, ruleName, parameters, Context.NONE).getValue(); + } + + /** + * Deletes a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String ruleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + final String apiVersion = "2022-08-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> deleteWithResponseAsync(String resourceGroupName, String ruleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (ruleName == null) { + return Mono.error(new IllegalArgumentException("Parameter ruleName is required and cannot be null.")); + } + final String apiVersion = "2022-08-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + ruleName, + apiVersion, + accept, + context); + } + + /** + * Deletes a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String ruleName) { + return deleteWithResponseAsync(resourceGroupName, ruleName).flatMap(ignored -> Mono.empty()); + } + + /** + * Deletes a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String ruleName, Context context) { + return deleteWithResponseAsync(resourceGroupName, ruleName, context).block(); + } + + /** + * Deletes a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String ruleName) { + deleteWithResponse(resourceGroupName, ruleName, Context.NONE); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listBySubscriptionNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listBySubscriptionNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScheduledQueryRulesImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScheduledQueryRulesImpl.java new file mode 100644 index 0000000000000..47cf19caf8145 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScheduledQueryRulesImpl.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.ScheduledQueryRulesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.ScheduledQueryRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.ScheduledQueryRuleResource; +import com.azure.resourcemanager.monitor.generated.models.ScheduledQueryRules; + +public final class ScheduledQueryRulesImpl implements ScheduledQueryRules { + private static final ClientLogger LOGGER = new ClientLogger(ScheduledQueryRulesImpl.class); + + private final ScheduledQueryRulesClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public ScheduledQueryRulesImpl( + ScheduledQueryRulesClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new ScheduledQueryRuleResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return Utils.mapPage(inner, inner1 -> new ScheduledQueryRuleResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new ScheduledQueryRuleResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, context); + return Utils.mapPage(inner, inner1 -> new ScheduledQueryRuleResourceImpl(inner1, this.manager())); + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, ruleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ScheduledQueryRuleResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ScheduledQueryRuleResource getByResourceGroup(String resourceGroupName, String ruleName) { + ScheduledQueryRuleResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, ruleName); + if (inner != null) { + return new ScheduledQueryRuleResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response deleteByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, ruleName, context); + } + + public void deleteByResourceGroup(String resourceGroupName, String ruleName) { + this.serviceClient().delete(resourceGroupName, ruleName); + } + + public ScheduledQueryRuleResource getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String ruleName = Utils.getValueFromIdByName(id, "scheduledQueryRules"); + if (ruleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'scheduledQueryRules'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, ruleName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String ruleName = Utils.getValueFromIdByName(id, "scheduledQueryRules"); + if (ruleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'scheduledQueryRules'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, ruleName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String ruleName = Utils.getValueFromIdByName(id, "scheduledQueryRules"); + if (ruleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'scheduledQueryRules'.", id))); + } + this.deleteByResourceGroupWithResponse(resourceGroupName, ruleName, Context.NONE); + } + + public Response deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String ruleName = Utils.getValueFromIdByName(id, "scheduledQueryRules"); + if (ruleName == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'scheduledQueryRules'.", id))); + } + return this.deleteByResourceGroupWithResponse(resourceGroupName, ruleName, context); + } + + private ScheduledQueryRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + public ScheduledQueryRuleResourceImpl define(String name) { + return new ScheduledQueryRuleResourceImpl(name, this.manager()); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScopedResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScopedResourceImpl.java new file mode 100644 index 0000000000000..6258cdb9352a2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScopedResourceImpl.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.ScopedResourceInner; +import com.azure.resourcemanager.monitor.generated.models.ScopedResource; + +public final class ScopedResourceImpl implements ScopedResource, ScopedResource.Definition, ScopedResource.Update { + private ScopedResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String linkedResourceId() { + return this.innerModel().linkedResourceId(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public String resourceGroupName() { + return resourceGroupName; + } + + public ScopedResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String scopeName; + + private String name; + + public ScopedResourceImpl withExistingPrivateLinkScope(String resourceGroupName, String scopeName) { + this.resourceGroupName = resourceGroupName; + this.scopeName = scopeName; + return this; + } + + public ScopedResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateLinkScopedResources() + .createOrUpdate(resourceGroupName, scopeName, name, this.innerModel(), Context.NONE); + return this; + } + + public ScopedResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateLinkScopedResources() + .createOrUpdate(resourceGroupName, scopeName, name, this.innerModel(), context); + return this; + } + + ScopedResourceImpl(String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new ScopedResourceInner(); + this.serviceManager = serviceManager; + this.name = name; + } + + public ScopedResourceImpl update() { + return this; + } + + public ScopedResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateLinkScopedResources() + .createOrUpdate(resourceGroupName, scopeName, name, this.innerModel(), Context.NONE); + return this; + } + + public ScopedResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateLinkScopedResources() + .createOrUpdate(resourceGroupName, scopeName, name, this.innerModel(), context); + return this; + } + + ScopedResourceImpl( + ScopedResourceInner innerObject, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.scopeName = Utils.getValueFromIdByName(innerObject.id(), "privateLinkScopes"); + this.name = Utils.getValueFromIdByName(innerObject.id(), "scopedResources"); + } + + public ScopedResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateLinkScopedResources() + .getWithResponse(resourceGroupName, scopeName, name, Context.NONE) + .getValue(); + return this; + } + + public ScopedResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateLinkScopedResources() + .getWithResponse(resourceGroupName, scopeName, name, context) + .getValue(); + return this; + } + + public ScopedResourceImpl withLinkedResourceId(String linkedResourceId) { + this.innerModel().withLinkedResourceId(linkedResourceId); + return this; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/SingleMetricBaselineImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/SingleMetricBaselineImpl.java new file mode 100644 index 0000000000000..3b34ac2d6f878 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/SingleMetricBaselineImpl.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.SingleMetricBaselineInner; +import com.azure.resourcemanager.monitor.generated.models.SingleMetricBaseline; +import com.azure.resourcemanager.monitor.generated.models.TimeSeriesBaseline; +import java.time.Duration; +import java.util.Collections; +import java.util.List; + +public final class SingleMetricBaselineImpl implements SingleMetricBaseline { + private SingleMetricBaselineInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + SingleMetricBaselineImpl( + SingleMetricBaselineInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String type() { + return this.innerModel().type(); + } + + public String name() { + return this.innerModel().name(); + } + + public String timespan() { + return this.innerModel().timespan(); + } + + public Duration interval() { + return this.innerModel().interval(); + } + + public String namespace() { + return this.innerModel().namespace(); + } + + public List baselines() { + List inner = this.innerModel().baselines(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public SingleMetricBaselineInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActivityLogsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActivityLogsClientImpl.java new file mode 100644 index 0000000000000..dd1b04d8581e3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActivityLogsClientImpl.java @@ -0,0 +1,430 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.TenantActivityLogsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.EventDataInner; +import com.azure.resourcemanager.monitor.generated.models.EventDataCollection; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TenantActivityLogsClient. */ +public final class TenantActivityLogsClientImpl implements TenantActivityLogsClient { + /** The proxy service used to perform REST calls. */ + private final TenantActivityLogsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of TenantActivityLogsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TenantActivityLogsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(TenantActivityLogsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientTenantActivityLogs to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientTenantA") + public interface TenantActivityLogsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.Insights/eventtypes/management/values") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @QueryParam("$select") String select, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs + * for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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. <br>The **$filter** is very restricted and allows only the + * following patterns.<br>- List events for a resource group: $filter=eventTimestamp ge '<Start + * Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and + * resourceGroupName eq '<ResourceGroupName>'.<br>- List events for resource: $filter=eventTimestamp + * ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and + * resourceUri eq '<ResourceURI>'.<br>- List events for a subscription: $filter=eventTimestamp ge + * '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, + * Operation'.<br>- List events for a resource provider: $filter=eventTimestamp ge '<Start Time>' + * and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceProvider eq + * '<ResourceProviderName>'.<br>- 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 + * '<CorrelationID>'.<br>**NOTE**: No other syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>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*. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity + * Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, String select) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2015-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> service.list(this.client.getEndpoint(), apiVersion, filter, select, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs + * for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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. <br>The **$filter** is very restricted and allows only the + * following patterns.<br>- List events for a resource group: $filter=eventTimestamp ge '<Start + * Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and + * resourceGroupName eq '<ResourceGroupName>'.<br>- List events for resource: $filter=eventTimestamp + * ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and + * resourceUri eq '<ResourceURI>'.<br>- List events for a subscription: $filter=eventTimestamp ge + * '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, + * Operation'.<br>- List events for a resource provider: $filter=eventTimestamp ge '<Start Time>' + * and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceProvider eq + * '<ResourceProviderName>'.<br>- 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 + * '<CorrelationID>'.<br>**NOTE**: No other syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>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*. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity + * Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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 along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, String select, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String apiVersion = "2015-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, filter, select, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs + * for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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. <br>The **$filter** is very restricted and allows only the + * following patterns.<br>- List events for a resource group: $filter=eventTimestamp ge '<Start + * Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and + * resourceGroupName eq '<ResourceGroupName>'.<br>- List events for resource: $filter=eventTimestamp + * ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and + * resourceUri eq '<ResourceURI>'.<br>- List events for a subscription: $filter=eventTimestamp ge + * '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, + * Operation'.<br>- List events for a resource provider: $filter=eventTimestamp ge '<Start Time>' + * and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceProvider eq + * '<ResourceProviderName>'.<br>- 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 + * '<CorrelationID>'.<br>**NOTE**: No other syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>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*. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity + * Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, String select) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, select), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs + * for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity + * Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + final String select = null; + return new PagedFlux<>( + () -> listSinglePageAsync(filter, select), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs + * for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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. <br>The **$filter** is very restricted and allows only the + * following patterns.<br>- List events for a resource group: $filter=eventTimestamp ge '<Start + * Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and + * resourceGroupName eq '<ResourceGroupName>'.<br>- List events for resource: $filter=eventTimestamp + * ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and + * resourceUri eq '<ResourceURI>'.<br>- List events for a subscription: $filter=eventTimestamp ge + * '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, + * Operation'.<br>- List events for a resource provider: $filter=eventTimestamp ge '<Start Time>' + * and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceProvider eq + * '<ResourceProviderName>'.<br>- 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 + * '<CorrelationID>'.<br>**NOTE**: No other syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>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*. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity + * Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, String select, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(filter, select, context), nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs + * for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity + * Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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 as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + final String select = null; + return new PagedIterable<>(listAsync(filter, select)); + } + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs + * for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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. <br>The **$filter** is very restricted and allows only the + * following patterns.<br>- List events for a resource group: $filter=eventTimestamp ge '<Start + * Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and + * resourceGroupName eq '<ResourceGroupName>'.<br>- List events for resource: $filter=eventTimestamp + * ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and + * resourceUri eq '<ResourceURI>'.<br>- List events for a subscription: $filter=eventTimestamp ge + * '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, + * Operation'.<br>- List events for a resource provider: $filter=eventTimestamp ge '<Start Time>' + * and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceProvider eq + * '<ResourceProviderName>'.<br>- 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 + * '<CorrelationID>'.<br>**NOTE**: No other syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>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*. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity + * Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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 as paginated response with {@link + * PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, String select, Context context) { + return new PagedIterable<>(listAsync(filter, select, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of events along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The URL to get the next list of items + *

The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of events along with {@link PagedResponse} on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActivityLogsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActivityLogsImpl.java new file mode 100644 index 0000000000000..8b3c4ae7a6ed8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActivityLogsImpl.java @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.TenantActivityLogsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.EventDataInner; +import com.azure.resourcemanager.monitor.generated.models.EventData; +import com.azure.resourcemanager.monitor.generated.models.TenantActivityLogs; + +public final class TenantActivityLogsImpl implements TenantActivityLogs { + private static final ClientLogger LOGGER = new ClientLogger(TenantActivityLogsImpl.class); + + private final TenantActivityLogsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public TenantActivityLogsImpl( + TenantActivityLogsClient innerClient, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new EventDataImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, String select, Context context) { + PagedIterable inner = this.serviceClient().list(filter, select, context); + return Utils.mapPage(inner, inner1 -> new EventDataImpl(inner1, this.manager())); + } + + private TenantActivityLogsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TestNotificationDetailsResponseImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TestNotificationDetailsResponseImpl.java new file mode 100644 index 0000000000000..b04eda57d074b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TestNotificationDetailsResponseImpl.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.TestNotificationDetailsResponseInner; +import com.azure.resourcemanager.monitor.generated.models.ActionDetail; +import com.azure.resourcemanager.monitor.generated.models.Context; +import com.azure.resourcemanager.monitor.generated.models.TestNotificationDetailsResponse; +import java.util.Collections; +import java.util.List; + +public final class TestNotificationDetailsResponseImpl implements TestNotificationDetailsResponse { + private TestNotificationDetailsResponseInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + TestNotificationDetailsResponseImpl( + TestNotificationDetailsResponseInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public Context context() { + return this.innerModel().context(); + } + + public String state() { + return this.innerModel().state(); + } + + public String completedTime() { + return this.innerModel().completedTime(); + } + + public String createdTime() { + return this.innerModel().createdTime(); + } + + public List actionDetails() { + List inner = this.innerModel().actionDetails(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public TestNotificationDetailsResponseInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/Utils.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/Utils.java new file mode 100644 index 0000000000000..eaf4e69bfabea --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/Utils.java @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.util.CoreUtils; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import reactor.core.publisher.Flux; + +final class Utils { + static String getValueFromIdByName(String id, String name) { + if (id == null) { + return null; + } + Iterator itr = Arrays.stream(id.split("/")).iterator(); + while (itr.hasNext()) { + String part = itr.next(); + if (part != null && !part.trim().isEmpty()) { + if (part.equalsIgnoreCase(name)) { + if (itr.hasNext()) { + return itr.next(); + } else { + return null; + } + } + } + } + return null; + } + + static String getValueFromIdByParameterName(String id, String pathTemplate, String parameterName) { + if (id == null || pathTemplate == null) { + return null; + } + String parameterNameParentheses = "{" + parameterName + "}"; + List idSegmentsReverted = Arrays.asList(id.split("/")); + List pathSegments = Arrays.asList(pathTemplate.split("/")); + Collections.reverse(idSegmentsReverted); + Iterator idItrReverted = idSegmentsReverted.iterator(); + int pathIndex = pathSegments.size(); + while (idItrReverted.hasNext() && pathIndex > 0) { + String idSegment = idItrReverted.next(); + String pathSegment = pathSegments.get(--pathIndex); + if (!CoreUtils.isNullOrEmpty(idSegment) && !CoreUtils.isNullOrEmpty(pathSegment)) { + if (pathSegment.equalsIgnoreCase(parameterNameParentheses)) { + if (pathIndex == 0 || (pathIndex == 1 && pathSegments.get(0).isEmpty())) { + List segments = new ArrayList<>(); + segments.add(idSegment); + idItrReverted.forEachRemaining(segments::add); + Collections.reverse(segments); + if (segments.size() > 0 && segments.get(0).isEmpty()) { + segments.remove(0); + } + return String.join("/", segments); + } else { + return idSegment; + } + } + } + } + return null; + } + + static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { + return new PagedIterableImpl(pageIterable, mapper); + } + + private static final class PagedIterableImpl extends PagedIterable { + + private final PagedIterable pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/VMInsightsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/VMInsightsClientImpl.java new file mode 100644 index 0000000000000..b19f98f5d8f9f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/VMInsightsClientImpl.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.VMInsightsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.VMInsightsOnboardingStatusInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VMInsightsClient. */ +public final class VMInsightsClientImpl implements VMInsightsClient { + /** The proxy service used to perform REST calls. */ + private final VMInsightsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of VMInsightsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VMInsightsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(VMInsightsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientVMInsights to be used by the proxy service to perform + * REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientVMInsig") + public interface VMInsightsService { + @Headers({"Content-Type: application/json"}) + @Get("/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getOnboardingStatus( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam(value = "resourceUri", encoded = true) String resourceUri, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieves the VM Insights onboarding status for the specified resource or resource scope. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource, or scope, whose status + * to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return vM Insights onboarding status for a resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOnboardingStatusWithResponseAsync(String resourceUri) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String apiVersion = "2018-11-27-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service.getOnboardingStatus(this.client.getEndpoint(), apiVersion, resourceUri, accept, context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Retrieves the VM Insights onboarding status for the specified resource or resource scope. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource, or scope, whose status + * to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return vM Insights onboarding status for a resource along with {@link Response} on successful completion of + * {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getOnboardingStatusWithResponseAsync( + String resourceUri, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceUri == null) { + return Mono.error(new IllegalArgumentException("Parameter resourceUri is required and cannot be null.")); + } + final String apiVersion = "2018-11-27-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.getOnboardingStatus(this.client.getEndpoint(), apiVersion, resourceUri, accept, context); + } + + /** + * Retrieves the VM Insights onboarding status for the specified resource or resource scope. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource, or scope, whose status + * to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return vM Insights onboarding status for a resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getOnboardingStatusAsync(String resourceUri) { + return getOnboardingStatusWithResponseAsync(resourceUri).flatMap(res -> Mono.justOrEmpty(res.getValue())); + } + + /** + * Retrieves the VM Insights onboarding status for the specified resource or resource scope. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource, or scope, whose status + * to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return vM Insights onboarding status for a resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getOnboardingStatusWithResponse( + String resourceUri, Context context) { + return getOnboardingStatusWithResponseAsync(resourceUri, context).block(); + } + + /** + * Retrieves the VM Insights onboarding status for the specified resource or resource scope. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource, or scope, whose status + * to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return vM Insights onboarding status for a resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VMInsightsOnboardingStatusInner getOnboardingStatus(String resourceUri) { + return getOnboardingStatusWithResponse(resourceUri, Context.NONE).getValue(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/VMInsightsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/VMInsightsImpl.java new file mode 100644 index 0000000000000..550f144d401e9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/VMInsightsImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.VMInsightsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.VMInsightsOnboardingStatusInner; +import com.azure.resourcemanager.monitor.generated.models.VMInsights; +import com.azure.resourcemanager.monitor.generated.models.VMInsightsOnboardingStatus; + +public final class VMInsightsImpl implements VMInsights { + private static final ClientLogger LOGGER = new ClientLogger(VMInsightsImpl.class); + + private final VMInsightsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public VMInsightsImpl( + VMInsightsClient innerClient, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Response getOnboardingStatusWithResponse(String resourceUri, Context context) { + Response inner = + this.serviceClient().getOnboardingStatusWithResponse(resourceUri, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VMInsightsOnboardingStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public VMInsightsOnboardingStatus getOnboardingStatus(String resourceUri) { + VMInsightsOnboardingStatusInner inner = this.serviceClient().getOnboardingStatus(resourceUri); + if (inner != null) { + return new VMInsightsOnboardingStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + private VMInsightsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/VMInsightsOnboardingStatusImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/VMInsightsOnboardingStatusImpl.java new file mode 100644 index 0000000000000..9cd5b4232a0af --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/VMInsightsOnboardingStatusImpl.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.VMInsightsOnboardingStatusInner; +import com.azure.resourcemanager.monitor.generated.models.DataContainer; +import com.azure.resourcemanager.monitor.generated.models.DataStatus; +import com.azure.resourcemanager.monitor.generated.models.OnboardingStatus; +import com.azure.resourcemanager.monitor.generated.models.VMInsightsOnboardingStatus; +import java.util.Collections; +import java.util.List; + +public final class VMInsightsOnboardingStatusImpl implements VMInsightsOnboardingStatus { + private VMInsightsOnboardingStatusInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + VMInsightsOnboardingStatusImpl( + VMInsightsOnboardingStatusInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String resourceId() { + return this.innerModel().resourceId(); + } + + public OnboardingStatus onboardingStatus() { + return this.innerModel().onboardingStatus(); + } + + public DataStatus dataStatus() { + return this.innerModel().dataStatus(); + } + + public List data() { + List inner = this.innerModel().data(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public VMInsightsOnboardingStatusInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/package-info.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/package-info.java new file mode 100644 index 0000000000000..64f7e8232bbdd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the implementations for MonitorClient. Monitor Management Client. */ +package com.azure.resourcemanager.monitor.generated.implementation; diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AccessMode.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AccessMode.java new file mode 100644 index 0000000000000..b3e50c7d32e85 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AccessMode.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Access mode types. */ +public final class AccessMode extends ExpandableStringEnum { + /** Static value Open for AccessMode. */ + public static final AccessMode OPEN = fromString("Open"); + + /** Static value PrivateOnly for AccessMode. */ + public static final AccessMode PRIVATE_ONLY = fromString("PrivateOnly"); + + /** + * Creates a new instance of AccessMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AccessMode() { + } + + /** + * Creates or finds a AccessMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding AccessMode. + */ + @JsonCreator + public static AccessMode fromString(String name) { + return fromString(name, AccessMode.class); + } + + /** + * Gets known AccessMode values. + * + * @return known AccessMode values. + */ + public static Collection values() { + return values(AccessMode.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AccessModeSettings.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AccessModeSettings.java new file mode 100644 index 0000000000000..81f91b9f44e64 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AccessModeSettings.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties that define the scope private link mode settings. */ +@Fluent +public final class AccessModeSettings { + /* + * Specifies the default access mode of queries through associated private endpoints in scope. If not specified + * default value is 'Open'. You can override this default setting for a specific private endpoint connection by + * adding an exclusion in the 'exclusions' array. + */ + @JsonProperty(value = "queryAccessMode", required = true) + private AccessMode queryAccessMode; + + /* + * Specifies the default access mode of ingestion through associated private endpoints in scope. If not specified + * default value is 'Open'. You can override this default setting for a specific private endpoint connection by + * adding an exclusion in the 'exclusions' array. + */ + @JsonProperty(value = "ingestionAccessMode", required = true) + private AccessMode ingestionAccessMode; + + /* + * List of exclusions that override the default access mode settings for specific private endpoint connections. + */ + @JsonProperty(value = "exclusions") + private List exclusions; + + /** Creates an instance of AccessModeSettings class. */ + public AccessModeSettings() { + } + + /** + * Get the queryAccessMode property: Specifies the default access mode of queries through associated private + * endpoints in scope. If not specified default value is 'Open'. You can override this default setting for a + * specific private endpoint connection by adding an exclusion in the 'exclusions' array. + * + * @return the queryAccessMode value. + */ + public AccessMode queryAccessMode() { + return this.queryAccessMode; + } + + /** + * Set the queryAccessMode property: Specifies the default access mode of queries through associated private + * endpoints in scope. If not specified default value is 'Open'. You can override this default setting for a + * specific private endpoint connection by adding an exclusion in the 'exclusions' array. + * + * @param queryAccessMode the queryAccessMode value to set. + * @return the AccessModeSettings object itself. + */ + public AccessModeSettings withQueryAccessMode(AccessMode queryAccessMode) { + this.queryAccessMode = queryAccessMode; + return this; + } + + /** + * Get the ingestionAccessMode property: Specifies the default access mode of ingestion through associated private + * endpoints in scope. If not specified default value is 'Open'. You can override this default setting for a + * specific private endpoint connection by adding an exclusion in the 'exclusions' array. + * + * @return the ingestionAccessMode value. + */ + public AccessMode ingestionAccessMode() { + return this.ingestionAccessMode; + } + + /** + * Set the ingestionAccessMode property: Specifies the default access mode of ingestion through associated private + * endpoints in scope. If not specified default value is 'Open'. You can override this default setting for a + * specific private endpoint connection by adding an exclusion in the 'exclusions' array. + * + * @param ingestionAccessMode the ingestionAccessMode value to set. + * @return the AccessModeSettings object itself. + */ + public AccessModeSettings withIngestionAccessMode(AccessMode ingestionAccessMode) { + this.ingestionAccessMode = ingestionAccessMode; + return this; + } + + /** + * Get the exclusions property: List of exclusions that override the default access mode settings for specific + * private endpoint connections. + * + * @return the exclusions value. + */ + public List exclusions() { + return this.exclusions; + } + + /** + * Set the exclusions property: List of exclusions that override the default access mode settings for specific + * private endpoint connections. + * + * @param exclusions the exclusions value to set. + * @return the AccessModeSettings object itself. + */ + public AccessModeSettings withExclusions(List exclusions) { + this.exclusions = exclusions; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (queryAccessMode() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property queryAccessMode in model AccessModeSettings")); + } + if (ingestionAccessMode() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property ingestionAccessMode in model AccessModeSettings")); + } + if (exclusions() != null) { + exclusions().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AccessModeSettings.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AccessModeSettingsExclusion.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AccessModeSettingsExclusion.java new file mode 100644 index 0000000000000..28cb713a0eaf6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AccessModeSettingsExclusion.java @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * Properties that define the scope private link mode settings exclusion item. This setting applies to a specific + * private endpoint connection and overrides the default settings for that private endpoint connection. + */ +@Fluent +public final class AccessModeSettingsExclusion { + /* + * The private endpoint connection name associated to the private endpoint on which we want to apply the specific + * access mode settings. + */ + @JsonProperty(value = "privateEndpointConnectionName") + private String privateEndpointConnectionName; + + /* + * Specifies the access mode of queries through the specified private endpoint connection in the exclusion. + */ + @JsonProperty(value = "queryAccessMode") + private AccessMode queryAccessMode; + + /* + * Specifies the access mode of ingestion through the specified private endpoint connection in the exclusion. + */ + @JsonProperty(value = "ingestionAccessMode") + private AccessMode ingestionAccessMode; + + /** Creates an instance of AccessModeSettingsExclusion class. */ + public AccessModeSettingsExclusion() { + } + + /** + * Get the privateEndpointConnectionName property: The private endpoint connection name associated to the private + * endpoint on which we want to apply the specific access mode settings. + * + * @return the privateEndpointConnectionName value. + */ + public String privateEndpointConnectionName() { + return this.privateEndpointConnectionName; + } + + /** + * Set the privateEndpointConnectionName property: The private endpoint connection name associated to the private + * endpoint on which we want to apply the specific access mode settings. + * + * @param privateEndpointConnectionName the privateEndpointConnectionName value to set. + * @return the AccessModeSettingsExclusion object itself. + */ + public AccessModeSettingsExclusion withPrivateEndpointConnectionName(String privateEndpointConnectionName) { + this.privateEndpointConnectionName = privateEndpointConnectionName; + return this; + } + + /** + * Get the queryAccessMode property: Specifies the access mode of queries through the specified private endpoint + * connection in the exclusion. + * + * @return the queryAccessMode value. + */ + public AccessMode queryAccessMode() { + return this.queryAccessMode; + } + + /** + * Set the queryAccessMode property: Specifies the access mode of queries through the specified private endpoint + * connection in the exclusion. + * + * @param queryAccessMode the queryAccessMode value to set. + * @return the AccessModeSettingsExclusion object itself. + */ + public AccessModeSettingsExclusion withQueryAccessMode(AccessMode queryAccessMode) { + this.queryAccessMode = queryAccessMode; + return this; + } + + /** + * Get the ingestionAccessMode property: Specifies the access mode of ingestion through the specified private + * endpoint connection in the exclusion. + * + * @return the ingestionAccessMode value. + */ + public AccessMode ingestionAccessMode() { + return this.ingestionAccessMode; + } + + /** + * Set the ingestionAccessMode property: Specifies the access mode of ingestion through the specified private + * endpoint connection in the exclusion. + * + * @param ingestionAccessMode the ingestionAccessMode value to set. + * @return the AccessModeSettingsExclusion object itself. + */ + public AccessModeSettingsExclusion withIngestionAccessMode(AccessMode ingestionAccessMode) { + this.ingestionAccessMode = ingestionAccessMode; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionDetail.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionDetail.java new file mode 100644 index 0000000000000..ca23c3fac00b5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionDetail.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The action detail. */ +@Fluent +public final class ActionDetail { + /* + * The mechanism type + */ + @JsonProperty(value = "MechanismType") + private String mechanismType; + + /* + * The name of the action + */ + @JsonProperty(value = "Name") + private String name; + + /* + * The status of the action + */ + @JsonProperty(value = "Status") + private String status; + + /* + * The substatus of the action + */ + @JsonProperty(value = "SubState") + private String subState; + + /* + * The send time + */ + @JsonProperty(value = "SendTime") + private String sendTime; + + /* + * The detail of the friendly error message + */ + @JsonProperty(value = "Detail") + private String detail; + + /** Creates an instance of ActionDetail class. */ + public ActionDetail() { + } + + /** + * Get the mechanismType property: The mechanism type. + * + * @return the mechanismType value. + */ + public String mechanismType() { + return this.mechanismType; + } + + /** + * Set the mechanismType property: The mechanism type. + * + * @param mechanismType the mechanismType value to set. + * @return the ActionDetail object itself. + */ + public ActionDetail withMechanismType(String mechanismType) { + this.mechanismType = mechanismType; + return this; + } + + /** + * Get the name property: The name of the action. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the action. + * + * @param name the name value to set. + * @return the ActionDetail object itself. + */ + public ActionDetail withName(String name) { + this.name = name; + return this; + } + + /** + * Get the status property: The status of the action. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The status of the action. + * + * @param status the status value to set. + * @return the ActionDetail object itself. + */ + public ActionDetail withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the subState property: The substatus of the action. + * + * @return the subState value. + */ + public String subState() { + return this.subState; + } + + /** + * Set the subState property: The substatus of the action. + * + * @param subState the subState value to set. + * @return the ActionDetail object itself. + */ + public ActionDetail withSubState(String subState) { + this.subState = subState; + return this; + } + + /** + * Get the sendTime property: The send time. + * + * @return the sendTime value. + */ + public String sendTime() { + return this.sendTime; + } + + /** + * Set the sendTime property: The send time. + * + * @param sendTime the sendTime value to set. + * @return the ActionDetail object itself. + */ + public ActionDetail withSendTime(String sendTime) { + this.sendTime = sendTime; + return this; + } + + /** + * Get the detail property: The detail of the friendly error message. + * + * @return the detail value. + */ + public String detail() { + return this.detail; + } + + /** + * Set the detail property: The detail of the friendly error message. + * + * @param detail the detail value to set. + * @return the ActionDetail object itself. + */ + public ActionDetail withDetail(String detail) { + this.detail = detail; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupList.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupList.java new file mode 100644 index 0000000000000..77129c5766527 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.ActionGroupResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of action groups. */ +@Fluent +public final class ActionGroupList { + /* + * The list of action groups. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Provides the link to retrieve the next set of elements. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of ActionGroupList class. */ + public ActionGroupList() { + } + + /** + * Get the value property: The list of action groups. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of action groups. + * + * @param value the value value to set. + * @return the ActionGroupList object itself. + */ + public ActionGroupList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Provides the link to retrieve the next set of elements. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Provides the link to retrieve the next set of elements. + * + * @param nextLink the nextLink value to set. + * @return the ActionGroupList object itself. + */ + public ActionGroupList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupPatchBody.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupPatchBody.java new file mode 100644 index 0000000000000..61dc8d1bccd8d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupPatchBody.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.ActionGroupPatch; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An action group object for the body of patch operations. */ +@Fluent +public final class ActionGroupPatchBody { + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The action group settings for an update operation. + */ + @JsonProperty(value = "properties") + private ActionGroupPatch innerProperties; + + /** Creates an instance of ActionGroupPatchBody class. */ + public ActionGroupPatchBody() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the ActionGroupPatchBody object itself. + */ + public ActionGroupPatchBody withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: The action group settings for an update operation. + * + * @return the innerProperties value. + */ + private ActionGroupPatch innerProperties() { + return this.innerProperties; + } + + /** + * Get the enabled property: Indicates whether this action group is enabled. If an action group is not enabled, then + * none of its actions will be activated. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: Indicates whether this action group is enabled. If an action group is not enabled, then + * none of its actions will be activated. + * + * @param enabled the enabled value to set. + * @return the ActionGroupPatchBody object itself. + */ + public ActionGroupPatchBody withEnabled(Boolean enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new ActionGroupPatch(); + } + this.innerProperties().withEnabled(enabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupResource.java new file mode 100644 index 0000000000000..3a4ba22c3e072 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupResource.java @@ -0,0 +1,513 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.ActionGroupResourceInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of ActionGroupResource. */ +public interface ActionGroupResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the groupShortName property: The short name of the action group. This will be used in SMS messages. + * + * @return the groupShortName value. + */ + String groupShortName(); + + /** + * Gets the enabled property: Indicates whether this action group is enabled. If an action group is not enabled, + * then none of its receivers will receive communications. + * + * @return the enabled value. + */ + boolean enabled(); + + /** + * Gets the emailReceivers property: The list of email receivers that are part of this action group. + * + * @return the emailReceivers value. + */ + List emailReceivers(); + + /** + * Gets the smsReceivers property: The list of SMS receivers that are part of this action group. + * + * @return the smsReceivers value. + */ + List smsReceivers(); + + /** + * Gets the webhookReceivers property: The list of webhook receivers that are part of this action group. + * + * @return the webhookReceivers value. + */ + List webhookReceivers(); + + /** + * Gets the itsmReceivers property: The list of ITSM receivers that are part of this action group. + * + * @return the itsmReceivers value. + */ + List itsmReceivers(); + + /** + * Gets the azureAppPushReceivers property: The list of AzureAppPush receivers that are part of this action group. + * + * @return the azureAppPushReceivers value. + */ + List azureAppPushReceivers(); + + /** + * Gets the automationRunbookReceivers property: The list of AutomationRunbook receivers that are part of this + * action group. + * + * @return the automationRunbookReceivers value. + */ + List automationRunbookReceivers(); + + /** + * Gets the voiceReceivers property: The list of voice receivers that are part of this action group. + * + * @return the voiceReceivers value. + */ + List voiceReceivers(); + + /** + * Gets the logicAppReceivers property: The list of logic app receivers that are part of this action group. + * + * @return the logicAppReceivers value. + */ + List logicAppReceivers(); + + /** + * Gets the azureFunctionReceivers property: The list of azure function receivers that are part of this action + * group. + * + * @return the azureFunctionReceivers value. + */ + List azureFunctionReceivers(); + + /** + * Gets the armRoleReceivers property: 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. + * + * @return the armRoleReceivers value. + */ + List armRoleReceivers(); + + /** + * Gets the eventHubReceivers property: The list of event hub receivers that are part of this action group. + * + * @return the eventHubReceivers value. + */ + List eventHubReceivers(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.ActionGroupResourceInner object. + * + * @return the inner object. + */ + ActionGroupResourceInner innerModel(); + + /** The entirety of the ActionGroupResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The ActionGroupResource definition stages. */ + interface DefinitionStages { + /** The first stage of the ActionGroupResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ActionGroupResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the ActionGroupResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the ActionGroupResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithGroupShortName, + DefinitionStages.WithEnabled, + DefinitionStages.WithEmailReceivers, + DefinitionStages.WithSmsReceivers, + DefinitionStages.WithWebhookReceivers, + DefinitionStages.WithItsmReceivers, + DefinitionStages.WithAzureAppPushReceivers, + DefinitionStages.WithAutomationRunbookReceivers, + DefinitionStages.WithVoiceReceivers, + DefinitionStages.WithLogicAppReceivers, + DefinitionStages.WithAzureFunctionReceivers, + DefinitionStages.WithArmRoleReceivers, + DefinitionStages.WithEventHubReceivers { + /** + * Executes the create request. + * + * @return the created resource. + */ + ActionGroupResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ActionGroupResource create(Context context); + } + /** The stage of the ActionGroupResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ActionGroupResource definition allowing to specify groupShortName. */ + interface WithGroupShortName { + /** + * Specifies the groupShortName property: The short name of the action group. This will be used in SMS + * messages.. + * + * @param groupShortName The short name of the action group. This will be used in SMS messages. + * @return the next definition stage. + */ + WithCreate withGroupShortName(String groupShortName); + } + /** The stage of the ActionGroupResource definition allowing to specify enabled. */ + interface WithEnabled { + /** + * Specifies the enabled property: Indicates whether this action group is enabled. If an action group is not + * enabled, then none of its receivers will receive communications.. + * + * @param enabled Indicates whether this action group is enabled. If an action group is not enabled, then + * none of its receivers will receive communications. + * @return the next definition stage. + */ + WithCreate withEnabled(boolean enabled); + } + /** The stage of the ActionGroupResource definition allowing to specify emailReceivers. */ + interface WithEmailReceivers { + /** + * Specifies the emailReceivers property: The list of email receivers that are part of this action group.. + * + * @param emailReceivers The list of email receivers that are part of this action group. + * @return the next definition stage. + */ + WithCreate withEmailReceivers(List emailReceivers); + } + /** The stage of the ActionGroupResource definition allowing to specify smsReceivers. */ + interface WithSmsReceivers { + /** + * Specifies the smsReceivers property: The list of SMS receivers that are part of this action group.. + * + * @param smsReceivers The list of SMS receivers that are part of this action group. + * @return the next definition stage. + */ + WithCreate withSmsReceivers(List smsReceivers); + } + /** The stage of the ActionGroupResource definition allowing to specify webhookReceivers. */ + interface WithWebhookReceivers { + /** + * Specifies the webhookReceivers property: The list of webhook receivers that are part of this action + * group.. + * + * @param webhookReceivers The list of webhook receivers that are part of this action group. + * @return the next definition stage. + */ + WithCreate withWebhookReceivers(List webhookReceivers); + } + /** The stage of the ActionGroupResource definition allowing to specify itsmReceivers. */ + interface WithItsmReceivers { + /** + * Specifies the itsmReceivers property: The list of ITSM receivers that are part of this action group.. + * + * @param itsmReceivers The list of ITSM receivers that are part of this action group. + * @return the next definition stage. + */ + WithCreate withItsmReceivers(List itsmReceivers); + } + /** The stage of the ActionGroupResource definition allowing to specify azureAppPushReceivers. */ + interface WithAzureAppPushReceivers { + /** + * Specifies the azureAppPushReceivers property: The list of AzureAppPush receivers that are part of this + * action group.. + * + * @param azureAppPushReceivers The list of AzureAppPush receivers that are part of this action group. + * @return the next definition stage. + */ + WithCreate withAzureAppPushReceivers(List azureAppPushReceivers); + } + /** The stage of the ActionGroupResource definition allowing to specify automationRunbookReceivers. */ + interface WithAutomationRunbookReceivers { + /** + * Specifies the automationRunbookReceivers property: The list of AutomationRunbook receivers that are part + * of this action group.. + * + * @param automationRunbookReceivers The list of AutomationRunbook receivers that are part of this action + * group. + * @return the next definition stage. + */ + WithCreate withAutomationRunbookReceivers(List automationRunbookReceivers); + } + /** The stage of the ActionGroupResource definition allowing to specify voiceReceivers. */ + interface WithVoiceReceivers { + /** + * Specifies the voiceReceivers property: The list of voice receivers that are part of this action group.. + * + * @param voiceReceivers The list of voice receivers that are part of this action group. + * @return the next definition stage. + */ + WithCreate withVoiceReceivers(List voiceReceivers); + } + /** The stage of the ActionGroupResource definition allowing to specify logicAppReceivers. */ + interface WithLogicAppReceivers { + /** + * Specifies the logicAppReceivers property: The list of logic app receivers that are part of this action + * group.. + * + * @param logicAppReceivers The list of logic app receivers that are part of this action group. + * @return the next definition stage. + */ + WithCreate withLogicAppReceivers(List logicAppReceivers); + } + /** The stage of the ActionGroupResource definition allowing to specify azureFunctionReceivers. */ + interface WithAzureFunctionReceivers { + /** + * Specifies the azureFunctionReceivers property: The list of azure function receivers that are part of this + * action group.. + * + * @param azureFunctionReceivers The list of azure function receivers that are part of this action group. + * @return the next definition stage. + */ + WithCreate withAzureFunctionReceivers(List azureFunctionReceivers); + } + /** The stage of the ActionGroupResource definition allowing to specify armRoleReceivers. */ + interface WithArmRoleReceivers { + /** + * Specifies the armRoleReceivers property: 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.. + * + * @param armRoleReceivers 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. + * @return the next definition stage. + */ + WithCreate withArmRoleReceivers(List armRoleReceivers); + } + /** The stage of the ActionGroupResource definition allowing to specify eventHubReceivers. */ + interface WithEventHubReceivers { + /** + * Specifies the eventHubReceivers property: The list of event hub receivers that are part of this action + * group.. + * + * @param eventHubReceivers The list of event hub receivers that are part of this action group. + * @return the next definition stage. + */ + WithCreate withEventHubReceivers(List eventHubReceivers); + } + } + /** + * Begins update for the ActionGroupResource resource. + * + * @return the stage of resource update. + */ + ActionGroupResource.Update update(); + + /** The template for ActionGroupResource update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithEnabled { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ActionGroupResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ActionGroupResource apply(Context context); + } + /** The ActionGroupResource update stages. */ + interface UpdateStages { + /** The stage of the ActionGroupResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ActionGroupResource update allowing to specify enabled. */ + interface WithEnabled { + /** + * Specifies the enabled property: Indicates whether this action group is enabled. If an action group is not + * enabled, then none of its actions will be activated.. + * + * @param enabled Indicates whether this action group is enabled. If an action group is not enabled, then + * none of its actions will be activated. + * @return the next definition stage. + */ + Update withEnabled(Boolean enabled); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ActionGroupResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ActionGroupResource refresh(Context context); + + /** + * Send test notifications to a set of provided receivers. + * + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + TestNotificationDetailsResponse createNotificationsAtActionGroupResourceLevel( + NotificationRequestBody notificationRequest); + + /** + * Send test notifications to a set of provided receivers. + * + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + TestNotificationDetailsResponse createNotificationsAtActionGroupResourceLevel( + NotificationRequestBody notificationRequest, Context context); + + /** + * 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 enableRequest The receiver to re-enable. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response enableReceiverWithResponse(EnableRequest enableRequest, Context context); + + /** + * 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 enableRequest The receiver to re-enable. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void enableReceiver(EnableRequest enableRequest); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroups.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroups.java new file mode 100644 index 0000000000000..ae9d525863b4a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroups.java @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ActionGroups. */ +public interface ActionGroups { + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String actionGroupName, Context context); + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group. + */ + ActionGroupResource getByResourceGroup(String resourceGroupName, String actionGroupName); + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String actionGroupName, Context context); + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String actionGroupName); + + /** + * Send test notifications to a set of provided receivers. + * + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + TestNotificationDetailsResponse postTestNotifications(NotificationRequestBody notificationRequest); + + /** + * Send test notifications to a set of provided receivers. + * + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + TestNotificationDetailsResponse postTestNotifications(NotificationRequestBody notificationRequest, Context context); + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + TestNotificationDetailsResponse createNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest); + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + TestNotificationDetailsResponse createNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest, Context context); + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationRequest The notification request body which includes the contact details. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + TestNotificationDetailsResponse createNotificationsAtActionGroupResourceLevel( + String resourceGroupName, String actionGroupName, NotificationRequestBody notificationRequest); + + /** + * Send test notifications to a set of provided receivers. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationRequest The notification request body which includes the contact details. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the details of the test notification results. + */ + TestNotificationDetailsResponse createNotificationsAtActionGroupResourceLevel( + String resourceGroupName, String actionGroupName, NotificationRequestBody notificationRequest, Context context); + + /** + * Get the test notifications by the notification id. + * + * @param notificationId The notification id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id along with {@link Response}. + */ + Response getTestNotificationsWithResponse(String notificationId, Context context); + + /** + * Get the test notifications by the notification id. + * + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id. + */ + TestNotificationDetailsResponse getTestNotifications(String notificationId); + + /** + * Get the test notifications by the notification id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationId The notification id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id along with {@link Response}. + */ + Response getTestNotificationsAtResourceGroupLevelWithResponse( + String resourceGroupName, String notificationId, Context context); + + /** + * Get the test notifications by the notification id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id. + */ + TestNotificationDetailsResponse getTestNotificationsAtResourceGroupLevel( + String resourceGroupName, String notificationId); + + /** + * Get the test notifications by the notification id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationId The notification id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id along with {@link Response}. + */ + Response getTestNotificationsAtActionGroupResourceLevelWithResponse( + String resourceGroupName, String actionGroupName, String notificationId, Context context); + + /** + * Get the test notifications by the notification id. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param notificationId The notification id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the test notifications by the notification id. + */ + TestNotificationDetailsResponse getTestNotificationsAtActionGroupResourceLevel( + String resourceGroupName, String actionGroupName, String notificationId); + + /** + * Get a list of all action groups in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Get a list of all action groups in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a subscription as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a resource group as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param enableRequest The receiver to re-enable. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response enableReceiverWithResponse( + String resourceGroupName, String actionGroupName, EnableRequest enableRequest, Context context); + + /** + * 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 resourceGroupName The name of the resource group. The name is case insensitive. + * @param actionGroupName The name of the action group. + * @param enableRequest The receiver to re-enable. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void enableReceiver(String resourceGroupName, String actionGroupName, EnableRequest enableRequest); + + /** + * Get an action group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group along with {@link Response}. + */ + ActionGroupResource getById(String id); + + /** + * Get an action group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an action group along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete an action group. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete an action group. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ActionGroupResource resource. + * + * @param name resource name. + * @return the first stage of the new ActionGroupResource definition. + */ + ActionGroupResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionList.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionList.java new file mode 100644 index 0000000000000..75ea666432f4c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionList.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Activity Log Alert rule actions. */ +@Fluent +public final class ActionList { + /* + * The list of the Action Groups. + */ + @JsonProperty(value = "actionGroups") + private List actionGroups; + + /** Creates an instance of ActionList class. */ + public ActionList() { + } + + /** + * Get the actionGroups property: The list of the Action Groups. + * + * @return the actionGroups value. + */ + public List actionGroups() { + return this.actionGroups; + } + + /** + * Set the actionGroups property: The list of the Action Groups. + * + * @param actionGroups the actionGroups value to set. + * @return the ActionList object itself. + */ + public ActionList withActionGroups(List actionGroups) { + this.actionGroups = actionGroups; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (actionGroups() != null) { + actionGroups().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionType.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionType.java new file mode 100644 index 0000000000000..ebf57ea74ed47 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionType.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. */ +public final class ActionType extends ExpandableStringEnum { + /** Static value Internal for ActionType. */ + public static final ActionType INTERNAL = fromString("Internal"); + + /** + * Creates a new instance of ActionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ActionType() { + } + + /** + * Creates or finds a ActionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ActionType. + */ + @JsonCreator + public static ActionType fromString(String name) { + return fromString(name, ActionType.class); + } + + /** + * Gets known ActionType values. + * + * @return known ActionType values. + */ + public static Collection values() { + return values(ActionType.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Actions.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Actions.java new file mode 100644 index 0000000000000..c840f1ead68f7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Actions.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Actions to invoke when the alert fires. */ +@Fluent +public final class Actions { + /* + * Action Group resource Ids to invoke when the alert fires. + */ + @JsonProperty(value = "actionGroups") + private List actionGroups; + + /* + * The properties of an alert payload. + */ + @JsonProperty(value = "customProperties") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map customProperties; + + /** Creates an instance of Actions class. */ + public Actions() { + } + + /** + * Get the actionGroups property: Action Group resource Ids to invoke when the alert fires. + * + * @return the actionGroups value. + */ + public List actionGroups() { + return this.actionGroups; + } + + /** + * Set the actionGroups property: Action Group resource Ids to invoke when the alert fires. + * + * @param actionGroups the actionGroups value to set. + * @return the Actions object itself. + */ + public Actions withActionGroups(List actionGroups) { + this.actionGroups = actionGroups; + return this; + } + + /** + * Get the customProperties property: The properties of an alert payload. + * + * @return the customProperties value. + */ + public Map customProperties() { + return this.customProperties; + } + + /** + * Set the customProperties property: The properties of an alert payload. + * + * @param customProperties the customProperties value to set. + * @return the Actions object itself. + */ + public Actions withCustomProperties(Map customProperties) { + this.customProperties = customProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertActionGroup.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertActionGroup.java new file mode 100644 index 0000000000000..fabdd98359b95 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertActionGroup.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A pointer to an Azure Action Group. */ +@Fluent +public final class ActivityLogAlertActionGroup { + /* + * The resource ID of the Action Group. This cannot be null or empty. + */ + @JsonProperty(value = "actionGroupId", required = true) + private String actionGroupId; + + /* + * the dictionary of custom properties to include with the post operation. These data are appended to the webhook + * payload. + */ + @JsonProperty(value = "webhookProperties") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map webhookProperties; + + /** Creates an instance of ActivityLogAlertActionGroup class. */ + public ActivityLogAlertActionGroup() { + } + + /** + * Get the actionGroupId property: The resource ID of the Action Group. This cannot be null or empty. + * + * @return the actionGroupId value. + */ + public String actionGroupId() { + return this.actionGroupId; + } + + /** + * Set the actionGroupId property: The resource ID of the Action Group. This cannot be null or empty. + * + * @param actionGroupId the actionGroupId value to set. + * @return the ActivityLogAlertActionGroup object itself. + */ + public ActivityLogAlertActionGroup withActionGroupId(String actionGroupId) { + this.actionGroupId = actionGroupId; + return this; + } + + /** + * Get the webhookProperties property: the dictionary of custom properties to include with the post operation. These + * data are appended to the webhook payload. + * + * @return the webhookProperties value. + */ + public Map webhookProperties() { + return this.webhookProperties; + } + + /** + * Set the webhookProperties property: the dictionary of custom properties to include with the post operation. These + * data are appended to the webhook payload. + * + * @param webhookProperties the webhookProperties value to set. + * @return the ActivityLogAlertActionGroup object itself. + */ + public ActivityLogAlertActionGroup withWebhookProperties(Map webhookProperties) { + this.webhookProperties = webhookProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (actionGroupId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property actionGroupId in model ActivityLogAlertActionGroup")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ActivityLogAlertActionGroup.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertAllOfCondition.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertAllOfCondition.java new file mode 100644 index 0000000000000..cf3c38f522e83 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertAllOfCondition.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** An Activity Log Alert rule condition that is met when all its member conditions are met. */ +@Fluent +public final class ActivityLogAlertAllOfCondition { + /* + * The list of Activity Log Alert rule conditions. + */ + @JsonProperty(value = "allOf", required = true) + private List allOf; + + /** Creates an instance of ActivityLogAlertAllOfCondition class. */ + public ActivityLogAlertAllOfCondition() { + } + + /** + * Get the allOf property: The list of Activity Log Alert rule conditions. + * + * @return the allOf value. + */ + public List allOf() { + return this.allOf; + } + + /** + * Set the allOf property: The list of Activity Log Alert rule conditions. + * + * @param allOf the allOf value to set. + * @return the ActivityLogAlertAllOfCondition object itself. + */ + public ActivityLogAlertAllOfCondition withAllOf(List allOf) { + this.allOf = allOf; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (allOf() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property allOf in model ActivityLogAlertAllOfCondition")); + } else { + allOf().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ActivityLogAlertAllOfCondition.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertLeafCondition.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertLeafCondition.java new file mode 100644 index 0000000000000..75de29219692f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertLeafCondition.java @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * An Activity Log Alert rule condition that is met when all its member conditions are met. Each condition can be of one + * of the following types: __Important__: Each type has its unique subset of properties. Properties from different types + * CANNOT exist in one condition. * __Leaf Condition -__ must contain 'field' and either 'equals' or 'containsAny'. + * _Please note, 'anyOf' should __not__ be set in a Leaf Condition._ * __AnyOf Condition -__ must contain __only__ + * 'anyOf' (which is an array of Leaf Conditions). _Please note, 'field', 'equals' and 'containsAny' should __not__ be + * set in an AnyOf Condition._. + */ +@Fluent +public final class ActivityLogAlertLeafCondition extends AlertRuleLeafCondition { + /* + * An Activity Log Alert rule 'anyOf' condition. + * + * An Activity Log Alert rule condition that is met when at least one of its member leaf conditions are met. + */ + @JsonProperty(value = "anyOf") + private List anyOf; + + /** Creates an instance of ActivityLogAlertLeafCondition class. */ + public ActivityLogAlertLeafCondition() { + } + + /** + * Get the anyOf property: An Activity Log Alert rule 'anyOf' condition. + * + *

An Activity Log Alert rule condition that is met when at least one of its member leaf conditions are met. + * + * @return the anyOf value. + */ + public List anyOf() { + return this.anyOf; + } + + /** + * Set the anyOf property: An Activity Log Alert rule 'anyOf' condition. + * + *

An Activity Log Alert rule condition that is met when at least one of its member leaf conditions are met. + * + * @param anyOf the anyOf value to set. + * @return the ActivityLogAlertLeafCondition object itself. + */ + public ActivityLogAlertLeafCondition withAnyOf(List anyOf) { + this.anyOf = anyOf; + return this; + } + + /** {@inheritDoc} */ + @Override + public ActivityLogAlertLeafCondition withField(String field) { + super.withField(field); + return this; + } + + /** {@inheritDoc} */ + @Override + public ActivityLogAlertLeafCondition withEquals(String equals) { + super.withEquals(equals); + return this; + } + + /** {@inheritDoc} */ + @Override + public ActivityLogAlertLeafCondition withContainsAny(List containsAny) { + super.withContainsAny(containsAny); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (anyOf() != null) { + anyOf().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertResource.java new file mode 100644 index 0000000000000..14733e578ebc5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertResource.java @@ -0,0 +1,312 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.ActivityLogAlertResourceInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of ActivityLogAlertResource. */ +public interface ActivityLogAlertResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the scopes property: A list of resource IDs that will be used as prefixes. The alert will only apply to + * Activity Log events with resource IDs that fall under one of these prefixes. This list must include at least one + * item. + * + * @return the scopes value. + */ + List scopes(); + + /** + * Gets the condition property: The condition that will cause this alert to activate. + * + * @return the condition value. + */ + ActivityLogAlertAllOfCondition condition(); + + /** + * Gets the actions property: The actions that will activate when the condition is met. + * + * @return the actions value. + */ + ActionList actions(); + + /** + * Gets the enabled property: Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert + * rule is not enabled, then none of its actions will be activated. + * + * @return the enabled value. + */ + Boolean enabled(); + + /** + * Gets the description property: A description of this Activity Log Alert rule. + * + * @return the description value. + */ + String description(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.ActivityLogAlertResourceInner object. + * + * @return the inner object. + */ + ActivityLogAlertResourceInner innerModel(); + + /** The entirety of the ActivityLogAlertResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The ActivityLogAlertResource definition stages. */ + interface DefinitionStages { + /** The first stage of the ActivityLogAlertResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ActivityLogAlertResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the ActivityLogAlertResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the ActivityLogAlertResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithScopes, + DefinitionStages.WithCondition, + DefinitionStages.WithActions, + DefinitionStages.WithEnabled, + DefinitionStages.WithDescription { + /** + * Executes the create request. + * + * @return the created resource. + */ + ActivityLogAlertResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ActivityLogAlertResource create(Context context); + } + /** The stage of the ActivityLogAlertResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ActivityLogAlertResource definition allowing to specify scopes. */ + interface WithScopes { + /** + * Specifies the scopes property: A list of resource IDs that will be used as prefixes. The alert will only + * apply to Activity Log events with resource IDs that fall under one of these prefixes. This list must + * include at least one item.. + * + * @param scopes A list of resource IDs that will be used as prefixes. The alert will only apply to Activity + * Log events with resource IDs that fall under one of these prefixes. This list must include at least + * one item. + * @return the next definition stage. + */ + WithCreate withScopes(List scopes); + } + /** The stage of the ActivityLogAlertResource definition allowing to specify condition. */ + interface WithCondition { + /** + * Specifies the condition property: The condition that will cause this alert to activate.. + * + * @param condition The condition that will cause this alert to activate. + * @return the next definition stage. + */ + WithCreate withCondition(ActivityLogAlertAllOfCondition condition); + } + /** The stage of the ActivityLogAlertResource definition allowing to specify actions. */ + interface WithActions { + /** + * Specifies the actions property: The actions that will activate when the condition is met.. + * + * @param actions The actions that will activate when the condition is met. + * @return the next definition stage. + */ + WithCreate withActions(ActionList actions); + } + /** The stage of the ActivityLogAlertResource definition allowing to specify enabled. */ + interface WithEnabled { + /** + * Specifies the enabled property: Indicates whether this Activity Log Alert rule is enabled. If an Activity + * Log Alert rule is not enabled, then none of its actions will be activated.. + * + * @param enabled Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule + * is not enabled, then none of its actions will be activated. + * @return the next definition stage. + */ + WithCreate withEnabled(Boolean enabled); + } + /** The stage of the ActivityLogAlertResource definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: A description of this Activity Log Alert rule.. + * + * @param description A description of this Activity Log Alert rule. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + } + /** + * Begins update for the ActivityLogAlertResource resource. + * + * @return the stage of resource update. + */ + ActivityLogAlertResource.Update update(); + + /** The template for ActivityLogAlertResource update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithEnabled { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ActivityLogAlertResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ActivityLogAlertResource apply(Context context); + } + /** The ActivityLogAlertResource update stages. */ + interface UpdateStages { + /** The stage of the ActivityLogAlertResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: The resource tags. + * + * @param tags The resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ActivityLogAlertResource update allowing to specify enabled. */ + interface WithEnabled { + /** + * Specifies the enabled property: Indicates whether this Activity Log Alert rule is enabled. If an Activity + * Log Alert rule is not enabled, then none of its actions will be activated.. + * + * @param enabled Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert rule + * is not enabled, then none of its actions will be activated. + * @return the next definition stage. + */ + Update withEnabled(Boolean enabled); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ActivityLogAlertResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ActivityLogAlertResource refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlerts.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlerts.java new file mode 100644 index 0000000000000..8f7d6d725c3bb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlerts.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ActivityLogAlerts. */ +public interface ActivityLogAlerts { + /** + * Get an Activity Log Alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String activityLogAlertName, Context context); + + /** + * Get an Activity Log Alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule. + */ + ActivityLogAlertResource getByResourceGroup(String resourceGroupName, String activityLogAlertName); + + /** + * Delete an Activity Log Alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse( + String resourceGroupName, String activityLogAlertName, Context context); + + /** + * Delete an Activity Log Alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param activityLogAlertName The name of the Activity Log Alert rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String activityLogAlertName); + + /** + * Get a list of all Activity Log Alert rules in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a subscription as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * Get a list of all Activity Log Alert rules in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a subscription as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Get a list of all Activity Log Alert rules in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get a list of all Activity Log Alert rules in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Activity Log Alert rules in a resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get an Activity Log Alert rule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule along with {@link Response}. + */ + ActivityLogAlertResource getById(String id); + + /** + * Get an Activity Log Alert rule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Activity Log Alert rule along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete an Activity Log Alert rule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete an Activity Log Alert rule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ActivityLogAlertResource resource. + * + * @param name resource name. + * @return the first stage of the new ActivityLogAlertResource definition. + */ + ActivityLogAlertResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogs.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogs.java new file mode 100644 index 0000000000000..6736aca8088d4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogs.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ActivityLogs. */ +public interface ActivityLogs { + /** + * Provides the list of records from the activity logs. + * + * @param filter Reduces the set of data collected.<br>This argument is required and it also requires at least + * the start date/time.<br>The **$filter** argument is very restricted and allows only the following + * patterns.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br><br>**NOTE**: No other + * syntax is allowed. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of events as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String filter); + + /** + * Provides the list of records from the activity logs. + * + * @param filter Reduces the set of data collected.<br>This argument is required and it also requires at least + * the start date/time.<br>The **$filter** argument is very restricted and allows only the following + * patterns.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br>- *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'.<br><br>**NOTE**: No other + * syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>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*. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of events as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String filter, String select, Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AggregationType.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AggregationType.java new file mode 100644 index 0000000000000..4fd2a1cb0dcc7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AggregationType.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** the aggregation type of the metric. */ +public enum AggregationType { + /** Enum value None. */ + NONE("None"), + + /** Enum value Average. */ + AVERAGE("Average"), + + /** Enum value Count. */ + COUNT("Count"), + + /** Enum value Minimum. */ + MINIMUM("Minimum"), + + /** Enum value Maximum. */ + MAXIMUM("Maximum"), + + /** Enum value Total. */ + TOTAL("Total"); + + /** The actual serialized value for a AggregationType instance. */ + private final String value; + + AggregationType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a AggregationType instance. + * + * @param value the serialized value to parse. + * @return the parsed AggregationType object, or null if unable to parse. + */ + @JsonCreator + public static AggregationType fromString(String value) { + if (value == null) { + return null; + } + AggregationType[] items = AggregationType.values(); + for (AggregationType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AggregationTypeEnum.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AggregationTypeEnum.java new file mode 100644 index 0000000000000..ee6609410c3cf --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AggregationTypeEnum.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** the criteria time aggregation types. */ +public final class AggregationTypeEnum extends ExpandableStringEnum { + /** Static value Average for AggregationTypeEnum. */ + public static final AggregationTypeEnum AVERAGE = fromString("Average"); + + /** Static value Count for AggregationTypeEnum. */ + public static final AggregationTypeEnum COUNT = fromString("Count"); + + /** Static value Minimum for AggregationTypeEnum. */ + public static final AggregationTypeEnum MINIMUM = fromString("Minimum"); + + /** Static value Maximum for AggregationTypeEnum. */ + public static final AggregationTypeEnum MAXIMUM = fromString("Maximum"); + + /** Static value Total for AggregationTypeEnum. */ + public static final AggregationTypeEnum TOTAL = fromString("Total"); + + /** + * Creates a new instance of AggregationTypeEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public AggregationTypeEnum() { + } + + /** + * Creates or finds a AggregationTypeEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding AggregationTypeEnum. + */ + @JsonCreator + public static AggregationTypeEnum fromString(String name) { + return fromString(name, AggregationTypeEnum.class); + } + + /** + * Gets known AggregationTypeEnum values. + * + * @return known AggregationTypeEnum values. + */ + public static Collection values() { + return values(AggregationTypeEnum.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleIncidents.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleIncidents.java new file mode 100644 index 0000000000000..a43ccca55f931 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleIncidents.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of AlertRuleIncidents. */ +public interface AlertRuleIncidents { + /** + * Gets an incident associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param incidentName The name of the incident to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident associated to an alert rule along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String ruleName, String incidentName, Context context); + + /** + * Gets an incident associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param incidentName The name of the incident to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an incident associated to an alert rule. + */ + Incident get(String resourceGroupName, String ruleName, String incidentName); + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of incidents associated to an alert rule as paginated response with {@link PagedIterable}. + */ + PagedIterable listByAlertRule(String resourceGroupName, String ruleName); + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of incidents associated to an alert rule as paginated response with {@link PagedIterable}. + */ + PagedIterable listByAlertRule(String resourceGroupName, String ruleName, Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleLeafCondition.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleLeafCondition.java new file mode 100644 index 0000000000000..cbf29bd9810cd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleLeafCondition.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * An Activity Log Alert rule condition that is met by comparing the field and value of an Activity Log event. This + * condition must contain 'field' and either 'equals' or 'containsAny'. + */ +@Fluent +public class AlertRuleLeafCondition { + /* + * The name of the Activity Log event's 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'. + */ + @JsonProperty(value = "field") + private String field; + + /* + * The value of the event's field will be compared to this value (case-insensitive) to determine if the condition + * is met. + */ + @JsonProperty(value = "equals") + private String equals; + + /* + * The value of the event's field will be compared to the values in this array (case-insensitive) to determine if + * the condition is met. + */ + @JsonProperty(value = "containsAny") + private List containsAny; + + /** Creates an instance of AlertRuleLeafCondition class. */ + public AlertRuleLeafCondition() { + } + + /** + * Get the field property: The name of the Activity Log event's 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'. + * + * @return the field value. + */ + public String field() { + return this.field; + } + + /** + * Set the field property: The name of the Activity Log event's 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'. + * + * @param field the field value to set. + * @return the AlertRuleLeafCondition object itself. + */ + public AlertRuleLeafCondition withField(String field) { + this.field = field; + return this; + } + + /** + * Get the equals property: The value of the event's field will be compared to this value (case-insensitive) to + * determine if the condition is met. + * + * @return the equals value. + */ + public String equals() { + return this.equals; + } + + /** + * Set the equals property: The value of the event's field will be compared to this value (case-insensitive) to + * determine if the condition is met. + * + * @param equals the equals value to set. + * @return the AlertRuleLeafCondition object itself. + */ + public AlertRuleLeafCondition withEquals(String equals) { + this.equals = equals; + return this; + } + + /** + * Get the containsAny property: The value of the event's field will be compared to the values in this array + * (case-insensitive) to determine if the condition is met. + * + * @return the containsAny value. + */ + public List containsAny() { + return this.containsAny; + } + + /** + * Set the containsAny property: The value of the event's field will be compared to the values in this array + * (case-insensitive) to determine if the condition is met. + * + * @param containsAny the containsAny value to set. + * @return the AlertRuleLeafCondition object itself. + */ + public AlertRuleLeafCondition withContainsAny(List containsAny) { + this.containsAny = containsAny; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleList.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleList.java new file mode 100644 index 0000000000000..bc8ce251625c9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.ActivityLogAlertResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of Activity Log Alert rules. */ +@Fluent +public final class AlertRuleList { + /* + * The list of Activity Log Alert rules. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Provides the link to retrieve the next set of elements. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of AlertRuleList class. */ + public AlertRuleList() { + } + + /** + * Get the value property: The list of Activity Log Alert rules. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of Activity Log Alert rules. + * + * @param value the value value to set. + * @return the AlertRuleList object itself. + */ + public AlertRuleList withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Provides the link to retrieve the next set of elements. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Provides the link to retrieve the next set of elements. + * + * @param nextLink the nextLink value to set. + * @return the AlertRuleList object itself. + */ + public AlertRuleList withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRulePatchObject.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRulePatchObject.java new file mode 100644 index 0000000000000..44075c629f945 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRulePatchObject.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.AlertRulePatchProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An Activity Log Alert rule object for the body of patch operations. */ +@Fluent +public final class AlertRulePatchObject { + /* + * The resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The activity log alert settings for an update operation. + */ + @JsonProperty(value = "properties") + private AlertRulePatchProperties innerProperties; + + /** Creates an instance of AlertRulePatchObject class. */ + public AlertRulePatchObject() { + } + + /** + * Get the tags property: The resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: The resource tags. + * + * @param tags the tags value to set. + * @return the AlertRulePatchObject object itself. + */ + public AlertRulePatchObject withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: The activity log alert settings for an update operation. + * + * @return the innerProperties value. + */ + private AlertRulePatchProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the enabled property: Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert + * rule is not enabled, then none of its actions will be activated. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: Indicates whether this Activity Log Alert rule is enabled. If an Activity Log Alert + * rule is not enabled, then none of its actions will be activated. + * + * @param enabled the enabled value to set. + * @return the AlertRulePatchObject object itself. + */ + public AlertRulePatchObject withEnabled(Boolean enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRulePatchProperties(); + } + this.innerProperties().withEnabled(enabled); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleResource.java new file mode 100644 index 0000000000000..1a7b571724cf4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleResource.java @@ -0,0 +1,425 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.AlertRuleResourceInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of AlertRuleResource. */ +public interface AlertRuleResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the namePropertiesName property: the name of the alert rule. + * + * @return the namePropertiesName value. + */ + String namePropertiesName(); + + /** + * Gets the description property: the description of the alert rule that will be included in the alert email. + * + * @return the description value. + */ + String description(); + + /** + * Gets the provisioningState property: the provisioning state. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the isEnabled property: the flag that indicates whether the alert rule is enabled. + * + * @return the isEnabled value. + */ + boolean isEnabled(); + + /** + * Gets the condition property: the condition that results in the alert rule being activated. + * + * @return the condition value. + */ + RuleCondition condition(); + + /** + * Gets the action property: action that is performed when the alert rule becomes active, and when an alert + * condition is resolved. + * + * @return the action value. + */ + RuleAction action(); + + /** + * Gets the actions property: the array of actions that are performed when the alert rule becomes active, and when + * an alert condition is resolved. + * + * @return the actions value. + */ + List actions(); + + /** + * Gets the lastUpdatedTime property: Last time the rule was updated in ISO8601 format. + * + * @return the lastUpdatedTime value. + */ + OffsetDateTime lastUpdatedTime(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.AlertRuleResourceInner object. + * + * @return the inner object. + */ + AlertRuleResourceInner innerModel(); + + /** The entirety of the AlertRuleResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithNamePropertiesName, + DefinitionStages.WithIsEnabled, + DefinitionStages.WithCondition, + DefinitionStages.WithCreate { + } + /** The AlertRuleResource definition stages. */ + interface DefinitionStages { + /** The first stage of the AlertRuleResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the AlertRuleResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the AlertRuleResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithNamePropertiesName withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the AlertRuleResource definition allowing to specify namePropertiesName. */ + interface WithNamePropertiesName { + /** + * Specifies the namePropertiesName property: the name of the alert rule.. + * + * @param namePropertiesName the name of the alert rule. + * @return the next definition stage. + */ + WithIsEnabled withNamePropertiesName(String namePropertiesName); + } + /** The stage of the AlertRuleResource definition allowing to specify isEnabled. */ + interface WithIsEnabled { + /** + * Specifies the isEnabled property: the flag that indicates whether the alert rule is enabled.. + * + * @param isEnabled the flag that indicates whether the alert rule is enabled. + * @return the next definition stage. + */ + WithCondition withIsEnabled(boolean isEnabled); + } + /** The stage of the AlertRuleResource definition allowing to specify condition. */ + interface WithCondition { + /** + * Specifies the condition property: the condition that results in the alert rule being activated.. + * + * @param condition the condition that results in the alert rule being activated. + * @return the next definition stage. + */ + WithCreate withCondition(RuleCondition condition); + } + /** + * The stage of the AlertRuleResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithDescription, + DefinitionStages.WithProvisioningState, + DefinitionStages.WithAction, + DefinitionStages.WithActions { + /** + * Executes the create request. + * + * @return the created resource. + */ + AlertRuleResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AlertRuleResource create(Context context); + } + /** The stage of the AlertRuleResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the AlertRuleResource definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: the description of the alert rule that will be included in the alert + * email.. + * + * @param description the description of the alert rule that will be included in the alert email. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the AlertRuleResource definition allowing to specify provisioningState. */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: the provisioning state.. + * + * @param provisioningState the provisioning state. + * @return the next definition stage. + */ + WithCreate withProvisioningState(String provisioningState); + } + /** The stage of the AlertRuleResource definition allowing to specify action. */ + interface WithAction { + /** + * Specifies the action property: action that is performed when the alert rule becomes active, and when an + * alert condition is resolved.. + * + * @param action action that is performed when the alert rule becomes active, and when an alert condition is + * resolved. + * @return the next definition stage. + */ + WithCreate withAction(RuleAction action); + } + /** The stage of the AlertRuleResource definition allowing to specify actions. */ + interface WithActions { + /** + * Specifies the actions property: the array of actions that are performed when the alert rule becomes + * active, and when an alert condition is resolved.. + * + * @param actions the array of actions that are performed when the alert rule becomes active, and when an + * alert condition is resolved. + * @return the next definition stage. + */ + WithCreate withActions(List actions); + } + } + /** + * Begins update for the AlertRuleResource resource. + * + * @return the stage of resource update. + */ + AlertRuleResource.Update update(); + + /** The template for AlertRuleResource update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithName, + UpdateStages.WithDescription, + UpdateStages.WithProvisioningState, + UpdateStages.WithIsEnabled, + UpdateStages.WithCondition, + UpdateStages.WithAction, + UpdateStages.WithActions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + AlertRuleResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + AlertRuleResource apply(Context context); + } + /** The AlertRuleResource update stages. */ + interface UpdateStages { + /** The stage of the AlertRuleResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the AlertRuleResource update allowing to specify name. */ + interface WithName { + /** + * Specifies the name property: the name of the alert rule.. + * + * @param name the name of the alert rule. + * @return the next definition stage. + */ + Update withName(String name); + } + /** The stage of the AlertRuleResource update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: the description of the alert rule that will be included in the alert + * email.. + * + * @param description the description of the alert rule that will be included in the alert email. + * @return the next definition stage. + */ + Update withDescription(String description); + } + /** The stage of the AlertRuleResource update allowing to specify provisioningState. */ + interface WithProvisioningState { + /** + * Specifies the provisioningState property: the provisioning state.. + * + * @param provisioningState the provisioning state. + * @return the next definition stage. + */ + Update withProvisioningState(String provisioningState); + } + /** The stage of the AlertRuleResource update allowing to specify isEnabled. */ + interface WithIsEnabled { + /** + * Specifies the isEnabled property: the flag that indicates whether the alert rule is enabled.. + * + * @param isEnabled the flag that indicates whether the alert rule is enabled. + * @return the next definition stage. + */ + Update withIsEnabled(boolean isEnabled); + } + /** The stage of the AlertRuleResource update allowing to specify condition. */ + interface WithCondition { + /** + * Specifies the condition property: the condition that results in the alert rule being activated.. + * + * @param condition the condition that results in the alert rule being activated. + * @return the next definition stage. + */ + Update withCondition(RuleCondition condition); + } + /** The stage of the AlertRuleResource update allowing to specify action. */ + interface WithAction { + /** + * Specifies the action property: action that is performed when the alert rule becomes active, and when an + * alert condition is resolved.. + * + * @param action action that is performed when the alert rule becomes active, and when an alert condition is + * resolved. + * @return the next definition stage. + */ + Update withAction(RuleAction action); + } + /** The stage of the AlertRuleResource update allowing to specify actions. */ + interface WithActions { + /** + * Specifies the actions property: the array of actions that are performed when the alert rule becomes + * active, and when an alert condition is resolved.. + * + * @param actions the array of actions that are performed when the alert rule becomes active, and when an + * alert condition is resolved. + * @return the next definition stage. + */ + Update withActions(List actions); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AlertRuleResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AlertRuleResource refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleResourceCollection.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleResourceCollection.java new file mode 100644 index 0000000000000..cb142b04dd7f1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleResourceCollection.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.AlertRuleResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of alert rule resources. */ +@Fluent +public final class AlertRuleResourceCollection { + /* + * the values for the alert rule resources. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of AlertRuleResourceCollection class. */ + public AlertRuleResourceCollection() { + } + + /** + * Get the value property: the values for the alert rule resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: the values for the alert rule resources. + * + * @param value the value value to set. + * @return the AlertRuleResourceCollection object itself. + */ + public AlertRuleResourceCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleResourcePatch.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleResourcePatch.java new file mode 100644 index 0000000000000..6a8d207169b3c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleResourcePatch.java @@ -0,0 +1,248 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.AlertRule; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** The alert rule object for patch operations. */ +@Fluent +public final class AlertRuleResourcePatch { + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The properties of an alert rule. + */ + @JsonProperty(value = "properties") + private AlertRule innerProperties; + + /** Creates an instance of AlertRuleResourcePatch class. */ + public AlertRuleResourcePatch() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: The properties of an alert rule. + * + * @return the innerProperties value. + */ + private AlertRule innerProperties() { + return this.innerProperties; + } + + /** + * Get the name property: the name of the alert rule. + * + * @return the name value. + */ + public String name() { + return this.innerProperties() == null ? null : this.innerProperties().name(); + } + + /** + * Set the name property: the name of the alert rule. + * + * @param name the name value to set. + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withName(String name) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRule(); + } + this.innerProperties().withName(name); + return this; + } + + /** + * Get the description property: the description of the alert rule that will be included in the alert email. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: the description of the alert rule that will be included in the alert email. + * + * @param description the description value to set. + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRule(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the provisioningState property: the provisioning state. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Set the provisioningState property: the provisioning state. + * + * @param provisioningState the provisioningState value to set. + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withProvisioningState(String provisioningState) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRule(); + } + this.innerProperties().withProvisioningState(provisioningState); + return this; + } + + /** + * Get the isEnabled property: the flag that indicates whether the alert rule is enabled. + * + * @return the isEnabled value. + */ + public Boolean isEnabled() { + return this.innerProperties() == null ? null : this.innerProperties().isEnabled(); + } + + /** + * Set the isEnabled property: the flag that indicates whether the alert rule is enabled. + * + * @param isEnabled the isEnabled value to set. + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withIsEnabled(Boolean isEnabled) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRule(); + } + this.innerProperties().withIsEnabled(isEnabled); + return this; + } + + /** + * Get the condition property: the condition that results in the alert rule being activated. + * + * @return the condition value. + */ + public RuleCondition condition() { + return this.innerProperties() == null ? null : this.innerProperties().condition(); + } + + /** + * Set the condition property: the condition that results in the alert rule being activated. + * + * @param condition the condition value to set. + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withCondition(RuleCondition condition) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRule(); + } + this.innerProperties().withCondition(condition); + return this; + } + + /** + * Get the action property: action that is performed when the alert rule becomes active, and when an alert condition + * is resolved. + * + * @return the action value. + */ + public RuleAction action() { + return this.innerProperties() == null ? null : this.innerProperties().action(); + } + + /** + * Set the action property: action that is performed when the alert rule becomes active, and when an alert condition + * is resolved. + * + * @param action the action value to set. + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withAction(RuleAction action) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRule(); + } + this.innerProperties().withAction(action); + return this; + } + + /** + * Get the actions property: the array of actions that are performed when the alert rule becomes active, and when an + * alert condition is resolved. + * + * @return the actions value. + */ + public List actions() { + return this.innerProperties() == null ? null : this.innerProperties().actions(); + } + + /** + * Set the actions property: the array of actions that are performed when the alert rule becomes active, and when an + * alert condition is resolved. + * + * @param actions the actions value to set. + * @return the AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch withActions(List actions) { + if (this.innerProperties() == null) { + this.innerProperties = new AlertRule(); + } + this.innerProperties().withActions(actions); + return this; + } + + /** + * Get the lastUpdatedTime property: Last time the rule was updated in ISO8601 format. + * + * @return the lastUpdatedTime value. + */ + public OffsetDateTime lastUpdatedTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedTime(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRules.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRules.java new file mode 100644 index 0000000000000..da73b156156c6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRules.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of AlertRules. */ +public interface AlertRules { + /** + * Deletes a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String ruleName, Context context); + + /** + * Deletes a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String ruleName); + + /** + * Gets a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a classic metric alert rule along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context); + + /** + * Gets a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a classic metric alert rule. + */ + AlertRuleResource getByResourceGroup(String resourceGroupName, String ruleName); + + /** + * List the classic metric alert rules within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List the classic metric alert rules within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List the classic metric alert rules within a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the classic metric alert rules within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets a classic metric alert rule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a classic metric alert rule along with {@link Response}. + */ + AlertRuleResource getById(String id); + + /** + * Gets a classic metric alert rule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a classic metric alert rule along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a classic metric alert rule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a classic metric alert rule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new AlertRuleResource resource. + * + * @param name resource name. + * @return the first stage of the new AlertRuleResource definition. + */ + AlertRuleResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertSeverity.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertSeverity.java new file mode 100644 index 0000000000000..90ccf2cf456cc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertSeverity.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. Relevant and required only for + * rules of the kind LogAlert. + */ +public final class AlertSeverity extends ExpandableStringEnum { + /** Static value 0 for AlertSeverity. */ + public static final AlertSeverity ZERO = fromLong(0L); + + /** Static value 1 for AlertSeverity. */ + public static final AlertSeverity ONE = fromLong(1L); + + /** Static value 2 for AlertSeverity. */ + public static final AlertSeverity TWO = fromLong(2L); + + /** Static value 3 for AlertSeverity. */ + public static final AlertSeverity THREE = fromLong(3L); + + /** Static value 4 for AlertSeverity. */ + public static final AlertSeverity FOUR = fromLong(4L); + + /** + * Creates a new instance of AlertSeverity value. + * + * @deprecated Use the {@link #fromString(long)} factory method. + */ + @Deprecated + public AlertSeverity() { + } + + /** + * Creates or finds a AlertSeverity from its string representation. + * + * @param name a name to look for. + * @return the corresponding AlertSeverity. + */ + @JsonCreator + public static AlertSeverity fromLong(long name) { + return fromString(String.valueOf(name), AlertSeverity.class); + } + + /** + * Gets known AlertSeverity values. + * + * @return known AlertSeverity values. + */ + public static Collection values() { + return values(AlertSeverity.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ArmRoleReceiver.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ArmRoleReceiver.java new file mode 100644 index 0000000000000..17ec817a455d0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ArmRoleReceiver.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An arm role receiver. */ +@Fluent +public final class ArmRoleReceiver { + /* + * The name of the arm role receiver. Names must be unique across all receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The arm role id. + */ + @JsonProperty(value = "roleId", required = true) + private String roleId; + + /* + * Indicates whether to use common alert schema. + */ + @JsonProperty(value = "useCommonAlertSchema") + private Boolean useCommonAlertSchema; + + /** Creates an instance of ArmRoleReceiver class. */ + public ArmRoleReceiver() { + } + + /** + * Get the name property: The name of the arm role receiver. Names must be unique across all receivers within an + * action group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the arm role receiver. Names must be unique across all receivers within an + * action group. + * + * @param name the name value to set. + * @return the ArmRoleReceiver object itself. + */ + public ArmRoleReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the roleId property: The arm role id. + * + * @return the roleId value. + */ + public String roleId() { + return this.roleId; + } + + /** + * Set the roleId property: The arm role id. + * + * @param roleId the roleId value to set. + * @return the ArmRoleReceiver object itself. + */ + public ArmRoleReceiver withRoleId(String roleId) { + this.roleId = roleId; + return this; + } + + /** + * Get the useCommonAlertSchema property: Indicates whether to use common alert schema. + * + * @return the useCommonAlertSchema value. + */ + public Boolean useCommonAlertSchema() { + return this.useCommonAlertSchema; + } + + /** + * Set the useCommonAlertSchema property: Indicates whether to use common alert schema. + * + * @param useCommonAlertSchema the useCommonAlertSchema value to set. + * @return the ArmRoleReceiver object itself. + */ + public ArmRoleReceiver withUseCommonAlertSchema(Boolean useCommonAlertSchema) { + this.useCommonAlertSchema = useCommonAlertSchema; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model ArmRoleReceiver")); + } + if (roleId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property roleId in model ArmRoleReceiver")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ArmRoleReceiver.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutomationRunbookReceiver.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutomationRunbookReceiver.java new file mode 100644 index 0000000000000..7f29f4d848118 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutomationRunbookReceiver.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Azure Automation Runbook notification receiver. */ +@Fluent +public final class AutomationRunbookReceiver { + /* + * The Azure automation account Id which holds this runbook and authenticate to Azure resource. + */ + @JsonProperty(value = "automationAccountId", required = true) + private String automationAccountId; + + /* + * The name for this runbook. + */ + @JsonProperty(value = "runbookName", required = true) + private String runbookName; + + /* + * The resource id for webhook linked to this runbook. + */ + @JsonProperty(value = "webhookResourceId", required = true) + private String webhookResourceId; + + /* + * Indicates whether this instance is global runbook. + */ + @JsonProperty(value = "isGlobalRunbook", required = true) + private boolean isGlobalRunbook; + + /* + * Indicates name of the webhook. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The URI where webhooks should be sent. + */ + @JsonProperty(value = "serviceUri") + private String serviceUri; + + /* + * Indicates whether to use common alert schema. + */ + @JsonProperty(value = "useCommonAlertSchema") + private Boolean useCommonAlertSchema; + + /** Creates an instance of AutomationRunbookReceiver class. */ + public AutomationRunbookReceiver() { + } + + /** + * Get the automationAccountId property: The Azure automation account Id which holds this runbook and authenticate + * to Azure resource. + * + * @return the automationAccountId value. + */ + public String automationAccountId() { + return this.automationAccountId; + } + + /** + * Set the automationAccountId property: The Azure automation account Id which holds this runbook and authenticate + * to Azure resource. + * + * @param automationAccountId the automationAccountId value to set. + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withAutomationAccountId(String automationAccountId) { + this.automationAccountId = automationAccountId; + return this; + } + + /** + * Get the runbookName property: The name for this runbook. + * + * @return the runbookName value. + */ + public String runbookName() { + return this.runbookName; + } + + /** + * Set the runbookName property: The name for this runbook. + * + * @param runbookName the runbookName value to set. + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withRunbookName(String runbookName) { + this.runbookName = runbookName; + return this; + } + + /** + * Get the webhookResourceId property: The resource id for webhook linked to this runbook. + * + * @return the webhookResourceId value. + */ + public String webhookResourceId() { + return this.webhookResourceId; + } + + /** + * Set the webhookResourceId property: The resource id for webhook linked to this runbook. + * + * @param webhookResourceId the webhookResourceId value to set. + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withWebhookResourceId(String webhookResourceId) { + this.webhookResourceId = webhookResourceId; + return this; + } + + /** + * Get the isGlobalRunbook property: Indicates whether this instance is global runbook. + * + * @return the isGlobalRunbook value. + */ + public boolean isGlobalRunbook() { + return this.isGlobalRunbook; + } + + /** + * Set the isGlobalRunbook property: Indicates whether this instance is global runbook. + * + * @param isGlobalRunbook the isGlobalRunbook value to set. + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withIsGlobalRunbook(boolean isGlobalRunbook) { + this.isGlobalRunbook = isGlobalRunbook; + return this; + } + + /** + * Get the name property: Indicates name of the webhook. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Indicates name of the webhook. + * + * @param name the name value to set. + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the serviceUri property: The URI where webhooks should be sent. + * + * @return the serviceUri value. + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the serviceUri property: The URI where webhooks should be sent. + * + * @param serviceUri the serviceUri value to set. + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + + /** + * Get the useCommonAlertSchema property: Indicates whether to use common alert schema. + * + * @return the useCommonAlertSchema value. + */ + public Boolean useCommonAlertSchema() { + return this.useCommonAlertSchema; + } + + /** + * Set the useCommonAlertSchema property: Indicates whether to use common alert schema. + * + * @param useCommonAlertSchema the useCommonAlertSchema value to set. + * @return the AutomationRunbookReceiver object itself. + */ + public AutomationRunbookReceiver withUseCommonAlertSchema(Boolean useCommonAlertSchema) { + this.useCommonAlertSchema = useCommonAlertSchema; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (automationAccountId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property automationAccountId in model AutomationRunbookReceiver")); + } + if (runbookName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property runbookName in model AutomationRunbookReceiver")); + } + if (webhookResourceId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property webhookResourceId in model AutomationRunbookReceiver")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AutomationRunbookReceiver.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleNotification.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleNotification.java new file mode 100644 index 0000000000000..b9b8cea8ffcb5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleNotification.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Autoscale notification. */ +@Fluent +public final class AutoscaleNotification { + /* + * the operation associated with the notification and its value must be "scale" + */ + @JsonProperty(value = "operation", required = true) + private String operation = "Scale"; + + /* + * the email notification. + */ + @JsonProperty(value = "email") + private EmailNotification email; + + /* + * the collection of webhook notifications. + */ + @JsonProperty(value = "webhooks") + private List webhooks; + + /** Creates an instance of AutoscaleNotification class. */ + public AutoscaleNotification() { + operation = "Scale"; + } + + /** + * Get the operation property: the operation associated with the notification and its value must be "scale". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: the operation associated with the notification and its value must be "scale". + * + * @param operation the operation value to set. + * @return the AutoscaleNotification object itself. + */ + public AutoscaleNotification withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Get the email property: the email notification. + * + * @return the email value. + */ + public EmailNotification email() { + return this.email; + } + + /** + * Set the email property: the email notification. + * + * @param email the email value to set. + * @return the AutoscaleNotification object itself. + */ + public AutoscaleNotification withEmail(EmailNotification email) { + this.email = email; + return this; + } + + /** + * Get the webhooks property: the collection of webhook notifications. + * + * @return the webhooks value. + */ + public List webhooks() { + return this.webhooks; + } + + /** + * Set the webhooks property: the collection of webhook notifications. + * + * @param webhooks the webhooks value to set. + * @return the AutoscaleNotification object itself. + */ + public AutoscaleNotification withWebhooks(List webhooks) { + this.webhooks = webhooks; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (email() != null) { + email().validate(); + } + if (webhooks() != null) { + webhooks().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleProfile.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleProfile.java new file mode 100644 index 0000000000000..9c848fe2ebda4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleProfile.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Autoscale profile. */ +@Fluent +public final class AutoscaleProfile { + /* + * the name of the profile. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * the number of instances that can be used during this profile. + */ + @JsonProperty(value = "capacity", required = true) + private ScaleCapacity capacity; + + /* + * the collection of rules that provide the triggers and parameters for the scaling action. A maximum of 10 rules + * can be specified. + */ + @JsonProperty(value = "rules", required = true) + private List rules; + + /* + * the specific date-time for the profile. This element is not used if the Recurrence element is used. + */ + @JsonProperty(value = "fixedDate") + private TimeWindow fixedDate; + + /* + * the repeating times at which this profile begins. This element is not used if the FixedDate element is used. + */ + @JsonProperty(value = "recurrence") + private Recurrence recurrence; + + /** Creates an instance of AutoscaleProfile class. */ + public AutoscaleProfile() { + } + + /** + * Get the name property: the name of the profile. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: the name of the profile. + * + * @param name the name value to set. + * @return the AutoscaleProfile object itself. + */ + public AutoscaleProfile withName(String name) { + this.name = name; + return this; + } + + /** + * Get the capacity property: the number of instances that can be used during this profile. + * + * @return the capacity value. + */ + public ScaleCapacity capacity() { + return this.capacity; + } + + /** + * Set the capacity property: the number of instances that can be used during this profile. + * + * @param capacity the capacity value to set. + * @return the AutoscaleProfile object itself. + */ + public AutoscaleProfile withCapacity(ScaleCapacity capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get the rules property: the collection of rules that provide the triggers and parameters for the scaling action. + * A maximum of 10 rules can be specified. + * + * @return the rules value. + */ + public List rules() { + return this.rules; + } + + /** + * Set the rules property: the collection of rules that provide the triggers and parameters for the scaling action. + * A maximum of 10 rules can be specified. + * + * @param rules the rules value to set. + * @return the AutoscaleProfile object itself. + */ + public AutoscaleProfile withRules(List rules) { + this.rules = rules; + return this; + } + + /** + * Get the fixedDate property: the specific date-time for the profile. This element is not used if the Recurrence + * element is used. + * + * @return the fixedDate value. + */ + public TimeWindow fixedDate() { + return this.fixedDate; + } + + /** + * Set the fixedDate property: the specific date-time for the profile. This element is not used if the Recurrence + * element is used. + * + * @param fixedDate the fixedDate value to set. + * @return the AutoscaleProfile object itself. + */ + public AutoscaleProfile withFixedDate(TimeWindow fixedDate) { + this.fixedDate = fixedDate; + return this; + } + + /** + * Get the recurrence property: the repeating times at which this profile begins. This element is not used if the + * FixedDate element is used. + * + * @return the recurrence value. + */ + public Recurrence recurrence() { + return this.recurrence; + } + + /** + * Set the recurrence property: the repeating times at which this profile begins. This element is not used if the + * FixedDate element is used. + * + * @param recurrence the recurrence value to set. + * @return the AutoscaleProfile object itself. + */ + public AutoscaleProfile withRecurrence(Recurrence recurrence) { + this.recurrence = recurrence; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model AutoscaleProfile")); + } + if (capacity() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property capacity in model AutoscaleProfile")); + } else { + capacity().validate(); + } + if (rules() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property rules in model AutoscaleProfile")); + } else { + rules().forEach(e -> e.validate()); + } + if (fixedDate() != null) { + fixedDate().validate(); + } + if (recurrence() != null) { + recurrence().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AutoscaleProfile.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettingResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettingResource.java new file mode 100644 index 0000000000000..88d0c9a7e330e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettingResource.java @@ -0,0 +1,431 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.AutoscaleSettingResourceInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of AutoscaleSettingResource. */ +public interface AutoscaleSettingResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: The system metadata related to the response. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the profiles property: the collection of automatic scaling profiles that specify different scaling + * parameters for different time periods. A maximum of 20 profiles can be specified. + * + * @return the profiles value. + */ + List profiles(); + + /** + * Gets the notifications property: the collection of notifications. + * + * @return the notifications value. + */ + List notifications(); + + /** + * Gets the enabled property: the enabled flag. Specifies whether automatic scaling is enabled for the resource. The + * default value is 'false'. + * + * @return the enabled value. + */ + Boolean enabled(); + + /** + * Gets the predictiveAutoscalePolicy property: the predictive autoscale policy mode. + * + * @return the predictiveAutoscalePolicy value. + */ + PredictiveAutoscalePolicy predictiveAutoscalePolicy(); + + /** + * Gets the namePropertiesName property: the name of the autoscale setting. + * + * @return the namePropertiesName value. + */ + String namePropertiesName(); + + /** + * Gets the targetResourceUri property: the resource identifier of the resource that the autoscale setting should be + * added to. + * + * @return the targetResourceUri value. + */ + String targetResourceUri(); + + /** + * Gets the targetResourceLocation property: the location of the resource that the autoscale setting should be added + * to. + * + * @return the targetResourceLocation value. + */ + String targetResourceLocation(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.AutoscaleSettingResourceInner object. + * + * @return the inner object. + */ + AutoscaleSettingResourceInner innerModel(); + + /** The entirety of the AutoscaleSettingResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithProfiles, + DefinitionStages.WithCreate { + } + /** The AutoscaleSettingResource definition stages. */ + interface DefinitionStages { + /** The first stage of the AutoscaleSettingResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the AutoscaleSettingResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the AutoscaleSettingResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithProfiles withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the AutoscaleSettingResource definition allowing to specify profiles. */ + interface WithProfiles { + /** + * Specifies the profiles property: the collection of automatic scaling profiles that specify different + * scaling parameters for different time periods. A maximum of 20 profiles can be specified.. + * + * @param profiles the collection of automatic scaling profiles that specify different scaling parameters + * for different time periods. A maximum of 20 profiles can be specified. + * @return the next definition stage. + */ + WithCreate withProfiles(List profiles); + } + /** + * The stage of the AutoscaleSettingResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithNotifications, + DefinitionStages.WithEnabled, + DefinitionStages.WithPredictiveAutoscalePolicy, + DefinitionStages.WithNamePropertiesName, + DefinitionStages.WithTargetResourceUri, + DefinitionStages.WithTargetResourceLocation { + /** + * Executes the create request. + * + * @return the created resource. + */ + AutoscaleSettingResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AutoscaleSettingResource create(Context context); + } + /** The stage of the AutoscaleSettingResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the AutoscaleSettingResource definition allowing to specify notifications. */ + interface WithNotifications { + /** + * Specifies the notifications property: the collection of notifications.. + * + * @param notifications the collection of notifications. + * @return the next definition stage. + */ + WithCreate withNotifications(List notifications); + } + /** The stage of the AutoscaleSettingResource definition allowing to specify enabled. */ + interface WithEnabled { + /** + * Specifies the enabled property: the enabled flag. Specifies whether automatic scaling is enabled for the + * resource. The default value is 'false'.. + * + * @param enabled the enabled flag. Specifies whether automatic scaling is enabled for the resource. The + * default value is 'false'. + * @return the next definition stage. + */ + WithCreate withEnabled(Boolean enabled); + } + /** The stage of the AutoscaleSettingResource definition allowing to specify predictiveAutoscalePolicy. */ + interface WithPredictiveAutoscalePolicy { + /** + * Specifies the predictiveAutoscalePolicy property: the predictive autoscale policy mode.. + * + * @param predictiveAutoscalePolicy the predictive autoscale policy mode. + * @return the next definition stage. + */ + WithCreate withPredictiveAutoscalePolicy(PredictiveAutoscalePolicy predictiveAutoscalePolicy); + } + /** The stage of the AutoscaleSettingResource definition allowing to specify namePropertiesName. */ + interface WithNamePropertiesName { + /** + * Specifies the namePropertiesName property: the name of the autoscale setting.. + * + * @param namePropertiesName the name of the autoscale setting. + * @return the next definition stage. + */ + WithCreate withNamePropertiesName(String namePropertiesName); + } + /** The stage of the AutoscaleSettingResource definition allowing to specify targetResourceUri. */ + interface WithTargetResourceUri { + /** + * Specifies the targetResourceUri property: the resource identifier of the resource that the autoscale + * setting should be added to.. + * + * @param targetResourceUri the resource identifier of the resource that the autoscale setting should be + * added to. + * @return the next definition stage. + */ + WithCreate withTargetResourceUri(String targetResourceUri); + } + /** The stage of the AutoscaleSettingResource definition allowing to specify targetResourceLocation. */ + interface WithTargetResourceLocation { + /** + * Specifies the targetResourceLocation property: the location of the resource that the autoscale setting + * should be added to.. + * + * @param targetResourceLocation the location of the resource that the autoscale setting should be added to. + * @return the next definition stage. + */ + WithCreate withTargetResourceLocation(String targetResourceLocation); + } + } + /** + * Begins update for the AutoscaleSettingResource resource. + * + * @return the stage of resource update. + */ + AutoscaleSettingResource.Update update(); + + /** The template for AutoscaleSettingResource update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithProfiles, + UpdateStages.WithNotifications, + UpdateStages.WithEnabled, + UpdateStages.WithPredictiveAutoscalePolicy, + UpdateStages.WithName, + UpdateStages.WithTargetResourceUri, + UpdateStages.WithTargetResourceLocation { + /** + * Executes the update request. + * + * @return the updated resource. + */ + AutoscaleSettingResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + AutoscaleSettingResource apply(Context context); + } + /** The AutoscaleSettingResource update stages. */ + interface UpdateStages { + /** The stage of the AutoscaleSettingResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the AutoscaleSettingResource update allowing to specify profiles. */ + interface WithProfiles { + /** + * Specifies the profiles property: the collection of automatic scaling profiles that specify different + * scaling parameters for different time periods. A maximum of 20 profiles can be specified.. + * + * @param profiles the collection of automatic scaling profiles that specify different scaling parameters + * for different time periods. A maximum of 20 profiles can be specified. + * @return the next definition stage. + */ + Update withProfiles(List profiles); + } + /** The stage of the AutoscaleSettingResource update allowing to specify notifications. */ + interface WithNotifications { + /** + * Specifies the notifications property: the collection of notifications.. + * + * @param notifications the collection of notifications. + * @return the next definition stage. + */ + Update withNotifications(List notifications); + } + /** The stage of the AutoscaleSettingResource update allowing to specify enabled. */ + interface WithEnabled { + /** + * Specifies the enabled property: the enabled flag. Specifies whether automatic scaling is enabled for the + * resource. The default value is 'false'.. + * + * @param enabled the enabled flag. Specifies whether automatic scaling is enabled for the resource. The + * default value is 'false'. + * @return the next definition stage. + */ + Update withEnabled(Boolean enabled); + } + /** The stage of the AutoscaleSettingResource update allowing to specify predictiveAutoscalePolicy. */ + interface WithPredictiveAutoscalePolicy { + /** + * Specifies the predictiveAutoscalePolicy property: the predictive autoscale policy mode.. + * + * @param predictiveAutoscalePolicy the predictive autoscale policy mode. + * @return the next definition stage. + */ + Update withPredictiveAutoscalePolicy(PredictiveAutoscalePolicy predictiveAutoscalePolicy); + } + /** The stage of the AutoscaleSettingResource update allowing to specify name. */ + interface WithName { + /** + * Specifies the name property: the name of the autoscale setting.. + * + * @param name the name of the autoscale setting. + * @return the next definition stage. + */ + Update withName(String name); + } + /** The stage of the AutoscaleSettingResource update allowing to specify targetResourceUri. */ + interface WithTargetResourceUri { + /** + * Specifies the targetResourceUri property: the resource identifier of the resource that the autoscale + * setting should be added to.. + * + * @param targetResourceUri the resource identifier of the resource that the autoscale setting should be + * added to. + * @return the next definition stage. + */ + Update withTargetResourceUri(String targetResourceUri); + } + /** The stage of the AutoscaleSettingResource update allowing to specify targetResourceLocation. */ + interface WithTargetResourceLocation { + /** + * Specifies the targetResourceLocation property: the location of the resource that the autoscale setting + * should be added to.. + * + * @param targetResourceLocation the location of the resource that the autoscale setting should be added to. + * @return the next definition stage. + */ + Update withTargetResourceLocation(String targetResourceLocation); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AutoscaleSettingResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AutoscaleSettingResource refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettingResourceCollection.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettingResourceCollection.java new file mode 100644 index 0000000000000..a182abb17e646 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettingResourceCollection.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.AutoscaleSettingResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of autoscale setting resources. */ +@Fluent +public final class AutoscaleSettingResourceCollection { + /* + * the values for the autoscale setting resources. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * URL to get the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of AutoscaleSettingResourceCollection class. */ + public AutoscaleSettingResourceCollection() { + } + + /** + * Get the value property: the values for the autoscale setting resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: the values for the autoscale setting resources. + * + * @param value the value value to set. + * @return the AutoscaleSettingResourceCollection object itself. + */ + public AutoscaleSettingResourceCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: URL to get the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: URL to get the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the AutoscaleSettingResourceCollection object itself. + */ + public AutoscaleSettingResourceCollection withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model AutoscaleSettingResourceCollection")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AutoscaleSettingResourceCollection.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettingResourcePatch.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettingResourcePatch.java new file mode 100644 index 0000000000000..a8272098fa9e6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettingResourcePatch.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.AutoscaleSetting; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The autoscale setting object for patch operations. */ +@Fluent +public final class AutoscaleSettingResourcePatch { + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The autoscale setting properties of the update operation. + */ + @JsonProperty(value = "properties") + private AutoscaleSetting innerProperties; + + /** Creates an instance of AutoscaleSettingResourcePatch class. */ + public AutoscaleSettingResourcePatch() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: The autoscale setting properties of the update operation. + * + * @return the innerProperties value. + */ + private AutoscaleSetting innerProperties() { + return this.innerProperties; + } + + /** + * Get the profiles property: the collection of automatic scaling profiles that specify different scaling parameters + * for different time periods. A maximum of 20 profiles can be specified. + * + * @return the profiles value. + */ + public List profiles() { + return this.innerProperties() == null ? null : this.innerProperties().profiles(); + } + + /** + * Set the profiles property: the collection of automatic scaling profiles that specify different scaling parameters + * for different time periods. A maximum of 20 profiles can be specified. + * + * @param profiles the profiles value to set. + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withProfiles(List profiles) { + if (this.innerProperties() == null) { + this.innerProperties = new AutoscaleSetting(); + } + this.innerProperties().withProfiles(profiles); + return this; + } + + /** + * Get the notifications property: the collection of notifications. + * + * @return the notifications value. + */ + public List notifications() { + return this.innerProperties() == null ? null : this.innerProperties().notifications(); + } + + /** + * Set the notifications property: the collection of notifications. + * + * @param notifications the notifications value to set. + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withNotifications(List notifications) { + if (this.innerProperties() == null) { + this.innerProperties = new AutoscaleSetting(); + } + this.innerProperties().withNotifications(notifications); + return this; + } + + /** + * Get the enabled property: the enabled flag. Specifies whether automatic scaling is enabled for the resource. The + * default value is 'false'. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: the enabled flag. Specifies whether automatic scaling is enabled for the resource. The + * default value is 'false'. + * + * @param enabled the enabled value to set. + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withEnabled(Boolean enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new AutoscaleSetting(); + } + this.innerProperties().withEnabled(enabled); + return this; + } + + /** + * Get the predictiveAutoscalePolicy property: the predictive autoscale policy mode. + * + * @return the predictiveAutoscalePolicy value. + */ + public PredictiveAutoscalePolicy predictiveAutoscalePolicy() { + return this.innerProperties() == null ? null : this.innerProperties().predictiveAutoscalePolicy(); + } + + /** + * Set the predictiveAutoscalePolicy property: the predictive autoscale policy mode. + * + * @param predictiveAutoscalePolicy the predictiveAutoscalePolicy value to set. + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withPredictiveAutoscalePolicy( + PredictiveAutoscalePolicy predictiveAutoscalePolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new AutoscaleSetting(); + } + this.innerProperties().withPredictiveAutoscalePolicy(predictiveAutoscalePolicy); + return this; + } + + /** + * Get the name property: the name of the autoscale setting. + * + * @return the name value. + */ + public String name() { + return this.innerProperties() == null ? null : this.innerProperties().name(); + } + + /** + * Set the name property: the name of the autoscale setting. + * + * @param name the name value to set. + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withName(String name) { + if (this.innerProperties() == null) { + this.innerProperties = new AutoscaleSetting(); + } + this.innerProperties().withName(name); + return this; + } + + /** + * Get the targetResourceUri property: the resource identifier of the resource that the autoscale setting should be + * added to. + * + * @return the targetResourceUri value. + */ + public String targetResourceUri() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceUri(); + } + + /** + * Set the targetResourceUri property: the resource identifier of the resource that the autoscale setting should be + * added to. + * + * @param targetResourceUri the targetResourceUri value to set. + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withTargetResourceUri(String targetResourceUri) { + if (this.innerProperties() == null) { + this.innerProperties = new AutoscaleSetting(); + } + this.innerProperties().withTargetResourceUri(targetResourceUri); + return this; + } + + /** + * Get the targetResourceLocation property: the location of the resource that the autoscale setting should be added + * to. + * + * @return the targetResourceLocation value. + */ + public String targetResourceLocation() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceLocation(); + } + + /** + * Set the targetResourceLocation property: the location of the resource that the autoscale setting should be added + * to. + * + * @param targetResourceLocation the targetResourceLocation value to set. + * @return the AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch withTargetResourceLocation(String targetResourceLocation) { + if (this.innerProperties() == null) { + this.innerProperties = new AutoscaleSetting(); + } + this.innerProperties().withTargetResourceLocation(targetResourceLocation); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettings.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettings.java new file mode 100644 index 0000000000000..3b73196fc9c65 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettings.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of AutoscaleSettings. */ +public interface AutoscaleSettings { + /** + * Lists the autoscale settings for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists the autoscale settings for a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Deletes and autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse( + String resourceGroupName, String autoscaleSettingName, Context context); + + /** + * Deletes and autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String autoscaleSettingName); + + /** + * Gets an autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an autoscale setting along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String autoscaleSettingName, Context context); + + /** + * Gets an autoscale setting. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an autoscale setting. + */ + AutoscaleSettingResource getByResourceGroup(String resourceGroupName, String autoscaleSettingName); + + /** + * Lists the autoscale settings for a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists the autoscale settings for a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of autoscale setting resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets an autoscale setting. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an autoscale setting along with {@link Response}. + */ + AutoscaleSettingResource getById(String id); + + /** + * Gets an autoscale setting. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an autoscale setting along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes and autoscale setting. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes and autoscale setting. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new AutoscaleSettingResource resource. + * + * @param name resource name. + * @return the first stage of the new AutoscaleSettingResource definition. + */ + AutoscaleSettingResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureAppPushReceiver.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureAppPushReceiver.java new file mode 100644 index 0000000000000..0c6d4b14ddd29 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureAppPushReceiver.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Azure mobile App push notification receiver. */ +@Fluent +public final class AzureAppPushReceiver { + /* + * The name of the Azure mobile app push receiver. Names must be unique across all receivers within an action + * group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The email address registered for the Azure mobile app. + */ + @JsonProperty(value = "emailAddress", required = true) + private String emailAddress; + + /** Creates an instance of AzureAppPushReceiver class. */ + public AzureAppPushReceiver() { + } + + /** + * Get the name property: The name of the Azure mobile app push receiver. Names must be unique across all receivers + * within an action group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the Azure mobile app push receiver. Names must be unique across all receivers + * within an action group. + * + * @param name the name value to set. + * @return the AzureAppPushReceiver object itself. + */ + public AzureAppPushReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the emailAddress property: The email address registered for the Azure mobile app. + * + * @return the emailAddress value. + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the emailAddress property: The email address registered for the Azure mobile app. + * + * @param emailAddress the emailAddress value to set. + * @return the AzureAppPushReceiver object itself. + */ + public AzureAppPushReceiver withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model AzureAppPushReceiver")); + } + if (emailAddress() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property emailAddress in model AzureAppPushReceiver")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AzureAppPushReceiver.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureFunctionReceiver.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureFunctionReceiver.java new file mode 100644 index 0000000000000..56df9d9d059a3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureFunctionReceiver.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An azure function receiver. */ +@Fluent +public final class AzureFunctionReceiver { + /* + * The name of the azure function receiver. Names must be unique across all receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The azure resource id of the function app. + */ + @JsonProperty(value = "functionAppResourceId", required = true) + private String functionAppResourceId; + + /* + * The function name in the function app. + */ + @JsonProperty(value = "functionName", required = true) + private String functionName; + + /* + * The http trigger url where http request sent to. + */ + @JsonProperty(value = "httpTriggerUrl", required = true) + private String httpTriggerUrl; + + /* + * Indicates whether to use common alert schema. + */ + @JsonProperty(value = "useCommonAlertSchema") + private Boolean useCommonAlertSchema; + + /** Creates an instance of AzureFunctionReceiver class. */ + public AzureFunctionReceiver() { + } + + /** + * Get the name property: The name of the azure function receiver. Names must be unique across all receivers within + * an action group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the azure function receiver. Names must be unique across all receivers within + * an action group. + * + * @param name the name value to set. + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the functionAppResourceId property: The azure resource id of the function app. + * + * @return the functionAppResourceId value. + */ + public String functionAppResourceId() { + return this.functionAppResourceId; + } + + /** + * Set the functionAppResourceId property: The azure resource id of the function app. + * + * @param functionAppResourceId the functionAppResourceId value to set. + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withFunctionAppResourceId(String functionAppResourceId) { + this.functionAppResourceId = functionAppResourceId; + return this; + } + + /** + * Get the functionName property: The function name in the function app. + * + * @return the functionName value. + */ + public String functionName() { + return this.functionName; + } + + /** + * Set the functionName property: The function name in the function app. + * + * @param functionName the functionName value to set. + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withFunctionName(String functionName) { + this.functionName = functionName; + return this; + } + + /** + * Get the httpTriggerUrl property: The http trigger url where http request sent to. + * + * @return the httpTriggerUrl value. + */ + public String httpTriggerUrl() { + return this.httpTriggerUrl; + } + + /** + * Set the httpTriggerUrl property: The http trigger url where http request sent to. + * + * @param httpTriggerUrl the httpTriggerUrl value to set. + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withHttpTriggerUrl(String httpTriggerUrl) { + this.httpTriggerUrl = httpTriggerUrl; + return this; + } + + /** + * Get the useCommonAlertSchema property: Indicates whether to use common alert schema. + * + * @return the useCommonAlertSchema value. + */ + public Boolean useCommonAlertSchema() { + return this.useCommonAlertSchema; + } + + /** + * Set the useCommonAlertSchema property: Indicates whether to use common alert schema. + * + * @param useCommonAlertSchema the useCommonAlertSchema value to set. + * @return the AzureFunctionReceiver object itself. + */ + public AzureFunctionReceiver withUseCommonAlertSchema(Boolean useCommonAlertSchema) { + this.useCommonAlertSchema = useCommonAlertSchema; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model AzureFunctionReceiver")); + } + if (functionAppResourceId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property functionAppResourceId in model AzureFunctionReceiver")); + } + if (functionName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property functionName in model AzureFunctionReceiver")); + } + if (httpTriggerUrl() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property httpTriggerUrl in model AzureFunctionReceiver")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AzureFunctionReceiver.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorMetricsDestination.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorMetricsDestination.java new file mode 100644 index 0000000000000..7c2c1e163cc9f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorMetricsDestination.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Azure Monitor Metrics destination. */ +@Fluent +public class AzureMonitorMetricsDestination { + /* + * A friendly name for the destination. + * This name should be unique across all destinations (regardless of type) within the data collection rule. + */ + @JsonProperty(value = "name") + private String name; + + /** Creates an instance of AzureMonitorMetricsDestination class. */ + public AzureMonitorMetricsDestination() { + } + + /** + * Get the name property: A friendly name for the destination. This name should be unique across all destinations + * (regardless of type) within the data collection rule. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: A friendly name for the destination. This name should be unique across all destinations + * (regardless of type) within the data collection rule. + * + * @param name the name value to set. + * @return the AzureMonitorMetricsDestination object itself. + */ + public AzureMonitorMetricsDestination withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorPrivateLinkScope.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorPrivateLinkScope.java new file mode 100644 index 0000000000000..6a28d8810a1c8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorPrivateLinkScope.java @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.AzureMonitorPrivateLinkScopeInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of AzureMonitorPrivateLinkScope. */ +public interface AzureMonitorPrivateLinkScope { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the systemData property: System data. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the provisioningState property: 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. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the privateEndpointConnections property: List of private endpoint connections. + * + * @return the privateEndpointConnections value. + */ + List privateEndpointConnections(); + + /** + * Gets the accessModeSettings property: Access mode settings. + * + * @return the accessModeSettings value. + */ + AccessModeSettings accessModeSettings(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.AzureMonitorPrivateLinkScopeInner + * object. + * + * @return the inner object. + */ + AzureMonitorPrivateLinkScopeInner innerModel(); + + /** The entirety of the AzureMonitorPrivateLinkScope definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithAccessModeSettings, + DefinitionStages.WithCreate { + } + /** The AzureMonitorPrivateLinkScope definition stages. */ + interface DefinitionStages { + /** The first stage of the AzureMonitorPrivateLinkScope definition. */ + interface Blank extends WithLocation { + } + /** The stage of the AzureMonitorPrivateLinkScope definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the AzureMonitorPrivateLinkScope definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithAccessModeSettings withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the AzureMonitorPrivateLinkScope definition allowing to specify accessModeSettings. */ + interface WithAccessModeSettings { + /** + * Specifies the accessModeSettings property: Access mode settings. + * + * @param accessModeSettings Access mode settings. + * @return the next definition stage. + */ + WithCreate withAccessModeSettings(AccessModeSettings accessModeSettings); + } + /** + * The stage of the AzureMonitorPrivateLinkScope definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags { + /** + * Executes the create request. + * + * @return the created resource. + */ + AzureMonitorPrivateLinkScope create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AzureMonitorPrivateLinkScope create(Context context); + } + /** The stage of the AzureMonitorPrivateLinkScope definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + } + /** + * Begins update for the AzureMonitorPrivateLinkScope resource. + * + * @return the stage of resource update. + */ + AzureMonitorPrivateLinkScope.Update update(); + + /** The template for AzureMonitorPrivateLinkScope update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + AzureMonitorPrivateLinkScope apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + AzureMonitorPrivateLinkScope apply(Context context); + } + /** The AzureMonitorPrivateLinkScope update stages. */ + interface UpdateStages { + /** The stage of the AzureMonitorPrivateLinkScope update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AzureMonitorPrivateLinkScope refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AzureMonitorPrivateLinkScope refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorPrivateLinkScopeListResult.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorPrivateLinkScopeListResult.java new file mode 100644 index 0000000000000..0dfd60d45847b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorPrivateLinkScopeListResult.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.AzureMonitorPrivateLinkScopeInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the list of Azure Monitor PrivateLinkScope resources. */ +@Fluent +public final class AzureMonitorPrivateLinkScopeListResult { + /* + * List of Azure Monitor PrivateLinkScope definitions. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URI to get the next set of Azure Monitor PrivateLinkScope definitions if too many PrivateLinkScopes where + * returned in the result set. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of AzureMonitorPrivateLinkScopeListResult class. */ + public AzureMonitorPrivateLinkScopeListResult() { + } + + /** + * Get the value property: List of Azure Monitor PrivateLinkScope definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: List of Azure Monitor PrivateLinkScope definitions. + * + * @param value the value value to set. + * @return the AzureMonitorPrivateLinkScopeListResult object itself. + */ + public AzureMonitorPrivateLinkScopeListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URI to get the next set of Azure Monitor PrivateLinkScope definitions if too many + * PrivateLinkScopes where returned in the result set. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URI to get the next set of Azure Monitor PrivateLinkScope definitions if too many + * PrivateLinkScopes where returned in the result set. + * + * @param nextLink the nextLink value to set. + * @return the AzureMonitorPrivateLinkScopeListResult object itself. + */ + public AzureMonitorPrivateLinkScopeListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model AzureMonitorPrivateLinkScopeListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AzureMonitorPrivateLinkScopeListResult.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspace.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspace.java new file mode 100644 index 0000000000000..dc68befe6de26 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspace.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of an Azure Monitor workspace. */ +@Immutable +public class AzureMonitorWorkspace { + /* + * The immutable ID of the Azure Monitor workspace. This property is read-only. + */ + @JsonProperty(value = "accountId", access = JsonProperty.Access.WRITE_ONLY) + private String accountId; + + /* + * Information about metrics for the Azure Monitor workspace + */ + @JsonProperty(value = "metrics", access = JsonProperty.Access.WRITE_ONLY) + private AzureMonitorWorkspaceMetrics metrics; + + /* + * The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * The Data Collection Rule and Endpoint used for ingestion by default. + */ + @JsonProperty(value = "defaultIngestionSettings", access = JsonProperty.Access.WRITE_ONLY) + private AzureMonitorWorkspaceDefaultIngestionSettings defaultIngestionSettings; + + /** Creates an instance of AzureMonitorWorkspace class. */ + public AzureMonitorWorkspace() { + } + + /** + * Get the accountId property: The immutable ID of the Azure Monitor workspace. This property is read-only. + * + * @return the accountId value. + */ + public String accountId() { + return this.accountId; + } + + /** + * Get the metrics property: Information about metrics for the Azure Monitor workspace. + * + * @return the metrics value. + */ + public AzureMonitorWorkspaceMetrics metrics() { + return this.metrics; + } + + /** + * Get the provisioningState property: The provisioning state of the Azure Monitor workspace. Set to Succeeded if + * everything is healthy. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the defaultIngestionSettings property: The Data Collection Rule and Endpoint used for ingestion by default. + * + * @return the defaultIngestionSettings value. + */ + public AzureMonitorWorkspaceDefaultIngestionSettings defaultIngestionSettings() { + return this.defaultIngestionSettings; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metrics() != null) { + metrics().validate(); + } + if (defaultIngestionSettings() != null) { + defaultIngestionSettings().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceDefaultIngestionSettings.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceDefaultIngestionSettings.java new file mode 100644 index 0000000000000..aad5a61a2b6f7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceDefaultIngestionSettings.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; + +/** The Data Collection Rule and Endpoint used for ingestion by default. */ +@Immutable +public final class AzureMonitorWorkspaceDefaultIngestionSettings extends IngestionSettings { + /** Creates an instance of AzureMonitorWorkspaceDefaultIngestionSettings class. */ + public AzureMonitorWorkspaceDefaultIngestionSettings() { + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceMetrics.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceMetrics.java new file mode 100644 index 0000000000000..8146887f6a55f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceMetrics.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; + +/** Information about metrics for the Azure Monitor workspace. */ +@Immutable +public final class AzureMonitorWorkspaceMetrics extends Metrics { + /** Creates an instance of AzureMonitorWorkspaceMetrics class. */ + public AzureMonitorWorkspaceMetrics() { + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceResource.java new file mode 100644 index 0000000000000..0a22e7815eab4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceResource.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.AzureMonitorWorkspaceResourceInner; +import java.util.Map; + +/** An immutable client-side representation of AzureMonitorWorkspaceResource. */ +public interface AzureMonitorWorkspaceResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the etag property: Resource entity tag (ETag). + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Azure Resource Manager metadata containing createdBy and modifiedBy information. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the accountId property: The immutable ID of the Azure Monitor workspace. This property is read-only. + * + * @return the accountId value. + */ + String accountId(); + + /** + * Gets the metrics property: Information about metrics for the Azure Monitor workspace. + * + * @return the metrics value. + */ + AzureMonitorWorkspaceMetrics metrics(); + + /** + * Gets the provisioningState property: The provisioning state of the Azure Monitor workspace. Set to Succeeded if + * everything is healthy. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the defaultIngestionSettings property: The Data Collection Rule and Endpoint used for ingestion by default. + * + * @return the defaultIngestionSettings value. + */ + AzureMonitorWorkspaceDefaultIngestionSettings defaultIngestionSettings(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.AzureMonitorWorkspaceResourceInner + * object. + * + * @return the inner object. + */ + AzureMonitorWorkspaceResourceInner innerModel(); + + /** The entirety of the AzureMonitorWorkspaceResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The AzureMonitorWorkspaceResource definition stages. */ + interface DefinitionStages { + /** The first stage of the AzureMonitorWorkspaceResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the AzureMonitorWorkspaceResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the AzureMonitorWorkspaceResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the AzureMonitorWorkspaceResource definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithTags { + /** + * Executes the create request. + * + * @return the created resource. + */ + AzureMonitorWorkspaceResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + AzureMonitorWorkspaceResource create(Context context); + } + /** The stage of the AzureMonitorWorkspaceResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + } + /** + * Begins update for the AzureMonitorWorkspaceResource resource. + * + * @return the stage of resource update. + */ + AzureMonitorWorkspaceResource.Update update(); + + /** The template for AzureMonitorWorkspaceResource update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + AzureMonitorWorkspaceResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + AzureMonitorWorkspaceResource apply(Context context); + } + /** The AzureMonitorWorkspaceResource update stages. */ + interface UpdateStages { + /** The stage of the AzureMonitorWorkspaceResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + AzureMonitorWorkspaceResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + AzureMonitorWorkspaceResource refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceResourceForUpdate.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceResourceForUpdate.java new file mode 100644 index 0000000000000..96cb7997554dd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceResourceForUpdate.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Definition of ARM tracked top level resource properties for update operation. */ +@Fluent +public final class AzureMonitorWorkspaceResourceForUpdate { + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of AzureMonitorWorkspaceResourceForUpdate class. */ + public AzureMonitorWorkspaceResourceForUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the AzureMonitorWorkspaceResourceForUpdate object itself. + */ + public AzureMonitorWorkspaceResourceForUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceResourceListResult.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceResourceListResult.java new file mode 100644 index 0000000000000..ff10f80956d1a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaceResourceListResult.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.AzureMonitorWorkspaceResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A pageable list of resources. */ +@Fluent +public final class AzureMonitorWorkspaceResourceListResult { + /* + * A list of resources + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URL to use for getting the next set of results + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of AzureMonitorWorkspaceResourceListResult class. */ + public AzureMonitorWorkspaceResourceListResult() { + } + + /** + * Get the value property: A list of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of resources. + * + * @param value the value value to set. + * @return the AzureMonitorWorkspaceResourceListResult object itself. + */ + public AzureMonitorWorkspaceResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to use for getting the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the AzureMonitorWorkspaceResourceListResult object itself. + */ + public AzureMonitorWorkspaceResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model AzureMonitorWorkspaceResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AzureMonitorWorkspaceResourceListResult.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaces.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaces.java new file mode 100644 index 0000000000000..607290cb209f2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorWorkspaces.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of AzureMonitorWorkspaces. */ +public interface AzureMonitorWorkspaces { + /** + * Lists all workspaces in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all workspaces in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all workspaces in the specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all workspaces in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Returns the specific Azure Monitor workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String azureMonitorWorkspaceName, Context context); + + /** + * Returns the specific Azure Monitor workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition. + */ + AzureMonitorWorkspaceResource getByResourceGroup(String resourceGroupName, String azureMonitorWorkspaceName); + + /** + * Delete a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse( + String resourceGroupName, String azureMonitorWorkspaceName, Context context); + + /** + * Delete a workspace. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param azureMonitorWorkspaceName The name of the Azure Monitor workspace. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String azureMonitorWorkspaceName); + + /** + * Returns the specific Azure Monitor workspace. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response}. + */ + AzureMonitorWorkspaceResource getById(String id); + + /** + * Returns the specific Azure Monitor workspace. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor Workspace definition along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete a workspace. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete a workspace. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new AzureMonitorWorkspaceResource resource. + * + * @param name resource name. + * @return the first stage of the new AzureMonitorWorkspaceResource definition. + */ + AzureMonitorWorkspaceResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/BaselineMetadata.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/BaselineMetadata.java new file mode 100644 index 0000000000000..4185fca43afbc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/BaselineMetadata.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a baseline metadata value. */ +@Fluent +public final class BaselineMetadata { + /* + * Name of the baseline metadata. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Value of the baseline metadata. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** Creates an instance of BaselineMetadata class. */ + public BaselineMetadata() { + } + + /** + * Get the name property: Name of the baseline metadata. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the baseline metadata. + * + * @param name the name value to set. + * @return the BaselineMetadata object itself. + */ + public BaselineMetadata withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: Value of the baseline metadata. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Value of the baseline metadata. + * + * @param value the value value to set. + * @return the BaselineMetadata object itself. + */ + public BaselineMetadata withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model BaselineMetadata")); + } + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model BaselineMetadata")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(BaselineMetadata.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/BaselineSensitivity.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/BaselineSensitivity.java new file mode 100644 index 0000000000000..147d46ee2963e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/BaselineSensitivity.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** the sensitivity of the baseline. */ +public final class BaselineSensitivity extends ExpandableStringEnum { + /** Static value Low for BaselineSensitivity. */ + public static final BaselineSensitivity LOW = fromString("Low"); + + /** Static value Medium for BaselineSensitivity. */ + public static final BaselineSensitivity MEDIUM = fromString("Medium"); + + /** Static value High for BaselineSensitivity. */ + public static final BaselineSensitivity HIGH = fromString("High"); + + /** + * Creates a new instance of BaselineSensitivity value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public BaselineSensitivity() { + } + + /** + * Creates or finds a BaselineSensitivity from its string representation. + * + * @param name a name to look for. + * @return the corresponding BaselineSensitivity. + */ + @JsonCreator + public static BaselineSensitivity fromString(String name) { + return fromString(name, BaselineSensitivity.class); + } + + /** + * Gets known BaselineSensitivity values. + * + * @return known BaselineSensitivity values. + */ + public static Collection values() { + return values(BaselineSensitivity.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Baselines.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Baselines.java new file mode 100644 index 0000000000000..6ba96d99b6d8f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Baselines.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import java.time.Duration; + +/** Resource collection API of Baselines. */ +public interface Baselines { + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of metric baselines as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri); + + /** + * **Lists the metric baseline values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @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'**. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param sensitivities The list of sensitivities (comma separated) to retrieve. + * @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' "**. + * @param resultType Allows retrieving only metadata of the baseline. On data request all information is retrieved. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of metric baselines as paginated response with {@link PagedIterable}. + */ + PagedIterable list( + String resourceUri, + String metricnames, + String metricnamespace, + String timespan, + Duration interval, + String aggregation, + String sensitivities, + String filter, + ResultType resultType, + Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/CategoryType.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/CategoryType.java new file mode 100644 index 0000000000000..0b5151348f407 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/CategoryType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** The type of the diagnostic settings category. */ +public enum CategoryType { + /** Enum value Metrics. */ + METRICS("Metrics"), + + /** Enum value Logs. */ + LOGS("Logs"); + + /** The actual serialized value for a CategoryType instance. */ + private final String value; + + CategoryType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a CategoryType instance. + * + * @param value the serialized value to parse. + * @return the parsed CategoryType object, or null if unable to parse. + */ + @JsonCreator + public static CategoryType fromString(String value) { + if (value == null) { + return null; + } + CategoryType[] items = CategoryType.values(); + for (CategoryType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ColumnDefinition.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ColumnDefinition.java new file mode 100644 index 0000000000000..75f59f58c95e5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ColumnDefinition.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Definition of custom data column. */ +@Fluent +public final class ColumnDefinition { + /* + * The name of the column. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The type of the column data. + */ + @JsonProperty(value = "type") + private KnownColumnDefinitionType type; + + /** Creates an instance of ColumnDefinition class. */ + public ColumnDefinition() { + } + + /** + * Get the name property: The name of the column. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the column. + * + * @param name the name value to set. + * @return the ColumnDefinition object itself. + */ + public ColumnDefinition withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: The type of the column data. + * + * @return the type value. + */ + public KnownColumnDefinitionType type() { + return this.type; + } + + /** + * Set the type property: The type of the column data. + * + * @param type the type value to set. + * @return the ColumnDefinition object itself. + */ + public ColumnDefinition withType(KnownColumnDefinitionType type) { + this.type = type; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ComparisonOperationType.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ComparisonOperationType.java new file mode 100644 index 0000000000000..df20a4ef769bf --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ComparisonOperationType.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** the operator that is used to compare the metric data and the threshold. */ +public enum ComparisonOperationType { + /** Enum value Equals. */ + EQUALS("Equals"), + + /** Enum value NotEquals. */ + NOT_EQUALS("NotEquals"), + + /** Enum value GreaterThan. */ + GREATER_THAN("GreaterThan"), + + /** Enum value GreaterThanOrEqual. */ + GREATER_THAN_OR_EQUAL("GreaterThanOrEqual"), + + /** Enum value LessThan. */ + LESS_THAN("LessThan"), + + /** Enum value LessThanOrEqual. */ + LESS_THAN_OR_EQUAL("LessThanOrEqual"); + + /** The actual serialized value for a ComparisonOperationType instance. */ + private final String value; + + ComparisonOperationType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ComparisonOperationType instance. + * + * @param value the serialized value to parse. + * @return the parsed ComparisonOperationType object, or null if unable to parse. + */ + @JsonCreator + public static ComparisonOperationType fromString(String value) { + if (value == null) { + return null; + } + ComparisonOperationType[] items = ComparisonOperationType.values(); + for (ComparisonOperationType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Condition.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Condition.java new file mode 100644 index 0000000000000..f3caf0c80f4ef --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Condition.java @@ -0,0 +1,278 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A condition of the scheduled query rule. */ +@Fluent +public final class Condition { + /* + * Log query alert + */ + @JsonProperty(value = "query") + private String query; + + /* + * Aggregation type. Relevant and required only for rules of the kind LogAlert. + */ + @JsonProperty(value = "timeAggregation") + private TimeAggregation timeAggregation; + + /* + * The column containing the metric measure number. Relevant only for rules of the kind LogAlert. + */ + @JsonProperty(value = "metricMeasureColumn") + private String metricMeasureColumn; + + /* + * The column containing the resource id. The content of the column must be a uri formatted as resource id. + * Relevant only for rules of the kind LogAlert. + */ + @JsonProperty(value = "resourceIdColumn") + private String resourceIdColumn; + + /* + * List of Dimensions conditions + */ + @JsonProperty(value = "dimensions") + private List dimensions; + + /* + * The criteria operator. Relevant and required only for rules of the kind LogAlert. + */ + @JsonProperty(value = "operator") + private ConditionOperator operator; + + /* + * the criteria threshold value that activates the alert. Relevant and required only for rules of the kind + * LogAlert. + */ + @JsonProperty(value = "threshold") + private Double threshold; + + /* + * The minimum number of violations required within the selected lookback time window required to raise an alert. + * Relevant only for rules of the kind LogAlert. + */ + @JsonProperty(value = "failingPeriods") + private ConditionFailingPeriods failingPeriods; + + /* + * The name of the metric to be sent. Relevant and required only for rules of the kind LogToMetric. + */ + @JsonProperty(value = "metricName") + private String metricName; + + /** Creates an instance of Condition class. */ + public Condition() { + } + + /** + * Get the query property: Log query alert. + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Set the query property: Log query alert. + * + * @param query the query value to set. + * @return the Condition object itself. + */ + public Condition withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get the timeAggregation property: Aggregation type. Relevant and required only for rules of the kind LogAlert. + * + * @return the timeAggregation value. + */ + public TimeAggregation timeAggregation() { + return this.timeAggregation; + } + + /** + * Set the timeAggregation property: Aggregation type. Relevant and required only for rules of the kind LogAlert. + * + * @param timeAggregation the timeAggregation value to set. + * @return the Condition object itself. + */ + public Condition withTimeAggregation(TimeAggregation timeAggregation) { + this.timeAggregation = timeAggregation; + return this; + } + + /** + * Get the metricMeasureColumn property: The column containing the metric measure number. Relevant only for rules of + * the kind LogAlert. + * + * @return the metricMeasureColumn value. + */ + public String metricMeasureColumn() { + return this.metricMeasureColumn; + } + + /** + * Set the metricMeasureColumn property: The column containing the metric measure number. Relevant only for rules of + * the kind LogAlert. + * + * @param metricMeasureColumn the metricMeasureColumn value to set. + * @return the Condition object itself. + */ + public Condition withMetricMeasureColumn(String metricMeasureColumn) { + this.metricMeasureColumn = metricMeasureColumn; + return this; + } + + /** + * Get the resourceIdColumn property: The column containing the resource id. The content of the column must be a uri + * formatted as resource id. Relevant only for rules of the kind LogAlert. + * + * @return the resourceIdColumn value. + */ + public String resourceIdColumn() { + return this.resourceIdColumn; + } + + /** + * Set the resourceIdColumn property: The column containing the resource id. The content of the column must be a uri + * formatted as resource id. Relevant only for rules of the kind LogAlert. + * + * @param resourceIdColumn the resourceIdColumn value to set. + * @return the Condition object itself. + */ + public Condition withResourceIdColumn(String resourceIdColumn) { + this.resourceIdColumn = resourceIdColumn; + return this; + } + + /** + * Get the dimensions property: List of Dimensions conditions. + * + * @return the dimensions value. + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Set the dimensions property: List of Dimensions conditions. + * + * @param dimensions the dimensions value to set. + * @return the Condition object itself. + */ + public Condition withDimensions(List dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Get the operator property: The criteria operator. Relevant and required only for rules of the kind LogAlert. + * + * @return the operator value. + */ + public ConditionOperator operator() { + return this.operator; + } + + /** + * Set the operator property: The criteria operator. Relevant and required only for rules of the kind LogAlert. + * + * @param operator the operator value to set. + * @return the Condition object itself. + */ + public Condition withOperator(ConditionOperator operator) { + this.operator = operator; + return this; + } + + /** + * Get the threshold property: the criteria threshold value that activates the alert. Relevant and required only for + * rules of the kind LogAlert. + * + * @return the threshold value. + */ + public Double threshold() { + return this.threshold; + } + + /** + * Set the threshold property: the criteria threshold value that activates the alert. Relevant and required only for + * rules of the kind LogAlert. + * + * @param threshold the threshold value to set. + * @return the Condition object itself. + */ + public Condition withThreshold(Double threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the failingPeriods property: The minimum number of violations required within the selected lookback time + * window required to raise an alert. Relevant only for rules of the kind LogAlert. + * + * @return the failingPeriods value. + */ + public ConditionFailingPeriods failingPeriods() { + return this.failingPeriods; + } + + /** + * Set the failingPeriods property: The minimum number of violations required within the selected lookback time + * window required to raise an alert. Relevant only for rules of the kind LogAlert. + * + * @param failingPeriods the failingPeriods value to set. + * @return the Condition object itself. + */ + public Condition withFailingPeriods(ConditionFailingPeriods failingPeriods) { + this.failingPeriods = failingPeriods; + return this; + } + + /** + * Get the metricName property: The name of the metric to be sent. Relevant and required only for rules of the kind + * LogToMetric. + * + * @return the metricName value. + */ + public String metricName() { + return this.metricName; + } + + /** + * Set the metricName property: The name of the metric to be sent. Relevant and required only for rules of the kind + * LogToMetric. + * + * @param metricName the metricName value to set. + * @return the Condition object itself. + */ + public Condition withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dimensions() != null) { + dimensions().forEach(e -> e.validate()); + } + if (failingPeriods() != null) { + failingPeriods().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ConditionFailingPeriods.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ConditionFailingPeriods.java new file mode 100644 index 0000000000000..d675ee30b8504 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ConditionFailingPeriods.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The minimum number of violations required within the selected lookback time window required to raise an alert. + * Relevant only for rules of the kind LogAlert. + */ +@Fluent +public final class ConditionFailingPeriods { + /* + * The number of aggregated lookback points. The lookback time window is calculated based on the aggregation + * granularity (windowSize) and the selected number of aggregated points. Default value is 1 + */ + @JsonProperty(value = "numberOfEvaluationPeriods") + private Long numberOfEvaluationPeriods; + + /* + * The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. Default + * value is 1 + */ + @JsonProperty(value = "minFailingPeriodsToAlert") + private Long minFailingPeriodsToAlert; + + /** Creates an instance of ConditionFailingPeriods class. */ + public ConditionFailingPeriods() { + } + + /** + * Get the numberOfEvaluationPeriods property: The number of aggregated lookback points. The lookback time window is + * calculated based on the aggregation granularity (windowSize) and the selected number of aggregated points. + * Default value is 1. + * + * @return the numberOfEvaluationPeriods value. + */ + public Long numberOfEvaluationPeriods() { + return this.numberOfEvaluationPeriods; + } + + /** + * Set the numberOfEvaluationPeriods property: The number of aggregated lookback points. The lookback time window is + * calculated based on the aggregation granularity (windowSize) and the selected number of aggregated points. + * Default value is 1. + * + * @param numberOfEvaluationPeriods the numberOfEvaluationPeriods value to set. + * @return the ConditionFailingPeriods object itself. + */ + public ConditionFailingPeriods withNumberOfEvaluationPeriods(Long numberOfEvaluationPeriods) { + this.numberOfEvaluationPeriods = numberOfEvaluationPeriods; + return this; + } + + /** + * Get the minFailingPeriodsToAlert property: The number of violations to trigger an alert. Should be smaller or + * equal to numberOfEvaluationPeriods. Default value is 1. + * + * @return the minFailingPeriodsToAlert value. + */ + public Long minFailingPeriodsToAlert() { + return this.minFailingPeriodsToAlert; + } + + /** + * Set the minFailingPeriodsToAlert property: The number of violations to trigger an alert. Should be smaller or + * equal to numberOfEvaluationPeriods. Default value is 1. + * + * @param minFailingPeriodsToAlert the minFailingPeriodsToAlert value to set. + * @return the ConditionFailingPeriods object itself. + */ + public ConditionFailingPeriods withMinFailingPeriodsToAlert(Long minFailingPeriodsToAlert) { + this.minFailingPeriodsToAlert = minFailingPeriodsToAlert; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ConditionOperator.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ConditionOperator.java new file mode 100644 index 0000000000000..49b1339ee3a06 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ConditionOperator.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Operators allowed in the rule condition. */ +public enum ConditionOperator { + /** Enum value GreaterThan. */ + GREATER_THAN("GreaterThan"), + + /** Enum value GreaterThanOrEqual. */ + GREATER_THAN_OR_EQUAL("GreaterThanOrEqual"), + + /** Enum value LessThan. */ + LESS_THAN("LessThan"), + + /** Enum value LessThanOrEqual. */ + LESS_THAN_OR_EQUAL("LessThanOrEqual"), + + /** Enum value Equals. */ + EQUALS("Equals"); + + /** The actual serialized value for a ConditionOperator instance. */ + private final String value; + + ConditionOperator(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ConditionOperator instance. + * + * @param value the serialized value to parse. + * @return the parsed ConditionOperator object, or null if unable to parse. + */ + @JsonCreator + public static ConditionOperator fromString(String value) { + if (value == null) { + return null; + } + ConditionOperator[] items = ConditionOperator.values(); + for (ConditionOperator item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ConfigurationAccessEndpointSpec.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ConfigurationAccessEndpointSpec.java new file mode 100644 index 0000000000000..f9849cbdd632a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ConfigurationAccessEndpointSpec.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Definition of the endpoint used for accessing configuration. */ +@Immutable +public class ConfigurationAccessEndpointSpec { + /* + * The endpoint. This property is READ-ONLY. + */ + @JsonProperty(value = "endpoint", access = JsonProperty.Access.WRITE_ONLY) + private String endpoint; + + /** Creates an instance of ConfigurationAccessEndpointSpec class. */ + public ConfigurationAccessEndpointSpec() { + } + + /** + * Get the endpoint property: The endpoint. This property is READ-ONLY. + * + * @return the endpoint value. + */ + public String endpoint() { + return this.endpoint; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Context.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Context.java new file mode 100644 index 0000000000000..94d5d221e734f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Context.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The context info. */ +@Fluent +public final class Context { + /* + * The source of the notification request + */ + @JsonProperty(value = "notificationSource") + private String notificationSource; + + /* + * The context id type + */ + @JsonProperty(value = "contextType") + private String contextType; + + /** Creates an instance of Context class. */ + public Context() { + } + + /** + * Get the notificationSource property: The source of the notification request. + * + * @return the notificationSource value. + */ + public String notificationSource() { + return this.notificationSource; + } + + /** + * Set the notificationSource property: The source of the notification request. + * + * @param notificationSource the notificationSource value to set. + * @return the Context object itself. + */ + public Context withNotificationSource(String notificationSource) { + this.notificationSource = notificationSource; + return this; + } + + /** + * Get the contextType property: The context id type. + * + * @return the contextType value. + */ + public String contextType() { + return this.contextType; + } + + /** + * Set the contextType property: The context id type. + * + * @param contextType the contextType value to set. + * @return the Context object itself. + */ + public Context withContextType(String contextType) { + this.contextType = contextType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/CriterionType.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/CriterionType.java new file mode 100644 index 0000000000000..b8ae18bb3406e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/CriterionType.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Specifies the type of threshold criteria. */ +public final class CriterionType extends ExpandableStringEnum { + /** Static value StaticThresholdCriterion for CriterionType. */ + public static final CriterionType STATIC_THRESHOLD_CRITERION = fromString("StaticThresholdCriterion"); + + /** Static value DynamicThresholdCriterion for CriterionType. */ + public static final CriterionType DYNAMIC_THRESHOLD_CRITERION = fromString("DynamicThresholdCriterion"); + + /** + * Creates a new instance of CriterionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CriterionType() { + } + + /** + * Creates or finds a CriterionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding CriterionType. + */ + @JsonCreator + public static CriterionType fromString(String name) { + return fromString(name, CriterionType.class); + } + + /** + * Gets known CriterionType values. + * + * @return known CriterionType values. + */ + public static Collection values() { + return values(CriterionType.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpoint.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpoint.java new file mode 100644 index 0000000000000..8c3f72e1d89a7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpoint.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Definition of data collection endpoint. */ +@Fluent +public class DataCollectionEndpoint { + /* + * Description of the data collection endpoint. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The immutable ID of this data collection endpoint resource. This property is READ-ONLY. + */ + @JsonProperty(value = "immutableId") + private String immutableId; + + /* + * The endpoint used by clients to access their configuration. + */ + @JsonProperty(value = "configurationAccess") + private DataCollectionEndpointConfigurationAccess configurationAccess; + + /* + * The endpoint used by clients to ingest logs. + */ + @JsonProperty(value = "logsIngestion") + private DataCollectionEndpointLogsIngestion logsIngestion; + + /* + * Network access control rules for the endpoints. + */ + @JsonProperty(value = "networkAcls") + private DataCollectionEndpointNetworkAcls networkAcls; + + /* + * The resource provisioning state. This property is READ-ONLY. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private KnownDataCollectionEndpointProvisioningState provisioningState; + + /** Creates an instance of DataCollectionEndpoint class. */ + public DataCollectionEndpoint() { + } + + /** + * Get the description property: Description of the data collection endpoint. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the data collection endpoint. + * + * @param description the description value to set. + * @return the DataCollectionEndpoint object itself. + */ + public DataCollectionEndpoint withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the immutableId property: The immutable ID of this data collection endpoint resource. This property is + * READ-ONLY. + * + * @return the immutableId value. + */ + public String immutableId() { + return this.immutableId; + } + + /** + * Set the immutableId property: The immutable ID of this data collection endpoint resource. This property is + * READ-ONLY. + * + * @param immutableId the immutableId value to set. + * @return the DataCollectionEndpoint object itself. + */ + public DataCollectionEndpoint withImmutableId(String immutableId) { + this.immutableId = immutableId; + return this; + } + + /** + * Get the configurationAccess property: The endpoint used by clients to access their configuration. + * + * @return the configurationAccess value. + */ + public DataCollectionEndpointConfigurationAccess configurationAccess() { + return this.configurationAccess; + } + + /** + * Set the configurationAccess property: The endpoint used by clients to access their configuration. + * + * @param configurationAccess the configurationAccess value to set. + * @return the DataCollectionEndpoint object itself. + */ + public DataCollectionEndpoint withConfigurationAccess( + DataCollectionEndpointConfigurationAccess configurationAccess) { + this.configurationAccess = configurationAccess; + return this; + } + + /** + * Get the logsIngestion property: The endpoint used by clients to ingest logs. + * + * @return the logsIngestion value. + */ + public DataCollectionEndpointLogsIngestion logsIngestion() { + return this.logsIngestion; + } + + /** + * Set the logsIngestion property: The endpoint used by clients to ingest logs. + * + * @param logsIngestion the logsIngestion value to set. + * @return the DataCollectionEndpoint object itself. + */ + public DataCollectionEndpoint withLogsIngestion(DataCollectionEndpointLogsIngestion logsIngestion) { + this.logsIngestion = logsIngestion; + return this; + } + + /** + * Get the networkAcls property: Network access control rules for the endpoints. + * + * @return the networkAcls value. + */ + public DataCollectionEndpointNetworkAcls networkAcls() { + return this.networkAcls; + } + + /** + * Set the networkAcls property: Network access control rules for the endpoints. + * + * @param networkAcls the networkAcls value to set. + * @return the DataCollectionEndpoint object itself. + */ + public DataCollectionEndpoint withNetworkAcls(DataCollectionEndpointNetworkAcls networkAcls) { + this.networkAcls = networkAcls; + return this; + } + + /** + * Get the provisioningState property: The resource provisioning state. This property is READ-ONLY. + * + * @return the provisioningState value. + */ + public KnownDataCollectionEndpointProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (configurationAccess() != null) { + configurationAccess().validate(); + } + if (logsIngestion() != null) { + logsIngestion().validate(); + } + if (networkAcls() != null) { + networkAcls().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointConfigurationAccess.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointConfigurationAccess.java new file mode 100644 index 0000000000000..9fd8965824724 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointConfigurationAccess.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; + +/** The endpoint used by clients to access their configuration. */ +@Immutable +public final class DataCollectionEndpointConfigurationAccess extends ConfigurationAccessEndpointSpec { + /** Creates an instance of DataCollectionEndpointConfigurationAccess class. */ + public DataCollectionEndpointConfigurationAccess() { + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointLogsIngestion.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointLogsIngestion.java new file mode 100644 index 0000000000000..4e76127aba437 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointLogsIngestion.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; + +/** The endpoint used by clients to ingest logs. */ +@Immutable +public final class DataCollectionEndpointLogsIngestion extends LogsIngestionEndpointSpec { + /** Creates an instance of DataCollectionEndpointLogsIngestion class. */ + public DataCollectionEndpointLogsIngestion() { + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointNetworkAcls.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointNetworkAcls.java new file mode 100644 index 0000000000000..d31aaa058aff9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointNetworkAcls.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; + +/** Network access control rules for the endpoints. */ +@Fluent +public final class DataCollectionEndpointNetworkAcls extends NetworkRuleSet { + /** Creates an instance of DataCollectionEndpointNetworkAcls class. */ + public DataCollectionEndpointNetworkAcls() { + } + + /** {@inheritDoc} */ + @Override + public DataCollectionEndpointNetworkAcls withPublicNetworkAccess( + KnownPublicNetworkAccessOptions publicNetworkAccess) { + super.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointResource.java new file mode 100644 index 0000000000000..d25f7a5f3a6e9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointResource.java @@ -0,0 +1,334 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionEndpointResourceInner; +import java.util.Map; + +/** An immutable client-side representation of DataCollectionEndpointResource. */ +public interface DataCollectionEndpointResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the kind property: The kind of the resource. + * + * @return the kind value. + */ + KnownDataCollectionEndpointResourceKind kind(); + + /** + * Gets the etag property: Resource entity tag (ETag). + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the description property: Description of the data collection endpoint. + * + * @return the description value. + */ + String description(); + + /** + * Gets the immutableId property: The immutable ID of this data collection endpoint resource. This property is + * READ-ONLY. + * + * @return the immutableId value. + */ + String immutableId(); + + /** + * Gets the configurationAccess property: The endpoint used by clients to access their configuration. + * + * @return the configurationAccess value. + */ + DataCollectionEndpointConfigurationAccess configurationAccess(); + + /** + * Gets the logsIngestion property: The endpoint used by clients to ingest logs. + * + * @return the logsIngestion value. + */ + DataCollectionEndpointLogsIngestion logsIngestion(); + + /** + * Gets the networkAcls property: Network access control rules for the endpoints. + * + * @return the networkAcls value. + */ + DataCollectionEndpointNetworkAcls networkAcls(); + + /** + * Gets the provisioningState property: The resource provisioning state. This property is READ-ONLY. + * + * @return the provisioningState value. + */ + KnownDataCollectionEndpointProvisioningState provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionEndpointResourceInner + * object. + * + * @return the inner object. + */ + DataCollectionEndpointResourceInner innerModel(); + + /** The entirety of the DataCollectionEndpointResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The DataCollectionEndpointResource definition stages. */ + interface DefinitionStages { + /** The first stage of the DataCollectionEndpointResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the DataCollectionEndpointResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the DataCollectionEndpointResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the DataCollectionEndpointResource definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithKind, + DefinitionStages.WithDescription, + DefinitionStages.WithImmutableId, + DefinitionStages.WithConfigurationAccess, + DefinitionStages.WithLogsIngestion, + DefinitionStages.WithNetworkAcls { + /** + * Executes the create request. + * + * @return the created resource. + */ + DataCollectionEndpointResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DataCollectionEndpointResource create(Context context); + } + /** The stage of the DataCollectionEndpointResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the DataCollectionEndpointResource definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: The kind of the resource.. + * + * @param kind The kind of the resource. + * @return the next definition stage. + */ + WithCreate withKind(KnownDataCollectionEndpointResourceKind kind); + } + /** The stage of the DataCollectionEndpointResource definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of the data collection endpoint.. + * + * @param description Description of the data collection endpoint. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the DataCollectionEndpointResource definition allowing to specify immutableId. */ + interface WithImmutableId { + /** + * Specifies the immutableId property: The immutable ID of this data collection endpoint resource. This + * property is READ-ONLY.. + * + * @param immutableId The immutable ID of this data collection endpoint resource. This property is + * READ-ONLY. + * @return the next definition stage. + */ + WithCreate withImmutableId(String immutableId); + } + /** The stage of the DataCollectionEndpointResource definition allowing to specify configurationAccess. */ + interface WithConfigurationAccess { + /** + * Specifies the configurationAccess property: The endpoint used by clients to access their configuration.. + * + * @param configurationAccess The endpoint used by clients to access their configuration. + * @return the next definition stage. + */ + WithCreate withConfigurationAccess(DataCollectionEndpointConfigurationAccess configurationAccess); + } + /** The stage of the DataCollectionEndpointResource definition allowing to specify logsIngestion. */ + interface WithLogsIngestion { + /** + * Specifies the logsIngestion property: The endpoint used by clients to ingest logs.. + * + * @param logsIngestion The endpoint used by clients to ingest logs. + * @return the next definition stage. + */ + WithCreate withLogsIngestion(DataCollectionEndpointLogsIngestion logsIngestion); + } + /** The stage of the DataCollectionEndpointResource definition allowing to specify networkAcls. */ + interface WithNetworkAcls { + /** + * Specifies the networkAcls property: Network access control rules for the endpoints.. + * + * @param networkAcls Network access control rules for the endpoints. + * @return the next definition stage. + */ + WithCreate withNetworkAcls(DataCollectionEndpointNetworkAcls networkAcls); + } + } + /** + * Begins update for the DataCollectionEndpointResource resource. + * + * @return the stage of resource update. + */ + DataCollectionEndpointResource.Update update(); + + /** The template for DataCollectionEndpointResource update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DataCollectionEndpointResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DataCollectionEndpointResource apply(Context context); + } + /** The DataCollectionEndpointResource update stages. */ + interface UpdateStages { + /** The stage of the DataCollectionEndpointResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DataCollectionEndpointResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DataCollectionEndpointResource refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointResourceListResult.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointResourceListResult.java new file mode 100644 index 0000000000000..ed119b2770859 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointResourceListResult.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionEndpointResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A pageable list of resources. */ +@Fluent +public final class DataCollectionEndpointResourceListResult { + /* + * A list of resources. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of DataCollectionEndpointResourceListResult class. */ + public DataCollectionEndpointResourceListResult() { + } + + /** + * Get the value property: A list of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of resources. + * + * @param value the value value to set. + * @return the DataCollectionEndpointResourceListResult object itself. + */ + public DataCollectionEndpointResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to use for getting the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the DataCollectionEndpointResourceListResult object itself. + */ + public DataCollectionEndpointResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model DataCollectionEndpointResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DataCollectionEndpointResourceListResult.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpoints.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpoints.java new file mode 100644 index 0000000000000..9dbc628db7acb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpoints.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DataCollectionEndpoints. */ +public interface DataCollectionEndpoints { + /** + * Lists all data collection endpoints in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all data collection endpoints in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all data collection endpoints in the specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all data collection endpoints in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Returns the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String dataCollectionEndpointName, Context context); + + /** + * Returns the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource. + */ + DataCollectionEndpointResource getByResourceGroup(String resourceGroupName, String dataCollectionEndpointName); + + /** + * Deletes a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse( + String resourceGroupName, String dataCollectionEndpointName, Context context); + + /** + * Deletes a data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String dataCollectionEndpointName); + + /** + * Returns the specified data collection endpoint. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response}. + */ + DataCollectionEndpointResource getById(String id); + + /** + * Returns the specified data collection endpoint. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a data collection endpoint. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a data collection endpoint. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DataCollectionEndpointResource resource. + * + * @param name resource name. + * @return the first stage of the new DataCollectionEndpointResource definition. + */ + DataCollectionEndpointResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRule.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRule.java new file mode 100644 index 0000000000000..1593a02daf5a7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRule.java @@ -0,0 +1,257 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Definition of what monitoring data to collect and where that data should be sent. */ +@Fluent +public class DataCollectionRule { + /* + * Description of the data collection rule. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The immutable ID of this data collection rule. This property is READ-ONLY. + */ + @JsonProperty(value = "immutableId", access = JsonProperty.Access.WRITE_ONLY) + private String immutableId; + + /* + * The resource ID of the data collection endpoint that this rule can be used with. + */ + @JsonProperty(value = "dataCollectionEndpointId") + private String dataCollectionEndpointId; + + /* + * Metadata about the resource + */ + @JsonProperty(value = "metadata", access = JsonProperty.Access.WRITE_ONLY) + private DataCollectionRuleMetadata metadata; + + /* + * Declaration of custom streams used in this rule. + */ + @JsonProperty(value = "streamDeclarations") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map streamDeclarations; + + /* + * The specification of data sources. + * This property is optional and can be omitted if the rule is meant to be used via direct calls to the provisioned + * endpoint. + */ + @JsonProperty(value = "dataSources") + private DataCollectionRuleDataSources dataSources; + + /* + * The specification of destinations. + */ + @JsonProperty(value = "destinations") + private DataCollectionRuleDestinations destinations; + + /* + * The specification of data flows. + */ + @JsonProperty(value = "dataFlows") + private List dataFlows; + + /* + * The resource provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private KnownDataCollectionRuleProvisioningState provisioningState; + + /** Creates an instance of DataCollectionRule class. */ + public DataCollectionRule() { + } + + /** + * Get the description property: Description of the data collection rule. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the data collection rule. + * + * @param description the description value to set. + * @return the DataCollectionRule object itself. + */ + public DataCollectionRule withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the immutableId property: The immutable ID of this data collection rule. This property is READ-ONLY. + * + * @return the immutableId value. + */ + public String immutableId() { + return this.immutableId; + } + + /** + * Get the dataCollectionEndpointId property: The resource ID of the data collection endpoint that this rule can be + * used with. + * + * @return the dataCollectionEndpointId value. + */ + public String dataCollectionEndpointId() { + return this.dataCollectionEndpointId; + } + + /** + * Set the dataCollectionEndpointId property: The resource ID of the data collection endpoint that this rule can be + * used with. + * + * @param dataCollectionEndpointId the dataCollectionEndpointId value to set. + * @return the DataCollectionRule object itself. + */ + public DataCollectionRule withDataCollectionEndpointId(String dataCollectionEndpointId) { + this.dataCollectionEndpointId = dataCollectionEndpointId; + return this; + } + + /** + * Get the metadata property: Metadata about the resource. + * + * @return the metadata value. + */ + public DataCollectionRuleMetadata metadata() { + return this.metadata; + } + + /** + * Get the streamDeclarations property: Declaration of custom streams used in this rule. + * + * @return the streamDeclarations value. + */ + public Map streamDeclarations() { + return this.streamDeclarations; + } + + /** + * Set the streamDeclarations property: Declaration of custom streams used in this rule. + * + * @param streamDeclarations the streamDeclarations value to set. + * @return the DataCollectionRule object itself. + */ + public DataCollectionRule withStreamDeclarations(Map streamDeclarations) { + this.streamDeclarations = streamDeclarations; + return this; + } + + /** + * Get the dataSources property: The specification of data sources. This property is optional and can be omitted if + * the rule is meant to be used via direct calls to the provisioned endpoint. + * + * @return the dataSources value. + */ + public DataCollectionRuleDataSources dataSources() { + return this.dataSources; + } + + /** + * Set the dataSources property: The specification of data sources. This property is optional and can be omitted if + * the rule is meant to be used via direct calls to the provisioned endpoint. + * + * @param dataSources the dataSources value to set. + * @return the DataCollectionRule object itself. + */ + public DataCollectionRule withDataSources(DataCollectionRuleDataSources dataSources) { + this.dataSources = dataSources; + return this; + } + + /** + * Get the destinations property: The specification of destinations. + * + * @return the destinations value. + */ + public DataCollectionRuleDestinations destinations() { + return this.destinations; + } + + /** + * Set the destinations property: The specification of destinations. + * + * @param destinations the destinations value to set. + * @return the DataCollectionRule object itself. + */ + public DataCollectionRule withDestinations(DataCollectionRuleDestinations destinations) { + this.destinations = destinations; + return this; + } + + /** + * Get the dataFlows property: The specification of data flows. + * + * @return the dataFlows value. + */ + public List dataFlows() { + return this.dataFlows; + } + + /** + * Set the dataFlows property: The specification of data flows. + * + * @param dataFlows the dataFlows value to set. + * @return the DataCollectionRule object itself. + */ + public DataCollectionRule withDataFlows(List dataFlows) { + this.dataFlows = dataFlows; + return this; + } + + /** + * Get the provisioningState property: The resource provisioning state. + * + * @return the provisioningState value. + */ + public KnownDataCollectionRuleProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metadata() != null) { + metadata().validate(); + } + if (streamDeclarations() != null) { + streamDeclarations() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + if (dataSources() != null) { + dataSources().validate(); + } + if (destinations() != null) { + destinations().validate(); + } + if (dataFlows() != null) { + dataFlows().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociation.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociation.java new file mode 100644 index 0000000000000..76e6a0fe3c5eb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociation.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Definition of association of a data collection rule with a monitored Azure resource. */ +@Fluent +public class DataCollectionRuleAssociation { + /* + * Description of the association. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The resource ID of the data collection rule that is to be associated. + */ + @JsonProperty(value = "dataCollectionRuleId") + private String dataCollectionRuleId; + + /* + * The resource ID of the data collection endpoint that is to be associated. + */ + @JsonProperty(value = "dataCollectionEndpointId") + private String dataCollectionEndpointId; + + /* + * The resource provisioning state. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private KnownDataCollectionRuleAssociationProvisioningState provisioningState; + + /* + * Metadata about the resource + */ + @JsonProperty(value = "metadata", access = JsonProperty.Access.WRITE_ONLY) + private DataCollectionRuleAssociationMetadata metadata; + + /** Creates an instance of DataCollectionRuleAssociation class. */ + public DataCollectionRuleAssociation() { + } + + /** + * Get the description property: Description of the association. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the association. + * + * @param description the description value to set. + * @return the DataCollectionRuleAssociation object itself. + */ + public DataCollectionRuleAssociation withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the dataCollectionRuleId property: The resource ID of the data collection rule that is to be associated. + * + * @return the dataCollectionRuleId value. + */ + public String dataCollectionRuleId() { + return this.dataCollectionRuleId; + } + + /** + * Set the dataCollectionRuleId property: The resource ID of the data collection rule that is to be associated. + * + * @param dataCollectionRuleId the dataCollectionRuleId value to set. + * @return the DataCollectionRuleAssociation object itself. + */ + public DataCollectionRuleAssociation withDataCollectionRuleId(String dataCollectionRuleId) { + this.dataCollectionRuleId = dataCollectionRuleId; + return this; + } + + /** + * Get the dataCollectionEndpointId property: The resource ID of the data collection endpoint that is to be + * associated. + * + * @return the dataCollectionEndpointId value. + */ + public String dataCollectionEndpointId() { + return this.dataCollectionEndpointId; + } + + /** + * Set the dataCollectionEndpointId property: The resource ID of the data collection endpoint that is to be + * associated. + * + * @param dataCollectionEndpointId the dataCollectionEndpointId value to set. + * @return the DataCollectionRuleAssociation object itself. + */ + public DataCollectionRuleAssociation withDataCollectionEndpointId(String dataCollectionEndpointId) { + this.dataCollectionEndpointId = dataCollectionEndpointId; + return this; + } + + /** + * Get the provisioningState property: The resource provisioning state. + * + * @return the provisioningState value. + */ + public KnownDataCollectionRuleAssociationProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the metadata property: Metadata about the resource. + * + * @return the metadata value. + */ + public DataCollectionRuleAssociationMetadata metadata() { + return this.metadata; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metadata() != null) { + metadata().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationMetadata.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationMetadata.java new file mode 100644 index 0000000000000..aa37619e93cdc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationMetadata.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; + +/** Metadata about the resource. */ +@Immutable +public final class DataCollectionRuleAssociationMetadata extends Metadata { + /** Creates an instance of DataCollectionRuleAssociationMetadata class. */ + public DataCollectionRuleAssociationMetadata() { + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationProxyOnlyResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationProxyOnlyResource.java new file mode 100644 index 0000000000000..8a5daf5034e23 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationProxyOnlyResource.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleAssociationProxyOnlyResourceInner; + +/** An immutable client-side representation of DataCollectionRuleAssociationProxyOnlyResource. */ +public interface DataCollectionRuleAssociationProxyOnlyResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Resource entity tag (ETag). + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the description property: Description of the association. + * + * @return the description value. + */ + String description(); + + /** + * Gets the dataCollectionRuleId property: The resource ID of the data collection rule that is to be associated. + * + * @return the dataCollectionRuleId value. + */ + String dataCollectionRuleId(); + + /** + * Gets the dataCollectionEndpointId property: The resource ID of the data collection endpoint that is to be + * associated. + * + * @return the dataCollectionEndpointId value. + */ + String dataCollectionEndpointId(); + + /** + * Gets the provisioningState property: The resource provisioning state. + * + * @return the provisioningState value. + */ + KnownDataCollectionRuleAssociationProvisioningState provisioningState(); + + /** + * Gets the metadata property: Metadata about the resource. + * + * @return the metadata value. + */ + DataCollectionRuleAssociationMetadata metadata(); + + /** + * Gets the inner + * com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleAssociationProxyOnlyResourceInner + * object. + * + * @return the inner object. + */ + DataCollectionRuleAssociationProxyOnlyResourceInner innerModel(); + + /** The entirety of the DataCollectionRuleAssociationProxyOnlyResource definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + /** The DataCollectionRuleAssociationProxyOnlyResource definition stages. */ + interface DefinitionStages { + /** The first stage of the DataCollectionRuleAssociationProxyOnlyResource definition. */ + interface Blank extends WithScope { + } + /** + * The stage of the DataCollectionRuleAssociationProxyOnlyResource definition allowing to specify parent + * resource. + */ + interface WithScope { + /** + * Specifies resourceUri. + * + * @param resourceUri The identifier of the resource. + * @return the next definition stage. + */ + WithCreate withExistingResourceUri(String resourceUri); + } + /** + * The stage of the DataCollectionRuleAssociationProxyOnlyResource definition which contains all the minimum + * required properties for the resource to be created, but also allows for any other optional properties to be + * specified. + */ + interface WithCreate + extends DefinitionStages.WithDescription, + DefinitionStages.WithDataCollectionRuleId, + DefinitionStages.WithDataCollectionEndpointId { + /** + * Executes the create request. + * + * @return the created resource. + */ + DataCollectionRuleAssociationProxyOnlyResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DataCollectionRuleAssociationProxyOnlyResource create(Context context); + } + /** + * The stage of the DataCollectionRuleAssociationProxyOnlyResource definition allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: Description of the association.. + * + * @param description Description of the association. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** + * The stage of the DataCollectionRuleAssociationProxyOnlyResource definition allowing to specify + * dataCollectionRuleId. + */ + interface WithDataCollectionRuleId { + /** + * Specifies the dataCollectionRuleId property: The resource ID of the data collection rule that is to be + * associated.. + * + * @param dataCollectionRuleId The resource ID of the data collection rule that is to be associated. + * @return the next definition stage. + */ + WithCreate withDataCollectionRuleId(String dataCollectionRuleId); + } + /** + * The stage of the DataCollectionRuleAssociationProxyOnlyResource definition allowing to specify + * dataCollectionEndpointId. + */ + interface WithDataCollectionEndpointId { + /** + * Specifies the dataCollectionEndpointId property: The resource ID of the data collection endpoint that is + * to be associated.. + * + * @param dataCollectionEndpointId The resource ID of the data collection endpoint that is to be associated. + * @return the next definition stage. + */ + WithCreate withDataCollectionEndpointId(String dataCollectionEndpointId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DataCollectionRuleAssociationProxyOnlyResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DataCollectionRuleAssociationProxyOnlyResource refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationProxyOnlyResourceListResult.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationProxyOnlyResourceListResult.java new file mode 100644 index 0000000000000..d6066fb567227 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationProxyOnlyResourceListResult.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleAssociationProxyOnlyResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A pageable list of resources. */ +@Fluent +public final class DataCollectionRuleAssociationProxyOnlyResourceListResult { + /* + * A list of resources. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of DataCollectionRuleAssociationProxyOnlyResourceListResult class. */ + public DataCollectionRuleAssociationProxyOnlyResourceListResult() { + } + + /** + * Get the value property: A list of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of resources. + * + * @param value the value value to set. + * @return the DataCollectionRuleAssociationProxyOnlyResourceListResult object itself. + */ + public DataCollectionRuleAssociationProxyOnlyResourceListResult withValue( + List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to use for getting the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the DataCollectionRuleAssociationProxyOnlyResourceListResult object itself. + */ + public DataCollectionRuleAssociationProxyOnlyResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model" + + " DataCollectionRuleAssociationProxyOnlyResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = + new ClientLogger(DataCollectionRuleAssociationProxyOnlyResourceListResult.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociations.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociations.java new file mode 100644 index 0000000000000..82e3b376f58ed --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociations.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DataCollectionRuleAssociations. */ +public interface DataCollectionRuleAssociations { + /** + * Lists associations for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResource(String resourceUri); + + /** + * Lists associations for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResource(String resourceUri, Context context); + + /** + * Lists associations for the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByRule( + String resourceGroupName, String dataCollectionRuleName); + + /** + * Lists associations for the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByRule( + String resourceGroupName, String dataCollectionRuleName, Context context); + + /** + * Lists associations for the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDataCollectionEndpoint( + String resourceGroupName, String dataCollectionEndpointName); + + /** + * Lists associations for the specified data collection endpoint. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionEndpointName The name of the data collection endpoint. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByDataCollectionEndpoint( + String resourceGroupName, String dataCollectionEndpointName, Context context); + + /** + * Returns the specified association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of generic ARM proxy resource along with {@link Response}. + */ + Response getWithResponse( + String resourceUri, String associationName, Context context); + + /** + * Returns the specified association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of generic ARM proxy resource. + */ + DataCollectionRuleAssociationProxyOnlyResource get(String resourceUri, String associationName); + + /** + * Deletes an association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceUri, String associationName, Context context); + + /** + * Deletes an association. + * + * @param resourceUri The identifier of the resource. + * @param associationName The name of the association. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceUri, String associationName); + + /** + * Returns the specified association. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of generic ARM proxy resource along with {@link Response}. + */ + DataCollectionRuleAssociationProxyOnlyResource getById(String id); + + /** + * Returns the specified association. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of generic ARM proxy resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes an association. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes an association. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DataCollectionRuleAssociationProxyOnlyResource resource. + * + * @param name resource name. + * @return the first stage of the new DataCollectionRuleAssociationProxyOnlyResource definition. + */ + DataCollectionRuleAssociationProxyOnlyResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleDataSources.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleDataSources.java new file mode 100644 index 0000000000000..e5716e608a4d5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleDataSources.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import java.util.List; + +/** + * The specification of data sources. This property is optional and can be omitted if the rule is meant to be used via + * direct calls to the provisioned endpoint. + */ +@Fluent +public final class DataCollectionRuleDataSources extends DataSourcesSpec { + /** Creates an instance of DataCollectionRuleDataSources class. */ + public DataCollectionRuleDataSources() { + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleDataSources withPerformanceCounters(List performanceCounters) { + super.withPerformanceCounters(performanceCounters); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleDataSources withWindowsEventLogs(List windowsEventLogs) { + super.withWindowsEventLogs(windowsEventLogs); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleDataSources withSyslog(List syslog) { + super.withSyslog(syslog); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleDataSources withExtensions(List extensions) { + super.withExtensions(extensions); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleDataSources withLogFiles(List logFiles) { + super.withLogFiles(logFiles); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleDataSources withIisLogs(List iisLogs) { + super.withIisLogs(iisLogs); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleDestinations.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleDestinations.java new file mode 100644 index 0000000000000..838211f361c66 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleDestinations.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import java.util.List; + +/** The specification of destinations. */ +@Fluent +public final class DataCollectionRuleDestinations extends DestinationsSpec { + /** Creates an instance of DataCollectionRuleDestinations class. */ + public DataCollectionRuleDestinations() { + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleDestinations withLogAnalytics(List logAnalytics) { + super.withLogAnalytics(logAnalytics); + return this; + } + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleDestinations withAzureMonitorMetrics( + DestinationsSpecAzureMonitorMetrics azureMonitorMetrics) { + super.withAzureMonitorMetrics(azureMonitorMetrics); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleMetadata.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleMetadata.java new file mode 100644 index 0000000000000..6f47e29bb0cf1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleMetadata.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; + +/** Metadata about the resource. */ +@Immutable +public final class DataCollectionRuleMetadata extends Metadata { + /** Creates an instance of DataCollectionRuleMetadata class. */ + public DataCollectionRuleMetadata() { + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleResource.java new file mode 100644 index 0000000000000..8e68bf622105a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleResource.java @@ -0,0 +1,369 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleResourceInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of DataCollectionRuleResource. */ +public interface DataCollectionRuleResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the kind property: The kind of the resource. + * + * @return the kind value. + */ + KnownDataCollectionRuleResourceKind kind(); + + /** + * Gets the etag property: Resource entity tag (ETag). + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the description property: Description of the data collection rule. + * + * @return the description value. + */ + String description(); + + /** + * Gets the immutableId property: The immutable ID of this data collection rule. This property is READ-ONLY. + * + * @return the immutableId value. + */ + String immutableId(); + + /** + * Gets the dataCollectionEndpointId property: The resource ID of the data collection endpoint that this rule can be + * used with. + * + * @return the dataCollectionEndpointId value. + */ + String dataCollectionEndpointId(); + + /** + * Gets the metadata property: Metadata about the resource. + * + * @return the metadata value. + */ + DataCollectionRuleMetadata metadata(); + + /** + * Gets the streamDeclarations property: Declaration of custom streams used in this rule. + * + * @return the streamDeclarations value. + */ + Map streamDeclarations(); + + /** + * Gets the dataSources property: The specification of data sources. This property is optional and can be omitted if + * the rule is meant to be used via direct calls to the provisioned endpoint. + * + * @return the dataSources value. + */ + DataCollectionRuleDataSources dataSources(); + + /** + * Gets the destinations property: The specification of destinations. + * + * @return the destinations value. + */ + DataCollectionRuleDestinations destinations(); + + /** + * Gets the dataFlows property: The specification of data flows. + * + * @return the dataFlows value. + */ + List dataFlows(); + + /** + * Gets the provisioningState property: The resource provisioning state. + * + * @return the provisioningState value. + */ + KnownDataCollectionRuleProvisioningState provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleResourceInner object. + * + * @return the inner object. + */ + DataCollectionRuleResourceInner innerModel(); + + /** The entirety of the DataCollectionRuleResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The DataCollectionRuleResource definition stages. */ + interface DefinitionStages { + /** The first stage of the DataCollectionRuleResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the DataCollectionRuleResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the DataCollectionRuleResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the DataCollectionRuleResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithKind, + DefinitionStages.WithDescription, + DefinitionStages.WithDataCollectionEndpointId, + DefinitionStages.WithStreamDeclarations, + DefinitionStages.WithDataSources, + DefinitionStages.WithDestinations, + DefinitionStages.WithDataFlows { + /** + * Executes the create request. + * + * @return the created resource. + */ + DataCollectionRuleResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DataCollectionRuleResource create(Context context); + } + /** The stage of the DataCollectionRuleResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the DataCollectionRuleResource definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: The kind of the resource.. + * + * @param kind The kind of the resource. + * @return the next definition stage. + */ + WithCreate withKind(KnownDataCollectionRuleResourceKind kind); + } + /** The stage of the DataCollectionRuleResource definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of the data collection rule.. + * + * @param description Description of the data collection rule. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the DataCollectionRuleResource definition allowing to specify dataCollectionEndpointId. */ + interface WithDataCollectionEndpointId { + /** + * Specifies the dataCollectionEndpointId property: The resource ID of the data collection endpoint that + * this rule can be used with.. + * + * @param dataCollectionEndpointId The resource ID of the data collection endpoint that this rule can be + * used with. + * @return the next definition stage. + */ + WithCreate withDataCollectionEndpointId(String dataCollectionEndpointId); + } + /** The stage of the DataCollectionRuleResource definition allowing to specify streamDeclarations. */ + interface WithStreamDeclarations { + /** + * Specifies the streamDeclarations property: Declaration of custom streams used in this rule.. + * + * @param streamDeclarations Declaration of custom streams used in this rule. + * @return the next definition stage. + */ + WithCreate withStreamDeclarations(Map streamDeclarations); + } + /** The stage of the DataCollectionRuleResource definition allowing to specify dataSources. */ + interface WithDataSources { + /** + * Specifies the dataSources property: The specification of data sources. This property is optional and can + * be omitted if the rule is meant to be used via direct calls to the provisioned endpoint.. + * + * @param dataSources The specification of data sources. This property is optional and can be omitted if the + * rule is meant to be used via direct calls to the provisioned endpoint. + * @return the next definition stage. + */ + WithCreate withDataSources(DataCollectionRuleDataSources dataSources); + } + /** The stage of the DataCollectionRuleResource definition allowing to specify destinations. */ + interface WithDestinations { + /** + * Specifies the destinations property: The specification of destinations.. + * + * @param destinations The specification of destinations. + * @return the next definition stage. + */ + WithCreate withDestinations(DataCollectionRuleDestinations destinations); + } + /** The stage of the DataCollectionRuleResource definition allowing to specify dataFlows. */ + interface WithDataFlows { + /** + * Specifies the dataFlows property: The specification of data flows.. + * + * @param dataFlows The specification of data flows. + * @return the next definition stage. + */ + WithCreate withDataFlows(List dataFlows); + } + } + /** + * Begins update for the DataCollectionRuleResource resource. + * + * @return the stage of resource update. + */ + DataCollectionRuleResource.Update update(); + + /** The template for DataCollectionRuleResource update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DataCollectionRuleResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DataCollectionRuleResource apply(Context context); + } + /** The DataCollectionRuleResource update stages. */ + interface UpdateStages { + /** The stage of the DataCollectionRuleResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DataCollectionRuleResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DataCollectionRuleResource refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleResourceListResult.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleResourceListResult.java new file mode 100644 index 0000000000000..29e2245ebcbf7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleResourceListResult.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A pageable list of resources. */ +@Fluent +public final class DataCollectionRuleResourceListResult { + /* + * A list of resources. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * The URL to use for getting the next set of results. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of DataCollectionRuleResourceListResult class. */ + public DataCollectionRuleResourceListResult() { + } + + /** + * Get the value property: A list of resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: A list of resources. + * + * @param value the value value to set. + * @return the DataCollectionRuleResourceListResult object itself. + */ + public DataCollectionRuleResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: The URL to use for getting the next set of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: The URL to use for getting the next set of results. + * + * @param nextLink the nextLink value to set. + * @return the DataCollectionRuleResourceListResult object itself. + */ + public DataCollectionRuleResourceListResult withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model DataCollectionRuleResourceListResult")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DataCollectionRuleResourceListResult.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRules.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRules.java new file mode 100644 index 0000000000000..93b6fc9930b71 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRules.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DataCollectionRules. */ +public interface DataCollectionRules { + /** + * Lists all data collection rules in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists all data collection rules in the specified resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Lists all data collection rules in the specified subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists all data collection rules in the specified subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a pageable list of resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Returns the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String dataCollectionRuleName, Context context); + + /** + * Returns the specified data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource. + */ + DataCollectionRuleResource getByResourceGroup(String resourceGroupName, String dataCollectionRuleName); + + /** + * Deletes a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse( + String resourceGroupName, String dataCollectionRuleName, Context context); + + /** + * Deletes a data collection rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param dataCollectionRuleName The name of the data collection rule. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String dataCollectionRuleName); + + /** + * Returns the specified data collection rule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response}. + */ + DataCollectionRuleResource getById(String id); + + /** + * Returns the specified data collection rule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return definition of ARM tracked top level resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a data collection rule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a data collection rule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DataCollectionRuleResource resource. + * + * @param name resource name. + * @return the first stage of the new DataCollectionRuleResource definition. + */ + DataCollectionRuleResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataContainer.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataContainer.java new file mode 100644 index 0000000000000..5f4ee229bf17a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataContainer.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about a container with data for a given resource. */ +@Fluent +public final class DataContainer { + /* + * Log Analytics workspace information. + */ + @JsonProperty(value = "workspace", required = true) + private WorkspaceInfo workspace; + + /** Creates an instance of DataContainer class. */ + public DataContainer() { + } + + /** + * Get the workspace property: Log Analytics workspace information. + * + * @return the workspace value. + */ + public WorkspaceInfo workspace() { + return this.workspace; + } + + /** + * Set the workspace property: Log Analytics workspace information. + * + * @param workspace the workspace value to set. + * @return the DataContainer object itself. + */ + public DataContainer withWorkspace(WorkspaceInfo workspace) { + this.workspace = workspace; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (workspace() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property workspace in model DataContainer")); + } else { + workspace().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DataContainer.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataFlow.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataFlow.java new file mode 100644 index 0000000000000..58950addc4012 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataFlow.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Definition of which streams are sent to which destinations. */ +@Fluent +public final class DataFlow { + /* + * List of streams for this data flow. + */ + @JsonProperty(value = "streams") + private List streams; + + /* + * List of destinations for this data flow. + */ + @JsonProperty(value = "destinations") + private List destinations; + + /* + * The KQL query to transform stream data. + */ + @JsonProperty(value = "transformKql") + private String transformKql; + + /* + * The output stream of the transform. Only required if the transform changes data to a different stream. + */ + @JsonProperty(value = "outputStream") + private String outputStream; + + /** Creates an instance of DataFlow class. */ + public DataFlow() { + } + + /** + * Get the streams property: List of streams for this data flow. + * + * @return the streams value. + */ + public List streams() { + return this.streams; + } + + /** + * Set the streams property: List of streams for this data flow. + * + * @param streams the streams value to set. + * @return the DataFlow object itself. + */ + public DataFlow withStreams(List streams) { + this.streams = streams; + return this; + } + + /** + * Get the destinations property: List of destinations for this data flow. + * + * @return the destinations value. + */ + public List destinations() { + return this.destinations; + } + + /** + * Set the destinations property: List of destinations for this data flow. + * + * @param destinations the destinations value to set. + * @return the DataFlow object itself. + */ + public DataFlow withDestinations(List destinations) { + this.destinations = destinations; + return this; + } + + /** + * Get the transformKql property: The KQL query to transform stream data. + * + * @return the transformKql value. + */ + public String transformKql() { + return this.transformKql; + } + + /** + * Set the transformKql property: The KQL query to transform stream data. + * + * @param transformKql the transformKql value to set. + * @return the DataFlow object itself. + */ + public DataFlow withTransformKql(String transformKql) { + this.transformKql = transformKql; + return this; + } + + /** + * Get the outputStream property: The output stream of the transform. Only required if the transform changes data to + * a different stream. + * + * @return the outputStream value. + */ + public String outputStream() { + return this.outputStream; + } + + /** + * Set the outputStream property: The output stream of the transform. Only required if the transform changes data to + * a different stream. + * + * @param outputStream the outputStream value to set. + * @return the DataFlow object itself. + */ + public DataFlow withOutputStream(String outputStream) { + this.outputStream = outputStream; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataSourcesSpec.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataSourcesSpec.java new file mode 100644 index 0000000000000..8da0b097bbdab --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataSourcesSpec.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specification of data sources that will be collected. */ +@Fluent +public class DataSourcesSpec { + /* + * The list of performance counter data source configurations. + */ + @JsonProperty(value = "performanceCounters") + private List performanceCounters; + + /* + * The list of Windows Event Log data source configurations. + */ + @JsonProperty(value = "windowsEventLogs") + private List windowsEventLogs; + + /* + * The list of Syslog data source configurations. + */ + @JsonProperty(value = "syslog") + private List syslog; + + /* + * The list of Azure VM extension data source configurations. + */ + @JsonProperty(value = "extensions") + private List extensions; + + /* + * The list of Log files source configurations. + */ + @JsonProperty(value = "logFiles") + private List logFiles; + + /* + * The list of IIS logs source configurations. + */ + @JsonProperty(value = "iisLogs") + private List iisLogs; + + /** Creates an instance of DataSourcesSpec class. */ + public DataSourcesSpec() { + } + + /** + * Get the performanceCounters property: The list of performance counter data source configurations. + * + * @return the performanceCounters value. + */ + public List performanceCounters() { + return this.performanceCounters; + } + + /** + * Set the performanceCounters property: The list of performance counter data source configurations. + * + * @param performanceCounters the performanceCounters value to set. + * @return the DataSourcesSpec object itself. + */ + public DataSourcesSpec withPerformanceCounters(List performanceCounters) { + this.performanceCounters = performanceCounters; + return this; + } + + /** + * Get the windowsEventLogs property: The list of Windows Event Log data source configurations. + * + * @return the windowsEventLogs value. + */ + public List windowsEventLogs() { + return this.windowsEventLogs; + } + + /** + * Set the windowsEventLogs property: The list of Windows Event Log data source configurations. + * + * @param windowsEventLogs the windowsEventLogs value to set. + * @return the DataSourcesSpec object itself. + */ + public DataSourcesSpec withWindowsEventLogs(List windowsEventLogs) { + this.windowsEventLogs = windowsEventLogs; + return this; + } + + /** + * Get the syslog property: The list of Syslog data source configurations. + * + * @return the syslog value. + */ + public List syslog() { + return this.syslog; + } + + /** + * Set the syslog property: The list of Syslog data source configurations. + * + * @param syslog the syslog value to set. + * @return the DataSourcesSpec object itself. + */ + public DataSourcesSpec withSyslog(List syslog) { + this.syslog = syslog; + return this; + } + + /** + * Get the extensions property: The list of Azure VM extension data source configurations. + * + * @return the extensions value. + */ + public List extensions() { + return this.extensions; + } + + /** + * Set the extensions property: The list of Azure VM extension data source configurations. + * + * @param extensions the extensions value to set. + * @return the DataSourcesSpec object itself. + */ + public DataSourcesSpec withExtensions(List extensions) { + this.extensions = extensions; + return this; + } + + /** + * Get the logFiles property: The list of Log files source configurations. + * + * @return the logFiles value. + */ + public List logFiles() { + return this.logFiles; + } + + /** + * Set the logFiles property: The list of Log files source configurations. + * + * @param logFiles the logFiles value to set. + * @return the DataSourcesSpec object itself. + */ + public DataSourcesSpec withLogFiles(List logFiles) { + this.logFiles = logFiles; + return this; + } + + /** + * Get the iisLogs property: The list of IIS logs source configurations. + * + * @return the iisLogs value. + */ + public List iisLogs() { + return this.iisLogs; + } + + /** + * Set the iisLogs property: The list of IIS logs source configurations. + * + * @param iisLogs the iisLogs value to set. + * @return the DataSourcesSpec object itself. + */ + public DataSourcesSpec withIisLogs(List iisLogs) { + this.iisLogs = iisLogs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (performanceCounters() != null) { + performanceCounters().forEach(e -> e.validate()); + } + if (windowsEventLogs() != null) { + windowsEventLogs().forEach(e -> e.validate()); + } + if (syslog() != null) { + syslog().forEach(e -> e.validate()); + } + if (extensions() != null) { + extensions().forEach(e -> e.validate()); + } + if (logFiles() != null) { + logFiles().forEach(e -> e.validate()); + } + if (iisLogs() != null) { + iisLogs().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataStatus.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataStatus.java new file mode 100644 index 0000000000000..0dae4ace800cb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataStatus.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * 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. + */ +public final class DataStatus extends ExpandableStringEnum { + /** Static value present for DataStatus. */ + public static final DataStatus PRESENT = fromString("present"); + + /** Static value notPresent for DataStatus. */ + public static final DataStatus NOT_PRESENT = fromString("notPresent"); + + /** + * Creates a new instance of DataStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DataStatus() { + } + + /** + * Creates or finds a DataStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding DataStatus. + */ + @JsonCreator + public static DataStatus fromString(String name) { + return fromString(name, DataStatus.class); + } + + /** + * Gets known DataStatus values. + * + * @return known DataStatus values. + */ + public static Collection values() { + return values(DataStatus.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DestinationsSpec.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DestinationsSpec.java new file mode 100644 index 0000000000000..4e2ed9cafc884 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DestinationsSpec.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specification of destinations that can be used in data flows. */ +@Fluent +public class DestinationsSpec { + /* + * List of Log Analytics destinations. + */ + @JsonProperty(value = "logAnalytics") + private List logAnalytics; + + /* + * Azure Monitor Metrics destination. + */ + @JsonProperty(value = "azureMonitorMetrics") + private DestinationsSpecAzureMonitorMetrics azureMonitorMetrics; + + /** Creates an instance of DestinationsSpec class. */ + public DestinationsSpec() { + } + + /** + * Get the logAnalytics property: List of Log Analytics destinations. + * + * @return the logAnalytics value. + */ + public List logAnalytics() { + return this.logAnalytics; + } + + /** + * Set the logAnalytics property: List of Log Analytics destinations. + * + * @param logAnalytics the logAnalytics value to set. + * @return the DestinationsSpec object itself. + */ + public DestinationsSpec withLogAnalytics(List logAnalytics) { + this.logAnalytics = logAnalytics; + return this; + } + + /** + * Get the azureMonitorMetrics property: Azure Monitor Metrics destination. + * + * @return the azureMonitorMetrics value. + */ + public DestinationsSpecAzureMonitorMetrics azureMonitorMetrics() { + return this.azureMonitorMetrics; + } + + /** + * Set the azureMonitorMetrics property: Azure Monitor Metrics destination. + * + * @param azureMonitorMetrics the azureMonitorMetrics value to set. + * @return the DestinationsSpec object itself. + */ + public DestinationsSpec withAzureMonitorMetrics(DestinationsSpecAzureMonitorMetrics azureMonitorMetrics) { + this.azureMonitorMetrics = azureMonitorMetrics; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (logAnalytics() != null) { + logAnalytics().forEach(e -> e.validate()); + } + if (azureMonitorMetrics() != null) { + azureMonitorMetrics().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DestinationsSpecAzureMonitorMetrics.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DestinationsSpecAzureMonitorMetrics.java new file mode 100644 index 0000000000000..31c7dcc876b93 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DestinationsSpecAzureMonitorMetrics.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; + +/** Azure Monitor Metrics destination. */ +@Fluent +public final class DestinationsSpecAzureMonitorMetrics extends AzureMonitorMetricsDestination { + /** Creates an instance of DestinationsSpecAzureMonitorMetrics class. */ + public DestinationsSpecAzureMonitorMetrics() { + } + + /** {@inheritDoc} */ + @Override + public DestinationsSpecAzureMonitorMetrics withName(String name) { + super.withName(name); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsCategories.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsCategories.java new file mode 100644 index 0000000000000..c671ac0ebfc4e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsCategories.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DiagnosticSettingsCategories. */ +public interface DiagnosticSettingsCategories { + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostic settings category for the specified resource along with {@link Response}. + */ + Response getWithResponse(String resourceUri, String name, Context context); + + /** + * Gets the diagnostic settings category for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the diagnostic settings category for the specified resource. + */ + DiagnosticSettingsCategoryResource get(String resourceUri, String name); + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of diagnostic setting category resources as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(String resourceUri); + + /** + * Lists the diagnostic settings categories for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of diagnostic setting category resources as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(String resourceUri, Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsCategoryResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsCategoryResource.java new file mode 100644 index 0000000000000..7a53651bf1e9a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsCategoryResource.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsCategoryResourceInner; +import java.util.List; + +/** An immutable client-side representation of DiagnosticSettingsCategoryResource. */ +public interface DiagnosticSettingsCategoryResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: The system metadata related to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the categoryType property: The type of the diagnostic settings category. + * + * @return the categoryType value. + */ + CategoryType categoryType(); + + /** + * Gets the categoryGroups property: the collection of what category groups are supported. + * + * @return the categoryGroups value. + */ + List categoryGroups(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsCategoryResourceInner + * object. + * + * @return the inner object. + */ + DiagnosticSettingsCategoryResourceInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsCategoryResourceCollection.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsCategoryResourceCollection.java new file mode 100644 index 0000000000000..ec5952ad5ba63 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsCategoryResourceCollection.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsCategoryResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of diagnostic setting category resources. */ +@Fluent +public final class DiagnosticSettingsCategoryResourceCollection { + /* + * The collection of diagnostic settings category resources. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of DiagnosticSettingsCategoryResourceCollection class. */ + public DiagnosticSettingsCategoryResourceCollection() { + } + + /** + * Get the value property: The collection of diagnostic settings category resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The collection of diagnostic settings category resources. + * + * @param value the value value to set. + * @return the DiagnosticSettingsCategoryResourceCollection object itself. + */ + public DiagnosticSettingsCategoryResourceCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsOperations.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsOperations.java new file mode 100644 index 0000000000000..3ae633899e073 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsOperations.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of DiagnosticSettingsOperations. */ +public interface DiagnosticSettingsOperations { + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings for the specified resource along with {@link Response}. + */ + Response getWithResponse(String resourceUri, String name, Context context); + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings for the specified resource. + */ + DiagnosticSettingsResource get(String resourceUri, String name); + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceUri, String name, Context context); + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param name The name of the diagnostic setting. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceUri, String name); + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings list for the specified resource as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(String resourceUri); + + /** + * Gets the active diagnostic settings list for the specified resource. + * + * @param resourceUri The identifier of the resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings list for the specified resource as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(String resourceUri, Context context); + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings for the specified resource along with {@link Response}. + */ + DiagnosticSettingsResource getById(String id); + + /** + * Gets the active diagnostic settings for the specified resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the active diagnostic settings for the specified resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes existing diagnostic settings for the specified resource. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new DiagnosticSettingsResource resource. + * + * @param name resource name. + * @return the first stage of the new DiagnosticSettingsResource definition. + */ + DiagnosticSettingsResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsResource.java new file mode 100644 index 0000000000000..17415efefad49 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsResource.java @@ -0,0 +1,437 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsResourceInner; +import java.util.List; + +/** An immutable client-side representation of DiagnosticSettingsResource. */ +public interface DiagnosticSettingsResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: The system metadata related to this resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the storageAccountId property: The resource ID of the storage account to which you would like to send + * Diagnostic Logs. + * + * @return the storageAccountId value. + */ + String storageAccountId(); + + /** + * Gets the serviceBusRuleId property: The service bus rule Id of the diagnostic setting. This is here to maintain + * backwards compatibility. + * + * @return the serviceBusRuleId value. + */ + String serviceBusRuleId(); + + /** + * Gets the eventHubAuthorizationRuleId property: The resource Id for the event hub authorization rule. + * + * @return the eventHubAuthorizationRuleId value. + */ + String eventHubAuthorizationRuleId(); + + /** + * Gets the eventHubName property: The name of the event hub. If none is specified, the default event hub will be + * selected. + * + * @return the eventHubName value. + */ + String eventHubName(); + + /** + * Gets the metrics property: The list of metric settings. + * + * @return the metrics value. + */ + List metrics(); + + /** + * Gets the logs property: The list of logs settings. + * + * @return the logs value. + */ + List logs(); + + /** + * Gets the workspaceId property: 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. + * + * @return the workspaceId value. + */ + String workspaceId(); + + /** + * Gets the marketplacePartnerId property: The full ARM resource ID of the Marketplace resource to which you would + * like to send Diagnostic Logs. + * + * @return the marketplacePartnerId value. + */ + String marketplacePartnerId(); + + /** + * Gets the logAnalyticsDestinationType property: 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: + * <normalized service identity>_<normalized category name>. Possible values are: Dedicated and null + * (null is default.). + * + * @return the logAnalyticsDestinationType value. + */ + String logAnalyticsDestinationType(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsResourceInner object. + * + * @return the inner object. + */ + DiagnosticSettingsResourceInner innerModel(); + + /** The entirety of the DiagnosticSettingsResource definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + /** The DiagnosticSettingsResource definition stages. */ + interface DefinitionStages { + /** The first stage of the DiagnosticSettingsResource definition. */ + interface Blank extends WithScope { + } + /** The stage of the DiagnosticSettingsResource definition allowing to specify parent resource. */ + interface WithScope { + /** + * Specifies resourceUri. + * + * @param resourceUri The identifier of the resource. + * @return the next definition stage. + */ + WithCreate withExistingResourceUri(String resourceUri); + } + /** + * The stage of the DiagnosticSettingsResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithStorageAccountId, + DefinitionStages.WithServiceBusRuleId, + DefinitionStages.WithEventHubAuthorizationRuleId, + DefinitionStages.WithEventHubName, + DefinitionStages.WithMetrics, + DefinitionStages.WithLogs, + DefinitionStages.WithWorkspaceId, + DefinitionStages.WithMarketplacePartnerId, + DefinitionStages.WithLogAnalyticsDestinationType { + /** + * Executes the create request. + * + * @return the created resource. + */ + DiagnosticSettingsResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DiagnosticSettingsResource create(Context context); + } + /** The stage of the DiagnosticSettingsResource definition allowing to specify storageAccountId. */ + interface WithStorageAccountId { + /** + * Specifies the storageAccountId property: The resource ID of the storage account to which you would like + * to send Diagnostic Logs.. + * + * @param storageAccountId The resource ID of the storage account to which you would like to send Diagnostic + * Logs. + * @return the next definition stage. + */ + WithCreate withStorageAccountId(String storageAccountId); + } + /** The stage of the DiagnosticSettingsResource definition allowing to specify serviceBusRuleId. */ + interface WithServiceBusRuleId { + /** + * Specifies the serviceBusRuleId property: The service bus rule Id of the diagnostic setting. This is here + * to maintain backwards compatibility.. + * + * @param serviceBusRuleId The service bus rule Id of the diagnostic setting. This is here to maintain + * backwards compatibility. + * @return the next definition stage. + */ + WithCreate withServiceBusRuleId(String serviceBusRuleId); + } + /** The stage of the DiagnosticSettingsResource definition allowing to specify eventHubAuthorizationRuleId. */ + interface WithEventHubAuthorizationRuleId { + /** + * Specifies the eventHubAuthorizationRuleId property: The resource Id for the event hub authorization + * rule.. + * + * @param eventHubAuthorizationRuleId The resource Id for the event hub authorization rule. + * @return the next definition stage. + */ + WithCreate withEventHubAuthorizationRuleId(String eventHubAuthorizationRuleId); + } + /** The stage of the DiagnosticSettingsResource definition allowing to specify eventHubName. */ + interface WithEventHubName { + /** + * Specifies the eventHubName property: The name of the event hub. If none is specified, the default event + * hub will be selected.. + * + * @param eventHubName The name of the event hub. If none is specified, the default event hub will be + * selected. + * @return the next definition stage. + */ + WithCreate withEventHubName(String eventHubName); + } + /** The stage of the DiagnosticSettingsResource definition allowing to specify metrics. */ + interface WithMetrics { + /** + * Specifies the metrics property: The list of metric settings.. + * + * @param metrics The list of metric settings. + * @return the next definition stage. + */ + WithCreate withMetrics(List metrics); + } + /** The stage of the DiagnosticSettingsResource definition allowing to specify logs. */ + interface WithLogs { + /** + * Specifies the logs property: The list of logs settings.. + * + * @param logs The list of logs settings. + * @return the next definition stage. + */ + WithCreate withLogs(List logs); + } + /** The stage of the DiagnosticSettingsResource definition allowing to specify workspaceId. */ + interface WithWorkspaceId { + /** + * Specifies the workspaceId property: 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. + * + * @param workspaceId 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. + * @return the next definition stage. + */ + WithCreate withWorkspaceId(String workspaceId); + } + /** The stage of the DiagnosticSettingsResource definition allowing to specify marketplacePartnerId. */ + interface WithMarketplacePartnerId { + /** + * Specifies the marketplacePartnerId property: The full ARM resource ID of the Marketplace resource to + * which you would like to send Diagnostic Logs.. + * + * @param marketplacePartnerId The full ARM resource ID of the Marketplace resource to which you would like + * to send Diagnostic Logs. + * @return the next definition stage. + */ + WithCreate withMarketplacePartnerId(String marketplacePartnerId); + } + /** The stage of the DiagnosticSettingsResource definition allowing to specify logAnalyticsDestinationType. */ + interface WithLogAnalyticsDestinationType { + /** + * Specifies the logAnalyticsDestinationType property: 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: <normalized service identity>_<normalized category name>. Possible + * values are: Dedicated and null (null is default.). + * + * @param logAnalyticsDestinationType 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: + * <normalized service identity>_<normalized category name>. Possible values are: Dedicated + * and null (null is default.). + * @return the next definition stage. + */ + WithCreate withLogAnalyticsDestinationType(String logAnalyticsDestinationType); + } + } + /** + * Begins update for the DiagnosticSettingsResource resource. + * + * @return the stage of resource update. + */ + DiagnosticSettingsResource.Update update(); + + /** The template for DiagnosticSettingsResource update. */ + interface Update + extends UpdateStages.WithStorageAccountId, + UpdateStages.WithServiceBusRuleId, + UpdateStages.WithEventHubAuthorizationRuleId, + UpdateStages.WithEventHubName, + UpdateStages.WithMetrics, + UpdateStages.WithLogs, + UpdateStages.WithWorkspaceId, + UpdateStages.WithMarketplacePartnerId, + UpdateStages.WithLogAnalyticsDestinationType { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DiagnosticSettingsResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DiagnosticSettingsResource apply(Context context); + } + /** The DiagnosticSettingsResource update stages. */ + interface UpdateStages { + /** The stage of the DiagnosticSettingsResource update allowing to specify storageAccountId. */ + interface WithStorageAccountId { + /** + * Specifies the storageAccountId property: The resource ID of the storage account to which you would like + * to send Diagnostic Logs.. + * + * @param storageAccountId The resource ID of the storage account to which you would like to send Diagnostic + * Logs. + * @return the next definition stage. + */ + Update withStorageAccountId(String storageAccountId); + } + /** The stage of the DiagnosticSettingsResource update allowing to specify serviceBusRuleId. */ + interface WithServiceBusRuleId { + /** + * Specifies the serviceBusRuleId property: The service bus rule Id of the diagnostic setting. This is here + * to maintain backwards compatibility.. + * + * @param serviceBusRuleId The service bus rule Id of the diagnostic setting. This is here to maintain + * backwards compatibility. + * @return the next definition stage. + */ + Update withServiceBusRuleId(String serviceBusRuleId); + } + /** The stage of the DiagnosticSettingsResource update allowing to specify eventHubAuthorizationRuleId. */ + interface WithEventHubAuthorizationRuleId { + /** + * Specifies the eventHubAuthorizationRuleId property: The resource Id for the event hub authorization + * rule.. + * + * @param eventHubAuthorizationRuleId The resource Id for the event hub authorization rule. + * @return the next definition stage. + */ + Update withEventHubAuthorizationRuleId(String eventHubAuthorizationRuleId); + } + /** The stage of the DiagnosticSettingsResource update allowing to specify eventHubName. */ + interface WithEventHubName { + /** + * Specifies the eventHubName property: The name of the event hub. If none is specified, the default event + * hub will be selected.. + * + * @param eventHubName The name of the event hub. If none is specified, the default event hub will be + * selected. + * @return the next definition stage. + */ + Update withEventHubName(String eventHubName); + } + /** The stage of the DiagnosticSettingsResource update allowing to specify metrics. */ + interface WithMetrics { + /** + * Specifies the metrics property: The list of metric settings.. + * + * @param metrics The list of metric settings. + * @return the next definition stage. + */ + Update withMetrics(List metrics); + } + /** The stage of the DiagnosticSettingsResource update allowing to specify logs. */ + interface WithLogs { + /** + * Specifies the logs property: The list of logs settings.. + * + * @param logs The list of logs settings. + * @return the next definition stage. + */ + Update withLogs(List logs); + } + /** The stage of the DiagnosticSettingsResource update allowing to specify workspaceId. */ + interface WithWorkspaceId { + /** + * Specifies the workspaceId property: 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. + * + * @param workspaceId 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. + * @return the next definition stage. + */ + Update withWorkspaceId(String workspaceId); + } + /** The stage of the DiagnosticSettingsResource update allowing to specify marketplacePartnerId. */ + interface WithMarketplacePartnerId { + /** + * Specifies the marketplacePartnerId property: The full ARM resource ID of the Marketplace resource to + * which you would like to send Diagnostic Logs.. + * + * @param marketplacePartnerId The full ARM resource ID of the Marketplace resource to which you would like + * to send Diagnostic Logs. + * @return the next definition stage. + */ + Update withMarketplacePartnerId(String marketplacePartnerId); + } + /** The stage of the DiagnosticSettingsResource update allowing to specify logAnalyticsDestinationType. */ + interface WithLogAnalyticsDestinationType { + /** + * Specifies the logAnalyticsDestinationType property: 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: <normalized service identity>_<normalized category name>. Possible + * values are: Dedicated and null (null is default.). + * + * @param logAnalyticsDestinationType 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: + * <normalized service identity>_<normalized category name>. Possible values are: Dedicated + * and null (null is default.). + * @return the next definition stage. + */ + Update withLogAnalyticsDestinationType(String logAnalyticsDestinationType); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DiagnosticSettingsResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DiagnosticSettingsResource refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsResourceCollection.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsResourceCollection.java new file mode 100644 index 0000000000000..2cc14607cb245 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsResourceCollection.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of alert rule resources. */ +@Fluent +public final class DiagnosticSettingsResourceCollection { + /* + * The collection of diagnostic settings resources;. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of DiagnosticSettingsResourceCollection class. */ + public DiagnosticSettingsResourceCollection() { + } + + /** + * Get the value property: The collection of diagnostic settings resources;. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The collection of diagnostic settings resources;. + * + * @param value the value value to set. + * @return the DiagnosticSettingsResourceCollection object itself. + */ + public DiagnosticSettingsResourceCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Dimension.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Dimension.java new file mode 100644 index 0000000000000..4129b7d693a76 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Dimension.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Dimension splitting and filtering definition. */ +@Fluent +public final class Dimension { + /* + * Name of the dimension + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Operator for dimension values + */ + @JsonProperty(value = "operator", required = true) + private DimensionOperator operator; + + /* + * List of dimension values + */ + @JsonProperty(value = "values", required = true) + private List values; + + /** Creates an instance of Dimension class. */ + public Dimension() { + } + + /** + * Get the name property: Name of the dimension. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the dimension. + * + * @param name the name value to set. + * @return the Dimension object itself. + */ + public Dimension withName(String name) { + this.name = name; + return this; + } + + /** + * Get the operator property: Operator for dimension values. + * + * @return the operator value. + */ + public DimensionOperator operator() { + return this.operator; + } + + /** + * Set the operator property: Operator for dimension values. + * + * @param operator the operator value to set. + * @return the Dimension object itself. + */ + public Dimension withOperator(DimensionOperator operator) { + this.operator = operator; + return this; + } + + /** + * Get the values property: List of dimension values. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: List of dimension values. + * + * @param values the values value to set. + * @return the Dimension object itself. + */ + public Dimension withValues(List values) { + this.values = values; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Dimension")); + } + if (operator() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property operator in model Dimension")); + } + if (values() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property values in model Dimension")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Dimension.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DimensionOperator.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DimensionOperator.java new file mode 100644 index 0000000000000..cfe7e95056dfb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DimensionOperator.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Operator for dimension values. */ +public final class DimensionOperator extends ExpandableStringEnum { + /** Static value Include for DimensionOperator. */ + public static final DimensionOperator INCLUDE = fromString("Include"); + + /** Static value Exclude for DimensionOperator. */ + public static final DimensionOperator EXCLUDE = fromString("Exclude"); + + /** + * Creates a new instance of DimensionOperator value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DimensionOperator() { + } + + /** + * Creates or finds a DimensionOperator from its string representation. + * + * @param name a name to look for. + * @return the corresponding DimensionOperator. + */ + @JsonCreator + public static DimensionOperator fromString(String name) { + return fromString(name, DimensionOperator.class); + } + + /** + * Gets known DimensionOperator values. + * + * @return known DimensionOperator values. + */ + public static Collection values() { + return values(DimensionOperator.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicMetricCriteria.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicMetricCriteria.java new file mode 100644 index 0000000000000..8cd0923181061 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicMetricCriteria.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.OffsetDateTime; +import java.util.List; + +/** Criterion for dynamic threshold. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "criterionType") +@JsonTypeName("DynamicThresholdCriterion") +@Fluent +public final class DynamicMetricCriteria extends MultiMetricCriteria { + /* + * The operator used to compare the metric value against the threshold. + */ + @JsonProperty(value = "operator", required = true) + private DynamicThresholdOperator operator; + + /* + * The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric + * series pattern. + */ + @JsonProperty(value = "alertSensitivity", required = true) + private DynamicThresholdSensitivity alertSensitivity; + + /* + * The minimum number of violations required within the selected lookback time window required to raise an alert. + */ + @JsonProperty(value = "failingPeriods", required = true) + private DynamicThresholdFailingPeriods failingPeriods; + + /* + * Use this option to set the date from which to start learning the metric historical data and calculate the + * dynamic thresholds (in ISO8601 format) + */ + @JsonProperty(value = "ignoreDataBefore") + private OffsetDateTime ignoreDataBefore; + + /** Creates an instance of DynamicMetricCriteria class. */ + public DynamicMetricCriteria() { + } + + /** + * Get the operator property: The operator used to compare the metric value against the threshold. + * + * @return the operator value. + */ + public DynamicThresholdOperator operator() { + return this.operator; + } + + /** + * Set the operator property: The operator used to compare the metric value against the threshold. + * + * @param operator the operator value to set. + * @return the DynamicMetricCriteria object itself. + */ + public DynamicMetricCriteria withOperator(DynamicThresholdOperator operator) { + this.operator = operator; + return this; + } + + /** + * Get the alertSensitivity property: The extent of deviation required to trigger an alert. This will affect how + * tight the threshold is to the metric series pattern. + * + * @return the alertSensitivity value. + */ + public DynamicThresholdSensitivity alertSensitivity() { + return this.alertSensitivity; + } + + /** + * Set the alertSensitivity property: The extent of deviation required to trigger an alert. This will affect how + * tight the threshold is to the metric series pattern. + * + * @param alertSensitivity the alertSensitivity value to set. + * @return the DynamicMetricCriteria object itself. + */ + public DynamicMetricCriteria withAlertSensitivity(DynamicThresholdSensitivity alertSensitivity) { + this.alertSensitivity = alertSensitivity; + return this; + } + + /** + * Get the failingPeriods property: The minimum number of violations required within the selected lookback time + * window required to raise an alert. + * + * @return the failingPeriods value. + */ + public DynamicThresholdFailingPeriods failingPeriods() { + return this.failingPeriods; + } + + /** + * Set the failingPeriods property: The minimum number of violations required within the selected lookback time + * window required to raise an alert. + * + * @param failingPeriods the failingPeriods value to set. + * @return the DynamicMetricCriteria object itself. + */ + public DynamicMetricCriteria withFailingPeriods(DynamicThresholdFailingPeriods failingPeriods) { + this.failingPeriods = failingPeriods; + return this; + } + + /** + * Get the ignoreDataBefore property: Use this option to set the date from which to start learning the metric + * historical data and calculate the dynamic thresholds (in ISO8601 format). + * + * @return the ignoreDataBefore value. + */ + public OffsetDateTime ignoreDataBefore() { + return this.ignoreDataBefore; + } + + /** + * Set the ignoreDataBefore property: Use this option to set the date from which to start learning the metric + * historical data and calculate the dynamic thresholds (in ISO8601 format). + * + * @param ignoreDataBefore the ignoreDataBefore value to set. + * @return the DynamicMetricCriteria object itself. + */ + public DynamicMetricCriteria withIgnoreDataBefore(OffsetDateTime ignoreDataBefore) { + this.ignoreDataBefore = ignoreDataBefore; + return this; + } + + /** {@inheritDoc} */ + @Override + public DynamicMetricCriteria withName(String name) { + super.withName(name); + return this; + } + + /** {@inheritDoc} */ + @Override + public DynamicMetricCriteria withMetricName(String metricName) { + super.withMetricName(metricName); + return this; + } + + /** {@inheritDoc} */ + @Override + public DynamicMetricCriteria withMetricNamespace(String metricNamespace) { + super.withMetricNamespace(metricNamespace); + return this; + } + + /** {@inheritDoc} */ + @Override + public DynamicMetricCriteria withTimeAggregation(AggregationTypeEnum timeAggregation) { + super.withTimeAggregation(timeAggregation); + return this; + } + + /** {@inheritDoc} */ + @Override + public DynamicMetricCriteria withDimensions(List dimensions) { + super.withDimensions(dimensions); + return this; + } + + /** {@inheritDoc} */ + @Override + public DynamicMetricCriteria withSkipMetricValidation(Boolean skipMetricValidation) { + super.withSkipMetricValidation(skipMetricValidation); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (operator() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property operator in model DynamicMetricCriteria")); + } + if (alertSensitivity() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property alertSensitivity in model DynamicMetricCriteria")); + } + if (failingPeriods() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property failingPeriods in model DynamicMetricCriteria")); + } else { + failingPeriods().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(DynamicMetricCriteria.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicThresholdFailingPeriods.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicThresholdFailingPeriods.java new file mode 100644 index 0000000000000..f39d47fc23708 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicThresholdFailingPeriods.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The minimum number of violations required within the selected lookback time window required to raise an alert. */ +@Fluent +public final class DynamicThresholdFailingPeriods { + /* + * 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. + */ + @JsonProperty(value = "numberOfEvaluationPeriods", required = true) + private float numberOfEvaluationPeriods; + + /* + * The number of violations to trigger an alert. Should be smaller or equal to numberOfEvaluationPeriods. + */ + @JsonProperty(value = "minFailingPeriodsToAlert", required = true) + private float minFailingPeriodsToAlert; + + /** Creates an instance of DynamicThresholdFailingPeriods class. */ + public DynamicThresholdFailingPeriods() { + } + + /** + * Get the numberOfEvaluationPeriods property: 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. + * + * @return the numberOfEvaluationPeriods value. + */ + public float numberOfEvaluationPeriods() { + return this.numberOfEvaluationPeriods; + } + + /** + * Set the numberOfEvaluationPeriods property: 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. + * + * @param numberOfEvaluationPeriods the numberOfEvaluationPeriods value to set. + * @return the DynamicThresholdFailingPeriods object itself. + */ + public DynamicThresholdFailingPeriods withNumberOfEvaluationPeriods(float numberOfEvaluationPeriods) { + this.numberOfEvaluationPeriods = numberOfEvaluationPeriods; + return this; + } + + /** + * Get the minFailingPeriodsToAlert property: The number of violations to trigger an alert. Should be smaller or + * equal to numberOfEvaluationPeriods. + * + * @return the minFailingPeriodsToAlert value. + */ + public float minFailingPeriodsToAlert() { + return this.minFailingPeriodsToAlert; + } + + /** + * Set the minFailingPeriodsToAlert property: The number of violations to trigger an alert. Should be smaller or + * equal to numberOfEvaluationPeriods. + * + * @param minFailingPeriodsToAlert the minFailingPeriodsToAlert value to set. + * @return the DynamicThresholdFailingPeriods object itself. + */ + public DynamicThresholdFailingPeriods withMinFailingPeriodsToAlert(float minFailingPeriodsToAlert) { + this.minFailingPeriodsToAlert = minFailingPeriodsToAlert; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicThresholdOperator.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicThresholdOperator.java new file mode 100644 index 0000000000000..fe50216143af9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicThresholdOperator.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The operator used to compare the metric value against the threshold. */ +public final class DynamicThresholdOperator extends ExpandableStringEnum { + /** Static value GreaterThan for DynamicThresholdOperator. */ + public static final DynamicThresholdOperator GREATER_THAN = fromString("GreaterThan"); + + /** Static value LessThan for DynamicThresholdOperator. */ + public static final DynamicThresholdOperator LESS_THAN = fromString("LessThan"); + + /** Static value GreaterOrLessThan for DynamicThresholdOperator. */ + public static final DynamicThresholdOperator GREATER_OR_LESS_THAN = fromString("GreaterOrLessThan"); + + /** + * Creates a new instance of DynamicThresholdOperator value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DynamicThresholdOperator() { + } + + /** + * Creates or finds a DynamicThresholdOperator from its string representation. + * + * @param name a name to look for. + * @return the corresponding DynamicThresholdOperator. + */ + @JsonCreator + public static DynamicThresholdOperator fromString(String name) { + return fromString(name, DynamicThresholdOperator.class); + } + + /** + * Gets known DynamicThresholdOperator values. + * + * @return known DynamicThresholdOperator values. + */ + public static Collection values() { + return values(DynamicThresholdOperator.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicThresholdSensitivity.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicThresholdSensitivity.java new file mode 100644 index 0000000000000..f49b0161ceceb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicThresholdSensitivity.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The extent of deviation required to trigger an alert. This will affect how tight the threshold is to the metric + * series pattern. + */ +public final class DynamicThresholdSensitivity extends ExpandableStringEnum { + /** Static value Low for DynamicThresholdSensitivity. */ + public static final DynamicThresholdSensitivity LOW = fromString("Low"); + + /** Static value Medium for DynamicThresholdSensitivity. */ + public static final DynamicThresholdSensitivity MEDIUM = fromString("Medium"); + + /** Static value High for DynamicThresholdSensitivity. */ + public static final DynamicThresholdSensitivity HIGH = fromString("High"); + + /** + * Creates a new instance of DynamicThresholdSensitivity value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public DynamicThresholdSensitivity() { + } + + /** + * Creates or finds a DynamicThresholdSensitivity from its string representation. + * + * @param name a name to look for. + * @return the corresponding DynamicThresholdSensitivity. + */ + @JsonCreator + public static DynamicThresholdSensitivity fromString(String name) { + return fromString(name, DynamicThresholdSensitivity.class); + } + + /** + * Gets known DynamicThresholdSensitivity values. + * + * @return known DynamicThresholdSensitivity values. + */ + public static Collection values() { + return values(DynamicThresholdSensitivity.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EmailNotification.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EmailNotification.java new file mode 100644 index 0000000000000..ce84bbd7ac923 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EmailNotification.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Email notification of an autoscale event. */ +@Fluent +public final class EmailNotification { + /* + * a value indicating whether to send email to subscription administrator. + */ + @JsonProperty(value = "sendToSubscriptionAdministrator") + private Boolean sendToSubscriptionAdministrator; + + /* + * a value indicating whether to send email to subscription co-administrators. + */ + @JsonProperty(value = "sendToSubscriptionCoAdministrators") + private Boolean sendToSubscriptionCoAdministrators; + + /* + * the custom e-mails list. This value can be null or empty, in which case this attribute will be ignored. + */ + @JsonProperty(value = "customEmails") + private List customEmails; + + /** Creates an instance of EmailNotification class. */ + public EmailNotification() { + } + + /** + * Get the sendToSubscriptionAdministrator property: a value indicating whether to send email to subscription + * administrator. + * + * @return the sendToSubscriptionAdministrator value. + */ + public Boolean sendToSubscriptionAdministrator() { + return this.sendToSubscriptionAdministrator; + } + + /** + * Set the sendToSubscriptionAdministrator property: a value indicating whether to send email to subscription + * administrator. + * + * @param sendToSubscriptionAdministrator the sendToSubscriptionAdministrator value to set. + * @return the EmailNotification object itself. + */ + public EmailNotification withSendToSubscriptionAdministrator(Boolean sendToSubscriptionAdministrator) { + this.sendToSubscriptionAdministrator = sendToSubscriptionAdministrator; + return this; + } + + /** + * Get the sendToSubscriptionCoAdministrators property: a value indicating whether to send email to subscription + * co-administrators. + * + * @return the sendToSubscriptionCoAdministrators value. + */ + public Boolean sendToSubscriptionCoAdministrators() { + return this.sendToSubscriptionCoAdministrators; + } + + /** + * Set the sendToSubscriptionCoAdministrators property: a value indicating whether to send email to subscription + * co-administrators. + * + * @param sendToSubscriptionCoAdministrators the sendToSubscriptionCoAdministrators value to set. + * @return the EmailNotification object itself. + */ + public EmailNotification withSendToSubscriptionCoAdministrators(Boolean sendToSubscriptionCoAdministrators) { + this.sendToSubscriptionCoAdministrators = sendToSubscriptionCoAdministrators; + return this; + } + + /** + * Get the customEmails property: the custom e-mails list. This value can be null or empty, in which case this + * attribute will be ignored. + * + * @return the customEmails value. + */ + public List customEmails() { + return this.customEmails; + } + + /** + * Set the customEmails property: the custom e-mails list. This value can be null or empty, in which case this + * attribute will be ignored. + * + * @param customEmails the customEmails value to set. + * @return the EmailNotification object itself. + */ + public EmailNotification withCustomEmails(List customEmails) { + this.customEmails = customEmails; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EmailReceiver.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EmailReceiver.java new file mode 100644 index 0000000000000..1fe241654082c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EmailReceiver.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An email receiver. */ +@Fluent +public final class EmailReceiver { + /* + * The name of the email receiver. Names must be unique across all receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The email address of this receiver. + */ + @JsonProperty(value = "emailAddress", required = true) + private String emailAddress; + + /* + * Indicates whether to use common alert schema. + */ + @JsonProperty(value = "useCommonAlertSchema") + private Boolean useCommonAlertSchema; + + /* + * The receiver status of the e-mail. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ReceiverStatus status; + + /** Creates an instance of EmailReceiver class. */ + public EmailReceiver() { + } + + /** + * Get the name property: The name of the email receiver. Names must be unique across all receivers within an action + * group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the email receiver. Names must be unique across all receivers within an action + * group. + * + * @param name the name value to set. + * @return the EmailReceiver object itself. + */ + public EmailReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the emailAddress property: The email address of this receiver. + * + * @return the emailAddress value. + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the emailAddress property: The email address of this receiver. + * + * @param emailAddress the emailAddress value to set. + * @return the EmailReceiver object itself. + */ + public EmailReceiver withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Get the useCommonAlertSchema property: Indicates whether to use common alert schema. + * + * @return the useCommonAlertSchema value. + */ + public Boolean useCommonAlertSchema() { + return this.useCommonAlertSchema; + } + + /** + * Set the useCommonAlertSchema property: Indicates whether to use common alert schema. + * + * @param useCommonAlertSchema the useCommonAlertSchema value to set. + * @return the EmailReceiver object itself. + */ + public EmailReceiver withUseCommonAlertSchema(Boolean useCommonAlertSchema) { + this.useCommonAlertSchema = useCommonAlertSchema; + return this; + } + + /** + * Get the status property: The receiver status of the e-mail. + * + * @return the status value. + */ + public ReceiverStatus status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model EmailReceiver")); + } + if (emailAddress() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property emailAddress in model EmailReceiver")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EmailReceiver.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EnableRequest.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EnableRequest.java new file mode 100644 index 0000000000000..8c30490d21260 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EnableRequest.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a receiver that should be resubscribed. */ +@Fluent +public final class EnableRequest { + /* + * The name of the receiver to resubscribe. + */ + @JsonProperty(value = "receiverName", required = true) + private String receiverName; + + /** Creates an instance of EnableRequest class. */ + public EnableRequest() { + } + + /** + * Get the receiverName property: The name of the receiver to resubscribe. + * + * @return the receiverName value. + */ + public String receiverName() { + return this.receiverName; + } + + /** + * Set the receiverName property: The name of the receiver to resubscribe. + * + * @param receiverName the receiverName value to set. + * @return the EnableRequest object itself. + */ + public EnableRequest withReceiverName(String receiverName) { + this.receiverName = receiverName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (receiverName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property receiverName in model EnableRequest")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EnableRequest.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventCategories.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventCategories.java new file mode 100644 index 0000000000000..66423ef8880d6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventCategories.java @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of EventCategories. */ +public interface EventCategories { + /** + * Get the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy as paginated + * response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Get the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the list of available event categories supported in the Activity Logs Service.<br>The current list + * includes the following: Administrative, Security, ServiceHealth, Alert, Recommendation, Policy as paginated + * response with {@link PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventCategoryCollection.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventCategoryCollection.java new file mode 100644 index 0000000000000..cdc4ece4d621b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventCategoryCollection.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.LocalizableStringInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A collection of event categories. Currently possible values are: Administrative, Security, ServiceHealth, Alert, + * Recommendation, Policy. + */ +@Fluent +public final class EventCategoryCollection { + /* + * the list that includes the Azure event categories. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** Creates an instance of EventCategoryCollection class. */ + public EventCategoryCollection() { + } + + /** + * Get the value property: the list that includes the Azure event categories. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: the list that includes the Azure event categories. + * + * @param value the value value to set. + * @return the EventCategoryCollection object itself. + */ + public EventCategoryCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model EventCategoryCollection")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EventCategoryCollection.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventData.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventData.java new file mode 100644 index 0000000000000..5306ced8f4431 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventData.java @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.EventDataInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of EventData. */ +public interface EventData { + /** + * Gets the authorization property: The sender authorization information. + * + * @return the authorization value. + */ + SenderAuthorization authorization(); + + /** + * Gets the claims property: key value pairs to identify ARM permissions. + * + * @return the claims value. + */ + Map claims(); + + /** + * Gets the caller property: the email address of the user who has performed the operation, the UPN claim or SPN + * claim based on availability. + * + * @return the caller value. + */ + String caller(); + + /** + * Gets the description property: the description of the event. + * + * @return the description value. + */ + String description(); + + /** + * Gets the id property: the Id of this event as required by ARM for RBAC. It contains the EventDataID and a + * timestamp information. + * + * @return the id value. + */ + String id(); + + /** + * Gets the eventDataId property: the event data Id. This is a unique identifier for an event. + * + * @return the eventDataId value. + */ + String eventDataId(); + + /** + * Gets the correlationId property: 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. + * + * @return the correlationId value. + */ + String correlationId(); + + /** + * Gets the eventName property: the event name. This value should not be confused with OperationName. For practical + * purposes, OperationName might be more appealing to end users. + * + * @return the eventName value. + */ + LocalizableString eventName(); + + /** + * Gets the category property: the event category. + * + * @return the category value. + */ + LocalizableString category(); + + /** + * Gets the httpRequest property: 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). + * + * @return the httpRequest value. + */ + HttpRequestInfo httpRequest(); + + /** + * Gets the level property: the event level. + * + * @return the level value. + */ + EventLevel level(); + + /** + * Gets the resourceGroupName property: the resource group name of the impacted resource. + * + * @return the resourceGroupName value. + */ + String resourceGroupName(); + + /** + * Gets the resourceProviderName property: the resource provider name of the impacted resource. + * + * @return the resourceProviderName value. + */ + LocalizableString resourceProviderName(); + + /** + * Gets the resourceId property: the resource uri that uniquely identifies the resource that caused this event. + * + * @return the resourceId value. + */ + String resourceId(); + + /** + * Gets the resourceType property: the resource type. + * + * @return the resourceType value. + */ + LocalizableString resourceType(); + + /** + * Gets the operationId property: It is usually a GUID shared among the events corresponding to single operation. + * This value should not be confused with EventName. + * + * @return the operationId value. + */ + String operationId(); + + /** + * Gets the operationName property: the operation name. + * + * @return the operationName value. + */ + LocalizableString operationName(); + + /** + * Gets the properties property: the set of <Key, Value> pairs (usually a Dictionary<String, String>) + * that includes details about the event. + * + * @return the properties value. + */ + Map properties(); + + /** + * Gets the status property: a string describing the status of the operation. Some typical values are: Started, In + * progress, Succeeded, Failed, Resolved. + * + * @return the status value. + */ + LocalizableString status(); + + /** + * Gets the subStatus property: 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). + * + * @return the subStatus value. + */ + LocalizableString subStatus(); + + /** + * Gets the eventTimestamp property: the timestamp of when the event was generated by the Azure service processing + * the request corresponding the event. It in ISO 8601 format. + * + * @return the eventTimestamp value. + */ + OffsetDateTime eventTimestamp(); + + /** + * Gets the submissionTimestamp property: 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. + * + * @return the submissionTimestamp value. + */ + OffsetDateTime submissionTimestamp(); + + /** + * Gets the subscriptionId property: the Azure subscription Id usually a GUID. + * + * @return the subscriptionId value. + */ + String subscriptionId(); + + /** + * Gets the tenantId property: the Azure tenant Id. + * + * @return the tenantId value. + */ + String tenantId(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.EventDataInner object. + * + * @return the inner object. + */ + EventDataInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventDataCollection.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventDataCollection.java new file mode 100644 index 0000000000000..d35f424dd306e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventDataCollection.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.EventDataInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents collection of events. */ +@Fluent +public final class EventDataCollection { + /* + * this list that includes the Azure audit logs. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /* + * Provides the link to retrieve the next set of events. + */ + @JsonProperty(value = "nextLink") + private String nextLink; + + /** Creates an instance of EventDataCollection class. */ + public EventDataCollection() { + } + + /** + * Get the value property: this list that includes the Azure audit logs. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: this list that includes the Azure audit logs. + * + * @param value the value value to set. + * @return the EventDataCollection object itself. + */ + public EventDataCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Provides the link to retrieve the next set of events. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Set the nextLink property: Provides the link to retrieve the next set of events. + * + * @param nextLink the nextLink value to set. + * @return the EventDataCollection object itself. + */ + public EventDataCollection withNextLink(String nextLink) { + this.nextLink = nextLink; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model EventDataCollection")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EventDataCollection.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventHubReceiver.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventHubReceiver.java new file mode 100644 index 0000000000000..23d27325253aa --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventHubReceiver.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Event hub receiver. */ +@Fluent +public final class EventHubReceiver { + /* + * The name of the Event hub receiver. Names must be unique across all receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The Event Hub namespace + */ + @JsonProperty(value = "eventHubNameSpace", required = true) + private String eventHubNameSpace; + + /* + * The name of the specific Event Hub queue + */ + @JsonProperty(value = "eventHubName", required = true) + private String eventHubName; + + /* + * Indicates whether to use common alert schema. + */ + @JsonProperty(value = "useCommonAlertSchema") + private Boolean useCommonAlertSchema; + + /* + * The tenant Id for the subscription containing this event hub + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /* + * The Id for the subscription containing this event hub + */ + @JsonProperty(value = "subscriptionId", required = true) + private String subscriptionId; + + /** Creates an instance of EventHubReceiver class. */ + public EventHubReceiver() { + } + + /** + * Get the name property: The name of the Event hub receiver. Names must be unique across all receivers within an + * action group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the Event hub receiver. Names must be unique across all receivers within an + * action group. + * + * @param name the name value to set. + * @return the EventHubReceiver object itself. + */ + public EventHubReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the eventHubNameSpace property: The Event Hub namespace. + * + * @return the eventHubNameSpace value. + */ + public String eventHubNameSpace() { + return this.eventHubNameSpace; + } + + /** + * Set the eventHubNameSpace property: The Event Hub namespace. + * + * @param eventHubNameSpace the eventHubNameSpace value to set. + * @return the EventHubReceiver object itself. + */ + public EventHubReceiver withEventHubNameSpace(String eventHubNameSpace) { + this.eventHubNameSpace = eventHubNameSpace; + return this; + } + + /** + * Get the eventHubName property: The name of the specific Event Hub queue. + * + * @return the eventHubName value. + */ + public String eventHubName() { + return this.eventHubName; + } + + /** + * Set the eventHubName property: The name of the specific Event Hub queue. + * + * @param eventHubName the eventHubName value to set. + * @return the EventHubReceiver object itself. + */ + public EventHubReceiver withEventHubName(String eventHubName) { + this.eventHubName = eventHubName; + return this; + } + + /** + * Get the useCommonAlertSchema property: Indicates whether to use common alert schema. + * + * @return the useCommonAlertSchema value. + */ + public Boolean useCommonAlertSchema() { + return this.useCommonAlertSchema; + } + + /** + * Set the useCommonAlertSchema property: Indicates whether to use common alert schema. + * + * @param useCommonAlertSchema the useCommonAlertSchema value to set. + * @return the EventHubReceiver object itself. + */ + public EventHubReceiver withUseCommonAlertSchema(Boolean useCommonAlertSchema) { + this.useCommonAlertSchema = useCommonAlertSchema; + return this; + } + + /** + * Get the tenantId property: The tenant Id for the subscription containing this event hub. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The tenant Id for the subscription containing this event hub. + * + * @param tenantId the tenantId value to set. + * @return the EventHubReceiver object itself. + */ + public EventHubReceiver withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Get the subscriptionId property: The Id for the subscription containing this event hub. + * + * @return the subscriptionId value. + */ + public String subscriptionId() { + return this.subscriptionId; + } + + /** + * Set the subscriptionId property: The Id for the subscription containing this event hub. + * + * @param subscriptionId the subscriptionId value to set. + * @return the EventHubReceiver object itself. + */ + public EventHubReceiver withSubscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model EventHubReceiver")); + } + if (eventHubNameSpace() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property eventHubNameSpace in model EventHubReceiver")); + } + if (eventHubName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property eventHubName in model EventHubReceiver")); + } + if (subscriptionId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property subscriptionId in model EventHubReceiver")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(EventHubReceiver.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventLevel.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventLevel.java new file mode 100644 index 0000000000000..3ebbb40ae10ca --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventLevel.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** the event level. */ +public enum EventLevel { + /** Enum value Critical. */ + CRITICAL("Critical"), + + /** Enum value Error. */ + ERROR("Error"), + + /** Enum value Warning. */ + WARNING("Warning"), + + /** Enum value Informational. */ + INFORMATIONAL("Informational"), + + /** Enum value Verbose. */ + VERBOSE("Verbose"); + + /** The actual serialized value for a EventLevel instance. */ + private final String value; + + EventLevel(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a EventLevel instance. + * + * @param value the serialized value to parse. + * @return the parsed EventLevel object, or null if unable to parse. + */ + @JsonCreator + public static EventLevel fromString(String value) { + if (value == null) { + return null; + } + EventLevel[] items = EventLevel.values(); + for (EventLevel item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ExtensionDataSource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ExtensionDataSource.java new file mode 100644 index 0000000000000..9ce6b9b0323a8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ExtensionDataSource.java @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Definition of which data will be collected from a separate VM extension that integrates with the Azure Monitor Agent. + * Collected from either Windows and Linux machines, depending on which extension is defined. + */ +@Fluent +public final class ExtensionDataSource { + /* + * List of streams that this data source will be sent to. + * A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will + * be sent to. + */ + @JsonProperty(value = "streams") + private List streams; + + /* + * The name of the VM extension. + */ + @JsonProperty(value = "extensionName", required = true) + private String extensionName; + + /* + * The extension settings. The format is specific for particular extension. + */ + @JsonProperty(value = "extensionSettings") + private Object extensionSettings; + + /* + * The list of data sources this extension needs data from. + */ + @JsonProperty(value = "inputDataSources") + private List inputDataSources; + + /* + * A friendly name for the data source. + * This name should be unique across all data sources (regardless of type) within the data collection rule. + */ + @JsonProperty(value = "name") + private String name; + + /** Creates an instance of ExtensionDataSource class. */ + public ExtensionDataSource() { + } + + /** + * Get the streams property: List of streams that this data source will be sent to. A stream indicates what schema + * will be used for this data and usually what table in Log Analytics the data will be sent to. + * + * @return the streams value. + */ + public List streams() { + return this.streams; + } + + /** + * Set the streams property: List of streams that this data source will be sent to. A stream indicates what schema + * will be used for this data and usually what table in Log Analytics the data will be sent to. + * + * @param streams the streams value to set. + * @return the ExtensionDataSource object itself. + */ + public ExtensionDataSource withStreams(List streams) { + this.streams = streams; + return this; + } + + /** + * Get the extensionName property: The name of the VM extension. + * + * @return the extensionName value. + */ + public String extensionName() { + return this.extensionName; + } + + /** + * Set the extensionName property: The name of the VM extension. + * + * @param extensionName the extensionName value to set. + * @return the ExtensionDataSource object itself. + */ + public ExtensionDataSource withExtensionName(String extensionName) { + this.extensionName = extensionName; + return this; + } + + /** + * Get the extensionSettings property: The extension settings. The format is specific for particular extension. + * + * @return the extensionSettings value. + */ + public Object extensionSettings() { + return this.extensionSettings; + } + + /** + * Set the extensionSettings property: The extension settings. The format is specific for particular extension. + * + * @param extensionSettings the extensionSettings value to set. + * @return the ExtensionDataSource object itself. + */ + public ExtensionDataSource withExtensionSettings(Object extensionSettings) { + this.extensionSettings = extensionSettings; + return this; + } + + /** + * Get the inputDataSources property: The list of data sources this extension needs data from. + * + * @return the inputDataSources value. + */ + public List inputDataSources() { + return this.inputDataSources; + } + + /** + * Set the inputDataSources property: The list of data sources this extension needs data from. + * + * @param inputDataSources the inputDataSources value to set. + * @return the ExtensionDataSource object itself. + */ + public ExtensionDataSource withInputDataSources(List inputDataSources) { + this.inputDataSources = inputDataSources; + return this; + } + + /** + * Get the name property: A friendly name for the data source. This name should be unique across all data sources + * (regardless of type) within the data collection rule. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: A friendly name for the data source. This name should be unique across all data sources + * (regardless of type) within the data collection rule. + * + * @param name the name value to set. + * @return the ExtensionDataSource object itself. + */ + public ExtensionDataSource withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (extensionName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property extensionName in model ExtensionDataSource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ExtensionDataSource.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/HttpRequestInfo.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/HttpRequestInfo.java new file mode 100644 index 0000000000000..4e913da25110b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/HttpRequestInfo.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Http request info. */ +@Fluent +public final class HttpRequestInfo { + /* + * the client request id. + */ + @JsonProperty(value = "clientRequestId") + private String clientRequestId; + + /* + * the client Ip Address + */ + @JsonProperty(value = "clientIpAddress") + private String clientIpAddress; + + /* + * the Http request method. + */ + @JsonProperty(value = "method") + private String method; + + /* + * the Uri. + */ + @JsonProperty(value = "uri") + private String uri; + + /** Creates an instance of HttpRequestInfo class. */ + public HttpRequestInfo() { + } + + /** + * Get the clientRequestId property: the client request id. + * + * @return the clientRequestId value. + */ + public String clientRequestId() { + return this.clientRequestId; + } + + /** + * Set the clientRequestId property: the client request id. + * + * @param clientRequestId the clientRequestId value to set. + * @return the HttpRequestInfo object itself. + */ + public HttpRequestInfo withClientRequestId(String clientRequestId) { + this.clientRequestId = clientRequestId; + return this; + } + + /** + * Get the clientIpAddress property: the client Ip Address. + * + * @return the clientIpAddress value. + */ + public String clientIpAddress() { + return this.clientIpAddress; + } + + /** + * Set the clientIpAddress property: the client Ip Address. + * + * @param clientIpAddress the clientIpAddress value to set. + * @return the HttpRequestInfo object itself. + */ + public HttpRequestInfo withClientIpAddress(String clientIpAddress) { + this.clientIpAddress = clientIpAddress; + return this; + } + + /** + * Get the method property: the Http request method. + * + * @return the method value. + */ + public String method() { + return this.method; + } + + /** + * Set the method property: the Http request method. + * + * @param method the method value to set. + * @return the HttpRequestInfo object itself. + */ + public HttpRequestInfo withMethod(String method) { + this.method = method; + return this; + } + + /** + * Get the uri property: the Uri. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: the Uri. + * + * @param uri the uri value to set. + * @return the HttpRequestInfo object itself. + */ + public HttpRequestInfo withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Identity.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Identity.java new file mode 100644 index 0000000000000..5bde2d88e147f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Identity.java @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Identity for the resource. */ +@Fluent +public class Identity { + /* + * The principal ID of resource identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The tenant ID of resource. + */ + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private String tenantId; + + /* + * Type of managed service identity. + */ + @JsonProperty(value = "type", required = true) + private IdentityType type; + + /* + * The list of user identities associated with the resource. The user identity dictionary key references will be + * ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + */ + @JsonProperty(value = "userAssignedIdentities") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map userAssignedIdentities; + + /** Creates an instance of Identity class. */ + public Identity() { + } + + /** + * Get the principalId property: The principal ID of resource identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the tenantId property: The tenant ID of resource. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Get the type property: Type of managed service identity. + * + * @return the type value. + */ + public IdentityType type() { + return this.type; + } + + /** + * Set the type property: Type of managed service identity. + * + * @param type the type value to set. + * @return the Identity object itself. + */ + public Identity withType(IdentityType type) { + this.type = type; + return this; + } + + /** + * Get the userAssignedIdentities property: The list of user identities associated with the resource. The user + * identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @return the userAssignedIdentities value. + */ + public Map userAssignedIdentities() { + return this.userAssignedIdentities; + } + + /** + * Set the userAssignedIdentities property: The list of user identities associated with the resource. The user + * identity dictionary key references will be ARM resource ids in the form: + * '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + * + * @param userAssignedIdentities the userAssignedIdentities value to set. + * @return the Identity object itself. + */ + public Identity withUserAssignedIdentities(Map userAssignedIdentities) { + this.userAssignedIdentities = userAssignedIdentities; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (type() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property type in model Identity")); + } + if (userAssignedIdentities() != null) { + userAssignedIdentities() + .values() + .forEach( + e -> { + if (e != null) { + e.validate(); + } + }); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Identity.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IdentityType.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IdentityType.java new file mode 100644 index 0000000000000..258c15d70eee2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IdentityType.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Type of managed service identity. */ +public enum IdentityType { + /** Enum value SystemAssigned. */ + SYSTEM_ASSIGNED("SystemAssigned"), + + /** Enum value UserAssigned. */ + USER_ASSIGNED("UserAssigned"), + + /** Enum value None. */ + NONE("None"); + + /** The actual serialized value for a IdentityType instance. */ + private final String value; + + IdentityType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a IdentityType instance. + * + * @param value the serialized value to parse. + * @return the parsed IdentityType object, or null if unable to parse. + */ + @JsonCreator + public static IdentityType fromString(String value) { + if (value == null) { + return null; + } + IdentityType[] items = IdentityType.values(); + for (IdentityType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IisLogsDataSource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IisLogsDataSource.java new file mode 100644 index 0000000000000..ae207700cfc3d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IisLogsDataSource.java @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Enables IIS logs to be collected by this data collection rule. */ +@Fluent +public final class IisLogsDataSource { + /* + * IIS streams + */ + @JsonProperty(value = "streams", required = true) + private List streams; + + /* + * Absolute paths file location + */ + @JsonProperty(value = "logDirectories") + private List logDirectories; + + /* + * A friendly name for the data source. + * This name should be unique across all data sources (regardless of type) within the data collection rule. + */ + @JsonProperty(value = "name") + private String name; + + /** Creates an instance of IisLogsDataSource class. */ + public IisLogsDataSource() { + } + + /** + * Get the streams property: IIS streams. + * + * @return the streams value. + */ + public List streams() { + return this.streams; + } + + /** + * Set the streams property: IIS streams. + * + * @param streams the streams value to set. + * @return the IisLogsDataSource object itself. + */ + public IisLogsDataSource withStreams(List streams) { + this.streams = streams; + return this; + } + + /** + * Get the logDirectories property: Absolute paths file location. + * + * @return the logDirectories value. + */ + public List logDirectories() { + return this.logDirectories; + } + + /** + * Set the logDirectories property: Absolute paths file location. + * + * @param logDirectories the logDirectories value to set. + * @return the IisLogsDataSource object itself. + */ + public IisLogsDataSource withLogDirectories(List logDirectories) { + this.logDirectories = logDirectories; + return this; + } + + /** + * Get the name property: A friendly name for the data source. This name should be unique across all data sources + * (regardless of type) within the data collection rule. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: A friendly name for the data source. This name should be unique across all data sources + * (regardless of type) within the data collection rule. + * + * @param name the name value to set. + * @return the IisLogsDataSource object itself. + */ + public IisLogsDataSource withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (streams() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property streams in model IisLogsDataSource")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(IisLogsDataSource.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Incident.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Incident.java new file mode 100644 index 0000000000000..7cc813adb146a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Incident.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.IncidentInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of Incident. */ +public interface Incident { + /** + * Gets the name property: Incident name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the ruleName property: Rule name that is associated with the incident. + * + * @return the ruleName value. + */ + String ruleName(); + + /** + * Gets the isActive property: A boolean to indicate whether the incident is active or resolved. + * + * @return the isActive value. + */ + Boolean isActive(); + + /** + * Gets the activatedTime property: The time at which the incident was activated in ISO8601 format. + * + * @return the activatedTime value. + */ + OffsetDateTime activatedTime(); + + /** + * Gets the resolvedTime property: The time at which the incident was resolved in ISO8601 format. If null, it means + * the incident is still active. + * + * @return the resolvedTime value. + */ + OffsetDateTime resolvedTime(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.IncidentInner object. + * + * @return the inner object. + */ + IncidentInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IncidentListResult.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IncidentListResult.java new file mode 100644 index 0000000000000..0cd0316a81a82 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IncidentListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.IncidentInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List incidents operation response. */ +@Fluent +public final class IncidentListResult { + /* + * the incident collection. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of IncidentListResult class. */ + public IncidentListResult() { + } + + /** + * Get the value property: the incident collection. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: the incident collection. + * + * @param value the value value to set. + * @return the IncidentListResult object itself. + */ + public IncidentListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IngestionSettings.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IngestionSettings.java new file mode 100644 index 0000000000000..39edf98321c3c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IngestionSettings.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Settings for data ingestion. */ +@Immutable +public class IngestionSettings { + /* + * The Azure resource Id of the default data collection rule for this workspace. + */ + @JsonProperty(value = "dataCollectionRuleResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String dataCollectionRuleResourceId; + + /* + * The Azure resource Id of the default data collection endpoint for this workspace. + */ + @JsonProperty(value = "dataCollectionEndpointResourceId", access = JsonProperty.Access.WRITE_ONLY) + private String dataCollectionEndpointResourceId; + + /** Creates an instance of IngestionSettings class. */ + public IngestionSettings() { + } + + /** + * Get the dataCollectionRuleResourceId property: The Azure resource Id of the default data collection rule for this + * workspace. + * + * @return the dataCollectionRuleResourceId value. + */ + public String dataCollectionRuleResourceId() { + return this.dataCollectionRuleResourceId; + } + + /** + * Get the dataCollectionEndpointResourceId property: The Azure resource Id of the default data collection endpoint + * for this workspace. + * + * @return the dataCollectionEndpointResourceId value. + */ + public String dataCollectionEndpointResourceId() { + return this.dataCollectionEndpointResourceId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ItsmReceiver.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ItsmReceiver.java new file mode 100644 index 0000000000000..c988c19ab6af2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ItsmReceiver.java @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Itsm receiver. */ +@Fluent +public final class ItsmReceiver { + /* + * The name of the Itsm receiver. Names must be unique across all receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * OMS LA instance identifier. + */ + @JsonProperty(value = "workspaceId", required = true) + private String workspaceId; + + /* + * Unique identification of ITSM connection among multiple defined in above workspace. + */ + @JsonProperty(value = "connectionId", required = true) + private String connectionId; + + /* + * JSON blob for the configurations of the ITSM action. CreateMultipleWorkItems option will be part of this blob as + * well. + */ + @JsonProperty(value = "ticketConfiguration", required = true) + private String ticketConfiguration; + + /* + * Region in which workspace resides. Supported + * values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope' + */ + @JsonProperty(value = "region", required = true) + private String region; + + /** Creates an instance of ItsmReceiver class. */ + public ItsmReceiver() { + } + + /** + * Get the name property: The name of the Itsm receiver. Names must be unique across all receivers within an action + * group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the Itsm receiver. Names must be unique across all receivers within an action + * group. + * + * @param name the name value to set. + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the workspaceId property: OMS LA instance identifier. + * + * @return the workspaceId value. + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Set the workspaceId property: OMS LA instance identifier. + * + * @param workspaceId the workspaceId value to set. + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withWorkspaceId(String workspaceId) { + this.workspaceId = workspaceId; + return this; + } + + /** + * Get the connectionId property: Unique identification of ITSM connection among multiple defined in above + * workspace. + * + * @return the connectionId value. + */ + public String connectionId() { + return this.connectionId; + } + + /** + * Set the connectionId property: Unique identification of ITSM connection among multiple defined in above + * workspace. + * + * @param connectionId the connectionId value to set. + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withConnectionId(String connectionId) { + this.connectionId = connectionId; + return this; + } + + /** + * Get the ticketConfiguration property: JSON blob for the configurations of the ITSM action. + * CreateMultipleWorkItems option will be part of this blob as well. + * + * @return the ticketConfiguration value. + */ + public String ticketConfiguration() { + return this.ticketConfiguration; + } + + /** + * Set the ticketConfiguration property: JSON blob for the configurations of the ITSM action. + * CreateMultipleWorkItems option will be part of this blob as well. + * + * @param ticketConfiguration the ticketConfiguration value to set. + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withTicketConfiguration(String ticketConfiguration) { + this.ticketConfiguration = ticketConfiguration; + return this; + } + + /** + * Get the region property: Region in which workspace resides. Supported + * values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'. + * + * @return the region value. + */ + public String region() { + return this.region; + } + + /** + * Set the region property: Region in which workspace resides. Supported + * values:'centralindia','japaneast','southeastasia','australiasoutheast','uksouth','westcentralus','canadacentral','eastus','westeurope'. + * + * @param region the region value to set. + * @return the ItsmReceiver object itself. + */ + public ItsmReceiver withRegion(String region) { + this.region = region; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model ItsmReceiver")); + } + if (workspaceId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property workspaceId in model ItsmReceiver")); + } + if (connectionId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property connectionId in model ItsmReceiver")); + } + if (ticketConfiguration() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property ticketConfiguration in model ItsmReceiver")); + } + if (region() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property region in model ItsmReceiver")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ItsmReceiver.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Kind.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Kind.java new file mode 100644 index 0000000000000..2597e8f7f0709 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Kind.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Indicates the type of scheduled query rule. The default is LogAlert. */ +public final class Kind extends ExpandableStringEnum { + /** Static value LogAlert for Kind. */ + public static final Kind LOG_ALERT = fromString("LogAlert"); + + /** Static value LogToMetric for Kind. */ + public static final Kind LOG_TO_METRIC = fromString("LogToMetric"); + + /** + * Creates a new instance of Kind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Kind() { + } + + /** + * Creates or finds a Kind from its string representation. + * + * @param name a name to look for. + * @return the corresponding Kind. + */ + @JsonCreator + public static Kind fromString(String name) { + return fromString(name, Kind.class); + } + + /** + * Gets known Kind values. + * + * @return known Kind values. + */ + public static Collection values() { + return values(Kind.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownColumnDefinitionType.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownColumnDefinitionType.java new file mode 100644 index 0000000000000..b7fa848a141bb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownColumnDefinitionType.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The type of the column data. */ +public final class KnownColumnDefinitionType extends ExpandableStringEnum { + /** Static value string for KnownColumnDefinitionType. */ + public static final KnownColumnDefinitionType STRING = fromString("string"); + + /** Static value int for KnownColumnDefinitionType. */ + public static final KnownColumnDefinitionType INT = fromString("int"); + + /** Static value long for KnownColumnDefinitionType. */ + public static final KnownColumnDefinitionType LONG = fromString("long"); + + /** Static value real for KnownColumnDefinitionType. */ + public static final KnownColumnDefinitionType REAL = fromString("real"); + + /** Static value boolean for KnownColumnDefinitionType. */ + public static final KnownColumnDefinitionType BOOLEAN = fromString("boolean"); + + /** Static value datetime for KnownColumnDefinitionType. */ + public static final KnownColumnDefinitionType DATETIME = fromString("datetime"); + + /** Static value dynamic for KnownColumnDefinitionType. */ + public static final KnownColumnDefinitionType DYNAMIC = fromString("dynamic"); + + /** + * Creates a new instance of KnownColumnDefinitionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KnownColumnDefinitionType() { + } + + /** + * Creates or finds a KnownColumnDefinitionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnownColumnDefinitionType. + */ + @JsonCreator + public static KnownColumnDefinitionType fromString(String name) { + return fromString(name, KnownColumnDefinitionType.class); + } + + /** + * Gets known KnownColumnDefinitionType values. + * + * @return known KnownColumnDefinitionType values. + */ + public static Collection values() { + return values(KnownColumnDefinitionType.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionEndpointProvisioningState.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionEndpointProvisioningState.java new file mode 100644 index 0000000000000..e587746d348f6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionEndpointProvisioningState.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The resource provisioning state. This property is READ-ONLY. */ +public final class KnownDataCollectionEndpointProvisioningState + extends ExpandableStringEnum { + /** Static value Creating for KnownDataCollectionEndpointProvisioningState. */ + public static final KnownDataCollectionEndpointProvisioningState CREATING = fromString("Creating"); + + /** Static value Updating for KnownDataCollectionEndpointProvisioningState. */ + public static final KnownDataCollectionEndpointProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for KnownDataCollectionEndpointProvisioningState. */ + public static final KnownDataCollectionEndpointProvisioningState DELETING = fromString("Deleting"); + + /** Static value Succeeded for KnownDataCollectionEndpointProvisioningState. */ + public static final KnownDataCollectionEndpointProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for KnownDataCollectionEndpointProvisioningState. */ + public static final KnownDataCollectionEndpointProvisioningState FAILED = fromString("Failed"); + + /** + * Creates a new instance of KnownDataCollectionEndpointProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KnownDataCollectionEndpointProvisioningState() { + } + + /** + * Creates or finds a KnownDataCollectionEndpointProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnownDataCollectionEndpointProvisioningState. + */ + @JsonCreator + public static KnownDataCollectionEndpointProvisioningState fromString(String name) { + return fromString(name, KnownDataCollectionEndpointProvisioningState.class); + } + + /** + * Gets known KnownDataCollectionEndpointProvisioningState values. + * + * @return known KnownDataCollectionEndpointProvisioningState values. + */ + public static Collection values() { + return values(KnownDataCollectionEndpointProvisioningState.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionEndpointResourceKind.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionEndpointResourceKind.java new file mode 100644 index 0000000000000..71f918ff217f4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionEndpointResourceKind.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The kind of the resource. */ +public final class KnownDataCollectionEndpointResourceKind + extends ExpandableStringEnum { + /** Static value Linux for KnownDataCollectionEndpointResourceKind. */ + public static final KnownDataCollectionEndpointResourceKind LINUX = fromString("Linux"); + + /** Static value Windows for KnownDataCollectionEndpointResourceKind. */ + public static final KnownDataCollectionEndpointResourceKind WINDOWS = fromString("Windows"); + + /** + * Creates a new instance of KnownDataCollectionEndpointResourceKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KnownDataCollectionEndpointResourceKind() { + } + + /** + * Creates or finds a KnownDataCollectionEndpointResourceKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnownDataCollectionEndpointResourceKind. + */ + @JsonCreator + public static KnownDataCollectionEndpointResourceKind fromString(String name) { + return fromString(name, KnownDataCollectionEndpointResourceKind.class); + } + + /** + * Gets known KnownDataCollectionEndpointResourceKind values. + * + * @return known KnownDataCollectionEndpointResourceKind values. + */ + public static Collection values() { + return values(KnownDataCollectionEndpointResourceKind.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionRuleAssociationProvisioningState.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionRuleAssociationProvisioningState.java new file mode 100644 index 0000000000000..ff3a8d5bb8461 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionRuleAssociationProvisioningState.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The resource provisioning state. */ +public final class KnownDataCollectionRuleAssociationProvisioningState + extends ExpandableStringEnum { + /** Static value Creating for KnownDataCollectionRuleAssociationProvisioningState. */ + public static final KnownDataCollectionRuleAssociationProvisioningState CREATING = fromString("Creating"); + + /** Static value Updating for KnownDataCollectionRuleAssociationProvisioningState. */ + public static final KnownDataCollectionRuleAssociationProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for KnownDataCollectionRuleAssociationProvisioningState. */ + public static final KnownDataCollectionRuleAssociationProvisioningState DELETING = fromString("Deleting"); + + /** Static value Succeeded for KnownDataCollectionRuleAssociationProvisioningState. */ + public static final KnownDataCollectionRuleAssociationProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for KnownDataCollectionRuleAssociationProvisioningState. */ + public static final KnownDataCollectionRuleAssociationProvisioningState FAILED = fromString("Failed"); + + /** + * Creates a new instance of KnownDataCollectionRuleAssociationProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KnownDataCollectionRuleAssociationProvisioningState() { + } + + /** + * Creates or finds a KnownDataCollectionRuleAssociationProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnownDataCollectionRuleAssociationProvisioningState. + */ + @JsonCreator + public static KnownDataCollectionRuleAssociationProvisioningState fromString(String name) { + return fromString(name, KnownDataCollectionRuleAssociationProvisioningState.class); + } + + /** + * Gets known KnownDataCollectionRuleAssociationProvisioningState values. + * + * @return known KnownDataCollectionRuleAssociationProvisioningState values. + */ + public static Collection values() { + return values(KnownDataCollectionRuleAssociationProvisioningState.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionRuleProvisioningState.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionRuleProvisioningState.java new file mode 100644 index 0000000000000..d87605064d3da --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionRuleProvisioningState.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The resource provisioning state. */ +public final class KnownDataCollectionRuleProvisioningState + extends ExpandableStringEnum { + /** Static value Creating for KnownDataCollectionRuleProvisioningState. */ + public static final KnownDataCollectionRuleProvisioningState CREATING = fromString("Creating"); + + /** Static value Updating for KnownDataCollectionRuleProvisioningState. */ + public static final KnownDataCollectionRuleProvisioningState UPDATING = fromString("Updating"); + + /** Static value Deleting for KnownDataCollectionRuleProvisioningState. */ + public static final KnownDataCollectionRuleProvisioningState DELETING = fromString("Deleting"); + + /** Static value Succeeded for KnownDataCollectionRuleProvisioningState. */ + public static final KnownDataCollectionRuleProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for KnownDataCollectionRuleProvisioningState. */ + public static final KnownDataCollectionRuleProvisioningState FAILED = fromString("Failed"); + + /** + * Creates a new instance of KnownDataCollectionRuleProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KnownDataCollectionRuleProvisioningState() { + } + + /** + * Creates or finds a KnownDataCollectionRuleProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnownDataCollectionRuleProvisioningState. + */ + @JsonCreator + public static KnownDataCollectionRuleProvisioningState fromString(String name) { + return fromString(name, KnownDataCollectionRuleProvisioningState.class); + } + + /** + * Gets known KnownDataCollectionRuleProvisioningState values. + * + * @return known KnownDataCollectionRuleProvisioningState values. + */ + public static Collection values() { + return values(KnownDataCollectionRuleProvisioningState.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionRuleResourceKind.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionRuleResourceKind.java new file mode 100644 index 0000000000000..d4be45780ab83 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionRuleResourceKind.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The kind of the resource. */ +public final class KnownDataCollectionRuleResourceKind + extends ExpandableStringEnum { + /** Static value Linux for KnownDataCollectionRuleResourceKind. */ + public static final KnownDataCollectionRuleResourceKind LINUX = fromString("Linux"); + + /** Static value Windows for KnownDataCollectionRuleResourceKind. */ + public static final KnownDataCollectionRuleResourceKind WINDOWS = fromString("Windows"); + + /** + * Creates a new instance of KnownDataCollectionRuleResourceKind value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KnownDataCollectionRuleResourceKind() { + } + + /** + * Creates or finds a KnownDataCollectionRuleResourceKind from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnownDataCollectionRuleResourceKind. + */ + @JsonCreator + public static KnownDataCollectionRuleResourceKind fromString(String name) { + return fromString(name, KnownDataCollectionRuleResourceKind.class); + } + + /** + * Gets known KnownDataCollectionRuleResourceKind values. + * + * @return known KnownDataCollectionRuleResourceKind values. + */ + public static Collection values() { + return values(KnownDataCollectionRuleResourceKind.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataFlowStreams.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataFlowStreams.java new file mode 100644 index 0000000000000..2e9b5f2fe1680 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataFlowStreams.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for KnownDataFlowStreams. */ +public final class KnownDataFlowStreams extends ExpandableStringEnum { + /** Static value Microsoft-Event for KnownDataFlowStreams. */ + public static final KnownDataFlowStreams MICROSOFT_EVENT = fromString("Microsoft-Event"); + + /** Static value Microsoft-InsightsMetrics for KnownDataFlowStreams. */ + public static final KnownDataFlowStreams MICROSOFT_INSIGHTS_METRICS = fromString("Microsoft-InsightsMetrics"); + + /** Static value Microsoft-Perf for KnownDataFlowStreams. */ + public static final KnownDataFlowStreams MICROSOFT_PERF = fromString("Microsoft-Perf"); + + /** Static value Microsoft-Syslog for KnownDataFlowStreams. */ + public static final KnownDataFlowStreams MICROSOFT_SYSLOG = fromString("Microsoft-Syslog"); + + /** Static value Microsoft-WindowsEvent for KnownDataFlowStreams. */ + public static final KnownDataFlowStreams MICROSOFT_WINDOWS_EVENT = fromString("Microsoft-WindowsEvent"); + + /** + * Creates a new instance of KnownDataFlowStreams value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KnownDataFlowStreams() { + } + + /** + * Creates or finds a KnownDataFlowStreams from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnownDataFlowStreams. + */ + @JsonCreator + public static KnownDataFlowStreams fromString(String name) { + return fromString(name, KnownDataFlowStreams.class); + } + + /** + * Gets known KnownDataFlowStreams values. + * + * @return known KnownDataFlowStreams values. + */ + public static Collection values() { + return values(KnownDataFlowStreams.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownExtensionDataSourceStreams.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownExtensionDataSourceStreams.java new file mode 100644 index 0000000000000..a5a6ed9022a79 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownExtensionDataSourceStreams.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for KnownExtensionDataSourceStreams. */ +public final class KnownExtensionDataSourceStreams extends ExpandableStringEnum { + /** Static value Microsoft-Event for KnownExtensionDataSourceStreams. */ + public static final KnownExtensionDataSourceStreams MICROSOFT_EVENT = fromString("Microsoft-Event"); + + /** Static value Microsoft-InsightsMetrics for KnownExtensionDataSourceStreams. */ + public static final KnownExtensionDataSourceStreams MICROSOFT_INSIGHTS_METRICS = + fromString("Microsoft-InsightsMetrics"); + + /** Static value Microsoft-Perf for KnownExtensionDataSourceStreams. */ + public static final KnownExtensionDataSourceStreams MICROSOFT_PERF = fromString("Microsoft-Perf"); + + /** Static value Microsoft-Syslog for KnownExtensionDataSourceStreams. */ + public static final KnownExtensionDataSourceStreams MICROSOFT_SYSLOG = fromString("Microsoft-Syslog"); + + /** Static value Microsoft-WindowsEvent for KnownExtensionDataSourceStreams. */ + public static final KnownExtensionDataSourceStreams MICROSOFT_WINDOWS_EVENT = fromString("Microsoft-WindowsEvent"); + + /** + * Creates a new instance of KnownExtensionDataSourceStreams value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KnownExtensionDataSourceStreams() { + } + + /** + * Creates or finds a KnownExtensionDataSourceStreams from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnownExtensionDataSourceStreams. + */ + @JsonCreator + public static KnownExtensionDataSourceStreams fromString(String name) { + return fromString(name, KnownExtensionDataSourceStreams.class); + } + + /** + * Gets known KnownExtensionDataSourceStreams values. + * + * @return known KnownExtensionDataSourceStreams values. + */ + public static Collection values() { + return values(KnownExtensionDataSourceStreams.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownLogFileTextSettingsRecordStartTimestampFormat.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownLogFileTextSettingsRecordStartTimestampFormat.java new file mode 100644 index 0000000000000..c038065718458 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownLogFileTextSettingsRecordStartTimestampFormat.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** One of the supported timestamp formats. */ +public final class KnownLogFileTextSettingsRecordStartTimestampFormat + extends ExpandableStringEnum { + /** Static value ISO 8601 for KnownLogFileTextSettingsRecordStartTimestampFormat. */ + public static final KnownLogFileTextSettingsRecordStartTimestampFormat ISO_8601 = fromString("ISO 8601"); + + /** Static value YYYY-MM-DD HH:MM:SS for KnownLogFileTextSettingsRecordStartTimestampFormat. */ + public static final KnownLogFileTextSettingsRecordStartTimestampFormat YYYY_MM_DD_HH_MM_SS = + fromString("YYYY-MM-DD HH:MM:SS"); + + /** Static value M/D/YYYY HH:MM:SS AM/PM for KnownLogFileTextSettingsRecordStartTimestampFormat. */ + public static final KnownLogFileTextSettingsRecordStartTimestampFormat M_D_YYYY_HH_MM_SS_AM_PM = + fromString("M/D/YYYY HH:MM:SS AM/PM"); + + /** Static value Mon DD, YYYY HH:MM:SS for KnownLogFileTextSettingsRecordStartTimestampFormat. */ + public static final KnownLogFileTextSettingsRecordStartTimestampFormat MON_DD_YYYY_HH_MM_SS = + fromString("Mon DD, YYYY HH:MM:SS"); + + /** Static value yyMMdd HH:mm:ss for KnownLogFileTextSettingsRecordStartTimestampFormat. */ + public static final KnownLogFileTextSettingsRecordStartTimestampFormat YY_MMDD_HH_MM_SS = + fromString("yyMMdd HH:mm:ss"); + + /** Static value ddMMyy HH:mm:ss for KnownLogFileTextSettingsRecordStartTimestampFormat. */ + public static final KnownLogFileTextSettingsRecordStartTimestampFormat DD_MMYY_HH_MM_SS = + fromString("ddMMyy HH:mm:ss"); + + /** Static value MMM d hh:mm:ss for KnownLogFileTextSettingsRecordStartTimestampFormat. */ + public static final KnownLogFileTextSettingsRecordStartTimestampFormat MMM_D_HH_MM_SS = + fromString("MMM d hh:mm:ss"); + + /** Static value dd/MMM/yyyy:HH:mm:ss zzz for KnownLogFileTextSettingsRecordStartTimestampFormat. */ + public static final KnownLogFileTextSettingsRecordStartTimestampFormat DD_MMM_YYYY_HH_MM_SS_ZZZ = + fromString("dd/MMM/yyyy:HH:mm:ss zzz"); + + /** Static value yyyy-MM-ddTHH:mm:ssK for KnownLogFileTextSettingsRecordStartTimestampFormat. */ + public static final KnownLogFileTextSettingsRecordStartTimestampFormat YYYY_MM_DD_THH_MM_SSK = + fromString("yyyy-MM-ddTHH:mm:ssK"); + + /** + * Creates a new instance of KnownLogFileTextSettingsRecordStartTimestampFormat value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KnownLogFileTextSettingsRecordStartTimestampFormat() { + } + + /** + * Creates or finds a KnownLogFileTextSettingsRecordStartTimestampFormat from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnownLogFileTextSettingsRecordStartTimestampFormat. + */ + @JsonCreator + public static KnownLogFileTextSettingsRecordStartTimestampFormat fromString(String name) { + return fromString(name, KnownLogFileTextSettingsRecordStartTimestampFormat.class); + } + + /** + * Gets known KnownLogFileTextSettingsRecordStartTimestampFormat values. + * + * @return known KnownLogFileTextSettingsRecordStartTimestampFormat values. + */ + public static Collection values() { + return values(KnownLogFileTextSettingsRecordStartTimestampFormat.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownLogFilesDataSourceFormat.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownLogFilesDataSourceFormat.java new file mode 100644 index 0000000000000..0f0cac7392740 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownLogFilesDataSourceFormat.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The data format of the log files. */ +public final class KnownLogFilesDataSourceFormat extends ExpandableStringEnum { + /** Static value text for KnownLogFilesDataSourceFormat. */ + public static final KnownLogFilesDataSourceFormat TEXT = fromString("text"); + + /** + * Creates a new instance of KnownLogFilesDataSourceFormat value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KnownLogFilesDataSourceFormat() { + } + + /** + * Creates or finds a KnownLogFilesDataSourceFormat from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnownLogFilesDataSourceFormat. + */ + @JsonCreator + public static KnownLogFilesDataSourceFormat fromString(String name) { + return fromString(name, KnownLogFilesDataSourceFormat.class); + } + + /** + * Gets known KnownLogFilesDataSourceFormat values. + * + * @return known KnownLogFilesDataSourceFormat values. + */ + public static Collection values() { + return values(KnownLogFilesDataSourceFormat.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownPerfCounterDataSourceStreams.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownPerfCounterDataSourceStreams.java new file mode 100644 index 0000000000000..19151b6c19164 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownPerfCounterDataSourceStreams.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for KnownPerfCounterDataSourceStreams. */ +public final class KnownPerfCounterDataSourceStreams extends ExpandableStringEnum { + /** Static value Microsoft-Perf for KnownPerfCounterDataSourceStreams. */ + public static final KnownPerfCounterDataSourceStreams MICROSOFT_PERF = fromString("Microsoft-Perf"); + + /** Static value Microsoft-InsightsMetrics for KnownPerfCounterDataSourceStreams. */ + public static final KnownPerfCounterDataSourceStreams MICROSOFT_INSIGHTS_METRICS = + fromString("Microsoft-InsightsMetrics"); + + /** + * Creates a new instance of KnownPerfCounterDataSourceStreams value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KnownPerfCounterDataSourceStreams() { + } + + /** + * Creates or finds a KnownPerfCounterDataSourceStreams from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnownPerfCounterDataSourceStreams. + */ + @JsonCreator + public static KnownPerfCounterDataSourceStreams fromString(String name) { + return fromString(name, KnownPerfCounterDataSourceStreams.class); + } + + /** + * Gets known KnownPerfCounterDataSourceStreams values. + * + * @return known KnownPerfCounterDataSourceStreams values. + */ + public static Collection values() { + return values(KnownPerfCounterDataSourceStreams.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownPublicNetworkAccessOptions.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownPublicNetworkAccessOptions.java new file mode 100644 index 0000000000000..38940d592c51d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownPublicNetworkAccessOptions.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The configuration to set whether network access from public internet to the endpoints are allowed. */ +public final class KnownPublicNetworkAccessOptions extends ExpandableStringEnum { + /** Static value Enabled for KnownPublicNetworkAccessOptions. */ + public static final KnownPublicNetworkAccessOptions ENABLED = fromString("Enabled"); + + /** Static value Disabled for KnownPublicNetworkAccessOptions. */ + public static final KnownPublicNetworkAccessOptions DISABLED = fromString("Disabled"); + + /** + * Creates a new instance of KnownPublicNetworkAccessOptions value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KnownPublicNetworkAccessOptions() { + } + + /** + * Creates or finds a KnownPublicNetworkAccessOptions from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnownPublicNetworkAccessOptions. + */ + @JsonCreator + public static KnownPublicNetworkAccessOptions fromString(String name) { + return fromString(name, KnownPublicNetworkAccessOptions.class); + } + + /** + * Gets known KnownPublicNetworkAccessOptions values. + * + * @return known KnownPublicNetworkAccessOptions values. + */ + public static Collection values() { + return values(KnownPublicNetworkAccessOptions.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownSyslogDataSourceFacilityNames.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownSyslogDataSourceFacilityNames.java new file mode 100644 index 0000000000000..023e71934cb9d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownSyslogDataSourceFacilityNames.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for KnownSyslogDataSourceFacilityNames. */ +public final class KnownSyslogDataSourceFacilityNames extends ExpandableStringEnum { + /** Static value auth for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames AUTH = fromString("auth"); + + /** Static value authpriv for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames AUTHPRIV = fromString("authpriv"); + + /** Static value cron for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames CRON = fromString("cron"); + + /** Static value daemon for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames DAEMON = fromString("daemon"); + + /** Static value kern for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames KERN = fromString("kern"); + + /** Static value lpr for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames LPR = fromString("lpr"); + + /** Static value mail for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames MAIL = fromString("mail"); + + /** Static value mark for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames MARK = fromString("mark"); + + /** Static value news for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames NEWS = fromString("news"); + + /** Static value syslog for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames SYSLOG = fromString("syslog"); + + /** Static value user for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames USER = fromString("user"); + + /** Static value uucp for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames UUCP = fromString("uucp"); + + /** Static value local0 for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames LOCAL0 = fromString("local0"); + + /** Static value local1 for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames LOCAL1 = fromString("local1"); + + /** Static value local2 for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames LOCAL2 = fromString("local2"); + + /** Static value local3 for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames LOCAL3 = fromString("local3"); + + /** Static value local4 for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames LOCAL4 = fromString("local4"); + + /** Static value local5 for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames LOCAL5 = fromString("local5"); + + /** Static value local6 for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames LOCAL6 = fromString("local6"); + + /** Static value local7 for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames LOCAL7 = fromString("local7"); + + /** Static value * for KnownSyslogDataSourceFacilityNames. */ + public static final KnownSyslogDataSourceFacilityNames ASTERISK = fromString("*"); + + /** + * Creates a new instance of KnownSyslogDataSourceFacilityNames value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KnownSyslogDataSourceFacilityNames() { + } + + /** + * Creates or finds a KnownSyslogDataSourceFacilityNames from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnownSyslogDataSourceFacilityNames. + */ + @JsonCreator + public static KnownSyslogDataSourceFacilityNames fromString(String name) { + return fromString(name, KnownSyslogDataSourceFacilityNames.class); + } + + /** + * Gets known KnownSyslogDataSourceFacilityNames values. + * + * @return known KnownSyslogDataSourceFacilityNames values. + */ + public static Collection values() { + return values(KnownSyslogDataSourceFacilityNames.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownSyslogDataSourceLogLevels.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownSyslogDataSourceLogLevels.java new file mode 100644 index 0000000000000..aadef4fc34c28 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownSyslogDataSourceLogLevels.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for KnownSyslogDataSourceLogLevels. */ +public final class KnownSyslogDataSourceLogLevels extends ExpandableStringEnum { + /** Static value Debug for KnownSyslogDataSourceLogLevels. */ + public static final KnownSyslogDataSourceLogLevels DEBUG = fromString("Debug"); + + /** Static value Info for KnownSyslogDataSourceLogLevels. */ + public static final KnownSyslogDataSourceLogLevels INFO = fromString("Info"); + + /** Static value Notice for KnownSyslogDataSourceLogLevels. */ + public static final KnownSyslogDataSourceLogLevels NOTICE = fromString("Notice"); + + /** Static value Warning for KnownSyslogDataSourceLogLevels. */ + public static final KnownSyslogDataSourceLogLevels WARNING = fromString("Warning"); + + /** Static value Error for KnownSyslogDataSourceLogLevels. */ + public static final KnownSyslogDataSourceLogLevels ERROR = fromString("Error"); + + /** Static value Critical for KnownSyslogDataSourceLogLevels. */ + public static final KnownSyslogDataSourceLogLevels CRITICAL = fromString("Critical"); + + /** Static value Alert for KnownSyslogDataSourceLogLevels. */ + public static final KnownSyslogDataSourceLogLevels ALERT = fromString("Alert"); + + /** Static value Emergency for KnownSyslogDataSourceLogLevels. */ + public static final KnownSyslogDataSourceLogLevels EMERGENCY = fromString("Emergency"); + + /** Static value * for KnownSyslogDataSourceLogLevels. */ + public static final KnownSyslogDataSourceLogLevels ASTERISK = fromString("*"); + + /** + * Creates a new instance of KnownSyslogDataSourceLogLevels value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KnownSyslogDataSourceLogLevels() { + } + + /** + * Creates or finds a KnownSyslogDataSourceLogLevels from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnownSyslogDataSourceLogLevels. + */ + @JsonCreator + public static KnownSyslogDataSourceLogLevels fromString(String name) { + return fromString(name, KnownSyslogDataSourceLogLevels.class); + } + + /** + * Gets known KnownSyslogDataSourceLogLevels values. + * + * @return known KnownSyslogDataSourceLogLevels values. + */ + public static Collection values() { + return values(KnownSyslogDataSourceLogLevels.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownSyslogDataSourceStreams.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownSyslogDataSourceStreams.java new file mode 100644 index 0000000000000..ab9af52dfda79 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownSyslogDataSourceStreams.java @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for KnownSyslogDataSourceStreams. */ +public final class KnownSyslogDataSourceStreams extends ExpandableStringEnum { + /** Static value Microsoft-Syslog for KnownSyslogDataSourceStreams. */ + public static final KnownSyslogDataSourceStreams MICROSOFT_SYSLOG = fromString("Microsoft-Syslog"); + + /** + * Creates a new instance of KnownSyslogDataSourceStreams value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KnownSyslogDataSourceStreams() { + } + + /** + * Creates or finds a KnownSyslogDataSourceStreams from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnownSyslogDataSourceStreams. + */ + @JsonCreator + public static KnownSyslogDataSourceStreams fromString(String name) { + return fromString(name, KnownSyslogDataSourceStreams.class); + } + + /** + * Gets known KnownSyslogDataSourceStreams values. + * + * @return known KnownSyslogDataSourceStreams values. + */ + public static Collection values() { + return values(KnownSyslogDataSourceStreams.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownWindowsEventLogDataSourceStreams.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownWindowsEventLogDataSourceStreams.java new file mode 100644 index 0000000000000..d08376238f6d9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownWindowsEventLogDataSourceStreams.java @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for KnownWindowsEventLogDataSourceStreams. */ +public final class KnownWindowsEventLogDataSourceStreams + extends ExpandableStringEnum { + /** Static value Microsoft-WindowsEvent for KnownWindowsEventLogDataSourceStreams. */ + public static final KnownWindowsEventLogDataSourceStreams MICROSOFT_WINDOWS_EVENT = + fromString("Microsoft-WindowsEvent"); + + /** Static value Microsoft-Event for KnownWindowsEventLogDataSourceStreams. */ + public static final KnownWindowsEventLogDataSourceStreams MICROSOFT_EVENT = fromString("Microsoft-Event"); + + /** + * Creates a new instance of KnownWindowsEventLogDataSourceStreams value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public KnownWindowsEventLogDataSourceStreams() { + } + + /** + * Creates or finds a KnownWindowsEventLogDataSourceStreams from its string representation. + * + * @param name a name to look for. + * @return the corresponding KnownWindowsEventLogDataSourceStreams. + */ + @JsonCreator + public static KnownWindowsEventLogDataSourceStreams fromString(String name) { + return fromString(name, KnownWindowsEventLogDataSourceStreams.class); + } + + /** + * Gets known KnownWindowsEventLogDataSourceStreams values. + * + * @return known KnownWindowsEventLogDataSourceStreams values. + */ + public static Collection values() { + return values(KnownWindowsEventLogDataSourceStreams.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LocalizableString.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LocalizableString.java new file mode 100644 index 0000000000000..8f67937892588 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LocalizableString.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.LocalizableStringInner; + +/** An immutable client-side representation of LocalizableString. */ +public interface LocalizableString { + /** + * Gets the value property: the invariant value. + * + * @return the value value. + */ + String value(); + + /** + * Gets the localizedValue property: the locale specific value. + * + * @return the localizedValue value. + */ + String localizedValue(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.LocalizableStringInner object. + * + * @return the inner object. + */ + LocalizableStringInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LocationThresholdRuleCondition.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LocationThresholdRuleCondition.java new file mode 100644 index 0000000000000..5e90c9d8db00a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LocationThresholdRuleCondition.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** A rule condition based on a certain number of locations failing. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition") +@Fluent +public final class LocationThresholdRuleCondition extends RuleCondition { + /* + * the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + * If specified then it must be between 5 minutes and 1 day. + */ + @JsonProperty(value = "windowSize") + private Duration windowSize; + + /* + * the number of locations that must fail to activate the alert. + */ + @JsonProperty(value = "failedLocationCount", required = true) + private int failedLocationCount; + + /** Creates an instance of LocationThresholdRuleCondition class. */ + public LocationThresholdRuleCondition() { + } + + /** + * Get the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert + * activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + * + * @return the windowSize value. + */ + public Duration windowSize() { + return this.windowSize; + } + + /** + * Set the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert + * activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + * + * @param windowSize the windowSize value to set. + * @return the LocationThresholdRuleCondition object itself. + */ + public LocationThresholdRuleCondition withWindowSize(Duration windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * Get the failedLocationCount property: the number of locations that must fail to activate the alert. + * + * @return the failedLocationCount value. + */ + public int failedLocationCount() { + return this.failedLocationCount; + } + + /** + * Set the failedLocationCount property: the number of locations that must fail to activate the alert. + * + * @param failedLocationCount the failedLocationCount value to set. + * @return the LocationThresholdRuleCondition object itself. + */ + public LocationThresholdRuleCondition withFailedLocationCount(int failedLocationCount) { + this.failedLocationCount = failedLocationCount; + return this; + } + + /** {@inheritDoc} */ + @Override + public LocationThresholdRuleCondition withDataSource(RuleDataSource dataSource) { + super.withDataSource(dataSource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogAnalyticsDestination.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogAnalyticsDestination.java new file mode 100644 index 0000000000000..fadc054ea4386 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogAnalyticsDestination.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Log Analytics destination. */ +@Fluent +public final class LogAnalyticsDestination { + /* + * The resource ID of the Log Analytics workspace. + */ + @JsonProperty(value = "workspaceResourceId") + private String workspaceResourceId; + + /* + * The Customer ID of the Log Analytics workspace. + */ + @JsonProperty(value = "workspaceId", access = JsonProperty.Access.WRITE_ONLY) + private String workspaceId; + + /* + * A friendly name for the destination. + * This name should be unique across all destinations (regardless of type) within the data collection rule. + */ + @JsonProperty(value = "name") + private String name; + + /** Creates an instance of LogAnalyticsDestination class. */ + public LogAnalyticsDestination() { + } + + /** + * Get the workspaceResourceId property: The resource ID of the Log Analytics workspace. + * + * @return the workspaceResourceId value. + */ + public String workspaceResourceId() { + return this.workspaceResourceId; + } + + /** + * Set the workspaceResourceId property: The resource ID of the Log Analytics workspace. + * + * @param workspaceResourceId the workspaceResourceId value to set. + * @return the LogAnalyticsDestination object itself. + */ + public LogAnalyticsDestination withWorkspaceResourceId(String workspaceResourceId) { + this.workspaceResourceId = workspaceResourceId; + return this; + } + + /** + * Get the workspaceId property: The Customer ID of the Log Analytics workspace. + * + * @return the workspaceId value. + */ + public String workspaceId() { + return this.workspaceId; + } + + /** + * Get the name property: A friendly name for the destination. This name should be unique across all destinations + * (regardless of type) within the data collection rule. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: A friendly name for the destination. This name should be unique across all destinations + * (regardless of type) within the data collection rule. + * + * @param name the name value to set. + * @return the LogAnalyticsDestination object itself. + */ + public LogAnalyticsDestination withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFileSettings.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFileSettings.java new file mode 100644 index 0000000000000..282790bd98742 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFileSettings.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Settings for different log file formats. */ +@Fluent +public class LogFileSettings { + /* + * Text settings + */ + @JsonProperty(value = "text") + private LogFileSettingsText text; + + /** Creates an instance of LogFileSettings class. */ + public LogFileSettings() { + } + + /** + * Get the text property: Text settings. + * + * @return the text value. + */ + public LogFileSettingsText text() { + return this.text; + } + + /** + * Set the text property: Text settings. + * + * @param text the text value to set. + * @return the LogFileSettings object itself. + */ + public LogFileSettings withText(LogFileSettingsText text) { + this.text = text; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (text() != null) { + text().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFileSettingsText.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFileSettingsText.java new file mode 100644 index 0000000000000..cc14d343e9c29 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFileSettingsText.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; + +/** Text settings. */ +@Fluent +public final class LogFileSettingsText extends LogFileTextSettings { + /** Creates an instance of LogFileSettingsText class. */ + public LogFileSettingsText() { + } + + /** {@inheritDoc} */ + @Override + public LogFileSettingsText withRecordStartTimestampFormat( + KnownLogFileTextSettingsRecordStartTimestampFormat recordStartTimestampFormat) { + super.withRecordStartTimestampFormat(recordStartTimestampFormat); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFileTextSettings.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFileTextSettings.java new file mode 100644 index 0000000000000..3a6a67f04bf3d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFileTextSettings.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Settings for text log files. */ +@Fluent +public class LogFileTextSettings { + /* + * One of the supported timestamp formats + */ + @JsonProperty(value = "recordStartTimestampFormat", required = true) + private KnownLogFileTextSettingsRecordStartTimestampFormat recordStartTimestampFormat; + + /** Creates an instance of LogFileTextSettings class. */ + public LogFileTextSettings() { + } + + /** + * Get the recordStartTimestampFormat property: One of the supported timestamp formats. + * + * @return the recordStartTimestampFormat value. + */ + public KnownLogFileTextSettingsRecordStartTimestampFormat recordStartTimestampFormat() { + return this.recordStartTimestampFormat; + } + + /** + * Set the recordStartTimestampFormat property: One of the supported timestamp formats. + * + * @param recordStartTimestampFormat the recordStartTimestampFormat value to set. + * @return the LogFileTextSettings object itself. + */ + public LogFileTextSettings withRecordStartTimestampFormat( + KnownLogFileTextSettingsRecordStartTimestampFormat recordStartTimestampFormat) { + this.recordStartTimestampFormat = recordStartTimestampFormat; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (recordStartTimestampFormat() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property recordStartTimestampFormat in model LogFileTextSettings")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LogFileTextSettings.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFilesDataSource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFilesDataSource.java new file mode 100644 index 0000000000000..fe285ea94b305 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFilesDataSource.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Definition of which custom log files will be collected by this data collection rule. */ +@Fluent +public final class LogFilesDataSource { + /* + * List of streams that this data source will be sent to. + * A stream indicates what schema will be used for this data source + */ + @JsonProperty(value = "streams", required = true) + private List streams; + + /* + * File Patterns where the log files are located + */ + @JsonProperty(value = "filePatterns", required = true) + private List filePatterns; + + /* + * The data format of the log files + */ + @JsonProperty(value = "format", required = true) + private KnownLogFilesDataSourceFormat format; + + /* + * The log files specific settings. + */ + @JsonProperty(value = "settings") + private LogFilesDataSourceSettings settings; + + /* + * A friendly name for the data source. + * This name should be unique across all data sources (regardless of type) within the data collection rule. + */ + @JsonProperty(value = "name") + private String name; + + /** Creates an instance of LogFilesDataSource class. */ + public LogFilesDataSource() { + } + + /** + * Get the streams property: List of streams that this data source will be sent to. A stream indicates what schema + * will be used for this data source. + * + * @return the streams value. + */ + public List streams() { + return this.streams; + } + + /** + * Set the streams property: List of streams that this data source will be sent to. A stream indicates what schema + * will be used for this data source. + * + * @param streams the streams value to set. + * @return the LogFilesDataSource object itself. + */ + public LogFilesDataSource withStreams(List streams) { + this.streams = streams; + return this; + } + + /** + * Get the filePatterns property: File Patterns where the log files are located. + * + * @return the filePatterns value. + */ + public List filePatterns() { + return this.filePatterns; + } + + /** + * Set the filePatterns property: File Patterns where the log files are located. + * + * @param filePatterns the filePatterns value to set. + * @return the LogFilesDataSource object itself. + */ + public LogFilesDataSource withFilePatterns(List filePatterns) { + this.filePatterns = filePatterns; + return this; + } + + /** + * Get the format property: The data format of the log files. + * + * @return the format value. + */ + public KnownLogFilesDataSourceFormat format() { + return this.format; + } + + /** + * Set the format property: The data format of the log files. + * + * @param format the format value to set. + * @return the LogFilesDataSource object itself. + */ + public LogFilesDataSource withFormat(KnownLogFilesDataSourceFormat format) { + this.format = format; + return this; + } + + /** + * Get the settings property: The log files specific settings. + * + * @return the settings value. + */ + public LogFilesDataSourceSettings settings() { + return this.settings; + } + + /** + * Set the settings property: The log files specific settings. + * + * @param settings the settings value to set. + * @return the LogFilesDataSource object itself. + */ + public LogFilesDataSource withSettings(LogFilesDataSourceSettings settings) { + this.settings = settings; + return this; + } + + /** + * Get the name property: A friendly name for the data source. This name should be unique across all data sources + * (regardless of type) within the data collection rule. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: A friendly name for the data source. This name should be unique across all data sources + * (regardless of type) within the data collection rule. + * + * @param name the name value to set. + * @return the LogFilesDataSource object itself. + */ + public LogFilesDataSource withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (streams() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property streams in model LogFilesDataSource")); + } + if (filePatterns() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property filePatterns in model LogFilesDataSource")); + } + if (format() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property format in model LogFilesDataSource")); + } + if (settings() != null) { + settings().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LogFilesDataSource.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFilesDataSourceSettings.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFilesDataSourceSettings.java new file mode 100644 index 0000000000000..eb4dc4e77e1f2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFilesDataSourceSettings.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; + +/** The log files specific settings. */ +@Fluent +public final class LogFilesDataSourceSettings extends LogFileSettings { + /** Creates an instance of LogFilesDataSourceSettings class. */ + public LogFilesDataSourceSettings() { + } + + /** {@inheritDoc} */ + @Override + public LogFilesDataSourceSettings withText(LogFileSettingsText text) { + super.withText(text); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfileCollection.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfileCollection.java new file mode 100644 index 0000000000000..3d3e475935c6e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfileCollection.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.LogProfileResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of log profiles. */ +@Fluent +public final class LogProfileCollection { + /* + * the values of the log profiles. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** Creates an instance of LogProfileCollection class. */ + public LogProfileCollection() { + } + + /** + * Get the value property: the values of the log profiles. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: the values of the log profiles. + * + * @param value the value value to set. + * @return the LogProfileCollection object itself. + */ + public LogProfileCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model LogProfileCollection")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LogProfileCollection.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfileResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfileResource.java new file mode 100644 index 0000000000000..61c240086d519 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfileResource.java @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.LogProfileResourceInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of LogProfileResource. */ +public interface LogProfileResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the storageAccountId property: the resource id of the storage account to which you would like to send the + * Activity Log. + * + * @return the storageAccountId value. + */ + String storageAccountId(); + + /** + * Gets the serviceBusRuleId property: 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}'. + * + * @return the serviceBusRuleId value. + */ + String serviceBusRuleId(); + + /** + * Gets the locations property: 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. + * + * @return the locations value. + */ + List locations(); + + /** + * Gets the categories property: the categories of the logs. These categories are created as is convenient to the + * user. Some values are: 'Write', 'Delete', and/or 'Action.'. + * + * @return the categories value. + */ + List categories(); + + /** + * Gets the retentionPolicy property: the retention policy for the events in the log. + * + * @return the retentionPolicy value. + */ + RetentionPolicy retentionPolicy(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.LogProfileResourceInner object. + * + * @return the inner object. + */ + LogProfileResourceInner innerModel(); + + /** The entirety of the LogProfileResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithLocations, + DefinitionStages.WithCategories, + DefinitionStages.WithRetentionPolicy, + DefinitionStages.WithCreate { + } + /** The LogProfileResource definition stages. */ + interface DefinitionStages { + /** The first stage of the LogProfileResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the LogProfileResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithLocations withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithLocations withRegion(String location); + } + /** The stage of the LogProfileResource definition allowing to specify locations. */ + interface WithLocations { + /** + * Specifies the locations property: 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.. + * + * @param 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. + * @return the next definition stage. + */ + WithCategories withLocations(List locations); + } + /** The stage of the LogProfileResource definition allowing to specify categories. */ + interface WithCategories { + /** + * Specifies the categories property: the categories of the logs. These categories are created as is + * convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.'. + * + * @param categories the categories of the logs. These categories are created as is convenient to the user. + * Some values are: 'Write', 'Delete', and/or 'Action.'. + * @return the next definition stage. + */ + WithRetentionPolicy withCategories(List categories); + } + /** The stage of the LogProfileResource definition allowing to specify retentionPolicy. */ + interface WithRetentionPolicy { + /** + * Specifies the retentionPolicy property: the retention policy for the events in the log.. + * + * @param retentionPolicy the retention policy for the events in the log. + * @return the next definition stage. + */ + WithCreate withRetentionPolicy(RetentionPolicy retentionPolicy); + } + /** + * The stage of the LogProfileResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithStorageAccountId, + DefinitionStages.WithServiceBusRuleId { + /** + * Executes the create request. + * + * @return the created resource. + */ + LogProfileResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LogProfileResource create(Context context); + } + /** The stage of the LogProfileResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the LogProfileResource definition allowing to specify storageAccountId. */ + interface WithStorageAccountId { + /** + * Specifies the storageAccountId property: the resource id of the storage account to which you would like + * to send the Activity Log.. + * + * @param storageAccountId the resource id of the storage account to which you would like to send the + * Activity Log. + * @return the next definition stage. + */ + WithCreate withStorageAccountId(String storageAccountId); + } + /** The stage of the LogProfileResource definition allowing to specify serviceBusRuleId. */ + interface WithServiceBusRuleId { + /** + * Specifies the serviceBusRuleId property: 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}'.. + * + * @param serviceBusRuleId 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}'. + * @return the next definition stage. + */ + WithCreate withServiceBusRuleId(String serviceBusRuleId); + } + } + /** + * Begins update for the LogProfileResource resource. + * + * @return the stage of resource update. + */ + LogProfileResource.Update update(); + + /** The template for LogProfileResource update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithStorageAccountId, + UpdateStages.WithServiceBusRuleId, + UpdateStages.WithLocations, + UpdateStages.WithCategories, + UpdateStages.WithRetentionPolicy { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LogProfileResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LogProfileResource apply(Context context); + } + /** The LogProfileResource update stages. */ + interface UpdateStages { + /** The stage of the LogProfileResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the LogProfileResource update allowing to specify storageAccountId. */ + interface WithStorageAccountId { + /** + * Specifies the storageAccountId property: the resource id of the storage account to which you would like + * to send the Activity Log.. + * + * @param storageAccountId the resource id of the storage account to which you would like to send the + * Activity Log. + * @return the next definition stage. + */ + Update withStorageAccountId(String storageAccountId); + } + /** The stage of the LogProfileResource update allowing to specify serviceBusRuleId. */ + interface WithServiceBusRuleId { + /** + * Specifies the serviceBusRuleId property: 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}'.. + * + * @param serviceBusRuleId 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}'. + * @return the next definition stage. + */ + Update withServiceBusRuleId(String serviceBusRuleId); + } + /** The stage of the LogProfileResource update allowing to specify locations. */ + interface WithLocations { + /** + * Specifies the locations property: 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.. + * + * @param 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. + * @return the next definition stage. + */ + Update withLocations(List locations); + } + /** The stage of the LogProfileResource update allowing to specify categories. */ + interface WithCategories { + /** + * Specifies the categories property: the categories of the logs. These categories are created as is + * convenient to the user. Some values are: 'Write', 'Delete', and/or 'Action.'. + * + * @param categories the categories of the logs. These categories are created as is convenient to the user. + * Some values are: 'Write', 'Delete', and/or 'Action.'. + * @return the next definition stage. + */ + Update withCategories(List categories); + } + /** The stage of the LogProfileResource update allowing to specify retentionPolicy. */ + interface WithRetentionPolicy { + /** + * Specifies the retentionPolicy property: the retention policy for the events in the log.. + * + * @param retentionPolicy the retention policy for the events in the log. + * @return the next definition stage. + */ + Update withRetentionPolicy(RetentionPolicy retentionPolicy); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LogProfileResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LogProfileResource refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfileResourcePatch.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfileResourcePatch.java new file mode 100644 index 0000000000000..18bf8ab29112d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfileResourcePatch.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.LogProfileProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The log profile resource for patch operations. */ +@Fluent +public final class LogProfileResourcePatch { + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The log profile properties for an update operation. + */ + @JsonProperty(value = "properties") + private LogProfileProperties innerProperties; + + /** Creates an instance of LogProfileResourcePatch class. */ + public LogProfileResourcePatch() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: The log profile properties for an update operation. + * + * @return the innerProperties value. + */ + private LogProfileProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the storageAccountId property: the resource id of the storage account to which you would like to send the + * Activity Log. + * + * @return the storageAccountId value. + */ + public String storageAccountId() { + return this.innerProperties() == null ? null : this.innerProperties().storageAccountId(); + } + + /** + * Set the storageAccountId property: the resource id of the storage account to which you would like to send the + * Activity Log. + * + * @param storageAccountId the storageAccountId value to set. + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withStorageAccountId(String storageAccountId) { + if (this.innerProperties() == null) { + this.innerProperties = new LogProfileProperties(); + } + this.innerProperties().withStorageAccountId(storageAccountId); + return this; + } + + /** + * Get the serviceBusRuleId property: 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}'. + * + * @return the serviceBusRuleId value. + */ + public String serviceBusRuleId() { + return this.innerProperties() == null ? null : this.innerProperties().serviceBusRuleId(); + } + + /** + * Set the serviceBusRuleId property: 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}'. + * + * @param serviceBusRuleId the serviceBusRuleId value to set. + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withServiceBusRuleId(String serviceBusRuleId) { + if (this.innerProperties() == null) { + this.innerProperties = new LogProfileProperties(); + } + this.innerProperties().withServiceBusRuleId(serviceBusRuleId); + return this; + } + + /** + * Get the locations property: 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. + * + * @return the locations value. + */ + public List locations() { + return this.innerProperties() == null ? null : this.innerProperties().locations(); + } + + /** + * Set the locations property: 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. + * + * @param locations the locations value to set. + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withLocations(List locations) { + if (this.innerProperties() == null) { + this.innerProperties = new LogProfileProperties(); + } + this.innerProperties().withLocations(locations); + return this; + } + + /** + * Get the categories property: the categories of the logs. These categories are created as is convenient to the + * user. Some values are: 'Write', 'Delete', and/or 'Action.'. + * + * @return the categories value. + */ + public List categories() { + return this.innerProperties() == null ? null : this.innerProperties().categories(); + } + + /** + * Set the categories property: the categories of the logs. These categories are created as is convenient to the + * user. Some values are: 'Write', 'Delete', and/or 'Action.'. + * + * @param categories the categories value to set. + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withCategories(List categories) { + if (this.innerProperties() == null) { + this.innerProperties = new LogProfileProperties(); + } + this.innerProperties().withCategories(categories); + return this; + } + + /** + * Get the retentionPolicy property: the retention policy for the events in the log. + * + * @return the retentionPolicy value. + */ + public RetentionPolicy retentionPolicy() { + return this.innerProperties() == null ? null : this.innerProperties().retentionPolicy(); + } + + /** + * Set the retentionPolicy property: the retention policy for the events in the log. + * + * @param retentionPolicy the retentionPolicy value to set. + * @return the LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch withRetentionPolicy(RetentionPolicy retentionPolicy) { + if (this.innerProperties() == null) { + this.innerProperties = new LogProfileProperties(); + } + this.innerProperties().withRetentionPolicy(retentionPolicy); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfiles.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfiles.java new file mode 100644 index 0000000000000..f917ea8fe5a40 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfiles.java @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of LogProfiles. */ +public interface LogProfiles { + /** + * Deletes the log profile. + * + * @param logProfileName The name of the log profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteWithResponse(String logProfileName, Context context); + + /** + * Deletes the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String logProfileName); + + /** + * Gets the log profile. + * + * @param logProfileName The name of the log profile. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile along with {@link Response}. + */ + Response getWithResponse(String logProfileName, Context context); + + /** + * Gets the log profile. + * + * @param logProfileName The name of the log profile. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile. + */ + LogProfileResource get(String logProfileName); + + /** + * List the log profiles. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of log profiles as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the log profiles. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of log profiles as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets the log profile. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile along with {@link Response}. + */ + LogProfileResource getById(String id); + + /** + * Gets the log profile. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the log profile along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the log profile. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the log profile. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new LogProfileResource resource. + * + * @param name resource name. + * @return the first stage of the new LogProfileResource definition. + */ + LogProfileResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogSettings.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogSettings.java new file mode 100644 index 0000000000000..45502378d8a19 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogSettings.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. */ +@Fluent +public final class LogSettings { + /* + * 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. + */ + @JsonProperty(value = "category") + private String category; + + /* + * 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. + */ + @JsonProperty(value = "categoryGroup") + private String categoryGroup; + + /* + * a value indicating whether this log is enabled. + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /* + * the retention policy for this log. + */ + @JsonProperty(value = "retentionPolicy") + private RetentionPolicy retentionPolicy; + + /** Creates an instance of LogSettings class. */ + public LogSettings() { + } + + /** + * Get the category property: 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. + * + * @return the category value. + */ + public String category() { + return this.category; + } + + /** + * Set the category property: 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. + * + * @param category the category value to set. + * @return the LogSettings object itself. + */ + public LogSettings withCategory(String category) { + this.category = category; + return this; + } + + /** + * Get the categoryGroup property: 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. + * + * @return the categoryGroup value. + */ + public String categoryGroup() { + return this.categoryGroup; + } + + /** + * Set the categoryGroup property: 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. + * + * @param categoryGroup the categoryGroup value to set. + * @return the LogSettings object itself. + */ + public LogSettings withCategoryGroup(String categoryGroup) { + this.categoryGroup = categoryGroup; + return this; + } + + /** + * Get the enabled property: a value indicating whether this log is enabled. + * + * @return the enabled value. + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: a value indicating whether this log is enabled. + * + * @param enabled the enabled value to set. + * @return the LogSettings object itself. + */ + public LogSettings withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the retentionPolicy property: the retention policy for this log. + * + * @return the retentionPolicy value. + */ + public RetentionPolicy retentionPolicy() { + return this.retentionPolicy; + } + + /** + * Set the retentionPolicy property: the retention policy for this log. + * + * @param retentionPolicy the retentionPolicy value to set. + * @return the LogSettings object itself. + */ + public LogSettings withRetentionPolicy(RetentionPolicy retentionPolicy) { + this.retentionPolicy = retentionPolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (retentionPolicy() != null) { + retentionPolicy().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogicAppReceiver.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogicAppReceiver.java new file mode 100644 index 0000000000000..aea8aad83afda --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogicAppReceiver.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A logic app receiver. */ +@Fluent +public final class LogicAppReceiver { + /* + * The name of the logic app receiver. Names must be unique across all receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The azure resource id of the logic app receiver. + */ + @JsonProperty(value = "resourceId", required = true) + private String resourceId; + + /* + * The callback url where http request sent to. + */ + @JsonProperty(value = "callbackUrl", required = true) + private String callbackUrl; + + /* + * Indicates whether to use common alert schema. + */ + @JsonProperty(value = "useCommonAlertSchema") + private Boolean useCommonAlertSchema; + + /** Creates an instance of LogicAppReceiver class. */ + public LogicAppReceiver() { + } + + /** + * Get the name property: The name of the logic app receiver. Names must be unique across all receivers within an + * action group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the logic app receiver. Names must be unique across all receivers within an + * action group. + * + * @param name the name value to set. + * @return the LogicAppReceiver object itself. + */ + public LogicAppReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the resourceId property: The azure resource id of the logic app receiver. + * + * @return the resourceId value. + */ + public String resourceId() { + return this.resourceId; + } + + /** + * Set the resourceId property: The azure resource id of the logic app receiver. + * + * @param resourceId the resourceId value to set. + * @return the LogicAppReceiver object itself. + */ + public LogicAppReceiver withResourceId(String resourceId) { + this.resourceId = resourceId; + return this; + } + + /** + * Get the callbackUrl property: The callback url where http request sent to. + * + * @return the callbackUrl value. + */ + public String callbackUrl() { + return this.callbackUrl; + } + + /** + * Set the callbackUrl property: The callback url where http request sent to. + * + * @param callbackUrl the callbackUrl value to set. + * @return the LogicAppReceiver object itself. + */ + public LogicAppReceiver withCallbackUrl(String callbackUrl) { + this.callbackUrl = callbackUrl; + return this; + } + + /** + * Get the useCommonAlertSchema property: Indicates whether to use common alert schema. + * + * @return the useCommonAlertSchema value. + */ + public Boolean useCommonAlertSchema() { + return this.useCommonAlertSchema; + } + + /** + * Set the useCommonAlertSchema property: Indicates whether to use common alert schema. + * + * @param useCommonAlertSchema the useCommonAlertSchema value to set. + * @return the LogicAppReceiver object itself. + */ + public LogicAppReceiver withUseCommonAlertSchema(Boolean useCommonAlertSchema) { + this.useCommonAlertSchema = useCommonAlertSchema; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model LogicAppReceiver")); + } + if (resourceId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property resourceId in model LogicAppReceiver")); + } + if (callbackUrl() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property callbackUrl in model LogicAppReceiver")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LogicAppReceiver.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogsIngestionEndpointSpec.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogsIngestionEndpointSpec.java new file mode 100644 index 0000000000000..1d364401666ce --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogsIngestionEndpointSpec.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Definition of the endpoint used for ingesting logs. */ +@Immutable +public class LogsIngestionEndpointSpec { + /* + * The endpoint. This property is READ-ONLY. + */ + @JsonProperty(value = "endpoint", access = JsonProperty.Access.WRITE_ONLY) + private String endpoint; + + /** Creates an instance of LogsIngestionEndpointSpec class. */ + public LogsIngestionEndpointSpec() { + } + + /** + * Get the endpoint property: The endpoint. This property is READ-ONLY. + * + * @return the endpoint value. + */ + public String endpoint() { + return this.endpoint; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ManagementEventAggregationCondition.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ManagementEventAggregationCondition.java new file mode 100644 index 0000000000000..675f8c4cf5774 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ManagementEventAggregationCondition.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; + +/** How the data that is collected should be combined over time. */ +@Fluent +public final class ManagementEventAggregationCondition { + /* + * the condition operator. + */ + @JsonProperty(value = "operator") + private ConditionOperator operator; + + /* + * The threshold value that activates the alert. + */ + @JsonProperty(value = "threshold") + private Double threshold; + + /* + * the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + * If specified then it must be between 5 minutes and 1 day. + */ + @JsonProperty(value = "windowSize") + private Duration windowSize; + + /** Creates an instance of ManagementEventAggregationCondition class. */ + public ManagementEventAggregationCondition() { + } + + /** + * Get the operator property: the condition operator. + * + * @return the operator value. + */ + public ConditionOperator operator() { + return this.operator; + } + + /** + * Set the operator property: the condition operator. + * + * @param operator the operator value to set. + * @return the ManagementEventAggregationCondition object itself. + */ + public ManagementEventAggregationCondition withOperator(ConditionOperator operator) { + this.operator = operator; + return this; + } + + /** + * Get the threshold property: The threshold value that activates the alert. + * + * @return the threshold value. + */ + public Double threshold() { + return this.threshold; + } + + /** + * Set the threshold property: The threshold value that activates the alert. + * + * @param threshold the threshold value to set. + * @return the ManagementEventAggregationCondition object itself. + */ + public ManagementEventAggregationCondition withThreshold(Double threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert + * activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + * + * @return the windowSize value. + */ + public Duration windowSize() { + return this.windowSize; + } + + /** + * Set the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert + * activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + * + * @param windowSize the windowSize value to set. + * @return the ManagementEventAggregationCondition object itself. + */ + public ManagementEventAggregationCondition withWindowSize(Duration windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ManagementEventRuleCondition.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ManagementEventRuleCondition.java new file mode 100644 index 0000000000000..cb386e4b72c11 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ManagementEventRuleCondition.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** A management event rule condition. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition") +@Fluent +public final class ManagementEventRuleCondition extends RuleCondition { + /* + * How the data that is collected should be combined over time and when the alert is activated. Note that for + * management event alerts aggregation is optional – if it is not provided then any event will cause the alert to + * activate. + */ + @JsonProperty(value = "aggregation") + private ManagementEventAggregationCondition aggregation; + + /** Creates an instance of ManagementEventRuleCondition class. */ + public ManagementEventRuleCondition() { + } + + /** + * Get the aggregation property: How the data that is collected should be combined over time and when the alert is + * activated. Note that for management event alerts aggregation is optional – if it is not provided then any event + * will cause the alert to activate. + * + * @return the aggregation value. + */ + public ManagementEventAggregationCondition aggregation() { + return this.aggregation; + } + + /** + * Set the aggregation property: How the data that is collected should be combined over time and when the alert is + * activated. Note that for management event alerts aggregation is optional – if it is not provided then any event + * will cause the alert to activate. + * + * @param aggregation the aggregation value to set. + * @return the ManagementEventRuleCondition object itself. + */ + public ManagementEventRuleCondition withAggregation(ManagementEventAggregationCondition aggregation) { + this.aggregation = aggregation; + return this; + } + + /** {@inheritDoc} */ + @Override + public ManagementEventRuleCondition withDataSource(RuleDataSource dataSource) { + super.withDataSource(dataSource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (aggregation() != null) { + aggregation().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Metadata.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Metadata.java new file mode 100644 index 0000000000000..fbf6a1fcc7a5d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Metadata.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Metadata about the resource. */ +@Immutable +public class Metadata { + /* + * Azure offering managing this resource on-behalf-of customer. + */ + @JsonProperty(value = "provisionedBy", access = JsonProperty.Access.WRITE_ONLY) + private String provisionedBy; + + /** Creates an instance of Metadata class. */ + public Metadata() { + } + + /** + * Get the provisionedBy property: Azure offering managing this resource on-behalf-of customer. + * + * @return the provisionedBy value. + */ + public String provisionedBy() { + return this.provisionedBy; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetadataValue.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetadataValue.java new file mode 100644 index 0000000000000..eec8dad64f552 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetadataValue.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.MetadataValueInner; + +/** An immutable client-side representation of MetadataValue. */ +public interface MetadataValue { + /** + * Gets the name property: the name of the metadata. + * + * @return the name value. + */ + LocalizableString name(); + + /** + * Gets the value property: the value of the metadata. + * + * @return the value value. + */ + String value(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.MetadataValueInner object. + * + * @return the inner object. + */ + MetadataValueInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Metric.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Metric.java new file mode 100644 index 0000000000000..bf1bc1526ad40 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Metric.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricInner; +import java.util.List; + +/** An immutable client-side representation of Metric. */ +public interface Metric { + /** + * Gets the id property: the metric Id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the type property: the resource type of the metric resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the name property: the name and the display name of the metric, i.e. it is localizable string. + * + * @return the name value. + */ + LocalizableString name(); + + /** + * Gets the displayDescription property: Detailed description of this metric. + * + * @return the displayDescription value. + */ + String displayDescription(); + + /** + * Gets the errorCode property: 'Success' or the error details on query failures for this metric. + * + * @return the errorCode value. + */ + String errorCode(); + + /** + * Gets the errorMessage property: Error message encountered querying this specific metric. + * + * @return the errorMessage value. + */ + String errorMessage(); + + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + MetricUnit unit(); + + /** + * Gets the timeseries property: the time series returned when a data query is performed. + * + * @return the timeseries value. + */ + List timeseries(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.MetricInner object. + * + * @return the inner object. + */ + MetricInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertAction.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertAction.java new file mode 100644 index 0000000000000..63c20124699ed --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertAction.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An alert action. */ +@Fluent +public final class MetricAlertAction { + /* + * the id of the action group to use. + */ + @JsonProperty(value = "actionGroupId") + private String actionGroupId; + + /* + * This field allows specifying custom properties, which would be appended to the alert payload sent as input to + * the webhook. + */ + @JsonProperty(value = "webHookProperties") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map webhookProperties; + + /** Creates an instance of MetricAlertAction class. */ + public MetricAlertAction() { + } + + /** + * Get the actionGroupId property: the id of the action group to use. + * + * @return the actionGroupId value. + */ + public String actionGroupId() { + return this.actionGroupId; + } + + /** + * Set the actionGroupId property: the id of the action group to use. + * + * @param actionGroupId the actionGroupId value to set. + * @return the MetricAlertAction object itself. + */ + public MetricAlertAction withActionGroupId(String actionGroupId) { + this.actionGroupId = actionGroupId; + return this; + } + + /** + * Get the webhookProperties property: This field allows specifying custom properties, which would be appended to + * the alert payload sent as input to the webhook. + * + * @return the webhookProperties value. + */ + public Map webhookProperties() { + return this.webhookProperties; + } + + /** + * Set the webhookProperties property: This field allows specifying custom properties, which would be appended to + * the alert payload sent as input to the webhook. + * + * @param webhookProperties the webhookProperties value to set. + * @return the MetricAlertAction object itself. + */ + public MetricAlertAction withWebhookProperties(Map webhookProperties) { + this.webhookProperties = webhookProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertCriteria.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertCriteria.java new file mode 100644 index 0000000000000..054983cecba37 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertCriteria.java @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.HashMap; +import java.util.Map; + +/** The rule criteria that defines the conditions of the alert rule. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "odata.type", + defaultImpl = MetricAlertCriteria.class) +@JsonTypeName("MetricAlertCriteria") +@JsonSubTypes({ + @JsonSubTypes.Type( + name = "Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria", + value = MetricAlertSingleResourceMultipleMetricCriteria.class), + @JsonSubTypes.Type( + name = "Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria", + value = WebtestLocationAvailabilityCriteria.class), + @JsonSubTypes.Type( + name = "Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria", + value = MetricAlertMultipleResourceMultipleMetricCriteria.class) +}) +@Fluent +public class MetricAlertCriteria { + /* + * The rule criteria that defines the conditions of the alert rule. + */ + @JsonIgnore private Map additionalProperties; + + /** Creates an instance of MetricAlertCriteria class. */ + public MetricAlertCriteria() { + } + + /** + * Get the additionalProperties property: The rule criteria that defines the conditions of the alert rule. + * + * @return the additionalProperties value. + */ + @JsonAnyGetter + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The rule criteria that defines the conditions of the alert rule. + * + * @param additionalProperties the additionalProperties value to set. + * @return the MetricAlertCriteria object itself. + */ + public MetricAlertCriteria withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + @JsonAnySetter + void withAdditionalProperties(String key, Object value) { + if (additionalProperties == null) { + additionalProperties = new HashMap<>(); + } + additionalProperties.put(key, value); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertMultipleResourceMultipleMetricCriteria.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertMultipleResourceMultipleMetricCriteria.java new file mode 100644 index 0000000000000..ab031fbfe8402 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertMultipleResourceMultipleMetricCriteria.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Specifies the metric alert criteria for multiple resource that has multiple metric criteria. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria") +@Fluent +public final class MetricAlertMultipleResourceMultipleMetricCriteria extends MetricAlertCriteria { + /* + * the list of multiple metric criteria for this 'all of' operation. + */ + @JsonProperty(value = "allOf") + private List allOf; + + /** Creates an instance of MetricAlertMultipleResourceMultipleMetricCriteria class. */ + public MetricAlertMultipleResourceMultipleMetricCriteria() { + } + + /** + * Get the allOf property: the list of multiple metric criteria for this 'all of' operation. + * + * @return the allOf value. + */ + public List allOf() { + return this.allOf; + } + + /** + * Set the allOf property: the list of multiple metric criteria for this 'all of' operation. + * + * @param allOf the allOf value to set. + * @return the MetricAlertMultipleResourceMultipleMetricCriteria object itself. + */ + public MetricAlertMultipleResourceMultipleMetricCriteria withAllOf(List allOf) { + this.allOf = allOf; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (allOf() != null) { + allOf().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertResource.java new file mode 100644 index 0000000000000..fdc7783634ffd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertResource.java @@ -0,0 +1,572 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricAlertResourceInner; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of MetricAlertResource. */ +public interface MetricAlertResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the description property: the description of the metric alert that will be included in the alert email. + * + * @return the description value. + */ + String description(); + + /** + * Gets the severity property: Alert severity {0, 1, 2, 3, 4}. + * + * @return the severity value. + */ + int severity(); + + /** + * Gets the enabled property: the flag that indicates whether the metric alert is enabled. + * + * @return the enabled value. + */ + boolean enabled(); + + /** + * Gets the scopes property: the list of resource id's that this metric alert is scoped to. + * + * @return the scopes value. + */ + List scopes(); + + /** + * Gets the evaluationFrequency property: how often the metric alert is evaluated represented in ISO 8601 duration + * format. + * + * @return the evaluationFrequency value. + */ + Duration evaluationFrequency(); + + /** + * Gets the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert + * activity based on the threshold. + * + * @return the windowSize value. + */ + Duration windowSize(); + + /** + * Gets the targetResourceType property: 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. + * + * @return the targetResourceType value. + */ + String targetResourceType(); + + /** + * Gets the targetResourceRegion property: 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. + * + * @return the targetResourceRegion value. + */ + String targetResourceRegion(); + + /** + * Gets the criteria property: defines the specific alert criteria information. + * + * @return the criteria value. + */ + MetricAlertCriteria criteria(); + + /** + * Gets the autoMitigate property: the flag that indicates whether the alert should be auto resolved or not. The + * default is true. + * + * @return the autoMitigate value. + */ + Boolean autoMitigate(); + + /** + * Gets the actions property: the array of actions that are performed when the alert rule becomes active, and when + * an alert condition is resolved. + * + * @return the actions value. + */ + List actions(); + + /** + * Gets the lastUpdatedTime property: Last time the rule was updated in ISO8601 format. + * + * @return the lastUpdatedTime value. + */ + OffsetDateTime lastUpdatedTime(); + + /** + * Gets the isMigrated property: the value indicating whether this alert rule is migrated. + * + * @return the isMigrated value. + */ + Boolean isMigrated(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.MetricAlertResourceInner object. + * + * @return the inner object. + */ + MetricAlertResourceInner innerModel(); + + /** The entirety of the MetricAlertResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithSeverity, + DefinitionStages.WithEnabled, + DefinitionStages.WithScopes, + DefinitionStages.WithEvaluationFrequency, + DefinitionStages.WithWindowSize, + DefinitionStages.WithCriteria, + DefinitionStages.WithCreate { + } + /** The MetricAlertResource definition stages. */ + interface DefinitionStages { + /** The first stage of the MetricAlertResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the MetricAlertResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the MetricAlertResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithSeverity withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the MetricAlertResource definition allowing to specify severity. */ + interface WithSeverity { + /** + * Specifies the severity property: Alert severity {0, 1, 2, 3, 4}. + * + * @param severity Alert severity {0, 1, 2, 3, 4}. + * @return the next definition stage. + */ + WithEnabled withSeverity(int severity); + } + /** The stage of the MetricAlertResource definition allowing to specify enabled. */ + interface WithEnabled { + /** + * Specifies the enabled property: the flag that indicates whether the metric alert is enabled.. + * + * @param enabled the flag that indicates whether the metric alert is enabled. + * @return the next definition stage. + */ + WithScopes withEnabled(boolean enabled); + } + /** The stage of the MetricAlertResource definition allowing to specify scopes. */ + interface WithScopes { + /** + * Specifies the scopes property: the list of resource id's that this metric alert is scoped to.. + * + * @param scopes the list of resource id's that this metric alert is scoped to. + * @return the next definition stage. + */ + WithEvaluationFrequency withScopes(List scopes); + } + /** The stage of the MetricAlertResource definition allowing to specify evaluationFrequency. */ + interface WithEvaluationFrequency { + /** + * Specifies the evaluationFrequency property: how often the metric alert is evaluated represented in ISO + * 8601 duration format.. + * + * @param evaluationFrequency how often the metric alert is evaluated represented in ISO 8601 duration + * format. + * @return the next definition stage. + */ + WithWindowSize withEvaluationFrequency(Duration evaluationFrequency); + } + /** The stage of the MetricAlertResource definition allowing to specify windowSize. */ + interface WithWindowSize { + /** + * Specifies the windowSize property: the period of time (in ISO 8601 duration format) that is used to + * monitor alert activity based on the threshold.. + * + * @param windowSize the period of time (in ISO 8601 duration format) that is used to monitor alert activity + * based on the threshold. + * @return the next definition stage. + */ + WithCriteria withWindowSize(Duration windowSize); + } + /** The stage of the MetricAlertResource definition allowing to specify criteria. */ + interface WithCriteria { + /** + * Specifies the criteria property: defines the specific alert criteria information.. + * + * @param criteria defines the specific alert criteria information. + * @return the next definition stage. + */ + WithCreate withCriteria(MetricAlertCriteria criteria); + } + /** + * The stage of the MetricAlertResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithDescription, + DefinitionStages.WithTargetResourceType, + DefinitionStages.WithTargetResourceRegion, + DefinitionStages.WithAutoMitigate, + DefinitionStages.WithActions { + /** + * Executes the create request. + * + * @return the created resource. + */ + MetricAlertResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + MetricAlertResource create(Context context); + } + /** The stage of the MetricAlertResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the MetricAlertResource definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: the description of the metric alert that will be included in the + * alert email.. + * + * @param description the description of the metric alert that will be included in the alert email. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the MetricAlertResource definition allowing to specify targetResourceType. */ + interface WithTargetResourceType { + /** + * Specifies the targetResourceType property: 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.. + * + * @param targetResourceType 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. + * @return the next definition stage. + */ + WithCreate withTargetResourceType(String targetResourceType); + } + /** The stage of the MetricAlertResource definition allowing to specify targetResourceRegion. */ + interface WithTargetResourceRegion { + /** + * Specifies the targetResourceRegion property: 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.. + * + * @param targetResourceRegion 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. + * @return the next definition stage. + */ + WithCreate withTargetResourceRegion(String targetResourceRegion); + } + /** The stage of the MetricAlertResource definition allowing to specify autoMitigate. */ + interface WithAutoMitigate { + /** + * Specifies the autoMitigate property: the flag that indicates whether the alert should be auto resolved or + * not. The default is true.. + * + * @param autoMitigate the flag that indicates whether the alert should be auto resolved or not. The default + * is true. + * @return the next definition stage. + */ + WithCreate withAutoMitigate(Boolean autoMitigate); + } + /** The stage of the MetricAlertResource definition allowing to specify actions. */ + interface WithActions { + /** + * Specifies the actions property: the array of actions that are performed when the alert rule becomes + * active, and when an alert condition is resolved.. + * + * @param actions the array of actions that are performed when the alert rule becomes active, and when an + * alert condition is resolved. + * @return the next definition stage. + */ + WithCreate withActions(List actions); + } + } + /** + * Begins update for the MetricAlertResource resource. + * + * @return the stage of resource update. + */ + MetricAlertResource.Update update(); + + /** The template for MetricAlertResource update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithDescription, + UpdateStages.WithSeverity, + UpdateStages.WithEnabled, + UpdateStages.WithScopes, + UpdateStages.WithEvaluationFrequency, + UpdateStages.WithWindowSize, + UpdateStages.WithTargetResourceType, + UpdateStages.WithTargetResourceRegion, + UpdateStages.WithCriteria, + UpdateStages.WithAutoMitigate, + UpdateStages.WithActions { + /** + * Executes the update request. + * + * @return the updated resource. + */ + MetricAlertResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + MetricAlertResource apply(Context context); + } + /** The MetricAlertResource update stages. */ + interface UpdateStages { + /** The stage of the MetricAlertResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the MetricAlertResource update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: the description of the metric alert that will be included in the + * alert email.. + * + * @param description the description of the metric alert that will be included in the alert email. + * @return the next definition stage. + */ + Update withDescription(String description); + } + /** The stage of the MetricAlertResource update allowing to specify severity. */ + interface WithSeverity { + /** + * Specifies the severity property: Alert severity {0, 1, 2, 3, 4}. + * + * @param severity Alert severity {0, 1, 2, 3, 4}. + * @return the next definition stage. + */ + Update withSeverity(Integer severity); + } + /** The stage of the MetricAlertResource update allowing to specify enabled. */ + interface WithEnabled { + /** + * Specifies the enabled property: the flag that indicates whether the metric alert is enabled.. + * + * @param enabled the flag that indicates whether the metric alert is enabled. + * @return the next definition stage. + */ + Update withEnabled(Boolean enabled); + } + /** The stage of the MetricAlertResource update allowing to specify scopes. */ + interface WithScopes { + /** + * Specifies the scopes property: the list of resource id's that this metric alert is scoped to.. + * + * @param scopes the list of resource id's that this metric alert is scoped to. + * @return the next definition stage. + */ + Update withScopes(List scopes); + } + /** The stage of the MetricAlertResource update allowing to specify evaluationFrequency. */ + interface WithEvaluationFrequency { + /** + * Specifies the evaluationFrequency property: how often the metric alert is evaluated represented in ISO + * 8601 duration format.. + * + * @param evaluationFrequency how often the metric alert is evaluated represented in ISO 8601 duration + * format. + * @return the next definition stage. + */ + Update withEvaluationFrequency(Duration evaluationFrequency); + } + /** The stage of the MetricAlertResource update allowing to specify windowSize. */ + interface WithWindowSize { + /** + * Specifies the windowSize property: the period of time (in ISO 8601 duration format) that is used to + * monitor alert activity based on the threshold.. + * + * @param windowSize the period of time (in ISO 8601 duration format) that is used to monitor alert activity + * based on the threshold. + * @return the next definition stage. + */ + Update withWindowSize(Duration windowSize); + } + /** The stage of the MetricAlertResource update allowing to specify targetResourceType. */ + interface WithTargetResourceType { + /** + * Specifies the targetResourceType property: the resource type of the target resource(s) on which the alert + * is created/updated. Mandatory for MultipleResourceMultipleMetricCriteria.. + * + * @param targetResourceType the resource type of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * @return the next definition stage. + */ + Update withTargetResourceType(String targetResourceType); + } + /** The stage of the MetricAlertResource update allowing to specify targetResourceRegion. */ + interface WithTargetResourceRegion { + /** + * Specifies the targetResourceRegion property: the region of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria.. + * + * @param targetResourceRegion the region of the target resource(s) on which the alert is created/updated. + * Mandatory for MultipleResourceMultipleMetricCriteria. + * @return the next definition stage. + */ + Update withTargetResourceRegion(String targetResourceRegion); + } + /** The stage of the MetricAlertResource update allowing to specify criteria. */ + interface WithCriteria { + /** + * Specifies the criteria property: defines the specific alert criteria information.. + * + * @param criteria defines the specific alert criteria information. + * @return the next definition stage. + */ + Update withCriteria(MetricAlertCriteria criteria); + } + /** The stage of the MetricAlertResource update allowing to specify autoMitigate. */ + interface WithAutoMitigate { + /** + * Specifies the autoMitigate property: the flag that indicates whether the alert should be auto resolved or + * not. The default is true.. + * + * @param autoMitigate the flag that indicates whether the alert should be auto resolved or not. The default + * is true. + * @return the next definition stage. + */ + Update withAutoMitigate(Boolean autoMitigate); + } + /** The stage of the MetricAlertResource update allowing to specify actions. */ + interface WithActions { + /** + * Specifies the actions property: the array of actions that are performed when the alert rule becomes + * active, and when an alert condition is resolved.. + * + * @param actions the array of actions that are performed when the alert rule becomes active, and when an + * alert condition is resolved. + * @return the next definition stage. + */ + Update withActions(List actions); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + MetricAlertResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + MetricAlertResource refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertResourceCollection.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertResourceCollection.java new file mode 100644 index 0000000000000..b5516af922765 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertResourceCollection.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricAlertResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of alert rule resources. */ +@Fluent +public final class MetricAlertResourceCollection { + /* + * the values for the alert rule resources. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of MetricAlertResourceCollection class. */ + public MetricAlertResourceCollection() { + } + + /** + * Get the value property: the values for the alert rule resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: the values for the alert rule resources. + * + * @param value the value value to set. + * @return the MetricAlertResourceCollection object itself. + */ + public MetricAlertResourceCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertResourcePatch.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertResourcePatch.java new file mode 100644 index 0000000000000..64d28b876d8fd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertResourcePatch.java @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricAlertPropertiesPatch; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** The metric alert resource for patch operations. */ +@Fluent +public final class MetricAlertResourcePatch { + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The alert rule properties of the resource. + */ + @JsonProperty(value = "properties") + private MetricAlertPropertiesPatch innerProperties; + + /** Creates an instance of MetricAlertResourcePatch class. */ + public MetricAlertResourcePatch() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: The alert rule properties of the resource. + * + * @return the innerProperties value. + */ + private MetricAlertPropertiesPatch innerProperties() { + return this.innerProperties; + } + + /** + * Get the description property: the description of the metric alert that will be included in the alert email. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: the description of the metric alert that will be included in the alert email. + * + * @param description the description value to set. + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertPropertiesPatch(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the severity property: Alert severity {0, 1, 2, 3, 4}. + * + * @return the severity value. + */ + public Integer severity() { + return this.innerProperties() == null ? null : this.innerProperties().severity(); + } + + /** + * Set the severity property: Alert severity {0, 1, 2, 3, 4}. + * + * @param severity the severity value to set. + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withSeverity(Integer severity) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertPropertiesPatch(); + } + this.innerProperties().withSeverity(severity); + return this; + } + + /** + * Get the enabled property: the flag that indicates whether the metric alert is enabled. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: the flag that indicates whether the metric alert is enabled. + * + * @param enabled the enabled value to set. + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withEnabled(Boolean enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertPropertiesPatch(); + } + this.innerProperties().withEnabled(enabled); + return this; + } + + /** + * Get the scopes property: the list of resource id's that this metric alert is scoped to. + * + * @return the scopes value. + */ + public List scopes() { + return this.innerProperties() == null ? null : this.innerProperties().scopes(); + } + + /** + * Set the scopes property: the list of resource id's that this metric alert is scoped to. + * + * @param scopes the scopes value to set. + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withScopes(List scopes) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertPropertiesPatch(); + } + this.innerProperties().withScopes(scopes); + return this; + } + + /** + * Get the evaluationFrequency property: how often the metric alert is evaluated represented in ISO 8601 duration + * format. + * + * @return the evaluationFrequency value. + */ + public Duration evaluationFrequency() { + return this.innerProperties() == null ? null : this.innerProperties().evaluationFrequency(); + } + + /** + * Set the evaluationFrequency property: how often the metric alert is evaluated represented in ISO 8601 duration + * format. + * + * @param evaluationFrequency the evaluationFrequency value to set. + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withEvaluationFrequency(Duration evaluationFrequency) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertPropertiesPatch(); + } + this.innerProperties().withEvaluationFrequency(evaluationFrequency); + return this; + } + + /** + * Get the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert + * activity based on the threshold. + * + * @return the windowSize value. + */ + public Duration windowSize() { + return this.innerProperties() == null ? null : this.innerProperties().windowSize(); + } + + /** + * Set the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert + * activity based on the threshold. + * + * @param windowSize the windowSize value to set. + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withWindowSize(Duration windowSize) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertPropertiesPatch(); + } + this.innerProperties().withWindowSize(windowSize); + return this; + } + + /** + * Get the targetResourceType property: the resource type of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @return the targetResourceType value. + */ + public String targetResourceType() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceType(); + } + + /** + * Set the targetResourceType property: the resource type of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @param targetResourceType the targetResourceType value to set. + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withTargetResourceType(String targetResourceType) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertPropertiesPatch(); + } + this.innerProperties().withTargetResourceType(targetResourceType); + return this; + } + + /** + * Get the targetResourceRegion property: the region of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @return the targetResourceRegion value. + */ + public String targetResourceRegion() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceRegion(); + } + + /** + * Set the targetResourceRegion property: the region of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + * + * @param targetResourceRegion the targetResourceRegion value to set. + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withTargetResourceRegion(String targetResourceRegion) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertPropertiesPatch(); + } + this.innerProperties().withTargetResourceRegion(targetResourceRegion); + return this; + } + + /** + * Get the criteria property: defines the specific alert criteria information. + * + * @return the criteria value. + */ + public MetricAlertCriteria criteria() { + return this.innerProperties() == null ? null : this.innerProperties().criteria(); + } + + /** + * Set the criteria property: defines the specific alert criteria information. + * + * @param criteria the criteria value to set. + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withCriteria(MetricAlertCriteria criteria) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertPropertiesPatch(); + } + this.innerProperties().withCriteria(criteria); + return this; + } + + /** + * Get the autoMitigate property: the flag that indicates whether the alert should be auto resolved or not. The + * default is true. + * + * @return the autoMitigate value. + */ + public Boolean autoMitigate() { + return this.innerProperties() == null ? null : this.innerProperties().autoMitigate(); + } + + /** + * Set the autoMitigate property: the flag that indicates whether the alert should be auto resolved or not. The + * default is true. + * + * @param autoMitigate the autoMitigate value to set. + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withAutoMitigate(Boolean autoMitigate) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertPropertiesPatch(); + } + this.innerProperties().withAutoMitigate(autoMitigate); + return this; + } + + /** + * Get the actions property: the array of actions that are performed when the alert rule becomes active, and when an + * alert condition is resolved. + * + * @return the actions value. + */ + public List actions() { + return this.innerProperties() == null ? null : this.innerProperties().actions(); + } + + /** + * Set the actions property: the array of actions that are performed when the alert rule becomes active, and when an + * alert condition is resolved. + * + * @param actions the actions value to set. + * @return the MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch withActions(List actions) { + if (this.innerProperties() == null) { + this.innerProperties = new MetricAlertPropertiesPatch(); + } + this.innerProperties().withActions(actions); + return this; + } + + /** + * Get the lastUpdatedTime property: Last time the rule was updated in ISO8601 format. + * + * @return the lastUpdatedTime value. + */ + public OffsetDateTime lastUpdatedTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedTime(); + } + + /** + * Get the isMigrated property: the value indicating whether this alert rule is migrated. + * + * @return the isMigrated value. + */ + public Boolean isMigrated() { + return this.innerProperties() == null ? null : this.innerProperties().isMigrated(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertSingleResourceMultipleMetricCriteria.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertSingleResourceMultipleMetricCriteria.java new file mode 100644 index 0000000000000..334712755b1fa --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertSingleResourceMultipleMetricCriteria.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Specifies the metric alert criteria for a single resource that has multiple metric criteria. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria") +@Fluent +public final class MetricAlertSingleResourceMultipleMetricCriteria extends MetricAlertCriteria { + /* + * The list of metric criteria for this 'all of' operation. + */ + @JsonProperty(value = "allOf") + private List allOf; + + /** Creates an instance of MetricAlertSingleResourceMultipleMetricCriteria class. */ + public MetricAlertSingleResourceMultipleMetricCriteria() { + } + + /** + * Get the allOf property: The list of metric criteria for this 'all of' operation. + * + * @return the allOf value. + */ + public List allOf() { + return this.allOf; + } + + /** + * Set the allOf property: The list of metric criteria for this 'all of' operation. + * + * @param allOf the allOf value to set. + * @return the MetricAlertSingleResourceMultipleMetricCriteria object itself. + */ + public MetricAlertSingleResourceMultipleMetricCriteria withAllOf(List allOf) { + this.allOf = allOf; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (allOf() != null) { + allOf().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertStatus.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertStatus.java new file mode 100644 index 0000000000000..120e042883fa4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertStatus.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An alert status. */ +@Fluent +public final class MetricAlertStatus { + /* + * The status name. + */ + @JsonProperty(value = "name") + private String name; + + /* + * The alert rule arm id. + */ + @JsonProperty(value = "id") + private String id; + + /* + * The extended resource type name. + */ + @JsonProperty(value = "type") + private String type; + + /* + * The alert status properties of the metric alert status. + */ + @JsonProperty(value = "properties") + private MetricAlertStatusProperties properties; + + /** Creates an instance of MetricAlertStatus class. */ + public MetricAlertStatus() { + } + + /** + * Get the name property: The status name. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The status name. + * + * @param name the name value to set. + * @return the MetricAlertStatus object itself. + */ + public MetricAlertStatus withName(String name) { + this.name = name; + return this; + } + + /** + * Get the id property: The alert rule arm id. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: The alert rule arm id. + * + * @param id the id value to set. + * @return the MetricAlertStatus object itself. + */ + public MetricAlertStatus withId(String id) { + this.id = id; + return this; + } + + /** + * Get the type property: The extended resource type name. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: The extended resource type name. + * + * @param type the type value to set. + * @return the MetricAlertStatus object itself. + */ + public MetricAlertStatus withType(String type) { + this.type = type; + return this; + } + + /** + * Get the properties property: The alert status properties of the metric alert status. + * + * @return the properties value. + */ + public MetricAlertStatusProperties properties() { + return this.properties; + } + + /** + * Set the properties property: The alert status properties of the metric alert status. + * + * @param properties the properties value to set. + * @return the MetricAlertStatus object itself. + */ + public MetricAlertStatus withProperties(MetricAlertStatusProperties properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertStatusCollection.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertStatusCollection.java new file mode 100644 index 0000000000000..350f2d29a6e81 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertStatusCollection.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricAlertStatusCollectionInner; +import java.util.List; + +/** An immutable client-side representation of MetricAlertStatusCollection. */ +public interface MetricAlertStatusCollection { + /** + * Gets the value property: the values for the alert rule resources. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.MetricAlertStatusCollectionInner object. + * + * @return the inner object. + */ + MetricAlertStatusCollectionInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertStatusProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertStatusProperties.java new file mode 100644 index 0000000000000..6ccee8f2414c7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertStatusProperties.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An alert status properties. */ +@Fluent +public final class MetricAlertStatusProperties { + /* + * An object describing the type of the dimensions. + */ + @JsonProperty(value = "dimensions") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map dimensions; + + /* + * status value + */ + @JsonProperty(value = "status") + private String status; + + /* + * UTC time when the status was checked. + */ + @JsonProperty(value = "timestamp") + private OffsetDateTime timestamp; + + /** Creates an instance of MetricAlertStatusProperties class. */ + public MetricAlertStatusProperties() { + } + + /** + * Get the dimensions property: An object describing the type of the dimensions. + * + * @return the dimensions value. + */ + public Map dimensions() { + return this.dimensions; + } + + /** + * Set the dimensions property: An object describing the type of the dimensions. + * + * @param dimensions the dimensions value to set. + * @return the MetricAlertStatusProperties object itself. + */ + public MetricAlertStatusProperties withDimensions(Map dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Get the status property: status value. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: status value. + * + * @param status the status value to set. + * @return the MetricAlertStatusProperties object itself. + */ + public MetricAlertStatusProperties withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the timestamp property: UTC time when the status was checked. + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Set the timestamp property: UTC time when the status was checked. + * + * @param timestamp the timestamp value to set. + * @return the MetricAlertStatusProperties object itself. + */ + public MetricAlertStatusProperties withTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlerts.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlerts.java new file mode 100644 index 0000000000000..1044dd228eab1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlerts.java @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of MetricAlerts. */ +public interface MetricAlerts { + /** + * Retrieve alert rule definitions in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * Retrieve alert rule definitions in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context); + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource. + */ + MetricAlertResource getByResourceGroup(String resourceGroupName, String ruleName); + + /** + * Delete an alert rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String ruleName, Context context); + + /** + * Delete an alert rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String ruleName); + + /** + * Retrieve an alert rule definition. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource along with {@link Response}. + */ + MetricAlertResource getById(String id); + + /** + * Retrieve an alert rule definition. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the metric alert resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete an alert rule definition. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Delete an alert rule definition. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new MetricAlertResource resource. + * + * @param name resource name. + * @return the first stage of the new MetricAlertResource definition. + */ + MetricAlertResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertsStatus.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertsStatus.java new file mode 100644 index 0000000000000..546e0657251d7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertsStatus.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of MetricAlertsStatus. */ +public interface MetricAlertsStatus { + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources along with {@link Response}. + */ + Response listWithResponse(String resourceGroupName, String ruleName, Context context); + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources. + */ + MetricAlertStatusCollection list(String resourceGroupName, String ruleName); + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources along with {@link Response}. + */ + Response listByNameWithResponse( + String resourceGroupName, String ruleName, String statusName, Context context); + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param statusName The name of the status. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of alert rule resources. + */ + MetricAlertStatusCollection listByName(String resourceGroupName, String ruleName, String statusName); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAvailability.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAvailability.java new file mode 100644 index 0000000000000..b66e050f9543d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAvailability.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; + +/** + * Metric availability specifies the time grain (aggregation interval or frequency) and the retention period for that + * time grain. + */ +@Fluent +public final class MetricAvailability { + /* + * the time grain specifies the aggregation interval for the metric. Expressed as a duration 'PT1M', 'P1D', etc. + */ + @JsonProperty(value = "timeGrain") + private Duration timeGrain; + + /* + * the retention period for the metric at the specified timegrain. Expressed as a duration 'PT1M', 'P1D', etc. + */ + @JsonProperty(value = "retention") + private Duration retention; + + /** Creates an instance of MetricAvailability class. */ + public MetricAvailability() { + } + + /** + * Get the timeGrain property: the time grain specifies the aggregation interval for the metric. Expressed as a + * duration 'PT1M', 'P1D', etc. + * + * @return the timeGrain value. + */ + public Duration timeGrain() { + return this.timeGrain; + } + + /** + * Set the timeGrain property: the time grain specifies the aggregation interval for the metric. Expressed as a + * duration 'PT1M', 'P1D', etc. + * + * @param timeGrain the timeGrain value to set. + * @return the MetricAvailability object itself. + */ + public MetricAvailability withTimeGrain(Duration timeGrain) { + this.timeGrain = timeGrain; + return this; + } + + /** + * Get the retention property: the retention period for the metric at the specified timegrain. Expressed as a + * duration 'PT1M', 'P1D', etc. + * + * @return the retention value. + */ + public Duration retention() { + return this.retention; + } + + /** + * Set the retention property: the retention period for the metric at the specified timegrain. Expressed as a + * duration 'PT1M', 'P1D', etc. + * + * @param retention the retention value to set. + * @return the MetricAvailability object itself. + */ + public MetricAvailability withRetention(Duration retention) { + this.retention = retention; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricBaselinesResponse.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricBaselinesResponse.java new file mode 100644 index 0000000000000..0bb6c9e9c8505 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricBaselinesResponse.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.SingleMetricBaselineInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of metric baselines. */ +@Fluent +public final class MetricBaselinesResponse { + /* + * The list of metric baselines. + */ + @JsonProperty(value = "value") + private List value; + + /** Creates an instance of MetricBaselinesResponse class. */ + public MetricBaselinesResponse() { + } + + /** + * Get the value property: The list of metric baselines. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of metric baselines. + * + * @param value the value value to set. + * @return the MetricBaselinesResponse object itself. + */ + public MetricBaselinesResponse withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricClass.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricClass.java new file mode 100644 index 0000000000000..1bb9c62405e8b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricClass.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The class of the metric. */ +public final class MetricClass extends ExpandableStringEnum { + /** Static value Availability for MetricClass. */ + public static final MetricClass AVAILABILITY = fromString("Availability"); + + /** Static value Transactions for MetricClass. */ + public static final MetricClass TRANSACTIONS = fromString("Transactions"); + + /** Static value Errors for MetricClass. */ + public static final MetricClass ERRORS = fromString("Errors"); + + /** Static value Latency for MetricClass. */ + public static final MetricClass LATENCY = fromString("Latency"); + + /** Static value Saturation for MetricClass. */ + public static final MetricClass SATURATION = fromString("Saturation"); + + /** + * Creates a new instance of MetricClass value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MetricClass() { + } + + /** + * Creates or finds a MetricClass from its string representation. + * + * @param name a name to look for. + * @return the corresponding MetricClass. + */ + @JsonCreator + public static MetricClass fromString(String name) { + return fromString(name, MetricClass.class); + } + + /** + * Gets known MetricClass values. + * + * @return known MetricClass values. + */ + public static Collection values() { + return values(MetricClass.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricCriteria.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricCriteria.java new file mode 100644 index 0000000000000..94cf7e9502cb4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricCriteria.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Criterion to filter metrics. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "criterionType") +@JsonTypeName("StaticThresholdCriterion") +@Fluent +public final class MetricCriteria extends MultiMetricCriteria { + /* + * the criteria operator. + */ + @JsonProperty(value = "operator", required = true) + private Operator operator; + + /* + * the criteria threshold value that activates the alert. + */ + @JsonProperty(value = "threshold", required = true) + private double threshold; + + /** Creates an instance of MetricCriteria class. */ + public MetricCriteria() { + } + + /** + * Get the operator property: the criteria operator. + * + * @return the operator value. + */ + public Operator operator() { + return this.operator; + } + + /** + * Set the operator property: the criteria operator. + * + * @param operator the operator value to set. + * @return the MetricCriteria object itself. + */ + public MetricCriteria withOperator(Operator operator) { + this.operator = operator; + return this; + } + + /** + * Get the threshold property: the criteria threshold value that activates the alert. + * + * @return the threshold value. + */ + public double threshold() { + return this.threshold; + } + + /** + * Set the threshold property: the criteria threshold value that activates the alert. + * + * @param threshold the threshold value to set. + * @return the MetricCriteria object itself. + */ + public MetricCriteria withThreshold(double threshold) { + this.threshold = threshold; + return this; + } + + /** {@inheritDoc} */ + @Override + public MetricCriteria withName(String name) { + super.withName(name); + return this; + } + + /** {@inheritDoc} */ + @Override + public MetricCriteria withMetricName(String metricName) { + super.withMetricName(metricName); + return this; + } + + /** {@inheritDoc} */ + @Override + public MetricCriteria withMetricNamespace(String metricNamespace) { + super.withMetricNamespace(metricNamespace); + return this; + } + + /** {@inheritDoc} */ + @Override + public MetricCriteria withTimeAggregation(AggregationTypeEnum timeAggregation) { + super.withTimeAggregation(timeAggregation); + return this; + } + + /** {@inheritDoc} */ + @Override + public MetricCriteria withDimensions(List dimensions) { + super.withDimensions(dimensions); + return this; + } + + /** {@inheritDoc} */ + @Override + public MetricCriteria withSkipMetricValidation(Boolean skipMetricValidation) { + super.withSkipMetricValidation(skipMetricValidation); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (operator() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property operator in model MetricCriteria")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricCriteria.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDefinition.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDefinition.java new file mode 100644 index 0000000000000..d61d96b5dd6b3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDefinition.java @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricDefinitionInner; +import java.util.List; + +/** An immutable client-side representation of MetricDefinition. */ +public interface MetricDefinition { + /** + * Gets the isDimensionRequired property: Flag to indicate whether the dimension is required. + * + * @return the isDimensionRequired value. + */ + Boolean isDimensionRequired(); + + /** + * Gets the resourceId property: the resource identifier of the resource that emitted the metric. + * + * @return the resourceId value. + */ + String resourceId(); + + /** + * Gets the namespace property: the namespace the metric belongs to. + * + * @return the namespace value. + */ + String namespace(); + + /** + * Gets the name property: the name and the display name of the metric, i.e. it is a localizable string. + * + * @return the name value. + */ + LocalizableString name(); + + /** + * Gets the displayDescription property: Detailed description of this metric. + * + * @return the displayDescription value. + */ + String displayDescription(); + + /** + * Gets the category property: Custom category name for this metric. + * + * @return the category value. + */ + String category(); + + /** + * Gets the metricClass property: The class of the metric. + * + * @return the metricClass value. + */ + MetricClass metricClass(); + + /** + * Gets the unit property: The unit of the metric. + * + * @return the unit value. + */ + MetricUnit unit(); + + /** + * Gets the primaryAggregationType property: the primary aggregation type value defining how to use the values for + * display. + * + * @return the primaryAggregationType value. + */ + AggregationType primaryAggregationType(); + + /** + * Gets the supportedAggregationTypes property: the collection of what aggregation types are supported. + * + * @return the supportedAggregationTypes value. + */ + List supportedAggregationTypes(); + + /** + * Gets the metricAvailabilities property: the collection of what aggregation intervals are available to be queried. + * + * @return the metricAvailabilities value. + */ + List metricAvailabilities(); + + /** + * Gets the id property: the resource identifier of the metric definition. + * + * @return the id value. + */ + String id(); + + /** + * Gets the dimensions property: the name and the display name of the dimension, i.e. it is a localizable string. + * + * @return the dimensions value. + */ + List dimensions(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.MetricDefinitionInner object. + * + * @return the inner object. + */ + MetricDefinitionInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDefinitionCollection.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDefinitionCollection.java new file mode 100644 index 0000000000000..764843d9ece97 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDefinitionCollection.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricDefinitionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents collection of metric definitions. */ +@Fluent +public final class MetricDefinitionCollection { + /* + * the values for the metric definitions. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** Creates an instance of MetricDefinitionCollection class. */ + public MetricDefinitionCollection() { + } + + /** + * Get the value property: the values for the metric definitions. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: the values for the metric definitions. + * + * @param value the value value to set. + * @return the MetricDefinitionCollection object itself. + */ + public MetricDefinitionCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property value in model MetricDefinitionCollection")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricDefinitionCollection.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDefinitions.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDefinitions.java new file mode 100644 index 0000000000000..35133d3d423b5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDefinitions.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of MetricDefinitions. */ +public interface MetricDefinitions { + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric definitions as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri); + + /** + * Lists the metric definitions for the resource. + * + * @param resourceUri The identifier of the resource. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric definitions as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri, String metricnamespace, Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDimension.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDimension.java new file mode 100644 index 0000000000000..a02b8a9ac12f2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDimension.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specifies a metric dimension. */ +@Fluent +public final class MetricDimension { + /* + * Name of the dimension. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * the dimension operator. Only 'Include' and 'Exclude' are supported + */ + @JsonProperty(value = "operator", required = true) + private String operator; + + /* + * list of dimension values. + */ + @JsonProperty(value = "values", required = true) + private List values; + + /** Creates an instance of MetricDimension class. */ + public MetricDimension() { + } + + /** + * Get the name property: Name of the dimension. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the dimension. + * + * @param name the name value to set. + * @return the MetricDimension object itself. + */ + public MetricDimension withName(String name) { + this.name = name; + return this; + } + + /** + * Get the operator property: the dimension operator. Only 'Include' and 'Exclude' are supported. + * + * @return the operator value. + */ + public String operator() { + return this.operator; + } + + /** + * Set the operator property: the dimension operator. Only 'Include' and 'Exclude' are supported. + * + * @param operator the operator value to set. + * @return the MetricDimension object itself. + */ + public MetricDimension withOperator(String operator) { + this.operator = operator; + return this; + } + + /** + * Get the values property: list of dimension values. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: list of dimension values. + * + * @param values the values value to set. + * @return the MetricDimension object itself. + */ + public MetricDimension withValues(List values) { + this.values = values; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model MetricDimension")); + } + if (operator() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property operator in model MetricDimension")); + } + if (values() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property values in model MetricDimension")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricDimension.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespace.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespace.java new file mode 100644 index 0000000000000..40cd52ca43660 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespace.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricNamespaceInner; + +/** An immutable client-side representation of MetricNamespace. */ +public interface MetricNamespace { + /** + * Gets the id property: The ID of the metric namespace. + * + * @return the id value. + */ + String id(); + + /** + * Gets the type property: The type of the namespace. + * + * @return the type value. + */ + String type(); + + /** + * Gets the name property: The escaped name of the namespace. + * + * @return the name value. + */ + String name(); + + /** + * Gets the classification property: Kind of namespace. + * + * @return the classification value. + */ + NamespaceClassification classification(); + + /** + * Gets the properties property: Properties which include the fully qualified namespace name. + * + * @return the properties value. + */ + MetricNamespaceName properties(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.MetricNamespaceInner object. + * + * @return the inner object. + */ + MetricNamespaceInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespaceCollection.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespaceCollection.java new file mode 100644 index 0000000000000..457007a5d7b20 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespaceCollection.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricNamespaceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents collection of metric namespaces. */ +@Fluent +public final class MetricNamespaceCollection { + /* + * The values for the metric namespaces. + */ + @JsonProperty(value = "value", required = true) + private List value; + + /** Creates an instance of MetricNamespaceCollection class. */ + public MetricNamespaceCollection() { + } + + /** + * Get the value property: The values for the metric namespaces. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The values for the metric namespaces. + * + * @param value the value value to set. + * @return the MetricNamespaceCollection object itself. + */ + public MetricNamespaceCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model MetricNamespaceCollection")); + } else { + value().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricNamespaceCollection.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespaceName.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespaceName.java new file mode 100644 index 0000000000000..f3aac4a514556 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespaceName.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The fully qualified metric namespace name. */ +@Fluent +public final class MetricNamespaceName { + /* + * The metric namespace name. + */ + @JsonProperty(value = "metricNamespaceName") + private String metricNamespaceName; + + /** Creates an instance of MetricNamespaceName class. */ + public MetricNamespaceName() { + } + + /** + * Get the metricNamespaceName property: The metric namespace name. + * + * @return the metricNamespaceName value. + */ + public String metricNamespaceName() { + return this.metricNamespaceName; + } + + /** + * Set the metricNamespaceName property: The metric namespace name. + * + * @param metricNamespaceName the metricNamespaceName value to set. + * @return the MetricNamespaceName object itself. + */ + public MetricNamespaceName withMetricNamespaceName(String metricNamespaceName) { + this.metricNamespaceName = metricNamespaceName; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespaces.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespaces.java new file mode 100644 index 0000000000000..b9b012690af9a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespaces.java @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of MetricNamespaces. */ +public interface MetricNamespaces { + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric namespaces as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri); + + /** + * Lists the metric namespaces for the resource. + * + * @param resourceUri The identifier of the resource. + * @param startTime The ISO 8601 conform Date start time from which to query for metric namespaces. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents collection of metric namespaces as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String resourceUri, String startTime, Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricSettings.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricSettings.java new file mode 100644 index 0000000000000..19a91ef850fe1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricSettings.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; + +/** Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular metric. */ +@Fluent +public final class MetricSettings { + /* + * the timegrain of the metric in ISO8601 format. + */ + @JsonProperty(value = "timeGrain") + private Duration timeGrain; + + /* + * 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. + */ + @JsonProperty(value = "category") + private String category; + + /* + * a value indicating whether this category is enabled. + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /* + * the retention policy for this category. + */ + @JsonProperty(value = "retentionPolicy") + private RetentionPolicy retentionPolicy; + + /** Creates an instance of MetricSettings class. */ + public MetricSettings() { + } + + /** + * Get the timeGrain property: the timegrain of the metric in ISO8601 format. + * + * @return the timeGrain value. + */ + public Duration timeGrain() { + return this.timeGrain; + } + + /** + * Set the timeGrain property: the timegrain of the metric in ISO8601 format. + * + * @param timeGrain the timeGrain value to set. + * @return the MetricSettings object itself. + */ + public MetricSettings withTimeGrain(Duration timeGrain) { + this.timeGrain = timeGrain; + return this; + } + + /** + * Get the category property: 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. + * + * @return the category value. + */ + public String category() { + return this.category; + } + + /** + * Set the category property: 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. + * + * @param category the category value to set. + * @return the MetricSettings object itself. + */ + public MetricSettings withCategory(String category) { + this.category = category; + return this; + } + + /** + * Get the enabled property: a value indicating whether this category is enabled. + * + * @return the enabled value. + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: a value indicating whether this category is enabled. + * + * @param enabled the enabled value to set. + * @return the MetricSettings object itself. + */ + public MetricSettings withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the retentionPolicy property: the retention policy for this category. + * + * @return the retentionPolicy value. + */ + public RetentionPolicy retentionPolicy() { + return this.retentionPolicy; + } + + /** + * Set the retentionPolicy property: the retention policy for this category. + * + * @param retentionPolicy the retentionPolicy value to set. + * @return the MetricSettings object itself. + */ + public MetricSettings withRetentionPolicy(RetentionPolicy retentionPolicy) { + this.retentionPolicy = retentionPolicy; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (retentionPolicy() != null) { + retentionPolicy().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricSingleDimension.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricSingleDimension.java new file mode 100644 index 0000000000000..2bdcb584ac754 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricSingleDimension.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The metric dimension name and value. */ +@Fluent +public final class MetricSingleDimension { + /* + * Name of the dimension. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Value of the dimension. + */ + @JsonProperty(value = "value", required = true) + private String value; + + /** Creates an instance of MetricSingleDimension class. */ + public MetricSingleDimension() { + } + + /** + * Get the name property: Name of the dimension. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the dimension. + * + * @param name the name value to set. + * @return the MetricSingleDimension object itself. + */ + public MetricSingleDimension withName(String name) { + this.name = name; + return this; + } + + /** + * Get the value property: Value of the dimension. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Value of the dimension. + * + * @param value the value value to set. + * @return the MetricSingleDimension object itself. + */ + public MetricSingleDimension withValue(String value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model MetricSingleDimension")); + } + if (value() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property value in model MetricSingleDimension")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricSingleDimension.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricStatisticType.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricStatisticType.java new file mode 100644 index 0000000000000..32bd57098525b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricStatisticType.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** the metric statistic type. How the metrics from multiple instances are combined. */ +public enum MetricStatisticType { + /** Enum value Average. */ + AVERAGE("Average"), + + /** Enum value Min. */ + MIN("Min"), + + /** Enum value Max. */ + MAX("Max"), + + /** Enum value Sum. */ + SUM("Sum"), + + /** Enum value Count. */ + COUNT("Count"); + + /** The actual serialized value for a MetricStatisticType instance. */ + private final String value; + + MetricStatisticType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a MetricStatisticType instance. + * + * @param value the serialized value to parse. + * @return the parsed MetricStatisticType object, or null if unable to parse. + */ + @JsonCreator + public static MetricStatisticType fromString(String value) { + if (value == null) { + return null; + } + MetricStatisticType[] items = MetricStatisticType.values(); + for (MetricStatisticType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricTrigger.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricTrigger.java new file mode 100644 index 0000000000000..f92f7a8d26ecb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricTrigger.java @@ -0,0 +1,396 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.util.List; + +/** The trigger that results in a scaling action. */ +@Fluent +public final class MetricTrigger { + /* + * the name of the metric that defines what the rule monitors. + */ + @JsonProperty(value = "metricName", required = true) + private String metricName; + + /* + * the namespace of the metric that defines what the rule monitors. + */ + @JsonProperty(value = "metricNamespace") + private String metricNamespace; + + /* + * the resource identifier of the resource the rule monitors. + */ + @JsonProperty(value = "metricResourceUri", required = true) + private String metricResourceUri; + + /* + * the location of the resource the rule monitors. + */ + @JsonProperty(value = "metricResourceLocation") + private String metricResourceLocation; + + /* + * 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. + */ + @JsonProperty(value = "timeGrain", required = true) + private Duration timeGrain; + + /* + * the metric statistic type. How the metrics from multiple instances are combined. + */ + @JsonProperty(value = "statistic", required = true) + private MetricStatisticType statistic; + + /* + * 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. + */ + @JsonProperty(value = "timeWindow", required = true) + private Duration timeWindow; + + /* + * time aggregation type. How the data that is collected should be combined over time. The default value is + * Average. + */ + @JsonProperty(value = "timeAggregation", required = true) + private TimeAggregationType timeAggregation; + + /* + * the operator that is used to compare the metric data and the threshold. + */ + @JsonProperty(value = "operator", required = true) + private ComparisonOperationType operator; + + /* + * the threshold of the metric that triggers the scale action. + */ + @JsonProperty(value = "threshold", required = true) + private double threshold; + + /* + * List of dimension conditions. For example: + * [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment"" + + ","Operator":"Equals","Values":["default"]}]. + */ + @JsonProperty(value = "dimensions") + private List dimensions; + + /* + * a value indicating whether metric should divide per instance. + */ + @JsonProperty(value = "dividePerInstance") + private Boolean dividePerInstance; + + /** Creates an instance of MetricTrigger class. */ + public MetricTrigger() { + } + + /** + * Get the metricName property: the name of the metric that defines what the rule monitors. + * + * @return the metricName value. + */ + public String metricName() { + return this.metricName; + } + + /** + * Set the metricName property: the name of the metric that defines what the rule monitors. + * + * @param metricName the metricName value to set. + * @return the MetricTrigger object itself. + */ + public MetricTrigger withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * Get the metricNamespace property: the namespace of the metric that defines what the rule monitors. + * + * @return the metricNamespace value. + */ + public String metricNamespace() { + return this.metricNamespace; + } + + /** + * Set the metricNamespace property: the namespace of the metric that defines what the rule monitors. + * + * @param metricNamespace the metricNamespace value to set. + * @return the MetricTrigger object itself. + */ + public MetricTrigger withMetricNamespace(String metricNamespace) { + this.metricNamespace = metricNamespace; + return this; + } + + /** + * Get the metricResourceUri property: the resource identifier of the resource the rule monitors. + * + * @return the metricResourceUri value. + */ + public String metricResourceUri() { + return this.metricResourceUri; + } + + /** + * Set the metricResourceUri property: the resource identifier of the resource the rule monitors. + * + * @param metricResourceUri the metricResourceUri value to set. + * @return the MetricTrigger object itself. + */ + public MetricTrigger withMetricResourceUri(String metricResourceUri) { + this.metricResourceUri = metricResourceUri; + return this; + } + + /** + * Get the metricResourceLocation property: the location of the resource the rule monitors. + * + * @return the metricResourceLocation value. + */ + public String metricResourceLocation() { + return this.metricResourceLocation; + } + + /** + * Set the metricResourceLocation property: the location of the resource the rule monitors. + * + * @param metricResourceLocation the metricResourceLocation value to set. + * @return the MetricTrigger object itself. + */ + public MetricTrigger withMetricResourceLocation(String metricResourceLocation) { + this.metricResourceLocation = metricResourceLocation; + return this; + } + + /** + * Get the timeGrain property: 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. + * + * @return the timeGrain value. + */ + public Duration timeGrain() { + return this.timeGrain; + } + + /** + * Set the timeGrain property: 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. + * + * @param timeGrain the timeGrain value to set. + * @return the MetricTrigger object itself. + */ + public MetricTrigger withTimeGrain(Duration timeGrain) { + this.timeGrain = timeGrain; + return this; + } + + /** + * Get the statistic property: the metric statistic type. How the metrics from multiple instances are combined. + * + * @return the statistic value. + */ + public MetricStatisticType statistic() { + return this.statistic; + } + + /** + * Set the statistic property: the metric statistic type. How the metrics from multiple instances are combined. + * + * @param statistic the statistic value to set. + * @return the MetricTrigger object itself. + */ + public MetricTrigger withStatistic(MetricStatisticType statistic) { + this.statistic = statistic; + return this; + } + + /** + * Get the timeWindow property: 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. + * + * @return the timeWindow value. + */ + public Duration timeWindow() { + return this.timeWindow; + } + + /** + * Set the timeWindow property: 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. + * + * @param timeWindow the timeWindow value to set. + * @return the MetricTrigger object itself. + */ + public MetricTrigger withTimeWindow(Duration timeWindow) { + this.timeWindow = timeWindow; + return this; + } + + /** + * Get the timeAggregation property: time aggregation type. How the data that is collected should be combined over + * time. The default value is Average. + * + * @return the timeAggregation value. + */ + public TimeAggregationType timeAggregation() { + return this.timeAggregation; + } + + /** + * Set the timeAggregation property: time aggregation type. How the data that is collected should be combined over + * time. The default value is Average. + * + * @param timeAggregation the timeAggregation value to set. + * @return the MetricTrigger object itself. + */ + public MetricTrigger withTimeAggregation(TimeAggregationType timeAggregation) { + this.timeAggregation = timeAggregation; + return this; + } + + /** + * Get the operator property: the operator that is used to compare the metric data and the threshold. + * + * @return the operator value. + */ + public ComparisonOperationType operator() { + return this.operator; + } + + /** + * Set the operator property: the operator that is used to compare the metric data and the threshold. + * + * @param operator the operator value to set. + * @return the MetricTrigger object itself. + */ + public MetricTrigger withOperator(ComparisonOperationType operator) { + this.operator = operator; + return this; + } + + /** + * Get the threshold property: the threshold of the metric that triggers the scale action. + * + * @return the threshold value. + */ + public double threshold() { + return this.threshold; + } + + /** + * Set the threshold property: the threshold of the metric that triggers the scale action. + * + * @param threshold the threshold value to set. + * @return the MetricTrigger object itself. + */ + public MetricTrigger withThreshold(double threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the dimensions property: List of dimension conditions. For example: + * [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment"" + + ","Operator":"Equals","Values":["default"]}]. + * + * @return the dimensions value. + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Set the dimensions property: List of dimension conditions. For example: + * [{"DimensionName":"AppName","Operator":"Equals","Values":["App1"]},{"DimensionName":"Deployment"" + + ","Operator":"Equals","Values":["default"]}]. + * + * @param dimensions the dimensions value to set. + * @return the MetricTrigger object itself. + */ + public MetricTrigger withDimensions(List dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Get the dividePerInstance property: a value indicating whether metric should divide per instance. + * + * @return the dividePerInstance value. + */ + public Boolean dividePerInstance() { + return this.dividePerInstance; + } + + /** + * Set the dividePerInstance property: a value indicating whether metric should divide per instance. + * + * @param dividePerInstance the dividePerInstance value to set. + * @return the MetricTrigger object itself. + */ + public MetricTrigger withDividePerInstance(Boolean dividePerInstance) { + this.dividePerInstance = dividePerInstance; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metricName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property metricName in model MetricTrigger")); + } + if (metricResourceUri() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property metricResourceUri in model MetricTrigger")); + } + if (timeGrain() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property timeGrain in model MetricTrigger")); + } + if (statistic() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property statistic in model MetricTrigger")); + } + if (timeWindow() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property timeWindow in model MetricTrigger")); + } + if (timeAggregation() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property timeAggregation in model MetricTrigger")); + } + if (operator() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property operator in model MetricTrigger")); + } + if (dimensions() != null) { + dimensions().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricTrigger.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricUnit.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricUnit.java new file mode 100644 index 0000000000000..223c0b7085cb1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricUnit.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The unit of the metric. */ +public final class MetricUnit extends ExpandableStringEnum { + /** Static value Count for MetricUnit. */ + public static final MetricUnit COUNT = fromString("Count"); + + /** Static value Bytes for MetricUnit. */ + public static final MetricUnit BYTES = fromString("Bytes"); + + /** Static value Seconds for MetricUnit. */ + public static final MetricUnit SECONDS = fromString("Seconds"); + + /** Static value CountPerSecond for MetricUnit. */ + public static final MetricUnit COUNT_PER_SECOND = fromString("CountPerSecond"); + + /** Static value BytesPerSecond for MetricUnit. */ + public static final MetricUnit BYTES_PER_SECOND = fromString("BytesPerSecond"); + + /** Static value Percent for MetricUnit. */ + public static final MetricUnit PERCENT = fromString("Percent"); + + /** Static value MilliSeconds for MetricUnit. */ + public static final MetricUnit MILLI_SECONDS = fromString("MilliSeconds"); + + /** Static value ByteSeconds for MetricUnit. */ + public static final MetricUnit BYTE_SECONDS = fromString("ByteSeconds"); + + /** Static value Unspecified for MetricUnit. */ + public static final MetricUnit UNSPECIFIED = fromString("Unspecified"); + + /** Static value Cores for MetricUnit. */ + public static final MetricUnit CORES = fromString("Cores"); + + /** Static value MilliCores for MetricUnit. */ + public static final MetricUnit MILLI_CORES = fromString("MilliCores"); + + /** Static value NanoCores for MetricUnit. */ + public static final MetricUnit NANO_CORES = fromString("NanoCores"); + + /** Static value BitsPerSecond for MetricUnit. */ + public static final MetricUnit BITS_PER_SECOND = fromString("BitsPerSecond"); + + /** + * Creates a new instance of MetricUnit value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MetricUnit() { + } + + /** + * Creates or finds a MetricUnit from its string representation. + * + * @param name a name to look for. + * @return the corresponding MetricUnit. + */ + @JsonCreator + public static MetricUnit fromString(String name) { + return fromString(name, MetricUnit.class); + } + + /** + * Gets known MetricUnit values. + * + * @return known MetricUnit values. + */ + public static Collection values() { + return values(MetricUnit.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricValue.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricValue.java new file mode 100644 index 0000000000000..c89664f7d2182 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricValue.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents a metric value. */ +@Fluent +public final class MetricValue { + /* + * the timestamp for the metric value in ISO 8601 format. + */ + @JsonProperty(value = "timeStamp", required = true) + private OffsetDateTime timestamp; + + /* + * the average value in the time range. + */ + @JsonProperty(value = "average") + private Double average; + + /* + * the least value in the time range. + */ + @JsonProperty(value = "minimum") + private Double minimum; + + /* + * the greatest value in the time range. + */ + @JsonProperty(value = "maximum") + private Double maximum; + + /* + * the sum of all of the values in the time range. + */ + @JsonProperty(value = "total") + private Double total; + + /* + * the number of samples in the time range. Can be used to determine the number of values that contributed to the + * average value. + */ + @JsonProperty(value = "count") + private Double count; + + /** Creates an instance of MetricValue class. */ + public MetricValue() { + } + + /** + * Get the timestamp property: the timestamp for the metric value in ISO 8601 format. + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Set the timestamp property: the timestamp for the metric value in ISO 8601 format. + * + * @param timestamp the timestamp value to set. + * @return the MetricValue object itself. + */ + public MetricValue withTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get the average property: the average value in the time range. + * + * @return the average value. + */ + public Double average() { + return this.average; + } + + /** + * Set the average property: the average value in the time range. + * + * @param average the average value to set. + * @return the MetricValue object itself. + */ + public MetricValue withAverage(Double average) { + this.average = average; + return this; + } + + /** + * Get the minimum property: the least value in the time range. + * + * @return the minimum value. + */ + public Double minimum() { + return this.minimum; + } + + /** + * Set the minimum property: the least value in the time range. + * + * @param minimum the minimum value to set. + * @return the MetricValue object itself. + */ + public MetricValue withMinimum(Double minimum) { + this.minimum = minimum; + return this; + } + + /** + * Get the maximum property: the greatest value in the time range. + * + * @return the maximum value. + */ + public Double maximum() { + return this.maximum; + } + + /** + * Set the maximum property: the greatest value in the time range. + * + * @param maximum the maximum value to set. + * @return the MetricValue object itself. + */ + public MetricValue withMaximum(Double maximum) { + this.maximum = maximum; + return this; + } + + /** + * Get the total property: the sum of all of the values in the time range. + * + * @return the total value. + */ + public Double total() { + return this.total; + } + + /** + * Set the total property: the sum of all of the values in the time range. + * + * @param total the total value to set. + * @return the MetricValue object itself. + */ + public MetricValue withTotal(Double total) { + this.total = total; + return this; + } + + /** + * Get the count property: the number of samples in the time range. Can be used to determine the number of values + * that contributed to the average value. + * + * @return the count value. + */ + public Double count() { + return this.count; + } + + /** + * Set the count property: the number of samples in the time range. Can be used to determine the number of values + * that contributed to the average value. + * + * @param count the count value to set. + * @return the MetricValue object itself. + */ + public MetricValue withCount(Double count) { + this.count = count; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (timestamp() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property timestamp in model MetricValue")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MetricValue.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Metrics.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Metrics.java new file mode 100644 index 0000000000000..d2f43318a75be --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Metrics.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about metrics for the workspace. */ +@Immutable +public class Metrics { + /* + * The Prometheus query endpoint for the workspace + */ + @JsonProperty(value = "prometheusQueryEndpoint", access = JsonProperty.Access.WRITE_ONLY) + private String prometheusQueryEndpoint; + + /* + * An internal identifier for the metrics container. Only to be used by the system + */ + @JsonProperty(value = "internalId", access = JsonProperty.Access.WRITE_ONLY) + private String internalId; + + /** Creates an instance of Metrics class. */ + public Metrics() { + } + + /** + * Get the prometheusQueryEndpoint property: The Prometheus query endpoint for the workspace. + * + * @return the prometheusQueryEndpoint value. + */ + public String prometheusQueryEndpoint() { + return this.prometheusQueryEndpoint; + } + + /** + * Get the internalId property: An internal identifier for the metrics container. Only to be used by the system. + * + * @return the internalId value. + */ + public String internalId() { + return this.internalId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricsOperations.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricsOperations.java new file mode 100644 index 0000000000000..9ae2f6d1eba87 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricsOperations.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.time.Duration; + +/** Resource collection API of MetricsOperations. */ +public interface MetricsOperations { + /** + * **Lists the metric values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @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'**. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param top The maximum number of records to retrieve. Valid only if $filter is specified. Defaults to 10. + * @param orderBy The aggregation to use for sorting results and the direction of the sort. Only one order can be + * specified. Examples: sum asc. + * @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' "**. + * @param resultType Reduces the set of data collected. The syntax allowed depends on the operation. See the + * operation's description for details. + * @param metricnamespace Metric namespace to query metric definitions for. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a metrics query along with {@link Response}. + */ + Response listWithResponse( + String resourceUri, + String timespan, + Duration interval, + String metricnames, + String aggregation, + Integer top, + String orderBy, + String filter, + ResultType resultType, + String metricnamespace, + Context context); + + /** + * **Lists the metric values for a resource**. + * + * @param resourceUri The identifier of the resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the response to a metrics query. + */ + ResponseModel list(String resourceUri); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MonitorOperations.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MonitorOperations.java new file mode 100644 index 0000000000000..1ed59aa7e3aa2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MonitorOperations.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of MonitorOperations. */ +public interface MonitorOperations { + /** + * Lists available Operations for this Resource Provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * Lists available Operations for this Resource Provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of REST API operations supported by an Azure Resource Provider as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MultiMetricCriteria.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MultiMetricCriteria.java new file mode 100644 index 0000000000000..26941a2542c25 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MultiMetricCriteria.java @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** The types of conditions for a multi resource alert. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "criterionType", + defaultImpl = MultiMetricCriteria.class) +@JsonTypeName("MultiMetricCriteria") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "StaticThresholdCriterion", value = MetricCriteria.class), + @JsonSubTypes.Type(name = "DynamicThresholdCriterion", value = DynamicMetricCriteria.class) +}) +@Fluent +public class MultiMetricCriteria { + /* + * Name of the criteria. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Name of the metric. + */ + @JsonProperty(value = "metricName", required = true) + private String metricName; + + /* + * Namespace of the metric. + */ + @JsonProperty(value = "metricNamespace") + private String metricNamespace; + + /* + * the criteria time aggregation types. + */ + @JsonProperty(value = "timeAggregation", required = true) + private AggregationTypeEnum timeAggregation; + + /* + * List of dimension conditions. + */ + @JsonProperty(value = "dimensions") + private List dimensions; + + /* + * Allows creating an alert rule on a custom metric that isn't yet emitted, by causing the metric validation to be + * skipped. + */ + @JsonProperty(value = "skipMetricValidation") + private Boolean skipMetricValidation; + + /* + * The types of conditions for a multi resource alert. + */ + @JsonIgnore private Map additionalProperties; + + /** Creates an instance of MultiMetricCriteria class. */ + public MultiMetricCriteria() { + } + + /** + * Get the name property: Name of the criteria. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Name of the criteria. + * + * @param name the name value to set. + * @return the MultiMetricCriteria object itself. + */ + public MultiMetricCriteria withName(String name) { + this.name = name; + return this; + } + + /** + * Get the metricName property: Name of the metric. + * + * @return the metricName value. + */ + public String metricName() { + return this.metricName; + } + + /** + * Set the metricName property: Name of the metric. + * + * @param metricName the metricName value to set. + * @return the MultiMetricCriteria object itself. + */ + public MultiMetricCriteria withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * Get the metricNamespace property: Namespace of the metric. + * + * @return the metricNamespace value. + */ + public String metricNamespace() { + return this.metricNamespace; + } + + /** + * Set the metricNamespace property: Namespace of the metric. + * + * @param metricNamespace the metricNamespace value to set. + * @return the MultiMetricCriteria object itself. + */ + public MultiMetricCriteria withMetricNamespace(String metricNamespace) { + this.metricNamespace = metricNamespace; + return this; + } + + /** + * Get the timeAggregation property: the criteria time aggregation types. + * + * @return the timeAggregation value. + */ + public AggregationTypeEnum timeAggregation() { + return this.timeAggregation; + } + + /** + * Set the timeAggregation property: the criteria time aggregation types. + * + * @param timeAggregation the timeAggregation value to set. + * @return the MultiMetricCriteria object itself. + */ + public MultiMetricCriteria withTimeAggregation(AggregationTypeEnum timeAggregation) { + this.timeAggregation = timeAggregation; + return this; + } + + /** + * Get the dimensions property: List of dimension conditions. + * + * @return the dimensions value. + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Set the dimensions property: List of dimension conditions. + * + * @param dimensions the dimensions value to set. + * @return the MultiMetricCriteria object itself. + */ + public MultiMetricCriteria withDimensions(List dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Get the skipMetricValidation property: Allows creating an alert rule on a custom metric that isn't yet emitted, + * by causing the metric validation to be skipped. + * + * @return the skipMetricValidation value. + */ + public Boolean skipMetricValidation() { + return this.skipMetricValidation; + } + + /** + * Set the skipMetricValidation property: Allows creating an alert rule on a custom metric that isn't yet emitted, + * by causing the metric validation to be skipped. + * + * @param skipMetricValidation the skipMetricValidation value to set. + * @return the MultiMetricCriteria object itself. + */ + public MultiMetricCriteria withSkipMetricValidation(Boolean skipMetricValidation) { + this.skipMetricValidation = skipMetricValidation; + return this; + } + + /** + * Get the additionalProperties property: The types of conditions for a multi resource alert. + * + * @return the additionalProperties value. + */ + @JsonAnyGetter + public Map additionalProperties() { + return this.additionalProperties; + } + + /** + * Set the additionalProperties property: The types of conditions for a multi resource alert. + * + * @param additionalProperties the additionalProperties value to set. + * @return the MultiMetricCriteria object itself. + */ + public MultiMetricCriteria withAdditionalProperties(Map additionalProperties) { + this.additionalProperties = additionalProperties; + return this; + } + + @JsonAnySetter + void withAdditionalProperties(String key, Object value) { + if (additionalProperties == null) { + additionalProperties = new HashMap<>(); + } + additionalProperties.put(key, value); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model MultiMetricCriteria")); + } + if (metricName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property metricName in model MultiMetricCriteria")); + } + if (timeAggregation() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property timeAggregation in model MultiMetricCriteria")); + } + if (dimensions() != null) { + dimensions().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(MultiMetricCriteria.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/NamespaceClassification.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/NamespaceClassification.java new file mode 100644 index 0000000000000..050e255e1aa6b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/NamespaceClassification.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Kind of namespace. */ +public final class NamespaceClassification extends ExpandableStringEnum { + /** Static value Platform for NamespaceClassification. */ + public static final NamespaceClassification PLATFORM = fromString("Platform"); + + /** Static value Custom for NamespaceClassification. */ + public static final NamespaceClassification CUSTOM = fromString("Custom"); + + /** Static value Qos for NamespaceClassification. */ + public static final NamespaceClassification QOS = fromString("Qos"); + + /** + * Creates a new instance of NamespaceClassification value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public NamespaceClassification() { + } + + /** + * Creates or finds a NamespaceClassification from its string representation. + * + * @param name a name to look for. + * @return the corresponding NamespaceClassification. + */ + @JsonCreator + public static NamespaceClassification fromString(String name) { + return fromString(name, NamespaceClassification.class); + } + + /** + * Gets known NamespaceClassification values. + * + * @return known NamespaceClassification values. + */ + public static Collection values() { + return values(NamespaceClassification.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/NetworkRuleSet.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/NetworkRuleSet.java new file mode 100644 index 0000000000000..238af5632c445 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/NetworkRuleSet.java @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Definition of the network rules. */ +@Fluent +public class NetworkRuleSet { + /* + * The configuration to set whether network access from public internet to the endpoints are allowed. + */ + @JsonProperty(value = "publicNetworkAccess") + private KnownPublicNetworkAccessOptions publicNetworkAccess; + + /** Creates an instance of NetworkRuleSet class. */ + public NetworkRuleSet() { + } + + /** + * Get the publicNetworkAccess property: The configuration to set whether network access from public internet to the + * endpoints are allowed. + * + * @return the publicNetworkAccess value. + */ + public KnownPublicNetworkAccessOptions publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: The configuration to set whether network access from public internet to the + * endpoints are allowed. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the NetworkRuleSet object itself. + */ + public NetworkRuleSet withPublicNetworkAccess(KnownPublicNetworkAccessOptions publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/NotificationRequestBody.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/NotificationRequestBody.java new file mode 100644 index 0000000000000..d5c288bd03ca8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/NotificationRequestBody.java @@ -0,0 +1,393 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The request body which contain contact detail metadata. */ +@Fluent +public final class NotificationRequestBody { + /* + * The value of the supported alert type. Supported alert type values are: servicehealth, metricstaticthreshold, + * metricsdynamicthreshold, logalertv2, smartalert, webtestalert, logalertv1numresult, logalertv1metricmeasurement, + * resourcehealth, activitylog, actualcostbudget, forecastedbudget + */ + @JsonProperty(value = "alertType", required = true) + private String alertType; + + /* + * The list of email receivers that are part of this action group. + */ + @JsonProperty(value = "emailReceivers") + private List emailReceivers; + + /* + * The list of SMS receivers that are part of this action group. + */ + @JsonProperty(value = "smsReceivers") + private List smsReceivers; + + /* + * The list of webhook receivers that are part of this action group. + */ + @JsonProperty(value = "webhookReceivers") + private List webhookReceivers; + + /* + * The list of ITSM receivers that are part of this action group. + */ + @JsonProperty(value = "itsmReceivers") + private List itsmReceivers; + + /* + * The list of AzureAppPush receivers that are part of this action group. + */ + @JsonProperty(value = "azureAppPushReceivers") + private List azureAppPushReceivers; + + /* + * The list of AutomationRunbook receivers that are part of this action group. + */ + @JsonProperty(value = "automationRunbookReceivers") + private List automationRunbookReceivers; + + /* + * The list of voice receivers that are part of this action group. + */ + @JsonProperty(value = "voiceReceivers") + private List voiceReceivers; + + /* + * The list of logic app receivers that are part of this action group. + */ + @JsonProperty(value = "logicAppReceivers") + private List logicAppReceivers; + + /* + * The list of azure function receivers that are part of this action group. + */ + @JsonProperty(value = "azureFunctionReceivers") + private List azureFunctionReceivers; + + /* + * 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. + */ + @JsonProperty(value = "armRoleReceivers") + private List armRoleReceivers; + + /* + * The list of event hub receivers that are part of this action group. + */ + @JsonProperty(value = "eventHubReceivers") + private List eventHubReceivers; + + /** Creates an instance of NotificationRequestBody class. */ + public NotificationRequestBody() { + } + + /** + * Get the alertType property: The value of the supported alert type. Supported alert type values are: + * servicehealth, metricstaticthreshold, metricsdynamicthreshold, logalertv2, smartalert, webtestalert, + * logalertv1numresult, logalertv1metricmeasurement, resourcehealth, activitylog, actualcostbudget, + * forecastedbudget. + * + * @return the alertType value. + */ + public String alertType() { + return this.alertType; + } + + /** + * Set the alertType property: The value of the supported alert type. Supported alert type values are: + * servicehealth, metricstaticthreshold, metricsdynamicthreshold, logalertv2, smartalert, webtestalert, + * logalertv1numresult, logalertv1metricmeasurement, resourcehealth, activitylog, actualcostbudget, + * forecastedbudget. + * + * @param alertType the alertType value to set. + * @return the NotificationRequestBody object itself. + */ + public NotificationRequestBody withAlertType(String alertType) { + this.alertType = alertType; + return this; + } + + /** + * Get the emailReceivers property: The list of email receivers that are part of this action group. + * + * @return the emailReceivers value. + */ + public List emailReceivers() { + return this.emailReceivers; + } + + /** + * Set the emailReceivers property: The list of email receivers that are part of this action group. + * + * @param emailReceivers the emailReceivers value to set. + * @return the NotificationRequestBody object itself. + */ + public NotificationRequestBody withEmailReceivers(List emailReceivers) { + this.emailReceivers = emailReceivers; + return this; + } + + /** + * Get the smsReceivers property: The list of SMS receivers that are part of this action group. + * + * @return the smsReceivers value. + */ + public List smsReceivers() { + return this.smsReceivers; + } + + /** + * Set the smsReceivers property: The list of SMS receivers that are part of this action group. + * + * @param smsReceivers the smsReceivers value to set. + * @return the NotificationRequestBody object itself. + */ + public NotificationRequestBody withSmsReceivers(List smsReceivers) { + this.smsReceivers = smsReceivers; + return this; + } + + /** + * Get the webhookReceivers property: The list of webhook receivers that are part of this action group. + * + * @return the webhookReceivers value. + */ + public List webhookReceivers() { + return this.webhookReceivers; + } + + /** + * Set the webhookReceivers property: The list of webhook receivers that are part of this action group. + * + * @param webhookReceivers the webhookReceivers value to set. + * @return the NotificationRequestBody object itself. + */ + public NotificationRequestBody withWebhookReceivers(List webhookReceivers) { + this.webhookReceivers = webhookReceivers; + return this; + } + + /** + * Get the itsmReceivers property: The list of ITSM receivers that are part of this action group. + * + * @return the itsmReceivers value. + */ + public List itsmReceivers() { + return this.itsmReceivers; + } + + /** + * Set the itsmReceivers property: The list of ITSM receivers that are part of this action group. + * + * @param itsmReceivers the itsmReceivers value to set. + * @return the NotificationRequestBody object itself. + */ + public NotificationRequestBody withItsmReceivers(List itsmReceivers) { + this.itsmReceivers = itsmReceivers; + return this; + } + + /** + * Get the azureAppPushReceivers property: The list of AzureAppPush receivers that are part of this action group. + * + * @return the azureAppPushReceivers value. + */ + public List azureAppPushReceivers() { + return this.azureAppPushReceivers; + } + + /** + * Set the azureAppPushReceivers property: The list of AzureAppPush receivers that are part of this action group. + * + * @param azureAppPushReceivers the azureAppPushReceivers value to set. + * @return the NotificationRequestBody object itself. + */ + public NotificationRequestBody withAzureAppPushReceivers(List azureAppPushReceivers) { + this.azureAppPushReceivers = azureAppPushReceivers; + return this; + } + + /** + * Get the automationRunbookReceivers property: The list of AutomationRunbook receivers that are part of this action + * group. + * + * @return the automationRunbookReceivers value. + */ + public List automationRunbookReceivers() { + return this.automationRunbookReceivers; + } + + /** + * Set the automationRunbookReceivers property: The list of AutomationRunbook receivers that are part of this action + * group. + * + * @param automationRunbookReceivers the automationRunbookReceivers value to set. + * @return the NotificationRequestBody object itself. + */ + public NotificationRequestBody withAutomationRunbookReceivers( + List automationRunbookReceivers) { + this.automationRunbookReceivers = automationRunbookReceivers; + return this; + } + + /** + * Get the voiceReceivers property: The list of voice receivers that are part of this action group. + * + * @return the voiceReceivers value. + */ + public List voiceReceivers() { + return this.voiceReceivers; + } + + /** + * Set the voiceReceivers property: The list of voice receivers that are part of this action group. + * + * @param voiceReceivers the voiceReceivers value to set. + * @return the NotificationRequestBody object itself. + */ + public NotificationRequestBody withVoiceReceivers(List voiceReceivers) { + this.voiceReceivers = voiceReceivers; + return this; + } + + /** + * Get the logicAppReceivers property: The list of logic app receivers that are part of this action group. + * + * @return the logicAppReceivers value. + */ + public List logicAppReceivers() { + return this.logicAppReceivers; + } + + /** + * Set the logicAppReceivers property: The list of logic app receivers that are part of this action group. + * + * @param logicAppReceivers the logicAppReceivers value to set. + * @return the NotificationRequestBody object itself. + */ + public NotificationRequestBody withLogicAppReceivers(List logicAppReceivers) { + this.logicAppReceivers = logicAppReceivers; + return this; + } + + /** + * Get the azureFunctionReceivers property: The list of azure function receivers that are part of this action group. + * + * @return the azureFunctionReceivers value. + */ + public List azureFunctionReceivers() { + return this.azureFunctionReceivers; + } + + /** + * Set the azureFunctionReceivers property: The list of azure function receivers that are part of this action group. + * + * @param azureFunctionReceivers the azureFunctionReceivers value to set. + * @return the NotificationRequestBody object itself. + */ + public NotificationRequestBody withAzureFunctionReceivers(List azureFunctionReceivers) { + this.azureFunctionReceivers = azureFunctionReceivers; + return this; + } + + /** + * Get the armRoleReceivers property: 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. + * + * @return the armRoleReceivers value. + */ + public List armRoleReceivers() { + return this.armRoleReceivers; + } + + /** + * Set the armRoleReceivers property: 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. + * + * @param armRoleReceivers the armRoleReceivers value to set. + * @return the NotificationRequestBody object itself. + */ + public NotificationRequestBody withArmRoleReceivers(List armRoleReceivers) { + this.armRoleReceivers = armRoleReceivers; + return this; + } + + /** + * Get the eventHubReceivers property: The list of event hub receivers that are part of this action group. + * + * @return the eventHubReceivers value. + */ + public List eventHubReceivers() { + return this.eventHubReceivers; + } + + /** + * Set the eventHubReceivers property: The list of event hub receivers that are part of this action group. + * + * @param eventHubReceivers the eventHubReceivers value to set. + * @return the NotificationRequestBody object itself. + */ + public NotificationRequestBody withEventHubReceivers(List eventHubReceivers) { + this.eventHubReceivers = eventHubReceivers; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (alertType() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property alertType in model NotificationRequestBody")); + } + if (emailReceivers() != null) { + emailReceivers().forEach(e -> e.validate()); + } + if (smsReceivers() != null) { + smsReceivers().forEach(e -> e.validate()); + } + if (webhookReceivers() != null) { + webhookReceivers().forEach(e -> e.validate()); + } + if (itsmReceivers() != null) { + itsmReceivers().forEach(e -> e.validate()); + } + if (azureAppPushReceivers() != null) { + azureAppPushReceivers().forEach(e -> e.validate()); + } + if (automationRunbookReceivers() != null) { + automationRunbookReceivers().forEach(e -> e.validate()); + } + if (voiceReceivers() != null) { + voiceReceivers().forEach(e -> e.validate()); + } + if (logicAppReceivers() != null) { + logicAppReceivers().forEach(e -> e.validate()); + } + if (azureFunctionReceivers() != null) { + azureFunctionReceivers().forEach(e -> e.validate()); + } + if (armRoleReceivers() != null) { + armRoleReceivers().forEach(e -> e.validate()); + } + if (eventHubReceivers() != null) { + eventHubReceivers().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(NotificationRequestBody.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Odatatype.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Odatatype.java new file mode 100644 index 0000000000000..1786a7b05229d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Odatatype.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** specifies the type of the alert criteria. */ +public final class Odatatype extends ExpandableStringEnum { + /** Static value Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria for Odatatype. */ + public static final Odatatype MICROSOFT_AZURE_MONITOR_SINGLE_RESOURCE_MULTIPLE_METRIC_CRITERIA = + fromString("Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria"); + + /** Static value Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria for Odatatype. */ + public static final Odatatype MICROSOFT_AZURE_MONITOR_MULTIPLE_RESOURCE_MULTIPLE_METRIC_CRITERIA = + fromString("Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria"); + + /** Static value Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria for Odatatype. */ + public static final Odatatype MICROSOFT_AZURE_MONITOR_WEBTEST_LOCATION_AVAILABILITY_CRITERIA = + fromString("Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria"); + + /** + * Creates a new instance of Odatatype value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Odatatype() { + } + + /** + * Creates or finds a Odatatype from its string representation. + * + * @param name a name to look for. + * @return the corresponding Odatatype. + */ + @JsonCreator + public static Odatatype fromString(String name) { + return fromString(name, Odatatype.class); + } + + /** + * Gets known Odatatype values. + * + * @return known Odatatype values. + */ + public static Collection values() { + return values(Odatatype.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OnboardingStatus.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OnboardingStatus.java new file mode 100644 index 0000000000000..ef339519c504d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OnboardingStatus.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * 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. + */ +public final class OnboardingStatus extends ExpandableStringEnum { + /** Static value onboarded for OnboardingStatus. */ + public static final OnboardingStatus ONBOARDED = fromString("onboarded"); + + /** Static value notOnboarded for OnboardingStatus. */ + public static final OnboardingStatus NOT_ONBOARDED = fromString("notOnboarded"); + + /** Static value unknown for OnboardingStatus. */ + public static final OnboardingStatus UNKNOWN = fromString("unknown"); + + /** + * Creates a new instance of OnboardingStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OnboardingStatus() { + } + + /** + * Creates or finds a OnboardingStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding OnboardingStatus. + */ + @JsonCreator + public static OnboardingStatus fromString(String name) { + return fromString(name, OnboardingStatus.class); + } + + /** + * Gets known OnboardingStatus values. + * + * @return known OnboardingStatus values. + */ + public static Collection values() { + return values(OnboardingStatus.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Operation.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Operation.java new file mode 100644 index 0000000000000..7a568e7227690 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Operation.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Microsoft Insights API operation definition. */ +@Fluent +public final class Operation { + /* + * Operation name: {provider}/{resource}/{operation} + */ + @JsonProperty(value = "name") + private String name; + + /* + * Display metadata associated with the operation. + */ + @JsonProperty(value = "display") + private OperationDisplay display; + + /** Creates an instance of Operation class. */ + public Operation() { + } + + /** + * Get the name property: Operation name: {provider}/{resource}/{operation}. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation name: {provider}/{resource}/{operation}. + * + * @param name the name value to set. + * @return the Operation object itself. + */ + public Operation withName(String name) { + this.name = name; + return this; + } + + /** + * Get the display property: Display metadata associated with the operation. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Set the display property: Display metadata associated with the operation. + * + * @param display the display value to set. + * @return the Operation object itself. + */ + public Operation withDisplay(OperationDisplay display) { + this.display = display; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationAutoGenerated.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationAutoGenerated.java new file mode 100644 index 0000000000000..3865a43b491fa --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationAutoGenerated.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.OperationAutoGeneratedInner; + +/** An immutable client-side representation of OperationAutoGenerated. */ +public interface OperationAutoGenerated { + /** + * Gets the name property: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: + * "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". + * + * @return the name value. + */ + String name(); + + /** + * Gets the isDataAction property: Whether the operation applies to data-plane. This is "true" for data-plane + * operations and "false" for ARM/control-plane operations. + * + * @return the isDataAction value. + */ + Boolean isDataAction(); + + /** + * Gets the display property: Localized display information for this particular operation. + * + * @return the display value. + */ + OperationDisplayAutoGenerated display(); + + /** + * Gets the origin property: The intended executor of the operation; as in Resource Based Access Control (RBAC) and + * audit logs UX. Default value is "user,system". + * + * @return the origin value. + */ + Origin origin(); + + /** + * Gets the actionType property: Enum. Indicates the action type. "Internal" refers to actions that are for internal + * only APIs. + * + * @return the actionType value. + */ + ActionType actionType(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.OperationAutoGeneratedInner object. + * + * @return the inner object. + */ + OperationAutoGeneratedInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationDisplay.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationDisplay.java new file mode 100644 index 0000000000000..aede46e7d3374 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationDisplay.java @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Display metadata associated with the operation. */ +@Fluent +public final class OperationDisplay { + /* + * Service provider: Microsoft.Insights + */ + @JsonProperty(value = "provider") + private String provider; + + /* + * Resource on which the operation is performed: AlertRules, Autoscale, etc. + */ + @JsonProperty(value = "resource") + private String resource; + + /* + * Operation type: Read, write, delete, etc. + */ + @JsonProperty(value = "operation") + private String operation; + + /** Creates an instance of OperationDisplay class. */ + public OperationDisplay() { + } + + /** + * Get the provider property: Service provider: Microsoft.Insights. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Set the provider property: Service provider: Microsoft.Insights. + * + * @param provider the provider value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withProvider(String provider) { + this.provider = provider; + return this; + } + + /** + * Get the resource property: Resource on which the operation is performed: AlertRules, Autoscale, etc. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Set the resource property: Resource on which the operation is performed: AlertRules, Autoscale, etc. + * + * @param resource the resource value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withResource(String resource) { + this.resource = resource; + return this; + } + + /** + * Get the operation property: Operation type: Read, write, delete, etc. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Set the operation property: Operation type: Read, write, delete, etc. + * + * @param operation the operation value to set. + * @return the OperationDisplay object itself. + */ + public OperationDisplay withOperation(String operation) { + this.operation = operation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationDisplayAutoGenerated.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationDisplayAutoGenerated.java new file mode 100644 index 0000000000000..b08371cf36ce4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationDisplayAutoGenerated.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Localized display information for this particular operation. */ +@Immutable +public final class OperationDisplayAutoGenerated { + /* + * The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + * Compute". + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + * Schedule Collections". + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + * Machine", "Restart Virtual Machine". + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * The short, localized friendly description of the operation; suitable for tool tips and detailed views. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** Creates an instance of OperationDisplayAutoGenerated class. */ + public OperationDisplayAutoGenerated() { + } + + /** + * Get the provider property: The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring + * Insights" or "Microsoft Compute". + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: The localized friendly name of the resource type related to this operation. E.g. + * "Virtual Machines" or "Job Schedule Collections". + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: The concise, localized friendly name for the operation; suitable for dropdowns. E.g. + * "Create or Update Virtual Machine", "Restart Virtual Machine". + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: The short, localized friendly description of the operation; suitable for tool tips + * and detailed views. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationListResult.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationListResult.java new file mode 100644 index 0000000000000..9da350dfd0078 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationListResult.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.OperationListResultInner; +import java.util.List; + +/** An immutable client-side representation of OperationListResult. */ +public interface OperationListResult { + /** + * Gets the value property: List of operations supported by the Microsoft.Insights provider. + * + * @return the value value. + */ + List value(); + + /** + * Gets the nextLink property: URL to get the next set of operation list results if there are any. + * + * @return the nextLink value. + */ + String nextLink(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.OperationListResultInner object. + * + * @return the inner object. + */ + OperationListResultInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationListResultAutoGenerated.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationListResultAutoGenerated.java new file mode 100644 index 0000000000000..5c550b70665ea --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationListResultAutoGenerated.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.monitor.generated.fluent.models.OperationAutoGeneratedInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of + * results. + */ +@Immutable +public final class OperationListResultAutoGenerated { + /* + * List of operations supported by the resource provider + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * URL to get the next set of operation list results (if there are any). + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of OperationListResultAutoGenerated class. */ + public OperationListResultAutoGenerated() { + } + + /** + * Get the value property: List of operations supported by the resource provider. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: URL to get the next set of operation list results (if there are any). + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationStatus.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationStatus.java new file mode 100644 index 0000000000000..a83fcf689d65f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationStatus.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.management.exception.ManagementError; +import com.azure.resourcemanager.monitor.generated.fluent.models.OperationStatusInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of OperationStatus. */ +public interface OperationStatus { + /** + * Gets the id property: The operation Id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The operation name. + * + * @return the name value. + */ + String name(); + + /** + * Gets the startTime property: Start time of the job in standard ISO8601 format. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: End time of the job in standard ISO8601 format. + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the status property: The status of the operation. + * + * @return the status value. + */ + String status(); + + /** + * Gets the error property: The error detail of the operation if any. + * + * @return the error value. + */ + ManagementError error(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.OperationStatusInner object. + * + * @return the inner object. + */ + OperationStatusInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Operations.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Operations.java new file mode 100644 index 0000000000000..746879efeebcd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Operations.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of Operations. */ +public interface Operations { + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Microsoft.Insights operations along with {@link Response}. + */ + Response listWithResponse(Context context); + + /** + * Lists all of the available operations from Microsoft.Insights provider. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return result of the request to list Microsoft.Insights operations. + */ + OperationListResult list(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Operator.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Operator.java new file mode 100644 index 0000000000000..db3b83096df8e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Operator.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** the criteria operator. */ +public final class Operator extends ExpandableStringEnum { + /** Static value Equals for Operator. */ + public static final Operator EQUALS = fromString("Equals"); + + /** Static value GreaterThan for Operator. */ + public static final Operator GREATER_THAN = fromString("GreaterThan"); + + /** Static value GreaterThanOrEqual for Operator. */ + public static final Operator GREATER_THAN_OR_EQUAL = fromString("GreaterThanOrEqual"); + + /** Static value LessThan for Operator. */ + public static final Operator LESS_THAN = fromString("LessThan"); + + /** Static value LessThanOrEqual for Operator. */ + public static final Operator LESS_THAN_OR_EQUAL = fromString("LessThanOrEqual"); + + /** + * Creates a new instance of Operator value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Operator() { + } + + /** + * Creates or finds a Operator from its string representation. + * + * @param name a name to look for. + * @return the corresponding Operator. + */ + @JsonCreator + public static Operator fromString(String name) { + return fromString(name, Operator.class); + } + + /** + * Gets known Operator values. + * + * @return known Operator values. + */ + public static Collection values() { + return values(Operator.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Origin.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Origin.java new file mode 100644 index 0000000000000..075110991664f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Origin.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value + * is "user,system". + */ +public final class Origin extends ExpandableStringEnum { + /** Static value user for Origin. */ + public static final Origin USER = fromString("user"); + + /** Static value system for Origin. */ + public static final Origin SYSTEM = fromString("system"); + + /** Static value user,system for Origin. */ + public static final Origin USER_SYSTEM = fromString("user,system"); + + /** + * Creates a new instance of Origin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public Origin() { + } + + /** + * Creates or finds a Origin from its string representation. + * + * @param name a name to look for. + * @return the corresponding Origin. + */ + @JsonCreator + public static Origin fromString(String name) { + return fromString(name, Origin.class); + } + + /** + * Gets known Origin values. + * + * @return known Origin values. + */ + public static Collection values() { + return values(Origin.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PerfCounterDataSource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PerfCounterDataSource.java new file mode 100644 index 0000000000000..f3c35a7270b01 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PerfCounterDataSource.java @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Definition of which performance counters will be collected and how they will be collected by this data collection + * rule. Collected from both Windows and Linux machines where the counter is present. + */ +@Fluent +public final class PerfCounterDataSource { + /* + * List of streams that this data source will be sent to. + * A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will + * be sent to. + */ + @JsonProperty(value = "streams") + private List streams; + + /* + * The number of seconds between consecutive counter measurements (samples). + */ + @JsonProperty(value = "samplingFrequencyInSeconds") + private Integer samplingFrequencyInSeconds; + + /* + * A list of specifier names of the performance counters you want to collect. + * Use a wildcard (*) to collect a counter for all instances. + * To get a list of performance counters on Windows, run the command 'typeperf'. + */ + @JsonProperty(value = "counterSpecifiers") + private List counterSpecifiers; + + /* + * A friendly name for the data source. + * This name should be unique across all data sources (regardless of type) within the data collection rule. + */ + @JsonProperty(value = "name") + private String name; + + /** Creates an instance of PerfCounterDataSource class. */ + public PerfCounterDataSource() { + } + + /** + * Get the streams property: List of streams that this data source will be sent to. A stream indicates what schema + * will be used for this data and usually what table in Log Analytics the data will be sent to. + * + * @return the streams value. + */ + public List streams() { + return this.streams; + } + + /** + * Set the streams property: List of streams that this data source will be sent to. A stream indicates what schema + * will be used for this data and usually what table in Log Analytics the data will be sent to. + * + * @param streams the streams value to set. + * @return the PerfCounterDataSource object itself. + */ + public PerfCounterDataSource withStreams(List streams) { + this.streams = streams; + return this; + } + + /** + * Get the samplingFrequencyInSeconds property: The number of seconds between consecutive counter measurements + * (samples). + * + * @return the samplingFrequencyInSeconds value. + */ + public Integer samplingFrequencyInSeconds() { + return this.samplingFrequencyInSeconds; + } + + /** + * Set the samplingFrequencyInSeconds property: The number of seconds between consecutive counter measurements + * (samples). + * + * @param samplingFrequencyInSeconds the samplingFrequencyInSeconds value to set. + * @return the PerfCounterDataSource object itself. + */ + public PerfCounterDataSource withSamplingFrequencyInSeconds(Integer samplingFrequencyInSeconds) { + this.samplingFrequencyInSeconds = samplingFrequencyInSeconds; + return this; + } + + /** + * Get the counterSpecifiers property: A list of specifier names of the performance counters you want to collect. + * Use a wildcard (*) to collect a counter for all instances. To get a list of performance counters on Windows, run + * the command 'typeperf'. + * + * @return the counterSpecifiers value. + */ + public List counterSpecifiers() { + return this.counterSpecifiers; + } + + /** + * Set the counterSpecifiers property: A list of specifier names of the performance counters you want to collect. + * Use a wildcard (*) to collect a counter for all instances. To get a list of performance counters on Windows, run + * the command 'typeperf'. + * + * @param counterSpecifiers the counterSpecifiers value to set. + * @return the PerfCounterDataSource object itself. + */ + public PerfCounterDataSource withCounterSpecifiers(List counterSpecifiers) { + this.counterSpecifiers = counterSpecifiers; + return this; + } + + /** + * Get the name property: A friendly name for the data source. This name should be unique across all data sources + * (regardless of type) within the data collection rule. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: A friendly name for the data source. This name should be unique across all data sources + * (regardless of type) within the data collection rule. + * + * @param name the name value to set. + * @return the PerfCounterDataSource object itself. + */ + public PerfCounterDataSource withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveAutoscalePolicy.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveAutoscalePolicy.java new file mode 100644 index 0000000000000..3b291b4d3f6b2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveAutoscalePolicy.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; + +/** The parameters for enabling predictive autoscale. */ +@Fluent +public final class PredictiveAutoscalePolicy { + /* + * the predictive autoscale mode + */ + @JsonProperty(value = "scaleMode", required = true) + private PredictiveAutoscalePolicyScaleMode scaleMode; + + /* + * 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. + */ + @JsonProperty(value = "scaleLookAheadTime") + private Duration scaleLookAheadTime; + + /** Creates an instance of PredictiveAutoscalePolicy class. */ + public PredictiveAutoscalePolicy() { + } + + /** + * Get the scaleMode property: the predictive autoscale mode. + * + * @return the scaleMode value. + */ + public PredictiveAutoscalePolicyScaleMode scaleMode() { + return this.scaleMode; + } + + /** + * Set the scaleMode property: the predictive autoscale mode. + * + * @param scaleMode the scaleMode value to set. + * @return the PredictiveAutoscalePolicy object itself. + */ + public PredictiveAutoscalePolicy withScaleMode(PredictiveAutoscalePolicyScaleMode scaleMode) { + this.scaleMode = scaleMode; + return this; + } + + /** + * Get the scaleLookAheadTime property: 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. + * + * @return the scaleLookAheadTime value. + */ + public Duration scaleLookAheadTime() { + return this.scaleLookAheadTime; + } + + /** + * Set the scaleLookAheadTime property: 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. + * + * @param scaleLookAheadTime the scaleLookAheadTime value to set. + * @return the PredictiveAutoscalePolicy object itself. + */ + public PredictiveAutoscalePolicy withScaleLookAheadTime(Duration scaleLookAheadTime) { + this.scaleLookAheadTime = scaleLookAheadTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (scaleMode() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property scaleMode in model PredictiveAutoscalePolicy")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PredictiveAutoscalePolicy.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveAutoscalePolicyScaleMode.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveAutoscalePolicyScaleMode.java new file mode 100644 index 0000000000000..07d20c9529ba3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveAutoscalePolicyScaleMode.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** the predictive autoscale mode. */ +public enum PredictiveAutoscalePolicyScaleMode { + /** Enum value Disabled. */ + DISABLED("Disabled"), + + /** Enum value ForecastOnly. */ + FORECAST_ONLY("ForecastOnly"), + + /** Enum value Enabled. */ + ENABLED("Enabled"); + + /** The actual serialized value for a PredictiveAutoscalePolicyScaleMode instance. */ + private final String value; + + PredictiveAutoscalePolicyScaleMode(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a PredictiveAutoscalePolicyScaleMode instance. + * + * @param value the serialized value to parse. + * @return the parsed PredictiveAutoscalePolicyScaleMode object, or null if unable to parse. + */ + @JsonCreator + public static PredictiveAutoscalePolicyScaleMode fromString(String value) { + if (value == null) { + return null; + } + PredictiveAutoscalePolicyScaleMode[] items = PredictiveAutoscalePolicyScaleMode.values(); + for (PredictiveAutoscalePolicyScaleMode item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveMetrics.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveMetrics.java new file mode 100644 index 0000000000000..ee3d7cbdc71ef --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveMetrics.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.time.Duration; + +/** Resource collection API of PredictiveMetrics. */ +public interface PredictiveMetrics { + /** + * get predictive autoscale metric future data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param metricName 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'**. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return predictive autoscale metric future data along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, + String autoscaleSettingName, + String timespan, + Duration interval, + String metricNamespace, + String metricName, + String aggregation, + Context context); + + /** + * get predictive autoscale metric future data. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param autoscaleSettingName The autoscale setting name. + * @param timespan The timespan of the query. It is a string with the following format + * 'startDateTime_ISO/endDateTime_ISO'. + * @param interval The interval (i.e. timegrain) of the query. + * @param metricNamespace Metric namespace to query metric definitions for. + * @param metricName 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'**. + * @param aggregation The list of aggregation types (comma separated) to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return predictive autoscale metric future data. + */ + PredictiveResponse get( + String resourceGroupName, + String autoscaleSettingName, + String timespan, + Duration interval, + String metricNamespace, + String metricName, + String aggregation); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveResponse.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveResponse.java new file mode 100644 index 0000000000000..53ba9a6c59ebf --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveResponse.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.PredictiveResponseInner; +import java.time.Duration; +import java.util.List; + +/** An immutable client-side representation of PredictiveResponse. */ +public interface PredictiveResponse { + /** + * Gets the timespan property: 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. + * + * @return the timespan value. + */ + String timespan(); + + /** + * Gets the interval property: 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. + * + * @return the interval value. + */ + Duration interval(); + + /** + * Gets the metricName property: The metrics being queried. + * + * @return the metricName value. + */ + String metricName(); + + /** + * Gets the targetResourceId property: resource of the predictive metric. + * + * @return the targetResourceId value. + */ + String targetResourceId(); + + /** + * Gets the data property: the value of the collection. + * + * @return the data value. + */ + List data(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.PredictiveResponseInner object. + * + * @return the inner object. + */ + PredictiveResponseInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveValue.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveValue.java new file mode 100644 index 0000000000000..d8bea057b8ff6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PredictiveValue.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents a predictive metric value in the given bucket. */ +@Fluent +public final class PredictiveValue { + /* + * the timestamp for the metric value in ISO 8601 format. + */ + @JsonProperty(value = "timeStamp", required = true) + private OffsetDateTime timestamp; + + /* + * Predictive value in this time bucket. + */ + @JsonProperty(value = "value", required = true) + private double value; + + /** Creates an instance of PredictiveValue class. */ + public PredictiveValue() { + } + + /** + * Get the timestamp property: the timestamp for the metric value in ISO 8601 format. + * + * @return the timestamp value. + */ + public OffsetDateTime timestamp() { + return this.timestamp; + } + + /** + * Set the timestamp property: the timestamp for the metric value in ISO 8601 format. + * + * @param timestamp the timestamp value to set. + * @return the PredictiveValue object itself. + */ + public PredictiveValue withTimestamp(OffsetDateTime timestamp) { + this.timestamp = timestamp; + return this; + } + + /** + * Get the value property: Predictive value in this time bucket. + * + * @return the value value. + */ + public double value() { + return this.value; + } + + /** + * Set the value property: Predictive value in this time bucket. + * + * @param value the value value to set. + * @return the PredictiveValue object itself. + */ + public PredictiveValue withValue(double value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (timestamp() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property timestamp in model PredictiveValue")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PredictiveValue.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpoint.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpoint.java new file mode 100644 index 0000000000000..cf5ad2e0806f9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpoint.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Private Endpoint resource. */ +@Immutable +public final class PrivateEndpoint { + /* + * The ARM identifier for Private Endpoint + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /** Creates an instance of PrivateEndpoint class. */ + public PrivateEndpoint() { + } + + /** + * Get the id property: The ARM identifier for Private Endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnection.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnection.java new file mode 100644 index 0000000000000..3517c10c8014f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnection.java @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionInner; + +/** An immutable client-side representation of PrivateEndpointConnection. */ +public interface PrivateEndpointConnection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the privateEndpoint property: The resource of private end point. + * + * @return the privateEndpoint value. + */ + PrivateEndpoint privateEndpoint(); + + /** + * Gets the privateLinkServiceConnectionState property: A collection of information about the state of the + * connection between service consumer and provider. + * + * @return the privateLinkServiceConnectionState value. + */ + PrivateLinkServiceConnectionState privateLinkServiceConnectionState(); + + /** + * Gets the provisioningState property: The provisioning state of the private endpoint connection resource. + * + * @return the provisioningState value. + */ + PrivateEndpointConnectionProvisioningState provisioningState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionInner object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); + + /** The entirety of the PrivateEndpointConnection definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The PrivateEndpointConnection definition stages. */ + interface DefinitionStages { + /** The first stage of the PrivateEndpointConnection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the PrivateEndpointConnection definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, scopeName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @return the next definition stage. + */ + WithCreate withExistingPrivateLinkScope(String resourceGroupName, String scopeName); + } + /** + * The stage of the PrivateEndpointConnection definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithPrivateEndpoint, DefinitionStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the create request. + * + * @return the created resource. + */ + PrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PrivateEndpointConnection create(Context context); + } + /** The stage of the PrivateEndpointConnection definition allowing to specify privateEndpoint. */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: The resource of private end point.. + * + * @param privateEndpoint The resource of private end point. + * @return the next definition stage. + */ + WithCreate withPrivateEndpoint(PrivateEndpoint privateEndpoint); + } + /** + * The stage of the PrivateEndpointConnection definition allowing to specify privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: A collection of information about the state of + * the connection between service consumer and provider.. + * + * @param privateLinkServiceConnectionState A collection of information about the state of the connection + * between service consumer and provider. + * @return the next definition stage. + */ + WithCreate withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState); + } + } + /** + * Begins update for the PrivateEndpointConnection resource. + * + * @return the stage of resource update. + */ + PrivateEndpointConnection.Update update(); + + /** The template for PrivateEndpointConnection update. */ + interface Update extends UpdateStages.WithPrivateEndpoint, UpdateStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PrivateEndpointConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PrivateEndpointConnection apply(Context context); + } + /** The PrivateEndpointConnection update stages. */ + interface UpdateStages { + /** The stage of the PrivateEndpointConnection update allowing to specify privateEndpoint. */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: The resource of private end point.. + * + * @param privateEndpoint The resource of private end point. + * @return the next definition stage. + */ + Update withPrivateEndpoint(PrivateEndpoint privateEndpoint); + } + /** The stage of the PrivateEndpointConnection update allowing to specify privateLinkServiceConnectionState. */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: A collection of information about the state of + * the connection between service consumer and provider.. + * + * @param privateLinkServiceConnectionState A collection of information about the state of the connection + * between service consumer and provider. + * @return the next definition stage. + */ + Update withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionState privateLinkServiceConnectionState); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnectionListResult.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 0000000000000..71d9a790e93fc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnectionListResult.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionListResultInner; +import java.util.List; + +/** An immutable client-side representation of PrivateEndpointConnectionListResult. */ +public interface PrivateEndpointConnectionListResult { + /** + * Gets the value property: Array of private endpoint connections. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionListResultInner + * object. + * + * @return the inner object. + */ + PrivateEndpointConnectionListResultInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnectionProvisioningState.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnectionProvisioningState.java new file mode 100644 index 0000000000000..2e1b3483965f5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnectionProvisioningState.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The current provisioning state. */ +public final class PrivateEndpointConnectionProvisioningState + extends ExpandableStringEnum { + /** Static value Succeeded for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Creating for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState CREATING = fromString("Creating"); + + /** Static value Deleting for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState DELETING = fromString("Deleting"); + + /** Static value Failed for PrivateEndpointConnectionProvisioningState. */ + public static final PrivateEndpointConnectionProvisioningState FAILED = fromString("Failed"); + + /** + * Creates a new instance of PrivateEndpointConnectionProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateEndpointConnectionProvisioningState() { + } + + /** + * Creates or finds a PrivateEndpointConnectionProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointConnectionProvisioningState. + */ + @JsonCreator + public static PrivateEndpointConnectionProvisioningState fromString(String name) { + return fromString(name, PrivateEndpointConnectionProvisioningState.class); + } + + /** + * Gets known PrivateEndpointConnectionProvisioningState values. + * + * @return known PrivateEndpointConnectionProvisioningState values. + */ + public static Collection values() { + return values(PrivateEndpointConnectionProvisioningState.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnections.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnections.java new file mode 100644 index 0000000000000..7702e96fc30e2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnections.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateEndpointConnections. */ +public interface PrivateEndpointConnections { + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + Response getWithResponse( + String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + PrivateEndpointConnection get(String resourceGroupName, String scopeName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String scopeName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String scopeName, String privateEndpointConnectionName, Context context); + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope along with {@link Response}. + */ + Response listByPrivateLinkScopeWithResponse( + String resourceGroupName, String scopeName, Context context); + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope. + */ + PrivateEndpointConnectionListResult listByPrivateLinkScope(String resourceGroupName, String scopeName); + + /** + * Gets a private endpoint connection. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + PrivateEndpointConnection getById(String id); + + /** + * Gets a private endpoint connection. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new PrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new PrivateEndpointConnection definition. + */ + PrivateEndpointConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointServiceConnectionStatus.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointServiceConnectionStatus.java new file mode 100644 index 0000000000000..090bed8e55dfb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointServiceConnectionStatus.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The private endpoint connection status. */ +public final class PrivateEndpointServiceConnectionStatus + extends ExpandableStringEnum { + /** Static value Pending for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus PENDING = fromString("Pending"); + + /** Static value Approved for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus APPROVED = fromString("Approved"); + + /** Static value Rejected for PrivateEndpointServiceConnectionStatus. */ + public static final PrivateEndpointServiceConnectionStatus REJECTED = fromString("Rejected"); + + /** + * Creates a new instance of PrivateEndpointServiceConnectionStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateEndpointServiceConnectionStatus() { + } + + /** + * Creates or finds a PrivateEndpointServiceConnectionStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointServiceConnectionStatus. + */ + @JsonCreator + public static PrivateEndpointServiceConnectionStatus fromString(String name) { + return fromString(name, PrivateEndpointServiceConnectionStatus.class); + } + + /** + * Gets known PrivateEndpointServiceConnectionStatus values. + * + * @return known PrivateEndpointServiceConnectionStatus values. + */ + public static Collection values() { + return values(PrivateEndpointServiceConnectionStatus.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkResource.java new file mode 100644 index 0000000000000..9c2e480553bb0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkResource.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateLinkResourceInner; +import java.util.List; + +/** An immutable client-side representation of PrivateLinkResource. */ +public interface PrivateLinkResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + String groupId(); + + /** + * Gets the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + List requiredMembers(); + + /** + * Gets the requiredZoneNames property: The private link resource Private link DNS zone name. + * + * @return the requiredZoneNames value. + */ + List requiredZoneNames(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkResourceListResult.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkResourceListResult.java new file mode 100644 index 0000000000000..ed97b521d7c63 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkResourceListResult.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateLinkResourceListResultInner; +import java.util.List; + +/** An immutable client-side representation of PrivateLinkResourceListResult. */ +public interface PrivateLinkResourceListResult { + /** + * Gets the value property: Array of private link resources. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.PrivateLinkResourceListResultInner + * object. + * + * @return the inner object. + */ + PrivateLinkResourceListResultInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkResources.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkResources.java new file mode 100644 index 0000000000000..1f932adaf72e7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkResources.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateLinkResources. */ +public interface PrivateLinkResources { + /** + * Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope along with {@link + * Response}. + */ + Response listByPrivateLinkScopeWithResponse( + String resourceGroupName, String scopeName, Context context); + + /** + * Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + */ + PrivateLinkResourceListResult listByPrivateLinkScope(String resourceGroupName, String scopeName); + + /** + * Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param groupName The name of the private link resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope along with {@link + * Response}. + */ + Response getWithResponse( + String resourceGroupName, String scopeName, String groupName, Context context); + + /** + * Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param groupName The name of the private link resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + */ + PrivateLinkResource get(String resourceGroupName, String scopeName, String groupName); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkScopeOperationStatus.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkScopeOperationStatus.java new file mode 100644 index 0000000000000..3dab81ef18941 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkScopeOperationStatus.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateLinkScopeOperationStatus. */ +public interface PrivateLinkScopeOperationStatus { + /** + * Get the status of an azure asynchronous operation associated with a private link scope operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param asyncOperationId The operation Id. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of an azure asynchronous operation associated with a private link scope operation along with + * {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String asyncOperationId, Context context); + + /** + * Get the status of an azure asynchronous operation associated with a private link scope operation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param asyncOperationId The operation Id. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the status of an azure asynchronous operation associated with a private link scope operation. + */ + OperationStatus getByResourceGroup(String resourceGroupName, String asyncOperationId); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkScopedResources.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkScopedResources.java new file mode 100644 index 0000000000000..127bf66cec24f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkScopedResources.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateLinkScopedResources. */ +public interface PrivateLinkScopedResources { + /** + * Gets a scoped resource in a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a scoped resource in a private link scope along with {@link Response}. + */ + Response getWithResponse(String resourceGroupName, String scopeName, String name, Context context); + + /** + * Gets a scoped resource in a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a scoped resource in a private link scope. + */ + ScopedResource get(String resourceGroupName, String scopeName, String name); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String scopeName, String name); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param name The name of the scoped resource object. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String scopeName, String name, Context context); + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByPrivateLinkScope(String resourceGroupName, String scopeName); + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByPrivateLinkScope(String resourceGroupName, String scopeName, Context context); + + /** + * Gets a scoped resource in a private link scope. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a scoped resource in a private link scope along with {@link Response}. + */ + ScopedResource getById(String id); + + /** + * Gets a scoped resource in a private link scope. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a scoped resource in a private link scope along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ScopedResource resource. + * + * @param name resource name. + * @return the first stage of the new ScopedResource definition. + */ + ScopedResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkScopes.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkScopes.java new file mode 100644 index 0000000000000..0753491fd5f01 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkScopes.java @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateLinkScopes. */ +public interface PrivateLinkScopes { + /** + * Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure Monitor PrivateLinkScopes within a subscription as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets a list of all Azure Monitor PrivateLinkScopes within a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all Azure Monitor PrivateLinkScopes within a subscription as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Gets a list of Azure Monitor PrivateLinkScopes within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Monitor PrivateLinkScopes within a resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of Azure Monitor PrivateLinkScopes within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of Azure Monitor PrivateLinkScopes within a resource group as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String scopeName); + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String scopeName, Context context); + + /** + * Returns a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String scopeName, Context context); + + /** + * Returns a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition. + */ + AzureMonitorPrivateLinkScope getByResourceGroup(String resourceGroupName, String scopeName); + + /** + * Returns a Azure Monitor PrivateLinkScope. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition along with {@link Response}. + */ + AzureMonitorPrivateLinkScope getById(String id); + + /** + * Returns a Azure Monitor PrivateLinkScope. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return an Azure Monitor PrivateLinkScope definition along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new AzureMonitorPrivateLinkScope resource. + * + * @param name resource name. + * @return the first stage of the new AzureMonitorPrivateLinkScope definition. + */ + AzureMonitorPrivateLinkScope.DefinitionStages.Blank define(String name); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkServiceConnectionState.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkServiceConnectionState.java new file mode 100644 index 0000000000000..d8cd175d53ab6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkServiceConnectionState.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A collection of information about the state of the connection between service consumer and provider. */ +@Fluent +public final class PrivateLinkServiceConnectionState { + /* + * Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + */ + @JsonProperty(value = "status") + private PrivateEndpointServiceConnectionStatus status; + + /* + * The reason for approval/rejection of the connection. + */ + @JsonProperty(value = "description") + private String description; + + /* + * A message indicating if changes on the service provider require any updates on the consumer. + */ + @JsonProperty(value = "actionsRequired") + private String actionsRequired; + + /** Creates an instance of PrivateLinkServiceConnectionState class. */ + public PrivateLinkServiceConnectionState() { + } + + /** + * Get the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @return the status value. + */ + public PrivateEndpointServiceConnectionStatus status() { + return this.status; + } + + /** + * Set the status property: Indicates whether the connection has been Approved/Rejected/Removed by the owner of the + * service. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withStatus(PrivateEndpointServiceConnectionStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: The reason for approval/rejection of the connection. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The reason for approval/rejection of the connection. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Set the actionsRequired property: A message indicating if changes on the service provider require any updates on + * the consumer. + * + * @param actionsRequired the actionsRequired value to set. + * @return the PrivateLinkServiceConnectionState object itself. + */ + public PrivateLinkServiceConnectionState withActionsRequired(String actionsRequired) { + this.actionsRequired = actionsRequired; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ProvisioningState.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ProvisioningState.java new file mode 100644 index 0000000000000..20a5dc32aab5b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ProvisioningState.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The provisioning state of the Azure Monitor workspace. Set to Succeeded if everything is healthy. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Creating for ProvisioningState. */ + public static final ProvisioningState CREATING = fromString("Creating"); + + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Deleting for ProvisioningState. */ + public static final ProvisioningState DELETING = fromString("Deleting"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** + * Creates a new instance of ProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ProvisioningState() { + } + + /** + * Creates or finds a ProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ProvisioningState. + */ + @JsonCreator + public static ProvisioningState fromString(String name) { + return fromString(name, ProvisioningState.class); + } + + /** + * Gets known ProvisioningState values. + * + * @return known ProvisioningState values. + */ + public static Collection values() { + return values(ProvisioningState.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PublicNetworkAccess.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PublicNetworkAccess.java new file mode 100644 index 0000000000000..20a7f2f65d1b2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PublicNetworkAccess.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** This determines if traffic is allowed over public network. By default it is enabled. */ +public final class PublicNetworkAccess extends ExpandableStringEnum { + /** Static value Enabled for PublicNetworkAccess. */ + public static final PublicNetworkAccess ENABLED = fromString("Enabled"); + + /** Static value Disabled for PublicNetworkAccess. */ + public static final PublicNetworkAccess DISABLED = fromString("Disabled"); + + /** Static value SecuredByPerimeter for PublicNetworkAccess. */ + public static final PublicNetworkAccess SECURED_BY_PERIMETER = fromString("SecuredByPerimeter"); + + /** + * Creates a new instance of PublicNetworkAccess value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PublicNetworkAccess() { + } + + /** + * Creates or finds a PublicNetworkAccess from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicNetworkAccess. + */ + @JsonCreator + public static PublicNetworkAccess fromString(String name) { + return fromString(name, PublicNetworkAccess.class); + } + + /** + * Gets known PublicNetworkAccess values. + * + * @return known PublicNetworkAccess values. + */ + public static Collection values() { + return values(PublicNetworkAccess.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ReceiverStatus.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ReceiverStatus.java new file mode 100644 index 0000000000000..25d7a64612629 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ReceiverStatus.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Indicates the status of the receiver. Receivers that are not Enabled will not receive any communications. */ +public enum ReceiverStatus { + /** Enum value NotSpecified. */ + NOT_SPECIFIED("NotSpecified"), + + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a ReceiverStatus instance. */ + private final String value; + + ReceiverStatus(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ReceiverStatus instance. + * + * @param value the serialized value to parse. + * @return the parsed ReceiverStatus object, or null if unable to parse. + */ + @JsonCreator + public static ReceiverStatus fromString(String value) { + if (value == null) { + return null; + } + ReceiverStatus[] items = ReceiverStatus.values(); + for (ReceiverStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Recurrence.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Recurrence.java new file mode 100644 index 0000000000000..29b6b77766e18 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Recurrence.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The repeating times at which this profile begins. This element is not used if the FixedDate element is used. */ +@Fluent +public final class Recurrence { + /* + * 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. + */ + @JsonProperty(value = "frequency", required = true) + private RecurrenceFrequency frequency; + + /* + * the scheduling constraints for when the profile begins. + */ + @JsonProperty(value = "schedule", required = true) + private RecurrentSchedule schedule; + + /** Creates an instance of Recurrence class. */ + public Recurrence() { + } + + /** + * Get the frequency property: 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. + * + * @return the frequency value. + */ + public RecurrenceFrequency frequency() { + return this.frequency; + } + + /** + * Set the frequency property: 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. + * + * @param frequency the frequency value to set. + * @return the Recurrence object itself. + */ + public Recurrence withFrequency(RecurrenceFrequency frequency) { + this.frequency = frequency; + return this; + } + + /** + * Get the schedule property: the scheduling constraints for when the profile begins. + * + * @return the schedule value. + */ + public RecurrentSchedule schedule() { + return this.schedule; + } + + /** + * Set the schedule property: the scheduling constraints for when the profile begins. + * + * @param schedule the schedule value to set. + * @return the Recurrence object itself. + */ + public Recurrence withSchedule(RecurrentSchedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (frequency() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property frequency in model Recurrence")); + } + if (schedule() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property schedule in model Recurrence")); + } else { + schedule().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Recurrence.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RecurrenceFrequency.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RecurrenceFrequency.java new file mode 100644 index 0000000000000..6a6121870d2e9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RecurrenceFrequency.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * 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. + */ +public enum RecurrenceFrequency { + /** Enum value None. */ + NONE("None"), + + /** Enum value Second. */ + SECOND("Second"), + + /** Enum value Minute. */ + MINUTE("Minute"), + + /** Enum value Hour. */ + HOUR("Hour"), + + /** Enum value Day. */ + DAY("Day"), + + /** Enum value Week. */ + WEEK("Week"), + + /** Enum value Month. */ + MONTH("Month"), + + /** Enum value Year. */ + YEAR("Year"); + + /** The actual serialized value for a RecurrenceFrequency instance. */ + private final String value; + + RecurrenceFrequency(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a RecurrenceFrequency instance. + * + * @param value the serialized value to parse. + * @return the parsed RecurrenceFrequency object, or null if unable to parse. + */ + @JsonCreator + public static RecurrenceFrequency fromString(String value) { + if (value == null) { + return null; + } + RecurrenceFrequency[] items = RecurrenceFrequency.values(); + for (RecurrenceFrequency item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RecurrentSchedule.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RecurrentSchedule.java new file mode 100644 index 0000000000000..e5e560b094667 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RecurrentSchedule.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The scheduling constraints for when the profile begins. */ +@Fluent +public final class RecurrentSchedule { + /* + * 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 + */ + @JsonProperty(value = "timeZone", required = true) + private String timeZone; + + /* + * the collection of days that the profile takes effect on. Possible values are Sunday through Saturday. + */ + @JsonProperty(value = "days", required = true) + private List days; + + /* + * 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). + */ + @JsonProperty(value = "hours", required = true) + private List hours; + + /* + * A collection of minutes at which the profile takes effect at. + */ + @JsonProperty(value = "minutes", required = true) + private List minutes; + + /** Creates an instance of RecurrentSchedule class. */ + public RecurrentSchedule() { + } + + /** + * Get the timeZone property: 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. + * + * @return the timeZone value. + */ + public String timeZone() { + return this.timeZone; + } + + /** + * Set the timeZone property: 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. + * + * @param timeZone the timeZone value to set. + * @return the RecurrentSchedule object itself. + */ + public RecurrentSchedule withTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Get the days property: the collection of days that the profile takes effect on. Possible values are Sunday + * through Saturday. + * + * @return the days value. + */ + public List days() { + return this.days; + } + + /** + * Set the days property: the collection of days that the profile takes effect on. Possible values are Sunday + * through Saturday. + * + * @param days the days value to set. + * @return the RecurrentSchedule object itself. + */ + public RecurrentSchedule withDays(List days) { + this.days = days; + return this; + } + + /** + * Get the hours property: 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). + * + * @return the hours value. + */ + public List hours() { + return this.hours; + } + + /** + * Set the hours property: 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). + * + * @param hours the hours value to set. + * @return the RecurrentSchedule object itself. + */ + public RecurrentSchedule withHours(List hours) { + this.hours = hours; + return this; + } + + /** + * Get the minutes property: A collection of minutes at which the profile takes effect at. + * + * @return the minutes value. + */ + public List minutes() { + return this.minutes; + } + + /** + * Set the minutes property: A collection of minutes at which the profile takes effect at. + * + * @param minutes the minutes value to set. + * @return the RecurrentSchedule object itself. + */ + public RecurrentSchedule withMinutes(List minutes) { + this.minutes = minutes; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (timeZone() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property timeZone in model RecurrentSchedule")); + } + if (days() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property days in model RecurrentSchedule")); + } + if (hours() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property hours in model RecurrentSchedule")); + } + if (minutes() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property minutes in model RecurrentSchedule")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(RecurrentSchedule.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResourceForUpdate.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResourceForUpdate.java new file mode 100644 index 0000000000000..4f344fdcc75b6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResourceForUpdate.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Definition of ARM tracked top level resource properties for update operation. */ +@Fluent +public final class ResourceForUpdate { + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of ResourceForUpdate class. */ + public ResourceForUpdate() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the ResourceForUpdate object itself. + */ + public ResourceForUpdate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResponseModel.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResponseModel.java new file mode 100644 index 0000000000000..2fe9f8bc96b68 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResponseModel.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.ResponseInner; +import java.time.Duration; +import java.util.List; + +/** An immutable client-side representation of ResponseModel. */ +public interface ResponseModel { + /** + * Gets the cost property: The integer value representing the relative cost of the query. + * + * @return the cost value. + */ + Integer cost(); + + /** + * Gets the timespan property: 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. + * + * @return the timespan value. + */ + String timespan(); + + /** + * Gets the interval property: 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. + * + * @return the interval value. + */ + Duration interval(); + + /** + * Gets the namespace property: The namespace of the metrics being queried. + * + * @return the namespace value. + */ + String namespace(); + + /** + * Gets the resourceRegion property: The region of the resource being queried for metrics. + * + * @return the resourceRegion value. + */ + String resourceRegion(); + + /** + * Gets the value property: the value of the collection. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.ResponseInner object. + * + * @return the inner object. + */ + ResponseInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResultType.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResultType.java new file mode 100644 index 0000000000000..6bc474107e68c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResultType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ResultType. */ +public enum ResultType { + /** Enum value Data. */ + DATA("Data"), + + /** Enum value Metadata. */ + METADATA("Metadata"); + + /** The actual serialized value for a ResultType instance. */ + private final String value; + + ResultType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ResultType instance. + * + * @param value the serialized value to parse. + * @return the parsed ResultType object, or null if unable to parse. + */ + @JsonCreator + public static ResultType fromString(String value) { + if (value == null) { + return null; + } + ResultType[] items = ResultType.values(); + for (ResultType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RetentionPolicy.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RetentionPolicy.java new file mode 100644 index 0000000000000..c8f8ad28bc609 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RetentionPolicy.java @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifies the retention policy for the log. */ +@Fluent +public final class RetentionPolicy { + /* + * a value indicating whether the retention policy is enabled. + */ + @JsonProperty(value = "enabled", required = true) + private boolean enabled; + + /* + * the number of days for the retention in days. A value of 0 will retain the events indefinitely. + */ + @JsonProperty(value = "days", required = true) + private int days; + + /** Creates an instance of RetentionPolicy class. */ + public RetentionPolicy() { + } + + /** + * Get the enabled property: a value indicating whether the retention policy is enabled. + * + * @return the enabled value. + */ + public boolean enabled() { + return this.enabled; + } + + /** + * Set the enabled property: a value indicating whether the retention policy is enabled. + * + * @param enabled the enabled value to set. + * @return the RetentionPolicy object itself. + */ + public RetentionPolicy withEnabled(boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the days property: the number of days for the retention in days. A value of 0 will retain the events + * indefinitely. + * + * @return the days value. + */ + public int days() { + return this.days; + } + + /** + * Set the days property: the number of days for the retention in days. A value of 0 will retain the events + * indefinitely. + * + * @param days the days value to set. + * @return the RetentionPolicy object itself. + */ + public RetentionPolicy withDays(int days) { + this.days = days; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleAction.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleAction.java new file mode 100644 index 0000000000000..2593a71b413b3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleAction.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The action that is performed when the alert rule becomes active, and when an alert condition is resolved. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "odata.type", + defaultImpl = RuleAction.class) +@JsonTypeName("RuleAction") +@JsonSubTypes({ + @JsonSubTypes.Type( + name = "Microsoft.Azure.Management.Insights.Models.RuleEmailAction", + value = RuleEmailAction.class), + @JsonSubTypes.Type( + name = "Microsoft.Azure.Management.Insights.Models.RuleWebhookAction", + value = RuleWebhookAction.class) +}) +@Immutable +public class RuleAction { + /** Creates an instance of RuleAction class. */ + public RuleAction() { + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleCondition.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleCondition.java new file mode 100644 index 0000000000000..1f3b9d9ef0f2d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleCondition.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The condition that results in the alert rule being activated. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "odata.type", + defaultImpl = RuleCondition.class) +@JsonTypeName("RuleCondition") +@JsonSubTypes({ + @JsonSubTypes.Type( + name = "Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition", + value = ThresholdRuleCondition.class), + @JsonSubTypes.Type( + name = "Microsoft.Azure.Management.Insights.Models.LocationThresholdRuleCondition", + value = LocationThresholdRuleCondition.class), + @JsonSubTypes.Type( + name = "Microsoft.Azure.Management.Insights.Models.ManagementEventRuleCondition", + value = ManagementEventRuleCondition.class) +}) +@Fluent +public class RuleCondition { + /* + * the resource from which the rule collects its data. For this type dataSource will always be of type + * RuleMetricDataSource. + */ + @JsonProperty(value = "dataSource") + private RuleDataSource dataSource; + + /** Creates an instance of RuleCondition class. */ + public RuleCondition() { + } + + /** + * Get the dataSource property: the resource from which the rule collects its data. For this type dataSource will + * always be of type RuleMetricDataSource. + * + * @return the dataSource value. + */ + public RuleDataSource dataSource() { + return this.dataSource; + } + + /** + * Set the dataSource property: the resource from which the rule collects its data. For this type dataSource will + * always be of type RuleMetricDataSource. + * + * @param dataSource the dataSource value to set. + * @return the RuleCondition object itself. + */ + public RuleCondition withDataSource(RuleDataSource dataSource) { + this.dataSource = dataSource; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dataSource() != null) { + dataSource().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleDataSource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleDataSource.java new file mode 100644 index 0000000000000..277e7e7aede0a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleDataSource.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The resource from which the rule collects its data. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "odata.type", + defaultImpl = RuleDataSource.class) +@JsonTypeName("RuleDataSource") +@JsonSubTypes({ + @JsonSubTypes.Type( + name = "Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource", + value = RuleMetricDataSource.class), + @JsonSubTypes.Type( + name = "Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource", + value = RuleManagementEventDataSource.class) +}) +@Fluent +public class RuleDataSource { + /* + * the resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for an + * existing rule. + */ + @JsonProperty(value = "resourceUri") + private String resourceUri; + + /* + * the legacy resource identifier of the resource the rule monitors. **NOTE**: this property cannot be updated for + * an existing rule. + */ + @JsonProperty(value = "legacyResourceId") + private String legacyResourceId; + + /* + * the location of the resource. + */ + @JsonProperty(value = "resourceLocation") + private String resourceLocation; + + /* + * the namespace of the metric. + */ + @JsonProperty(value = "metricNamespace") + private String metricNamespace; + + /** Creates an instance of RuleDataSource class. */ + public RuleDataSource() { + } + + /** + * Get the resourceUri property: the resource identifier of the resource the rule monitors. **NOTE**: this property + * cannot be updated for an existing rule. + * + * @return the resourceUri value. + */ + public String resourceUri() { + return this.resourceUri; + } + + /** + * Set the resourceUri property: the resource identifier of the resource the rule monitors. **NOTE**: this property + * cannot be updated for an existing rule. + * + * @param resourceUri the resourceUri value to set. + * @return the RuleDataSource object itself. + */ + public RuleDataSource withResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + /** + * Get the legacyResourceId property: the legacy resource identifier of the resource the rule monitors. **NOTE**: + * this property cannot be updated for an existing rule. + * + * @return the legacyResourceId value. + */ + public String legacyResourceId() { + return this.legacyResourceId; + } + + /** + * Set the legacyResourceId property: the legacy resource identifier of the resource the rule monitors. **NOTE**: + * this property cannot be updated for an existing rule. + * + * @param legacyResourceId the legacyResourceId value to set. + * @return the RuleDataSource object itself. + */ + public RuleDataSource withLegacyResourceId(String legacyResourceId) { + this.legacyResourceId = legacyResourceId; + return this; + } + + /** + * Get the resourceLocation property: the location of the resource. + * + * @return the resourceLocation value. + */ + public String resourceLocation() { + return this.resourceLocation; + } + + /** + * Set the resourceLocation property: the location of the resource. + * + * @param resourceLocation the resourceLocation value to set. + * @return the RuleDataSource object itself. + */ + public RuleDataSource withResourceLocation(String resourceLocation) { + this.resourceLocation = resourceLocation; + return this; + } + + /** + * Get the metricNamespace property: the namespace of the metric. + * + * @return the metricNamespace value. + */ + public String metricNamespace() { + return this.metricNamespace; + } + + /** + * Set the metricNamespace property: the namespace of the metric. + * + * @param metricNamespace the metricNamespace value to set. + * @return the RuleDataSource object itself. + */ + public RuleDataSource withMetricNamespace(String metricNamespace) { + this.metricNamespace = metricNamespace; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleEmailAction.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleEmailAction.java new file mode 100644 index 0000000000000..ab4971d26b8a1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleEmailAction.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** + * Specifies the action to send email when the rule condition is evaluated. The discriminator is always RuleEmailAction + * in this case. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.RuleEmailAction") +@Fluent +public final class RuleEmailAction extends RuleAction { + /* + * Whether the administrators (service and co-administrators) of the service should be notified when the alert is + * activated. + */ + @JsonProperty(value = "sendToServiceOwners") + private Boolean sendToServiceOwners; + + /* + * the list of administrator's custom email addresses to notify of the activation of the alert. + */ + @JsonProperty(value = "customEmails") + private List customEmails; + + /** Creates an instance of RuleEmailAction class. */ + public RuleEmailAction() { + } + + /** + * Get the sendToServiceOwners property: Whether the administrators (service and co-administrators) of the service + * should be notified when the alert is activated. + * + * @return the sendToServiceOwners value. + */ + public Boolean sendToServiceOwners() { + return this.sendToServiceOwners; + } + + /** + * Set the sendToServiceOwners property: Whether the administrators (service and co-administrators) of the service + * should be notified when the alert is activated. + * + * @param sendToServiceOwners the sendToServiceOwners value to set. + * @return the RuleEmailAction object itself. + */ + public RuleEmailAction withSendToServiceOwners(Boolean sendToServiceOwners) { + this.sendToServiceOwners = sendToServiceOwners; + return this; + } + + /** + * Get the customEmails property: the list of administrator's custom email addresses to notify of the activation of + * the alert. + * + * @return the customEmails value. + */ + public List customEmails() { + return this.customEmails; + } + + /** + * Set the customEmails property: the list of administrator's custom email addresses to notify of the activation of + * the alert. + * + * @param customEmails the customEmails value to set. + * @return the RuleEmailAction object itself. + */ + public RuleEmailAction withCustomEmails(List customEmails) { + this.customEmails = customEmails; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleManagementEventClaimsDataSource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleManagementEventClaimsDataSource.java new file mode 100644 index 0000000000000..a6572e5d2e3d6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleManagementEventClaimsDataSource.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The claims for a rule management event data source. */ +@Fluent +public final class RuleManagementEventClaimsDataSource { + /* + * the email address. + */ + @JsonProperty(value = "emailAddress") + private String emailAddress; + + /** Creates an instance of RuleManagementEventClaimsDataSource class. */ + public RuleManagementEventClaimsDataSource() { + } + + /** + * Get the emailAddress property: the email address. + * + * @return the emailAddress value. + */ + public String emailAddress() { + return this.emailAddress; + } + + /** + * Set the emailAddress property: the email address. + * + * @param emailAddress the emailAddress value to set. + * @return the RuleManagementEventClaimsDataSource object itself. + */ + public RuleManagementEventClaimsDataSource withEmailAddress(String emailAddress) { + this.emailAddress = emailAddress; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleManagementEventDataSource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleManagementEventDataSource.java new file mode 100644 index 0000000000000..2ae0da275e211 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleManagementEventDataSource.java @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** + * A rule management event data source. The discriminator fields is always RuleManagementEventDataSource in this case. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.RuleManagementEventDataSource") +@Fluent +public final class RuleManagementEventDataSource extends RuleDataSource { + /* + * the event name. + */ + @JsonProperty(value = "eventName") + private String eventName; + + /* + * the event source. + */ + @JsonProperty(value = "eventSource") + private String eventSource; + + /* + * the level. + */ + @JsonProperty(value = "level") + private String level; + + /* + * The name of the operation that should be checked for. If no name is provided, any operation will match. + */ + @JsonProperty(value = "operationName") + private String operationName; + + /* + * the resource group name. + */ + @JsonProperty(value = "resourceGroupName") + private String resourceGroupName; + + /* + * the resource provider name. + */ + @JsonProperty(value = "resourceProviderName") + private String resourceProviderName; + + /* + * The status of the operation that should be checked for. If no status is provided, any status will match. + */ + @JsonProperty(value = "status") + private String status; + + /* + * the substatus. + */ + @JsonProperty(value = "subStatus") + private String subStatus; + + /* + * the claims. + */ + @JsonProperty(value = "claims") + private RuleManagementEventClaimsDataSource claims; + + /** Creates an instance of RuleManagementEventDataSource class. */ + public RuleManagementEventDataSource() { + } + + /** + * Get the eventName property: the event name. + * + * @return the eventName value. + */ + public String eventName() { + return this.eventName; + } + + /** + * Set the eventName property: the event name. + * + * @param eventName the eventName value to set. + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withEventName(String eventName) { + this.eventName = eventName; + return this; + } + + /** + * Get the eventSource property: the event source. + * + * @return the eventSource value. + */ + public String eventSource() { + return this.eventSource; + } + + /** + * Set the eventSource property: the event source. + * + * @param eventSource the eventSource value to set. + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withEventSource(String eventSource) { + this.eventSource = eventSource; + return this; + } + + /** + * Get the level property: the level. + * + * @return the level value. + */ + public String level() { + return this.level; + } + + /** + * Set the level property: the level. + * + * @param level the level value to set. + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withLevel(String level) { + this.level = level; + return this; + } + + /** + * Get the operationName property: The name of the operation that should be checked for. If no name is provided, any + * operation will match. + * + * @return the operationName value. + */ + public String operationName() { + return this.operationName; + } + + /** + * Set the operationName property: The name of the operation that should be checked for. If no name is provided, any + * operation will match. + * + * @param operationName the operationName value to set. + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withOperationName(String operationName) { + this.operationName = operationName; + return this; + } + + /** + * Get the resourceGroupName property: the resource group name. + * + * @return the resourceGroupName value. + */ + public String resourceGroupName() { + return this.resourceGroupName; + } + + /** + * Set the resourceGroupName property: the resource group name. + * + * @param resourceGroupName the resourceGroupName value to set. + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withResourceGroupName(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + /** + * Get the resourceProviderName property: the resource provider name. + * + * @return the resourceProviderName value. + */ + public String resourceProviderName() { + return this.resourceProviderName; + } + + /** + * Set the resourceProviderName property: the resource provider name. + * + * @param resourceProviderName the resourceProviderName value to set. + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withResourceProviderName(String resourceProviderName) { + this.resourceProviderName = resourceProviderName; + return this; + } + + /** + * Get the status property: The status of the operation that should be checked for. If no status is provided, any + * status will match. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The status of the operation that should be checked for. If no status is provided, any + * status will match. + * + * @param status the status value to set. + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the subStatus property: the substatus. + * + * @return the subStatus value. + */ + public String subStatus() { + return this.subStatus; + } + + /** + * Set the subStatus property: the substatus. + * + * @param subStatus the subStatus value to set. + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withSubStatus(String subStatus) { + this.subStatus = subStatus; + return this; + } + + /** + * Get the claims property: the claims. + * + * @return the claims value. + */ + public RuleManagementEventClaimsDataSource claims() { + return this.claims; + } + + /** + * Set the claims property: the claims. + * + * @param claims the claims value to set. + * @return the RuleManagementEventDataSource object itself. + */ + public RuleManagementEventDataSource withClaims(RuleManagementEventClaimsDataSource claims) { + this.claims = claims; + return this; + } + + /** {@inheritDoc} */ + @Override + public RuleManagementEventDataSource withResourceUri(String resourceUri) { + super.withResourceUri(resourceUri); + return this; + } + + /** {@inheritDoc} */ + @Override + public RuleManagementEventDataSource withLegacyResourceId(String legacyResourceId) { + super.withLegacyResourceId(legacyResourceId); + return this; + } + + /** {@inheritDoc} */ + @Override + public RuleManagementEventDataSource withResourceLocation(String resourceLocation) { + super.withResourceLocation(resourceLocation); + return this; + } + + /** {@inheritDoc} */ + @Override + public RuleManagementEventDataSource withMetricNamespace(String metricNamespace) { + super.withMetricNamespace(metricNamespace); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (claims() != null) { + claims().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleMetricDataSource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleMetricDataSource.java new file mode 100644 index 0000000000000..040b8d679a935 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleMetricDataSource.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** A rule metric data source. The discriminator value is always RuleMetricDataSource in this case. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.RuleMetricDataSource") +@Fluent +public final class RuleMetricDataSource extends RuleDataSource { + /* + * the name of the metric that defines what the rule monitors. + */ + @JsonProperty(value = "metricName") + private String metricName; + + /** Creates an instance of RuleMetricDataSource class. */ + public RuleMetricDataSource() { + } + + /** + * Get the metricName property: the name of the metric that defines what the rule monitors. + * + * @return the metricName value. + */ + public String metricName() { + return this.metricName; + } + + /** + * Set the metricName property: the name of the metric that defines what the rule monitors. + * + * @param metricName the metricName value to set. + * @return the RuleMetricDataSource object itself. + */ + public RuleMetricDataSource withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** {@inheritDoc} */ + @Override + public RuleMetricDataSource withResourceUri(String resourceUri) { + super.withResourceUri(resourceUri); + return this; + } + + /** {@inheritDoc} */ + @Override + public RuleMetricDataSource withLegacyResourceId(String legacyResourceId) { + super.withLegacyResourceId(legacyResourceId); + return this; + } + + /** {@inheritDoc} */ + @Override + public RuleMetricDataSource withResourceLocation(String resourceLocation) { + super.withResourceLocation(resourceLocation); + return this; + } + + /** {@inheritDoc} */ + @Override + public RuleMetricDataSource withMetricNamespace(String metricNamespace) { + super.withMetricNamespace(metricNamespace); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleResolveConfiguration.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleResolveConfiguration.java new file mode 100644 index 0000000000000..f9eb6e0ce700c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleResolveConfiguration.java @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; + +/** TBD. Relevant only for rules of the kind LogAlert. */ +@Fluent +public final class RuleResolveConfiguration { + /* + * The flag that indicates whether or not to auto resolve a fired alert. + */ + @JsonProperty(value = "autoResolved") + private Boolean autoResolved; + + /* + * The duration a rule must evaluate as healthy before the fired alert is automatically resolved represented in ISO + * 8601 duration format. + */ + @JsonProperty(value = "timeToResolve") + private Duration timeToResolve; + + /** Creates an instance of RuleResolveConfiguration class. */ + public RuleResolveConfiguration() { + } + + /** + * Get the autoResolved property: The flag that indicates whether or not to auto resolve a fired alert. + * + * @return the autoResolved value. + */ + public Boolean autoResolved() { + return this.autoResolved; + } + + /** + * Set the autoResolved property: The flag that indicates whether or not to auto resolve a fired alert. + * + * @param autoResolved the autoResolved value to set. + * @return the RuleResolveConfiguration object itself. + */ + public RuleResolveConfiguration withAutoResolved(Boolean autoResolved) { + this.autoResolved = autoResolved; + return this; + } + + /** + * Get the timeToResolve property: The duration a rule must evaluate as healthy before the fired alert is + * automatically resolved represented in ISO 8601 duration format. + * + * @return the timeToResolve value. + */ + public Duration timeToResolve() { + return this.timeToResolve; + } + + /** + * Set the timeToResolve property: The duration a rule must evaluate as healthy before the fired alert is + * automatically resolved represented in ISO 8601 duration format. + * + * @param timeToResolve the timeToResolve value to set. + * @return the RuleResolveConfiguration object itself. + */ + public RuleResolveConfiguration withTimeToResolve(Duration timeToResolve) { + this.timeToResolve = timeToResolve; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleWebhookAction.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleWebhookAction.java new file mode 100644 index 0000000000000..dfcfdb369f510 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleWebhookAction.java @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.Map; + +/** + * Specifies the action to post to service when the rule condition is evaluated. The discriminator is always + * RuleWebhookAction in this case. + */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.RuleWebhookAction") +@Fluent +public final class RuleWebhookAction extends RuleAction { + /* + * the service uri to Post the notification when the alert activates or resolves. + */ + @JsonProperty(value = "serviceUri") + private String serviceUri; + + /* + * the dictionary of custom properties to include with the post operation. These data are appended to the webhook + * payload. + */ + @JsonProperty(value = "properties") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map properties; + + /** Creates an instance of RuleWebhookAction class. */ + public RuleWebhookAction() { + } + + /** + * Get the serviceUri property: the service uri to Post the notification when the alert activates or resolves. + * + * @return the serviceUri value. + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the serviceUri property: the service uri to Post the notification when the alert activates or resolves. + * + * @param serviceUri the serviceUri value to set. + * @return the RuleWebhookAction object itself. + */ + public RuleWebhookAction withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + + /** + * Get the properties property: the dictionary of custom properties to include with the post operation. These data + * are appended to the webhook payload. + * + * @return the properties value. + */ + public Map properties() { + return this.properties; + } + + /** + * Set the properties property: the dictionary of custom properties to include with the post operation. These data + * are appended to the webhook payload. + * + * @param properties the properties value to set. + * @return the RuleWebhookAction object itself. + */ + public RuleWebhookAction withProperties(Map properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleAction.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleAction.java new file mode 100644 index 0000000000000..7e9c810edc5bb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleAction.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; + +/** The parameters for the scaling action. */ +@Fluent +public final class ScaleAction { + /* + * the scale direction. Whether the scaling action increases or decreases the number of instances. + */ + @JsonProperty(value = "direction", required = true) + private ScaleDirection direction; + + /* + * the type of action that should occur when the scale rule fires. + */ + @JsonProperty(value = "type", required = true) + private ScaleType type; + + /* + * the number of instances that are involved in the scaling action. This value must be 1 or greater. The default + * value is 1. + */ + @JsonProperty(value = "value") + private String value; + + /* + * 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. + */ + @JsonProperty(value = "cooldown", required = true) + private Duration cooldown; + + /** Creates an instance of ScaleAction class. */ + public ScaleAction() { + } + + /** + * Get the direction property: the scale direction. Whether the scaling action increases or decreases the number of + * instances. + * + * @return the direction value. + */ + public ScaleDirection direction() { + return this.direction; + } + + /** + * Set the direction property: the scale direction. Whether the scaling action increases or decreases the number of + * instances. + * + * @param direction the direction value to set. + * @return the ScaleAction object itself. + */ + public ScaleAction withDirection(ScaleDirection direction) { + this.direction = direction; + return this; + } + + /** + * Get the type property: the type of action that should occur when the scale rule fires. + * + * @return the type value. + */ + public ScaleType type() { + return this.type; + } + + /** + * Set the type property: the type of action that should occur when the scale rule fires. + * + * @param type the type value to set. + * @return the ScaleAction object itself. + */ + public ScaleAction withType(ScaleType type) { + this.type = type; + return this; + } + + /** + * Get the value property: the number of instances that are involved in the scaling action. This value must be 1 or + * greater. The default value is 1. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: the number of instances that are involved in the scaling action. This value must be 1 or + * greater. The default value is 1. + * + * @param value the value value to set. + * @return the ScaleAction object itself. + */ + public ScaleAction withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the cooldown property: 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. + * + * @return the cooldown value. + */ + public Duration cooldown() { + return this.cooldown; + } + + /** + * Set the cooldown property: 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. + * + * @param cooldown the cooldown value to set. + * @return the ScaleAction object itself. + */ + public ScaleAction withCooldown(Duration cooldown) { + this.cooldown = cooldown; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (direction() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property direction in model ScaleAction")); + } + if (type() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property type in model ScaleAction")); + } + if (cooldown() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property cooldown in model ScaleAction")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ScaleAction.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleCapacity.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleCapacity.java new file mode 100644 index 0000000000000..3f9abb8019f57 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleCapacity.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The number of instances that can be used during this profile. */ +@Fluent +public final class ScaleCapacity { + /* + * the minimum number of instances for the resource. + */ + @JsonProperty(value = "minimum", required = true) + private String minimum; + + /* + * 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. + */ + @JsonProperty(value = "maximum", required = true) + private String maximum; + + /* + * 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. + */ + @JsonProperty(value = "default", required = true) + private String defaultProperty; + + /** Creates an instance of ScaleCapacity class. */ + public ScaleCapacity() { + } + + /** + * Get the minimum property: the minimum number of instances for the resource. + * + * @return the minimum value. + */ + public String minimum() { + return this.minimum; + } + + /** + * Set the minimum property: the minimum number of instances for the resource. + * + * @param minimum the minimum value to set. + * @return the ScaleCapacity object itself. + */ + public ScaleCapacity withMinimum(String minimum) { + this.minimum = minimum; + return this; + } + + /** + * Get the maximum property: 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. + * + * @return the maximum value. + */ + public String maximum() { + return this.maximum; + } + + /** + * Set the maximum property: 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. + * + * @param maximum the maximum value to set. + * @return the ScaleCapacity object itself. + */ + public ScaleCapacity withMaximum(String maximum) { + this.maximum = maximum; + return this; + } + + /** + * Get the defaultProperty property: 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. + * + * @return the defaultProperty value. + */ + public String defaultProperty() { + return this.defaultProperty; + } + + /** + * Set the defaultProperty property: 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. + * + * @param defaultProperty the defaultProperty value to set. + * @return the ScaleCapacity object itself. + */ + public ScaleCapacity withDefaultProperty(String defaultProperty) { + this.defaultProperty = defaultProperty; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (minimum() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property minimum in model ScaleCapacity")); + } + if (maximum() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property maximum in model ScaleCapacity")); + } + if (defaultProperty() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property defaultProperty in model ScaleCapacity")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ScaleCapacity.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleDirection.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleDirection.java new file mode 100644 index 0000000000000..fbb3c7f721341 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleDirection.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** the scale direction. Whether the scaling action increases or decreases the number of instances. */ +public enum ScaleDirection { + /** Enum value None. */ + NONE("None"), + + /** Enum value Increase. */ + INCREASE("Increase"), + + /** Enum value Decrease. */ + DECREASE("Decrease"); + + /** The actual serialized value for a ScaleDirection instance. */ + private final String value; + + ScaleDirection(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ScaleDirection instance. + * + * @param value the serialized value to parse. + * @return the parsed ScaleDirection object, or null if unable to parse. + */ + @JsonCreator + public static ScaleDirection fromString(String value) { + if (value == null) { + return null; + } + ScaleDirection[] items = ScaleDirection.values(); + for (ScaleDirection item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleRule.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleRule.java new file mode 100644 index 0000000000000..2cce9a3447925 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleRule.java @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A rule that provide the triggers and parameters for the scaling action. */ +@Fluent +public final class ScaleRule { + /* + * the trigger that results in a scaling action. + */ + @JsonProperty(value = "metricTrigger", required = true) + private MetricTrigger metricTrigger; + + /* + * the parameters for the scaling action. + */ + @JsonProperty(value = "scaleAction", required = true) + private ScaleAction scaleAction; + + /** Creates an instance of ScaleRule class. */ + public ScaleRule() { + } + + /** + * Get the metricTrigger property: the trigger that results in a scaling action. + * + * @return the metricTrigger value. + */ + public MetricTrigger metricTrigger() { + return this.metricTrigger; + } + + /** + * Set the metricTrigger property: the trigger that results in a scaling action. + * + * @param metricTrigger the metricTrigger value to set. + * @return the ScaleRule object itself. + */ + public ScaleRule withMetricTrigger(MetricTrigger metricTrigger) { + this.metricTrigger = metricTrigger; + return this; + } + + /** + * Get the scaleAction property: the parameters for the scaling action. + * + * @return the scaleAction value. + */ + public ScaleAction scaleAction() { + return this.scaleAction; + } + + /** + * Set the scaleAction property: the parameters for the scaling action. + * + * @param scaleAction the scaleAction value to set. + * @return the ScaleRule object itself. + */ + public ScaleRule withScaleAction(ScaleAction scaleAction) { + this.scaleAction = scaleAction; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metricTrigger() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property metricTrigger in model ScaleRule")); + } else { + metricTrigger().validate(); + } + if (scaleAction() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property scaleAction in model ScaleRule")); + } else { + scaleAction().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ScaleRule.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleRuleMetricDimension.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleRuleMetricDimension.java new file mode 100644 index 0000000000000..b658add9556dd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleRuleMetricDimension.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specifies an auto scale rule metric dimension. */ +@Fluent +public final class ScaleRuleMetricDimension { + /* + * Name of the dimension. + */ + @JsonProperty(value = "DimensionName", required = true) + private String dimensionName; + + /* + * 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 + */ + @JsonProperty(value = "Operator", required = true) + private ScaleRuleMetricDimensionOperationType operator; + + /* + * list of dimension values. For example: ["App1","App2"]. + */ + @JsonProperty(value = "Values", required = true) + private List values; + + /** Creates an instance of ScaleRuleMetricDimension class. */ + public ScaleRuleMetricDimension() { + } + + /** + * Get the dimensionName property: Name of the dimension. + * + * @return the dimensionName value. + */ + public String dimensionName() { + return this.dimensionName; + } + + /** + * Set the dimensionName property: Name of the dimension. + * + * @param dimensionName the dimensionName value to set. + * @return the ScaleRuleMetricDimension object itself. + */ + public ScaleRuleMetricDimension withDimensionName(String dimensionName) { + this.dimensionName = dimensionName; + return this; + } + + /** + * Get the operator property: 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. + * + * @return the operator value. + */ + public ScaleRuleMetricDimensionOperationType operator() { + return this.operator; + } + + /** + * Set the operator property: 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. + * + * @param operator the operator value to set. + * @return the ScaleRuleMetricDimension object itself. + */ + public ScaleRuleMetricDimension withOperator(ScaleRuleMetricDimensionOperationType operator) { + this.operator = operator; + return this; + } + + /** + * Get the values property: list of dimension values. For example: ["App1","App2"]. + * + * @return the values value. + */ + public List values() { + return this.values; + } + + /** + * Set the values property: list of dimension values. For example: ["App1","App2"]. + * + * @param values the values value to set. + * @return the ScaleRuleMetricDimension object itself. + */ + public ScaleRuleMetricDimension withValues(List values) { + this.values = values; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dimensionName() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property dimensionName in model ScaleRuleMetricDimension")); + } + if (operator() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property operator in model ScaleRuleMetricDimension")); + } + if (values() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property values in model ScaleRuleMetricDimension")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ScaleRuleMetricDimension.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleRuleMetricDimensionOperationType.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleRuleMetricDimensionOperationType.java new file mode 100644 index 0000000000000..b71de630a11ac --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleRuleMetricDimensionOperationType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * 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. + */ +public final class ScaleRuleMetricDimensionOperationType + extends ExpandableStringEnum { + /** Static value Equals for ScaleRuleMetricDimensionOperationType. */ + public static final ScaleRuleMetricDimensionOperationType EQUALS = fromString("Equals"); + + /** Static value NotEquals for ScaleRuleMetricDimensionOperationType. */ + public static final ScaleRuleMetricDimensionOperationType NOT_EQUALS = fromString("NotEquals"); + + /** + * Creates a new instance of ScaleRuleMetricDimensionOperationType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ScaleRuleMetricDimensionOperationType() { + } + + /** + * Creates or finds a ScaleRuleMetricDimensionOperationType from its string representation. + * + * @param name a name to look for. + * @return the corresponding ScaleRuleMetricDimensionOperationType. + */ + @JsonCreator + public static ScaleRuleMetricDimensionOperationType fromString(String name) { + return fromString(name, ScaleRuleMetricDimensionOperationType.class); + } + + /** + * Gets known ScaleRuleMetricDimensionOperationType values. + * + * @return known ScaleRuleMetricDimensionOperationType values. + */ + public static Collection values() { + return values(ScaleRuleMetricDimensionOperationType.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleType.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleType.java new file mode 100644 index 0000000000000..9b3cb99cdfeea --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleType.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** the type of action that should occur when the scale rule fires. */ +public enum ScaleType { + /** Enum value ChangeCount. */ + CHANGE_COUNT("ChangeCount"), + + /** Enum value PercentChangeCount. */ + PERCENT_CHANGE_COUNT("PercentChangeCount"), + + /** Enum value ExactCount. */ + EXACT_COUNT("ExactCount"), + + /** Enum value ServiceAllowedNextValue. */ + SERVICE_ALLOWED_NEXT_VALUE("ServiceAllowedNextValue"); + + /** The actual serialized value for a ScaleType instance. */ + private final String value; + + ScaleType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ScaleType instance. + * + * @param value the serialized value to parse. + * @return the parsed ScaleType object, or null if unable to parse. + */ + @JsonCreator + public static ScaleType fromString(String value) { + if (value == null) { + return null; + } + ScaleType[] items = ScaleType.values(); + for (ScaleType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRuleCriteria.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRuleCriteria.java new file mode 100644 index 0000000000000..388e29aa44248 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRuleCriteria.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The rule criteria that defines the conditions of the scheduled query rule. */ +@Fluent +public final class ScheduledQueryRuleCriteria { + /* + * A list of conditions to evaluate against the specified scopes + */ + @JsonProperty(value = "allOf") + private List allOf; + + /** Creates an instance of ScheduledQueryRuleCriteria class. */ + public ScheduledQueryRuleCriteria() { + } + + /** + * Get the allOf property: A list of conditions to evaluate against the specified scopes. + * + * @return the allOf value. + */ + public List allOf() { + return this.allOf; + } + + /** + * Set the allOf property: A list of conditions to evaluate against the specified scopes. + * + * @param allOf the allOf value to set. + * @return the ScheduledQueryRuleCriteria object itself. + */ + public ScheduledQueryRuleCriteria withAllOf(List allOf) { + this.allOf = allOf; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (allOf() != null) { + allOf().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRuleResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRuleResource.java new file mode 100644 index 0000000000000..bb3352d82b194 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRuleResource.java @@ -0,0 +1,865 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.ScheduledQueryRuleResourceInner; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of ScheduledQueryRuleResource. */ +public interface ScheduledQueryRuleResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the identity property: The identity of the resource. + * + * @return the identity value. + */ + Identity identity(); + + /** + * Gets the kind property: Indicates the type of scheduled query rule. The default is LogAlert. + * + * @return the kind value. + */ + Kind kind(); + + /** + * Gets the etag property: 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. + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: SystemData of ScheduledQueryRule. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the createdWithApiVersion property: The api-version used when creating this alert rule. + * + * @return the createdWithApiVersion value. + */ + String createdWithApiVersion(); + + /** + * Gets the isLegacyLogAnalyticsRule property: True if alert rule is legacy Log Analytic rule. + * + * @return the isLegacyLogAnalyticsRule value. + */ + Boolean isLegacyLogAnalyticsRule(); + + /** + * Gets the description property: The description of the scheduled query rule. + * + * @return the description value. + */ + String description(); + + /** + * Gets the displayName property: The display name of the alert rule. + * + * @return the displayName value. + */ + String displayName(); + + /** + * Gets the severity property: Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. + * Relevant and required only for rules of the kind LogAlert. + * + * @return the severity value. + */ + AlertSeverity severity(); + + /** + * Gets the enabled property: The flag which indicates whether this scheduled query rule is enabled. Value should be + * true or false. + * + * @return the enabled value. + */ + Boolean enabled(); + + /** + * Gets the publicNetworkAccess property: This determines if traffic is allowed over public network. By default it + * is enabled. + * + * @return the publicNetworkAccess value. + */ + PublicNetworkAccess publicNetworkAccess(); + + /** + * Gets the scopes property: The list of resource id's that this scheduled query rule is scoped to. + * + * @return the scopes value. + */ + List scopes(); + + /** + * Gets the evaluationFrequency property: How often the scheduled query rule is evaluated represented in ISO 8601 + * duration format. Relevant and required only for rules of the kind LogAlert. + * + * @return the evaluationFrequency value. + */ + Duration evaluationFrequency(); + + /** + * Gets the windowSize property: The period of time (in ISO 8601 duration format) on which the Alert query will be + * executed (bin size). Relevant and required only for rules of the kind LogAlert. + * + * @return the windowSize value. + */ + Duration windowSize(); + + /** + * Gets the overrideQueryTimeRange property: If specified then overrides the query time range (default is + * WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + * + * @return the overrideQueryTimeRange value. + */ + Duration overrideQueryTimeRange(); + + /** + * Gets the targetResourceTypes property: List of resource type of the target resource(s) on which the alert is + * created/updated. For example if the scope is a resource group and targetResourceTypes is + * Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual machine in the resource + * group which meet the alert criteria. Relevant only for rules of the kind LogAlert. + * + * @return the targetResourceTypes value. + */ + List targetResourceTypes(); + + /** + * Gets the criteria property: The rule criteria that defines the conditions of the scheduled query rule. + * + * @return the criteria value. + */ + ScheduledQueryRuleCriteria criteria(); + + /** + * Gets the muteActionsDuration property: Mute actions for the chosen period of time (in ISO 8601 duration format) + * after the alert is fired. Relevant only for rules of the kind LogAlert. + * + * @return the muteActionsDuration value. + */ + Duration muteActionsDuration(); + + /** + * Gets the actions property: Actions to invoke when the alert fires. + * + * @return the actions value. + */ + Actions actions(); + + /** + * Gets the isWorkspaceAlertsStorageConfigured property: The flag which indicates whether this scheduled query rule + * has been configured to be stored in the customer's storage. The default is false. + * + * @return the isWorkspaceAlertsStorageConfigured value. + */ + Boolean isWorkspaceAlertsStorageConfigured(); + + /** + * Gets the checkWorkspaceAlertsStorageConfigured property: The flag which indicates whether this scheduled query + * rule should be stored in the customer's storage. The default is false. Relevant only for rules of the kind + * LogAlert. + * + * @return the checkWorkspaceAlertsStorageConfigured value. + */ + Boolean checkWorkspaceAlertsStorageConfigured(); + + /** + * Gets the skipQueryValidation property: The flag which indicates whether the provided query should be validated or + * not. The default is false. Relevant only for rules of the kind LogAlert. + * + * @return the skipQueryValidation value. + */ + Boolean skipQueryValidation(); + + /** + * Gets the autoMitigate property: The flag that indicates whether the alert should be automatically resolved or + * not. The default is true. Relevant only for rules of the kind LogAlert. + * + * @return the autoMitigate value. + */ + Boolean autoMitigate(); + + /** + * Gets the ruleResolveConfiguration property: Defines the configuration for resolving fired alerts. Relevant only + * for rules of the kind LogAlert. + * + * @return the ruleResolveConfiguration value. + */ + RuleResolveConfiguration ruleResolveConfiguration(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.ScheduledQueryRuleResourceInner object. + * + * @return the inner object. + */ + ScheduledQueryRuleResourceInner innerModel(); + + /** The entirety of the ScheduledQueryRuleResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The ScheduledQueryRuleResource definition stages. */ + interface DefinitionStages { + /** The first stage of the ScheduledQueryRuleResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the ScheduledQueryRuleResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithIdentity, + DefinitionStages.WithKind, + DefinitionStages.WithDescription, + DefinitionStages.WithDisplayName, + DefinitionStages.WithSeverity, + DefinitionStages.WithEnabled, + DefinitionStages.WithPublicNetworkAccess, + DefinitionStages.WithScopes, + DefinitionStages.WithEvaluationFrequency, + DefinitionStages.WithWindowSize, + DefinitionStages.WithOverrideQueryTimeRange, + DefinitionStages.WithTargetResourceTypes, + DefinitionStages.WithCriteria, + DefinitionStages.WithMuteActionsDuration, + DefinitionStages.WithActions, + DefinitionStages.WithCheckWorkspaceAlertsStorageConfigured, + DefinitionStages.WithSkipQueryValidation, + DefinitionStages.WithAutoMitigate, + DefinitionStages.WithRuleResolveConfiguration { + /** + * Executes the create request. + * + * @return the created resource. + */ + ScheduledQueryRuleResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ScheduledQueryRuleResource create(Context context); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the resource.. + * + * @param identity The identity of the resource. + * @return the next definition stage. + */ + WithCreate withIdentity(Identity identity); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: Indicates the type of scheduled query rule. The default is LogAlert.. + * + * @param kind Indicates the type of scheduled query rule. The default is LogAlert. + * @return the next definition stage. + */ + WithCreate withKind(Kind kind); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: The description of the scheduled query rule.. + * + * @param description The description of the scheduled query rule. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify displayName. */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name of the alert rule. + * + * @param displayName The display name of the alert rule. + * @return the next definition stage. + */ + WithCreate withDisplayName(String displayName); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify severity. */ + interface WithSeverity { + /** + * Specifies the severity property: Severity of the alert. Should be an integer between [0-4]. Value of 0 is + * severest. Relevant and required only for rules of the kind LogAlert.. + * + * @param severity Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. + * Relevant and required only for rules of the kind LogAlert. + * @return the next definition stage. + */ + WithCreate withSeverity(AlertSeverity severity); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify enabled. */ + interface WithEnabled { + /** + * Specifies the enabled property: The flag which indicates whether this scheduled query rule is enabled. + * Value should be true or false. + * + * @param enabled The flag which indicates whether this scheduled query rule is enabled. Value should be + * true or false. + * @return the next definition stage. + */ + WithCreate withEnabled(Boolean enabled); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify publicNetworkAccess. */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: This determines if traffic is allowed over public network. By + * default it is enabled.. + * + * @param publicNetworkAccess This determines if traffic is allowed over public network. By default it is + * enabled. + * @return the next definition stage. + */ + WithCreate withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify scopes. */ + interface WithScopes { + /** + * Specifies the scopes property: The list of resource id's that this scheduled query rule is scoped to.. + * + * @param scopes The list of resource id's that this scheduled query rule is scoped to. + * @return the next definition stage. + */ + WithCreate withScopes(List scopes); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify evaluationFrequency. */ + interface WithEvaluationFrequency { + /** + * Specifies the evaluationFrequency property: How often the scheduled query rule is evaluated represented + * in ISO 8601 duration format. Relevant and required only for rules of the kind LogAlert.. + * + * @param evaluationFrequency How often the scheduled query rule is evaluated represented in ISO 8601 + * duration format. Relevant and required only for rules of the kind LogAlert. + * @return the next definition stage. + */ + WithCreate withEvaluationFrequency(Duration evaluationFrequency); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify windowSize. */ + interface WithWindowSize { + /** + * Specifies the windowSize property: The period of time (in ISO 8601 duration format) on which the Alert + * query will be executed (bin size). Relevant and required only for rules of the kind LogAlert.. + * + * @param windowSize The period of time (in ISO 8601 duration format) on which the Alert query will be + * executed (bin size). Relevant and required only for rules of the kind LogAlert. + * @return the next definition stage. + */ + WithCreate withWindowSize(Duration windowSize); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify overrideQueryTimeRange. */ + interface WithOverrideQueryTimeRange { + /** + * Specifies the overrideQueryTimeRange property: If specified then overrides the query time range (default + * is WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert.. + * + * @param overrideQueryTimeRange If specified then overrides the query time range (default is + * WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + * @return the next definition stage. + */ + WithCreate withOverrideQueryTimeRange(Duration overrideQueryTimeRange); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify targetResourceTypes. */ + interface WithTargetResourceTypes { + /** + * Specifies the targetResourceTypes property: List of resource type of the target resource(s) on which the + * alert is created/updated. For example if the scope is a resource group and targetResourceTypes is + * Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual machine in the + * resource group which meet the alert criteria. Relevant only for rules of the kind LogAlert. + * + * @param targetResourceTypes List of resource type of the target resource(s) on which the alert is + * created/updated. For example if the scope is a resource group and targetResourceTypes is + * Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual machine in + * the resource group which meet the alert criteria. Relevant only for rules of the kind LogAlert. + * @return the next definition stage. + */ + WithCreate withTargetResourceTypes(List targetResourceTypes); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify criteria. */ + interface WithCriteria { + /** + * Specifies the criteria property: The rule criteria that defines the conditions of the scheduled query + * rule.. + * + * @param criteria The rule criteria that defines the conditions of the scheduled query rule. + * @return the next definition stage. + */ + WithCreate withCriteria(ScheduledQueryRuleCriteria criteria); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify muteActionsDuration. */ + interface WithMuteActionsDuration { + /** + * Specifies the muteActionsDuration property: Mute actions for the chosen period of time (in ISO 8601 + * duration format) after the alert is fired. Relevant only for rules of the kind LogAlert.. + * + * @param muteActionsDuration Mute actions for the chosen period of time (in ISO 8601 duration format) after + * the alert is fired. Relevant only for rules of the kind LogAlert. + * @return the next definition stage. + */ + WithCreate withMuteActionsDuration(Duration muteActionsDuration); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify actions. */ + interface WithActions { + /** + * Specifies the actions property: Actions to invoke when the alert fires.. + * + * @param actions Actions to invoke when the alert fires. + * @return the next definition stage. + */ + WithCreate withActions(Actions actions); + } + /** + * The stage of the ScheduledQueryRuleResource definition allowing to specify + * checkWorkspaceAlertsStorageConfigured. + */ + interface WithCheckWorkspaceAlertsStorageConfigured { + /** + * Specifies the checkWorkspaceAlertsStorageConfigured property: The flag which indicates whether this + * scheduled query rule should be stored in the customer's storage. The default is false. Relevant only for + * rules of the kind LogAlert.. + * + * @param checkWorkspaceAlertsStorageConfigured The flag which indicates whether this scheduled query rule + * should be stored in the customer's storage. The default is false. Relevant only for rules of the kind + * LogAlert. + * @return the next definition stage. + */ + WithCreate withCheckWorkspaceAlertsStorageConfigured(Boolean checkWorkspaceAlertsStorageConfigured); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify skipQueryValidation. */ + interface WithSkipQueryValidation { + /** + * Specifies the skipQueryValidation property: The flag which indicates whether the provided query should be + * validated or not. The default is false. Relevant only for rules of the kind LogAlert.. + * + * @param skipQueryValidation The flag which indicates whether the provided query should be validated or + * not. The default is false. Relevant only for rules of the kind LogAlert. + * @return the next definition stage. + */ + WithCreate withSkipQueryValidation(Boolean skipQueryValidation); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify autoMitigate. */ + interface WithAutoMitigate { + /** + * Specifies the autoMitigate property: The flag that indicates whether the alert should be automatically + * resolved or not. The default is true. Relevant only for rules of the kind LogAlert.. + * + * @param autoMitigate The flag that indicates whether the alert should be automatically resolved or not. + * The default is true. Relevant only for rules of the kind LogAlert. + * @return the next definition stage. + */ + WithCreate withAutoMitigate(Boolean autoMitigate); + } + /** The stage of the ScheduledQueryRuleResource definition allowing to specify ruleResolveConfiguration. */ + interface WithRuleResolveConfiguration { + /** + * Specifies the ruleResolveConfiguration property: Defines the configuration for resolving fired alerts. + * Relevant only for rules of the kind LogAlert.. + * + * @param ruleResolveConfiguration Defines the configuration for resolving fired alerts. Relevant only for + * rules of the kind LogAlert. + * @return the next definition stage. + */ + WithCreate withRuleResolveConfiguration(RuleResolveConfiguration ruleResolveConfiguration); + } + } + /** + * Begins update for the ScheduledQueryRuleResource resource. + * + * @return the stage of resource update. + */ + ScheduledQueryRuleResource.Update update(); + + /** The template for ScheduledQueryRuleResource update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithIdentity, + UpdateStages.WithDescription, + UpdateStages.WithDisplayName, + UpdateStages.WithSeverity, + UpdateStages.WithEnabled, + UpdateStages.WithPublicNetworkAccess, + UpdateStages.WithScopes, + UpdateStages.WithEvaluationFrequency, + UpdateStages.WithWindowSize, + UpdateStages.WithOverrideQueryTimeRange, + UpdateStages.WithTargetResourceTypes, + UpdateStages.WithCriteria, + UpdateStages.WithMuteActionsDuration, + UpdateStages.WithActions, + UpdateStages.WithCheckWorkspaceAlertsStorageConfigured, + UpdateStages.WithSkipQueryValidation, + UpdateStages.WithAutoMitigate, + UpdateStages.WithRuleResolveConfiguration { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ScheduledQueryRuleResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ScheduledQueryRuleResource apply(Context context); + } + /** The ScheduledQueryRuleResource update stages. */ + interface UpdateStages { + /** The stage of the ScheduledQueryRuleResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the ScheduledQueryRuleResource update allowing to specify identity. */ + interface WithIdentity { + /** + * Specifies the identity property: The identity of the resource.. + * + * @param identity The identity of the resource. + * @return the next definition stage. + */ + Update withIdentity(Identity identity); + } + /** The stage of the ScheduledQueryRuleResource update allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: The description of the scheduled query rule.. + * + * @param description The description of the scheduled query rule. + * @return the next definition stage. + */ + Update withDescription(String description); + } + /** The stage of the ScheduledQueryRuleResource update allowing to specify displayName. */ + interface WithDisplayName { + /** + * Specifies the displayName property: The display name of the alert rule. + * + * @param displayName The display name of the alert rule. + * @return the next definition stage. + */ + Update withDisplayName(String displayName); + } + /** The stage of the ScheduledQueryRuleResource update allowing to specify severity. */ + interface WithSeverity { + /** + * Specifies the severity property: Severity of the alert. Should be an integer between [0-4]. Value of 0 is + * severest. Relevant and required only for rules of the kind LogAlert.. + * + * @param severity Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. + * Relevant and required only for rules of the kind LogAlert. + * @return the next definition stage. + */ + Update withSeverity(AlertSeverity severity); + } + /** The stage of the ScheduledQueryRuleResource update allowing to specify enabled. */ + interface WithEnabled { + /** + * Specifies the enabled property: The flag which indicates whether this scheduled query rule is enabled. + * Value should be true or false. + * + * @param enabled The flag which indicates whether this scheduled query rule is enabled. Value should be + * true or false. + * @return the next definition stage. + */ + Update withEnabled(Boolean enabled); + } + /** The stage of the ScheduledQueryRuleResource update allowing to specify publicNetworkAccess. */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: This determines if traffic is allowed over public network. By + * default it is enabled.. + * + * @param publicNetworkAccess This determines if traffic is allowed over public network. By default it is + * enabled. + * @return the next definition stage. + */ + Update withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess); + } + /** The stage of the ScheduledQueryRuleResource update allowing to specify scopes. */ + interface WithScopes { + /** + * Specifies the scopes property: The list of resource id's that this scheduled query rule is scoped to.. + * + * @param scopes The list of resource id's that this scheduled query rule is scoped to. + * @return the next definition stage. + */ + Update withScopes(List scopes); + } + /** The stage of the ScheduledQueryRuleResource update allowing to specify evaluationFrequency. */ + interface WithEvaluationFrequency { + /** + * Specifies the evaluationFrequency property: How often the scheduled query rule is evaluated represented + * in ISO 8601 duration format. Relevant and required only for rules of the kind LogAlert.. + * + * @param evaluationFrequency How often the scheduled query rule is evaluated represented in ISO 8601 + * duration format. Relevant and required only for rules of the kind LogAlert. + * @return the next definition stage. + */ + Update withEvaluationFrequency(Duration evaluationFrequency); + } + /** The stage of the ScheduledQueryRuleResource update allowing to specify windowSize. */ + interface WithWindowSize { + /** + * Specifies the windowSize property: The period of time (in ISO 8601 duration format) on which the Alert + * query will be executed (bin size). Relevant and required only for rules of the kind LogAlert.. + * + * @param windowSize The period of time (in ISO 8601 duration format) on which the Alert query will be + * executed (bin size). Relevant and required only for rules of the kind LogAlert. + * @return the next definition stage. + */ + Update withWindowSize(Duration windowSize); + } + /** The stage of the ScheduledQueryRuleResource update allowing to specify overrideQueryTimeRange. */ + interface WithOverrideQueryTimeRange { + /** + * Specifies the overrideQueryTimeRange property: If specified then overrides the query time range (default + * is WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert.. + * + * @param overrideQueryTimeRange If specified then overrides the query time range (default is + * WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + * @return the next definition stage. + */ + Update withOverrideQueryTimeRange(Duration overrideQueryTimeRange); + } + /** The stage of the ScheduledQueryRuleResource update allowing to specify targetResourceTypes. */ + interface WithTargetResourceTypes { + /** + * Specifies the targetResourceTypes property: List of resource type of the target resource(s) on which the + * alert is created/updated. For example if the scope is a resource group and targetResourceTypes is + * Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual machine in the + * resource group which meet the alert criteria. Relevant only for rules of the kind LogAlert. + * + * @param targetResourceTypes List of resource type of the target resource(s) on which the alert is + * created/updated. For example if the scope is a resource group and targetResourceTypes is + * Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual machine in + * the resource group which meet the alert criteria. Relevant only for rules of the kind LogAlert. + * @return the next definition stage. + */ + Update withTargetResourceTypes(List targetResourceTypes); + } + /** The stage of the ScheduledQueryRuleResource update allowing to specify criteria. */ + interface WithCriteria { + /** + * Specifies the criteria property: The rule criteria that defines the conditions of the scheduled query + * rule.. + * + * @param criteria The rule criteria that defines the conditions of the scheduled query rule. + * @return the next definition stage. + */ + Update withCriteria(ScheduledQueryRuleCriteria criteria); + } + /** The stage of the ScheduledQueryRuleResource update allowing to specify muteActionsDuration. */ + interface WithMuteActionsDuration { + /** + * Specifies the muteActionsDuration property: Mute actions for the chosen period of time (in ISO 8601 + * duration format) after the alert is fired. Relevant only for rules of the kind LogAlert.. + * + * @param muteActionsDuration Mute actions for the chosen period of time (in ISO 8601 duration format) after + * the alert is fired. Relevant only for rules of the kind LogAlert. + * @return the next definition stage. + */ + Update withMuteActionsDuration(Duration muteActionsDuration); + } + /** The stage of the ScheduledQueryRuleResource update allowing to specify actions. */ + interface WithActions { + /** + * Specifies the actions property: Actions to invoke when the alert fires.. + * + * @param actions Actions to invoke when the alert fires. + * @return the next definition stage. + */ + Update withActions(Actions actions); + } + /** + * The stage of the ScheduledQueryRuleResource update allowing to specify checkWorkspaceAlertsStorageConfigured. + */ + interface WithCheckWorkspaceAlertsStorageConfigured { + /** + * Specifies the checkWorkspaceAlertsStorageConfigured property: The flag which indicates whether this + * scheduled query rule should be stored in the customer's storage. The default is false. Relevant only for + * rules of the kind LogAlert.. + * + * @param checkWorkspaceAlertsStorageConfigured The flag which indicates whether this scheduled query rule + * should be stored in the customer's storage. The default is false. Relevant only for rules of the kind + * LogAlert. + * @return the next definition stage. + */ + Update withCheckWorkspaceAlertsStorageConfigured(Boolean checkWorkspaceAlertsStorageConfigured); + } + /** The stage of the ScheduledQueryRuleResource update allowing to specify skipQueryValidation. */ + interface WithSkipQueryValidation { + /** + * Specifies the skipQueryValidation property: The flag which indicates whether the provided query should be + * validated or not. The default is false. Relevant only for rules of the kind LogAlert.. + * + * @param skipQueryValidation The flag which indicates whether the provided query should be validated or + * not. The default is false. Relevant only for rules of the kind LogAlert. + * @return the next definition stage. + */ + Update withSkipQueryValidation(Boolean skipQueryValidation); + } + /** The stage of the ScheduledQueryRuleResource update allowing to specify autoMitigate. */ + interface WithAutoMitigate { + /** + * Specifies the autoMitigate property: The flag that indicates whether the alert should be automatically + * resolved or not. The default is true. Relevant only for rules of the kind LogAlert.. + * + * @param autoMitigate The flag that indicates whether the alert should be automatically resolved or not. + * The default is true. Relevant only for rules of the kind LogAlert. + * @return the next definition stage. + */ + Update withAutoMitigate(Boolean autoMitigate); + } + /** The stage of the ScheduledQueryRuleResource update allowing to specify ruleResolveConfiguration. */ + interface WithRuleResolveConfiguration { + /** + * Specifies the ruleResolveConfiguration property: Defines the configuration for resolving fired alerts. + * Relevant only for rules of the kind LogAlert.. + * + * @param ruleResolveConfiguration Defines the configuration for resolving fired alerts. Relevant only for + * rules of the kind LogAlert. + * @return the next definition stage. + */ + Update withRuleResolveConfiguration(RuleResolveConfiguration ruleResolveConfiguration); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ScheduledQueryRuleResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ScheduledQueryRuleResource refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRuleResourceCollection.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRuleResourceCollection.java new file mode 100644 index 0000000000000..9096a4bcdf355 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRuleResourceCollection.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.ScheduledQueryRuleResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of scheduled query rule resources. */ +@Fluent +public final class ScheduledQueryRuleResourceCollection { + /* + * The values for the scheduled query rule resources. + */ + @JsonProperty(value = "value") + private List value; + + /* + * Provides the link to retrieve the next set of elements. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ScheduledQueryRuleResourceCollection class. */ + public ScheduledQueryRuleResourceCollection() { + } + + /** + * Get the value property: The values for the scheduled query rule resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The values for the scheduled query rule resources. + * + * @param value the value value to set. + * @return the ScheduledQueryRuleResourceCollection object itself. + */ + public ScheduledQueryRuleResourceCollection withValue(List value) { + this.value = value; + return this; + } + + /** + * Get the nextLink property: Provides the link to retrieve the next set of elements. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRuleResourcePatch.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRuleResourcePatch.java new file mode 100644 index 0000000000000..7d3db9dbf3a33 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRuleResourcePatch.java @@ -0,0 +1,554 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.ScheduledQueryRuleProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.util.List; +import java.util.Map; + +/** The scheduled query rule resource for patch operations. */ +@Fluent +public final class ScheduledQueryRuleResourcePatch { + /* + * The identity of the resource. + */ + @JsonProperty(value = "identity") + private Identity identity; + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The scheduled query rule properties of the resource. + */ + @JsonProperty(value = "properties") + private ScheduledQueryRuleProperties innerProperties; + + /** Creates an instance of ScheduledQueryRuleResourcePatch class. */ + public ScheduledQueryRuleResourcePatch() { + } + + /** + * Get the identity property: The identity of the resource. + * + * @return the identity value. + */ + public Identity identity() { + return this.identity; + } + + /** + * Set the identity property: The identity of the resource. + * + * @param identity the identity value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withIdentity(Identity identity) { + this.identity = identity; + return this; + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: The scheduled query rule properties of the resource. + * + * @return the innerProperties value. + */ + private ScheduledQueryRuleProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the createdWithApiVersion property: The api-version used when creating this alert rule. + * + * @return the createdWithApiVersion value. + */ + public String createdWithApiVersion() { + return this.innerProperties() == null ? null : this.innerProperties().createdWithApiVersion(); + } + + /** + * Get the isLegacyLogAnalyticsRule property: True if alert rule is legacy Log Analytic rule. + * + * @return the isLegacyLogAnalyticsRule value. + */ + public Boolean isLegacyLogAnalyticsRule() { + return this.innerProperties() == null ? null : this.innerProperties().isLegacyLogAnalyticsRule(); + } + + /** + * Get the description property: The description of the scheduled query rule. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of the scheduled query rule. + * + * @param description the description value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withDescription(description); + return this; + } + + /** + * Get the displayName property: The display name of the alert rule. + * + * @return the displayName value. + */ + public String displayName() { + return this.innerProperties() == null ? null : this.innerProperties().displayName(); + } + + /** + * Set the displayName property: The display name of the alert rule. + * + * @param displayName the displayName value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the severity property: Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. + * Relevant and required only for rules of the kind LogAlert. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.innerProperties() == null ? null : this.innerProperties().severity(); + } + + /** + * Set the severity property: Severity of the alert. Should be an integer between [0-4]. Value of 0 is severest. + * Relevant and required only for rules of the kind LogAlert. + * + * @param severity the severity value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withSeverity(AlertSeverity severity) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withSeverity(severity); + return this; + } + + /** + * Get the enabled property: The flag which indicates whether this scheduled query rule is enabled. Value should be + * true or false. + * + * @return the enabled value. + */ + public Boolean enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: The flag which indicates whether this scheduled query rule is enabled. Value should be + * true or false. + * + * @param enabled the enabled value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withEnabled(Boolean enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withEnabled(enabled); + return this; + } + + /** + * Get the publicNetworkAccess property: This determines if traffic is allowed over public network. By default it is + * enabled. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccess publicNetworkAccess() { + return this.innerProperties() == null ? null : this.innerProperties().publicNetworkAccess(); + } + + /** + * Set the publicNetworkAccess property: This determines if traffic is allowed over public network. By default it is + * enabled. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withPublicNetworkAccess(PublicNetworkAccess publicNetworkAccess) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** + * Get the scopes property: The list of resource id's that this scheduled query rule is scoped to. + * + * @return the scopes value. + */ + public List scopes() { + return this.innerProperties() == null ? null : this.innerProperties().scopes(); + } + + /** + * Set the scopes property: The list of resource id's that this scheduled query rule is scoped to. + * + * @param scopes the scopes value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withScopes(List scopes) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withScopes(scopes); + return this; + } + + /** + * Get the evaluationFrequency property: How often the scheduled query rule is evaluated represented in ISO 8601 + * duration format. Relevant and required only for rules of the kind LogAlert. + * + * @return the evaluationFrequency value. + */ + public Duration evaluationFrequency() { + return this.innerProperties() == null ? null : this.innerProperties().evaluationFrequency(); + } + + /** + * Set the evaluationFrequency property: How often the scheduled query rule is evaluated represented in ISO 8601 + * duration format. Relevant and required only for rules of the kind LogAlert. + * + * @param evaluationFrequency the evaluationFrequency value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withEvaluationFrequency(Duration evaluationFrequency) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withEvaluationFrequency(evaluationFrequency); + return this; + } + + /** + * Get the windowSize property: The period of time (in ISO 8601 duration format) on which the Alert query will be + * executed (bin size). Relevant and required only for rules of the kind LogAlert. + * + * @return the windowSize value. + */ + public Duration windowSize() { + return this.innerProperties() == null ? null : this.innerProperties().windowSize(); + } + + /** + * Set the windowSize property: The period of time (in ISO 8601 duration format) on which the Alert query will be + * executed (bin size). Relevant and required only for rules of the kind LogAlert. + * + * @param windowSize the windowSize value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withWindowSize(Duration windowSize) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withWindowSize(windowSize); + return this; + } + + /** + * Get the overrideQueryTimeRange property: If specified then overrides the query time range (default is + * WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + * + * @return the overrideQueryTimeRange value. + */ + public Duration overrideQueryTimeRange() { + return this.innerProperties() == null ? null : this.innerProperties().overrideQueryTimeRange(); + } + + /** + * Set the overrideQueryTimeRange property: If specified then overrides the query time range (default is + * WindowSize*NumberOfEvaluationPeriods). Relevant only for rules of the kind LogAlert. + * + * @param overrideQueryTimeRange the overrideQueryTimeRange value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withOverrideQueryTimeRange(Duration overrideQueryTimeRange) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withOverrideQueryTimeRange(overrideQueryTimeRange); + return this; + } + + /** + * Get the targetResourceTypes property: List of resource type of the target resource(s) on which the alert is + * created/updated. For example if the scope is a resource group and targetResourceTypes is + * Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual machine in the resource + * group which meet the alert criteria. Relevant only for rules of the kind LogAlert. + * + * @return the targetResourceTypes value. + */ + public List targetResourceTypes() { + return this.innerProperties() == null ? null : this.innerProperties().targetResourceTypes(); + } + + /** + * Set the targetResourceTypes property: List of resource type of the target resource(s) on which the alert is + * created/updated. For example if the scope is a resource group and targetResourceTypes is + * Microsoft.Compute/virtualMachines, then a different alert will be fired for each virtual machine in the resource + * group which meet the alert criteria. Relevant only for rules of the kind LogAlert. + * + * @param targetResourceTypes the targetResourceTypes value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withTargetResourceTypes(List targetResourceTypes) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withTargetResourceTypes(targetResourceTypes); + return this; + } + + /** + * Get the criteria property: The rule criteria that defines the conditions of the scheduled query rule. + * + * @return the criteria value. + */ + public ScheduledQueryRuleCriteria criteria() { + return this.innerProperties() == null ? null : this.innerProperties().criteria(); + } + + /** + * Set the criteria property: The rule criteria that defines the conditions of the scheduled query rule. + * + * @param criteria the criteria value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withCriteria(ScheduledQueryRuleCriteria criteria) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withCriteria(criteria); + return this; + } + + /** + * Get the muteActionsDuration property: Mute actions for the chosen period of time (in ISO 8601 duration format) + * after the alert is fired. Relevant only for rules of the kind LogAlert. + * + * @return the muteActionsDuration value. + */ + public Duration muteActionsDuration() { + return this.innerProperties() == null ? null : this.innerProperties().muteActionsDuration(); + } + + /** + * Set the muteActionsDuration property: Mute actions for the chosen period of time (in ISO 8601 duration format) + * after the alert is fired. Relevant only for rules of the kind LogAlert. + * + * @param muteActionsDuration the muteActionsDuration value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withMuteActionsDuration(Duration muteActionsDuration) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withMuteActionsDuration(muteActionsDuration); + return this; + } + + /** + * Get the actions property: Actions to invoke when the alert fires. + * + * @return the actions value. + */ + public Actions actions() { + return this.innerProperties() == null ? null : this.innerProperties().actions(); + } + + /** + * Set the actions property: Actions to invoke when the alert fires. + * + * @param actions the actions value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withActions(Actions actions) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withActions(actions); + return this; + } + + /** + * Get the isWorkspaceAlertsStorageConfigured property: The flag which indicates whether this scheduled query rule + * has been configured to be stored in the customer's storage. The default is false. + * + * @return the isWorkspaceAlertsStorageConfigured value. + */ + public Boolean isWorkspaceAlertsStorageConfigured() { + return this.innerProperties() == null ? null : this.innerProperties().isWorkspaceAlertsStorageConfigured(); + } + + /** + * Get the checkWorkspaceAlertsStorageConfigured property: The flag which indicates whether this scheduled query + * rule should be stored in the customer's storage. The default is false. Relevant only for rules of the kind + * LogAlert. + * + * @return the checkWorkspaceAlertsStorageConfigured value. + */ + public Boolean checkWorkspaceAlertsStorageConfigured() { + return this.innerProperties() == null ? null : this.innerProperties().checkWorkspaceAlertsStorageConfigured(); + } + + /** + * Set the checkWorkspaceAlertsStorageConfigured property: The flag which indicates whether this scheduled query + * rule should be stored in the customer's storage. The default is false. Relevant only for rules of the kind + * LogAlert. + * + * @param checkWorkspaceAlertsStorageConfigured the checkWorkspaceAlertsStorageConfigured value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withCheckWorkspaceAlertsStorageConfigured( + Boolean checkWorkspaceAlertsStorageConfigured) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withCheckWorkspaceAlertsStorageConfigured(checkWorkspaceAlertsStorageConfigured); + return this; + } + + /** + * Get the skipQueryValidation property: The flag which indicates whether the provided query should be validated or + * not. The default is false. Relevant only for rules of the kind LogAlert. + * + * @return the skipQueryValidation value. + */ + public Boolean skipQueryValidation() { + return this.innerProperties() == null ? null : this.innerProperties().skipQueryValidation(); + } + + /** + * Set the skipQueryValidation property: The flag which indicates whether the provided query should be validated or + * not. The default is false. Relevant only for rules of the kind LogAlert. + * + * @param skipQueryValidation the skipQueryValidation value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withSkipQueryValidation(Boolean skipQueryValidation) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withSkipQueryValidation(skipQueryValidation); + return this; + } + + /** + * Get the autoMitigate property: The flag that indicates whether the alert should be automatically resolved or not. + * The default is true. Relevant only for rules of the kind LogAlert. + * + * @return the autoMitigate value. + */ + public Boolean autoMitigate() { + return this.innerProperties() == null ? null : this.innerProperties().autoMitigate(); + } + + /** + * Set the autoMitigate property: The flag that indicates whether the alert should be automatically resolved or not. + * The default is true. Relevant only for rules of the kind LogAlert. + * + * @param autoMitigate the autoMitigate value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withAutoMitigate(Boolean autoMitigate) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withAutoMitigate(autoMitigate); + return this; + } + + /** + * Get the ruleResolveConfiguration property: Defines the configuration for resolving fired alerts. Relevant only + * for rules of the kind LogAlert. + * + * @return the ruleResolveConfiguration value. + */ + public RuleResolveConfiguration ruleResolveConfiguration() { + return this.innerProperties() == null ? null : this.innerProperties().ruleResolveConfiguration(); + } + + /** + * Set the ruleResolveConfiguration property: Defines the configuration for resolving fired alerts. Relevant only + * for rules of the kind LogAlert. + * + * @param ruleResolveConfiguration the ruleResolveConfiguration value to set. + * @return the ScheduledQueryRuleResourcePatch object itself. + */ + public ScheduledQueryRuleResourcePatch withRuleResolveConfiguration( + RuleResolveConfiguration ruleResolveConfiguration) { + if (this.innerProperties() == null) { + this.innerProperties = new ScheduledQueryRuleProperties(); + } + this.innerProperties().withRuleResolveConfiguration(ruleResolveConfiguration); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (innerProperties() != null) { + innerProperties().validate(); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRules.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRules.java new file mode 100644 index 0000000000000..e8b5e7e8b4206 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScheduledQueryRules.java @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ScheduledQueryRules. */ +public interface ScheduledQueryRules { + /** + * Retrieve a scheduled query rule definitions in a subscription. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * Retrieve a scheduled query rule definitions in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(Context context); + + /** + * Retrieve scheduled query rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Retrieve scheduled query rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a collection of scheduled query rule resources as paginated response with {@link + * PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieve an scheduled query rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context); + + /** + * Retrieve an scheduled query rule definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource. + */ + ScheduledQueryRuleResource getByResourceGroup(String resourceGroupName, String ruleName); + + /** + * Deletes a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByResourceGroupWithResponse(String resourceGroupName, String ruleName, Context context); + + /** + * Deletes a scheduled query rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param ruleName The name of the rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByResourceGroup(String resourceGroupName, String ruleName); + + /** + * Retrieve an scheduled query rule definition. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource along with {@link Response}. + */ + ScheduledQueryRuleResource getById(String id); + + /** + * Retrieve an scheduled query rule definition. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the scheduled query rule resource along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a scheduled query rule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a scheduled query rule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link Response}. + */ + Response deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ScheduledQueryRuleResource resource. + * + * @param name resource name. + * @return the first stage of the new ScheduledQueryRuleResource definition. + */ + ScheduledQueryRuleResource.DefinitionStages.Blank define(String name); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScopedResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScopedResource.java new file mode 100644 index 0000000000000..95fdf1f902e7b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScopedResource.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.ScopedResourceInner; + +/** An immutable client-side representation of ScopedResource. */ +public interface ScopedResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the systemData property: System data. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the linkedResourceId property: The resource id of the scoped Azure monitor resource. + * + * @return the linkedResourceId value. + */ + String linkedResourceId(); + + /** + * Gets the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.ScopedResourceInner object. + * + * @return the inner object. + */ + ScopedResourceInner innerModel(); + + /** The entirety of the ScopedResource definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ScopedResource definition stages. */ + interface DefinitionStages { + /** The first stage of the ScopedResource definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ScopedResource definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, scopeName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @return the next definition stage. + */ + WithCreate withExistingPrivateLinkScope(String resourceGroupName, String scopeName); + } + /** + * The stage of the ScopedResource definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.WithLinkedResourceId { + /** + * Executes the create request. + * + * @return the created resource. + */ + ScopedResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ScopedResource create(Context context); + } + /** The stage of the ScopedResource definition allowing to specify linkedResourceId. */ + interface WithLinkedResourceId { + /** + * Specifies the linkedResourceId property: The resource id of the scoped Azure monitor resource.. + * + * @param linkedResourceId The resource id of the scoped Azure monitor resource. + * @return the next definition stage. + */ + WithCreate withLinkedResourceId(String linkedResourceId); + } + } + /** + * Begins update for the ScopedResource resource. + * + * @return the stage of resource update. + */ + ScopedResource.Update update(); + + /** The template for ScopedResource update. */ + interface Update extends UpdateStages.WithLinkedResourceId { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ScopedResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ScopedResource apply(Context context); + } + /** The ScopedResource update stages. */ + interface UpdateStages { + /** The stage of the ScopedResource update allowing to specify linkedResourceId. */ + interface WithLinkedResourceId { + /** + * Specifies the linkedResourceId property: The resource id of the scoped Azure monitor resource.. + * + * @param linkedResourceId The resource id of the scoped Azure monitor resource. + * @return the next definition stage. + */ + Update withLinkedResourceId(String linkedResourceId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ScopedResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ScopedResource refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScopedResourceListResult.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScopedResourceListResult.java new file mode 100644 index 0000000000000..667ed12c5609b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScopedResourceListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.resourcemanager.monitor.generated.fluent.models.ScopedResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of scoped resources in a private link scope. */ +@Immutable +public final class ScopedResourceListResult { + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** Creates an instance of ScopedResourceListResult class. */ + public ScopedResourceListResult() { + } + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SenderAuthorization.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SenderAuthorization.java new file mode 100644 index 0000000000000..147abe403499d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SenderAuthorization.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * 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'. + */ +@Fluent +public final class SenderAuthorization { + /* + * the permissible actions. For instance: microsoft.support/supporttickets/write + */ + @JsonProperty(value = "action") + private String action; + + /* + * the role of the user. For instance: Subscription Admin + */ + @JsonProperty(value = "role") + private String role; + + /* + * the scope. + */ + @JsonProperty(value = "scope") + private String scope; + + /** Creates an instance of SenderAuthorization class. */ + public SenderAuthorization() { + } + + /** + * Get the action property: the permissible actions. For instance: microsoft.support/supporttickets/write. + * + * @return the action value. + */ + public String action() { + return this.action; + } + + /** + * Set the action property: the permissible actions. For instance: microsoft.support/supporttickets/write. + * + * @param action the action value to set. + * @return the SenderAuthorization object itself. + */ + public SenderAuthorization withAction(String action) { + this.action = action; + return this; + } + + /** + * Get the role property: the role of the user. For instance: Subscription Admin. + * + * @return the role value. + */ + public String role() { + return this.role; + } + + /** + * Set the role property: the role of the user. For instance: Subscription Admin. + * + * @param role the role value to set. + * @return the SenderAuthorization object itself. + */ + public SenderAuthorization withRole(String role) { + this.role = role; + return this; + } + + /** + * Get the scope property: the scope. + * + * @return the scope value. + */ + public String scope() { + return this.scope; + } + + /** + * Set the scope property: the scope. + * + * @param scope the scope value to set. + * @return the SenderAuthorization object itself. + */ + public SenderAuthorization withScope(String scope) { + this.scope = scope; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SingleBaseline.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SingleBaseline.java new file mode 100644 index 0000000000000..d6a4d7058e38c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SingleBaseline.java @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The baseline values for a single sensitivity value. */ +@Fluent +public final class SingleBaseline { + /* + * the sensitivity of the baseline. + */ + @JsonProperty(value = "sensitivity", required = true) + private BaselineSensitivity sensitivity; + + /* + * The low thresholds of the baseline. + */ + @JsonProperty(value = "lowThresholds", required = true) + private List lowThresholds; + + /* + * The high thresholds of the baseline. + */ + @JsonProperty(value = "highThresholds", required = true) + private List highThresholds; + + /** Creates an instance of SingleBaseline class. */ + public SingleBaseline() { + } + + /** + * Get the sensitivity property: the sensitivity of the baseline. + * + * @return the sensitivity value. + */ + public BaselineSensitivity sensitivity() { + return this.sensitivity; + } + + /** + * Set the sensitivity property: the sensitivity of the baseline. + * + * @param sensitivity the sensitivity value to set. + * @return the SingleBaseline object itself. + */ + public SingleBaseline withSensitivity(BaselineSensitivity sensitivity) { + this.sensitivity = sensitivity; + return this; + } + + /** + * Get the lowThresholds property: The low thresholds of the baseline. + * + * @return the lowThresholds value. + */ + public List lowThresholds() { + return this.lowThresholds; + } + + /** + * Set the lowThresholds property: The low thresholds of the baseline. + * + * @param lowThresholds the lowThresholds value to set. + * @return the SingleBaseline object itself. + */ + public SingleBaseline withLowThresholds(List lowThresholds) { + this.lowThresholds = lowThresholds; + return this; + } + + /** + * Get the highThresholds property: The high thresholds of the baseline. + * + * @return the highThresholds value. + */ + public List highThresholds() { + return this.highThresholds; + } + + /** + * Set the highThresholds property: The high thresholds of the baseline. + * + * @param highThresholds the highThresholds value to set. + * @return the SingleBaseline object itself. + */ + public SingleBaseline withHighThresholds(List highThresholds) { + this.highThresholds = highThresholds; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sensitivity() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property sensitivity in model SingleBaseline")); + } + if (lowThresholds() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property lowThresholds in model SingleBaseline")); + } + if (highThresholds() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property highThresholds in model SingleBaseline")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SingleBaseline.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SingleMetricBaseline.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SingleMetricBaseline.java new file mode 100644 index 0000000000000..2b519dbad35ed --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SingleMetricBaseline.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.SingleMetricBaselineInner; +import java.time.Duration; +import java.util.List; + +/** An immutable client-side representation of SingleMetricBaseline. */ +public interface SingleMetricBaseline { + /** + * Gets the id property: The metric baseline Id. + * + * @return the id value. + */ + String id(); + + /** + * Gets the type property: The resource type of the metric baseline resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the name property: The name of the metric for which the baselines were retrieved. + * + * @return the name value. + */ + String name(); + + /** + * Gets the timespan property: 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. + * + * @return the timespan value. + */ + String timespan(); + + /** + * Gets the interval property: 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. + * + * @return the interval value. + */ + Duration interval(); + + /** + * Gets the namespace property: The namespace of the metrics been queried. + * + * @return the namespace value. + */ + String namespace(); + + /** + * Gets the baselines property: The baseline for each time series that was queried. + * + * @return the baselines value. + */ + List baselines(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.SingleMetricBaselineInner object. + * + * @return the inner object. + */ + SingleMetricBaselineInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SmsReceiver.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SmsReceiver.java new file mode 100644 index 0000000000000..5c91922d1e874 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SmsReceiver.java @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An SMS receiver. */ +@Fluent +public final class SmsReceiver { + /* + * The name of the SMS receiver. Names must be unique across all receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The country code of the SMS receiver. + */ + @JsonProperty(value = "countryCode", required = true) + private String countryCode; + + /* + * The phone number of the SMS receiver. + */ + @JsonProperty(value = "phoneNumber", required = true) + private String phoneNumber; + + /* + * The status of the receiver. + */ + @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) + private ReceiverStatus status; + + /** Creates an instance of SmsReceiver class. */ + public SmsReceiver() { + } + + /** + * Get the name property: The name of the SMS receiver. Names must be unique across all receivers within an action + * group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the SMS receiver. Names must be unique across all receivers within an action + * group. + * + * @param name the name value to set. + * @return the SmsReceiver object itself. + */ + public SmsReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the countryCode property: The country code of the SMS receiver. + * + * @return the countryCode value. + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Set the countryCode property: The country code of the SMS receiver. + * + * @param countryCode the countryCode value to set. + * @return the SmsReceiver object itself. + */ + public SmsReceiver withCountryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Get the phoneNumber property: The phone number of the SMS receiver. + * + * @return the phoneNumber value. + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: The phone number of the SMS receiver. + * + * @param phoneNumber the phoneNumber value to set. + * @return the SmsReceiver object itself. + */ + public SmsReceiver withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Get the status property: The status of the receiver. + * + * @return the status value. + */ + public ReceiverStatus status() { + return this.status; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model SmsReceiver")); + } + if (countryCode() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property countryCode in model SmsReceiver")); + } + if (phoneNumber() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property phoneNumber in model SmsReceiver")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(SmsReceiver.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/StreamDeclaration.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/StreamDeclaration.java new file mode 100644 index 0000000000000..d0ab6a797f325 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/StreamDeclaration.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Declaration of a custom stream. */ +@Fluent +public final class StreamDeclaration { + /* + * List of columns used by data in this stream. + */ + @JsonProperty(value = "columns") + private List columns; + + /** Creates an instance of StreamDeclaration class. */ + public StreamDeclaration() { + } + + /** + * Get the columns property: List of columns used by data in this stream. + * + * @return the columns value. + */ + public List columns() { + return this.columns; + } + + /** + * Set the columns property: List of columns used by data in this stream. + * + * @param columns the columns value to set. + * @return the StreamDeclaration object itself. + */ + public StreamDeclaration withColumns(List columns) { + this.columns = columns; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (columns() != null) { + columns().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SyslogDataSource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SyslogDataSource.java new file mode 100644 index 0000000000000..c04aa1e2f838c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SyslogDataSource.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Definition of which syslog data will be collected and how it will be collected. Only collected from Linux machines. + */ +@Fluent +public final class SyslogDataSource { + /* + * List of streams that this data source will be sent to. + * A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will + * be sent to. + */ + @JsonProperty(value = "streams") + private List streams; + + /* + * The list of facility names. + */ + @JsonProperty(value = "facilityNames") + private List facilityNames; + + /* + * The log levels to collect. + */ + @JsonProperty(value = "logLevels") + private List logLevels; + + /* + * A friendly name for the data source. + * This name should be unique across all data sources (regardless of type) within the data collection rule. + */ + @JsonProperty(value = "name") + private String name; + + /** Creates an instance of SyslogDataSource class. */ + public SyslogDataSource() { + } + + /** + * Get the streams property: List of streams that this data source will be sent to. A stream indicates what schema + * will be used for this data and usually what table in Log Analytics the data will be sent to. + * + * @return the streams value. + */ + public List streams() { + return this.streams; + } + + /** + * Set the streams property: List of streams that this data source will be sent to. A stream indicates what schema + * will be used for this data and usually what table in Log Analytics the data will be sent to. + * + * @param streams the streams value to set. + * @return the SyslogDataSource object itself. + */ + public SyslogDataSource withStreams(List streams) { + this.streams = streams; + return this; + } + + /** + * Get the facilityNames property: The list of facility names. + * + * @return the facilityNames value. + */ + public List facilityNames() { + return this.facilityNames; + } + + /** + * Set the facilityNames property: The list of facility names. + * + * @param facilityNames the facilityNames value to set. + * @return the SyslogDataSource object itself. + */ + public SyslogDataSource withFacilityNames(List facilityNames) { + this.facilityNames = facilityNames; + return this; + } + + /** + * Get the logLevels property: The log levels to collect. + * + * @return the logLevels value. + */ + public List logLevels() { + return this.logLevels; + } + + /** + * Set the logLevels property: The log levels to collect. + * + * @param logLevels the logLevels value to set. + * @return the SyslogDataSource object itself. + */ + public SyslogDataSource withLogLevels(List logLevels) { + this.logLevels = logLevels; + return this; + } + + /** + * Get the name property: A friendly name for the data source. This name should be unique across all data sources + * (regardless of type) within the data collection rule. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: A friendly name for the data source. This name should be unique across all data sources + * (regardless of type) within the data collection rule. + * + * @param name the name value to set. + * @return the SyslogDataSource object itself. + */ + public SyslogDataSource withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TagsResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TagsResource.java new file mode 100644 index 0000000000000..9f0e56ea6d9b8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TagsResource.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** + * A container holding only the Tags for a resource, allowing the user to update the tags on a PrivateLinkScope + * instance. + */ +@Fluent +public final class TagsResource { + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /** Creates an instance of TagsResource class. */ + public TagsResource() { + } + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the TagsResource object itself. + */ + public TagsResource withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TenantActivityLogs.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TenantActivityLogs.java new file mode 100644 index 0000000000000..aa9c8b88c5891 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TenantActivityLogs.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of TenantActivityLogs. */ +public interface TenantActivityLogs { + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs + * for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity + * Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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 as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(); + + /** + * Gets the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity Logs + * for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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. <br>The **$filter** is very restricted and allows only the + * following patterns.<br>- List events for a resource group: $filter=eventTimestamp ge '<Start + * Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and + * resourceGroupName eq '<ResourceGroupName>'.<br>- List events for resource: $filter=eventTimestamp + * ge '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and + * resourceUri eq '<ResourceURI>'.<br>- List events for a subscription: $filter=eventTimestamp ge + * '<Start Time>' and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, + * Operation'.<br>- List events for a resource provider: $filter=eventTimestamp ge '<Start Time>' + * and eventTimestamp le '<End Time>' and eventChannels eq 'Admin, Operation' and resourceProvider eq + * '<ResourceProviderName>'.<br>- 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 + * '<CorrelationID>'.<br>**NOTE**: No other syntax is allowed. + * @param select Used to fetch events with only the given properties.<br>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*. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the Activity Logs for the Tenant.<br>Everything that is applicable to the API to get the Activity + * Logs for the subscription is applicable to this API (the parameters, $filter, etc.).<br>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 as paginated response with {@link + * PagedIterable}. + */ + PagedIterable list(String filter, String select, Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TestNotificationDetailsResponse.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TestNotificationDetailsResponse.java new file mode 100644 index 0000000000000..7d4bfffa0d816 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TestNotificationDetailsResponse.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.TestNotificationDetailsResponseInner; +import java.util.List; + +/** An immutable client-side representation of TestNotificationDetailsResponse. */ +public interface TestNotificationDetailsResponse { + /** + * Gets the context property: The context info. + * + * @return the context value. + */ + Context context(); + + /** + * Gets the state property: The overall state. + * + * @return the state value. + */ + String state(); + + /** + * Gets the completedTime property: The completed time. + * + * @return the completedTime value. + */ + String completedTime(); + + /** + * Gets the createdTime property: The created time. + * + * @return the createdTime value. + */ + String createdTime(); + + /** + * Gets the actionDetails property: The list of action detail. + * + * @return the actionDetails value. + */ + List actionDetails(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.TestNotificationDetailsResponseInner + * object. + * + * @return the inner object. + */ + TestNotificationDetailsResponseInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ThresholdRuleCondition.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ThresholdRuleCondition.java new file mode 100644 index 0000000000000..859f14459c8f3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ThresholdRuleCondition.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.Duration; + +/** A rule condition based on a metric crossing a threshold. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Management.Insights.Models.ThresholdRuleCondition") +@Fluent +public final class ThresholdRuleCondition extends RuleCondition { + /* + * the operator used to compare the data and the threshold. + */ + @JsonProperty(value = "operator", required = true) + private ConditionOperator operator; + + /* + * the threshold value that activates the alert. + */ + @JsonProperty(value = "threshold", required = true) + private double threshold; + + /* + * the period of time (in ISO 8601 duration format) that is used to monitor alert activity based on the threshold. + * If specified then it must be between 5 minutes and 1 day. + */ + @JsonProperty(value = "windowSize") + private Duration windowSize; + + /* + * the time aggregation operator. How the data that are collected should be combined over time. The default value + * is the PrimaryAggregationType of the Metric. + */ + @JsonProperty(value = "timeAggregation") + private TimeAggregationOperator timeAggregation; + + /** Creates an instance of ThresholdRuleCondition class. */ + public ThresholdRuleCondition() { + } + + /** + * Get the operator property: the operator used to compare the data and the threshold. + * + * @return the operator value. + */ + public ConditionOperator operator() { + return this.operator; + } + + /** + * Set the operator property: the operator used to compare the data and the threshold. + * + * @param operator the operator value to set. + * @return the ThresholdRuleCondition object itself. + */ + public ThresholdRuleCondition withOperator(ConditionOperator operator) { + this.operator = operator; + return this; + } + + /** + * Get the threshold property: the threshold value that activates the alert. + * + * @return the threshold value. + */ + public double threshold() { + return this.threshold; + } + + /** + * Set the threshold property: the threshold value that activates the alert. + * + * @param threshold the threshold value to set. + * @return the ThresholdRuleCondition object itself. + */ + public ThresholdRuleCondition withThreshold(double threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert + * activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + * + * @return the windowSize value. + */ + public Duration windowSize() { + return this.windowSize; + } + + /** + * Set the windowSize property: the period of time (in ISO 8601 duration format) that is used to monitor alert + * activity based on the threshold. If specified then it must be between 5 minutes and 1 day. + * + * @param windowSize the windowSize value to set. + * @return the ThresholdRuleCondition object itself. + */ + public ThresholdRuleCondition withWindowSize(Duration windowSize) { + this.windowSize = windowSize; + return this; + } + + /** + * Get the timeAggregation property: the time aggregation operator. How the data that are collected should be + * combined over time. The default value is the PrimaryAggregationType of the Metric. + * + * @return the timeAggregation value. + */ + public TimeAggregationOperator timeAggregation() { + return this.timeAggregation; + } + + /** + * Set the timeAggregation property: the time aggregation operator. How the data that are collected should be + * combined over time. The default value is the PrimaryAggregationType of the Metric. + * + * @param timeAggregation the timeAggregation value to set. + * @return the ThresholdRuleCondition object itself. + */ + public ThresholdRuleCondition withTimeAggregation(TimeAggregationOperator timeAggregation) { + this.timeAggregation = timeAggregation; + return this; + } + + /** {@inheritDoc} */ + @Override + public ThresholdRuleCondition withDataSource(RuleDataSource dataSource) { + super.withDataSource(dataSource); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (operator() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property operator in model ThresholdRuleCondition")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ThresholdRuleCondition.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeAggregation.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeAggregation.java new file mode 100644 index 0000000000000..f51b266d55bc8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeAggregation.java @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Aggregation type. Relevant and required only for rules of the kind LogAlert. */ +public final class TimeAggregation extends ExpandableStringEnum { + /** Static value Count for TimeAggregation. */ + public static final TimeAggregation COUNT = fromString("Count"); + + /** Static value Average for TimeAggregation. */ + public static final TimeAggregation AVERAGE = fromString("Average"); + + /** Static value Minimum for TimeAggregation. */ + public static final TimeAggregation MINIMUM = fromString("Minimum"); + + /** Static value Maximum for TimeAggregation. */ + public static final TimeAggregation MAXIMUM = fromString("Maximum"); + + /** Static value Total for TimeAggregation. */ + public static final TimeAggregation TOTAL = fromString("Total"); + + /** + * Creates a new instance of TimeAggregation value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public TimeAggregation() { + } + + /** + * Creates or finds a TimeAggregation from its string representation. + * + * @param name a name to look for. + * @return the corresponding TimeAggregation. + */ + @JsonCreator + public static TimeAggregation fromString(String name) { + return fromString(name, TimeAggregation.class); + } + + /** + * Gets known TimeAggregation values. + * + * @return known TimeAggregation values. + */ + public static Collection values() { + return values(TimeAggregation.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeAggregationOperator.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeAggregationOperator.java new file mode 100644 index 0000000000000..452c2f1ce67f6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeAggregationOperator.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Aggregation operators allowed in a rule. */ +public enum TimeAggregationOperator { + /** Enum value Average. */ + AVERAGE("Average"), + + /** Enum value Minimum. */ + MINIMUM("Minimum"), + + /** Enum value Maximum. */ + MAXIMUM("Maximum"), + + /** Enum value Total. */ + TOTAL("Total"), + + /** Enum value Last. */ + LAST("Last"); + + /** The actual serialized value for a TimeAggregationOperator instance. */ + private final String value; + + TimeAggregationOperator(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TimeAggregationOperator instance. + * + * @param value the serialized value to parse. + * @return the parsed TimeAggregationOperator object, or null if unable to parse. + */ + @JsonCreator + public static TimeAggregationOperator fromString(String value) { + if (value == null) { + return null; + } + TimeAggregationOperator[] items = TimeAggregationOperator.values(); + for (TimeAggregationOperator item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeAggregationType.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeAggregationType.java new file mode 100644 index 0000000000000..42442f996cfa6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeAggregationType.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** time aggregation type. How the data that is collected should be combined over time. The default value is Average. */ +public enum TimeAggregationType { + /** Enum value Average. */ + AVERAGE("Average"), + + /** Enum value Minimum. */ + MINIMUM("Minimum"), + + /** Enum value Maximum. */ + MAXIMUM("Maximum"), + + /** Enum value Total. */ + TOTAL("Total"), + + /** Enum value Count. */ + COUNT("Count"), + + /** Enum value Last. */ + LAST("Last"); + + /** The actual serialized value for a TimeAggregationType instance. */ + private final String value; + + TimeAggregationType(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a TimeAggregationType instance. + * + * @param value the serialized value to parse. + * @return the parsed TimeAggregationType object, or null if unable to parse. + */ + @JsonCreator + public static TimeAggregationType fromString(String value) { + if (value == null) { + return null; + } + TimeAggregationType[] items = TimeAggregationType.values(); + for (TimeAggregationType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + /** {@inheritDoc} */ + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeSeriesBaseline.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeSeriesBaseline.java new file mode 100644 index 0000000000000..64fd113cf6d89 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeSeriesBaseline.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; + +/** The baseline values for a single time series. */ +@Fluent +public final class TimeSeriesBaseline { + /* + * The aggregation type of the metric. + */ + @JsonProperty(value = "aggregation", required = true) + private String aggregation; + + /* + * The dimensions of this time series. + */ + @JsonProperty(value = "dimensions") + private List dimensions; + + /* + * The list of timestamps of the baselines. + */ + @JsonProperty(value = "timestamps", required = true) + private List timestamps; + + /* + * The baseline values for each sensitivity. + */ + @JsonProperty(value = "data", required = true) + private List data; + + /* + * The baseline metadata values. + */ + @JsonProperty(value = "metadataValues") + private List metadataValues; + + /** Creates an instance of TimeSeriesBaseline class. */ + public TimeSeriesBaseline() { + } + + /** + * Get the aggregation property: The aggregation type of the metric. + * + * @return the aggregation value. + */ + public String aggregation() { + return this.aggregation; + } + + /** + * Set the aggregation property: The aggregation type of the metric. + * + * @param aggregation the aggregation value to set. + * @return the TimeSeriesBaseline object itself. + */ + public TimeSeriesBaseline withAggregation(String aggregation) { + this.aggregation = aggregation; + return this; + } + + /** + * Get the dimensions property: The dimensions of this time series. + * + * @return the dimensions value. + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Set the dimensions property: The dimensions of this time series. + * + * @param dimensions the dimensions value to set. + * @return the TimeSeriesBaseline object itself. + */ + public TimeSeriesBaseline withDimensions(List dimensions) { + this.dimensions = dimensions; + return this; + } + + /** + * Get the timestamps property: The list of timestamps of the baselines. + * + * @return the timestamps value. + */ + public List timestamps() { + return this.timestamps; + } + + /** + * Set the timestamps property: The list of timestamps of the baselines. + * + * @param timestamps the timestamps value to set. + * @return the TimeSeriesBaseline object itself. + */ + public TimeSeriesBaseline withTimestamps(List timestamps) { + this.timestamps = timestamps; + return this; + } + + /** + * Get the data property: The baseline values for each sensitivity. + * + * @return the data value. + */ + public List data() { + return this.data; + } + + /** + * Set the data property: The baseline values for each sensitivity. + * + * @param data the data value to set. + * @return the TimeSeriesBaseline object itself. + */ + public TimeSeriesBaseline withData(List data) { + this.data = data; + return this; + } + + /** + * Get the metadataValues property: The baseline metadata values. + * + * @return the metadataValues value. + */ + public List metadataValues() { + return this.metadataValues; + } + + /** + * Set the metadataValues property: The baseline metadata values. + * + * @param metadataValues the metadataValues value to set. + * @return the TimeSeriesBaseline object itself. + */ + public TimeSeriesBaseline withMetadataValues(List metadataValues) { + this.metadataValues = metadataValues; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (aggregation() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property aggregation in model TimeSeriesBaseline")); + } + if (dimensions() != null) { + dimensions().forEach(e -> e.validate()); + } + if (timestamps() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property timestamps in model TimeSeriesBaseline")); + } + if (data() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property data in model TimeSeriesBaseline")); + } else { + data().forEach(e -> e.validate()); + } + if (metadataValues() != null) { + metadataValues().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TimeSeriesBaseline.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeSeriesElement.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeSeriesElement.java new file mode 100644 index 0000000000000..40159efa05e36 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeSeriesElement.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetadataValueInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A time series result type. The discriminator value is always TimeSeries in this case. */ +@Fluent +public final class TimeSeriesElement { + /* + * the metadata values returned if $filter was specified in the call. + */ + @JsonProperty(value = "metadatavalues") + private List metadatavalues; + + /* + * An array of data points representing the metric values. This is only returned if a result type of data is + * specified. + */ + @JsonProperty(value = "data") + private List data; + + /** Creates an instance of TimeSeriesElement class. */ + public TimeSeriesElement() { + } + + /** + * Get the metadatavalues property: the metadata values returned if $filter was specified in the call. + * + * @return the metadatavalues value. + */ + public List metadatavalues() { + return this.metadatavalues; + } + + /** + * Set the metadatavalues property: the metadata values returned if $filter was specified in the call. + * + * @param metadatavalues the metadatavalues value to set. + * @return the TimeSeriesElement object itself. + */ + public TimeSeriesElement withMetadatavalues(List metadatavalues) { + this.metadatavalues = metadatavalues; + return this; + } + + /** + * Get the data property: An array of data points representing the metric values. This is only returned if a result + * type of data is specified. + * + * @return the data value. + */ + public List data() { + return this.data; + } + + /** + * Set the data property: An array of data points representing the metric values. This is only returned if a result + * type of data is specified. + * + * @param data the data value to set. + * @return the TimeSeriesElement object itself. + */ + public TimeSeriesElement withData(List data) { + this.data = data; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (metadatavalues() != null) { + metadatavalues().forEach(e -> e.validate()); + } + if (data() != null) { + data().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeWindow.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeWindow.java new file mode 100644 index 0000000000000..c48ccec41e77b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeWindow.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A specific date-time for the profile. */ +@Fluent +public final class TimeWindow { + /* + * 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 + */ + @JsonProperty(value = "timeZone") + private String timeZone; + + /* + * the start time for the profile in ISO 8601 format. + */ + @JsonProperty(value = "start", required = true) + private OffsetDateTime start; + + /* + * the end time for the profile in ISO 8601 format. + */ + @JsonProperty(value = "end", required = true) + private OffsetDateTime end; + + /** Creates an instance of TimeWindow class. */ + public TimeWindow() { + } + + /** + * Get the timeZone property: 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. + * + * @return the timeZone value. + */ + public String timeZone() { + return this.timeZone; + } + + /** + * Set the timeZone property: 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. + * + * @param timeZone the timeZone value to set. + * @return the TimeWindow object itself. + */ + public TimeWindow withTimeZone(String timeZone) { + this.timeZone = timeZone; + return this; + } + + /** + * Get the start property: the start time for the profile in ISO 8601 format. + * + * @return the start value. + */ + public OffsetDateTime start() { + return this.start; + } + + /** + * Set the start property: the start time for the profile in ISO 8601 format. + * + * @param start the start value to set. + * @return the TimeWindow object itself. + */ + public TimeWindow withStart(OffsetDateTime start) { + this.start = start; + return this; + } + + /** + * Get the end property: the end time for the profile in ISO 8601 format. + * + * @return the end value. + */ + public OffsetDateTime end() { + return this.end; + } + + /** + * Set the end property: the end time for the profile in ISO 8601 format. + * + * @param end the end value to set. + * @return the TimeWindow object itself. + */ + public TimeWindow withEnd(OffsetDateTime end) { + this.end = end; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (start() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property start in model TimeWindow")); + } + if (end() == null) { + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("Missing required property end in model TimeWindow")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TimeWindow.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/UserIdentityProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/UserIdentityProperties.java new file mode 100644 index 0000000000000..65ec9aad54d6b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/UserIdentityProperties.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** User assigned identity properties. */ +@Immutable +public final class UserIdentityProperties { + /* + * The principal id of user assigned identity. + */ + @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) + private String principalId; + + /* + * The client id of user assigned identity. + */ + @JsonProperty(value = "clientId", access = JsonProperty.Access.WRITE_ONLY) + private String clientId; + + /** Creates an instance of UserIdentityProperties class. */ + public UserIdentityProperties() { + } + + /** + * Get the principalId property: The principal id of user assigned identity. + * + * @return the principalId value. + */ + public String principalId() { + return this.principalId; + } + + /** + * Get the clientId property: The client id of user assigned identity. + * + * @return the clientId value. + */ + public String clientId() { + return this.clientId; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/VMInsights.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/VMInsights.java new file mode 100644 index 0000000000000..37f836dc11dd7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/VMInsights.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of VMInsights. */ +public interface VMInsights { + /** + * Retrieves the VM Insights onboarding status for the specified resource or resource scope. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource, or scope, whose status + * to retrieve. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return vM Insights onboarding status for a resource along with {@link Response}. + */ + Response getOnboardingStatusWithResponse(String resourceUri, Context context); + + /** + * Retrieves the VM Insights onboarding status for the specified resource or resource scope. + * + * @param resourceUri The fully qualified Azure Resource manager identifier of the resource, or scope, whose status + * to retrieve. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return vM Insights onboarding status for a resource. + */ + VMInsightsOnboardingStatus getOnboardingStatus(String resourceUri); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/VMInsightsOnboardingStatus.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/VMInsightsOnboardingStatus.java new file mode 100644 index 0000000000000..e9602a88ada7e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/VMInsightsOnboardingStatus.java @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.VMInsightsOnboardingStatusInner; +import java.util.List; + +/** An immutable client-side representation of VMInsightsOnboardingStatus. */ +public interface VMInsightsOnboardingStatus { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the resourceId property: Azure Resource Manager identifier of the resource whose onboarding status is being + * represented. + * + * @return the resourceId value. + */ + String resourceId(); + + /** + * Gets the onboardingStatus property: 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. + * + * @return the onboardingStatus value. + */ + OnboardingStatus onboardingStatus(); + + /** + * Gets the dataStatus property: 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. + * + * @return the dataStatus value. + */ + DataStatus dataStatus(); + + /** + * Gets the data property: Containers that currently store VM Insights data for the specified resource. + * + * @return the data value. + */ + List data(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.VMInsightsOnboardingStatusInner object. + * + * @return the inner object. + */ + VMInsightsOnboardingStatusInner innerModel(); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/VoiceReceiver.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/VoiceReceiver.java new file mode 100644 index 0000000000000..fc61aa317dc6d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/VoiceReceiver.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A voice receiver. */ +@Fluent +public final class VoiceReceiver { + /* + * The name of the voice receiver. Names must be unique across all receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The country code of the voice receiver. + */ + @JsonProperty(value = "countryCode", required = true) + private String countryCode; + + /* + * The phone number of the voice receiver. + */ + @JsonProperty(value = "phoneNumber", required = true) + private String phoneNumber; + + /** Creates an instance of VoiceReceiver class. */ + public VoiceReceiver() { + } + + /** + * Get the name property: The name of the voice receiver. Names must be unique across all receivers within an action + * group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the voice receiver. Names must be unique across all receivers within an action + * group. + * + * @param name the name value to set. + * @return the VoiceReceiver object itself. + */ + public VoiceReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the countryCode property: The country code of the voice receiver. + * + * @return the countryCode value. + */ + public String countryCode() { + return this.countryCode; + } + + /** + * Set the countryCode property: The country code of the voice receiver. + * + * @param countryCode the countryCode value to set. + * @return the VoiceReceiver object itself. + */ + public VoiceReceiver withCountryCode(String countryCode) { + this.countryCode = countryCode; + return this; + } + + /** + * Get the phoneNumber property: The phone number of the voice receiver. + * + * @return the phoneNumber value. + */ + public String phoneNumber() { + return this.phoneNumber; + } + + /** + * Set the phoneNumber property: The phone number of the voice receiver. + * + * @param phoneNumber the phoneNumber value to set. + * @return the VoiceReceiver object itself. + */ + public VoiceReceiver withPhoneNumber(String phoneNumber) { + this.phoneNumber = phoneNumber; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model VoiceReceiver")); + } + if (countryCode() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property countryCode in model VoiceReceiver")); + } + if (phoneNumber() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property phoneNumber in model VoiceReceiver")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(VoiceReceiver.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebhookNotification.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebhookNotification.java new file mode 100644 index 0000000000000..c69cd5a6e4860 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebhookNotification.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Webhook notification of an autoscale event. */ +@Fluent +public final class WebhookNotification { + /* + * the service address to receive the notification. + */ + @JsonProperty(value = "serviceUri") + private String serviceUri; + + /* + * a property bag of settings. This value can be empty. + */ + @JsonProperty(value = "properties") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map properties; + + /** Creates an instance of WebhookNotification class. */ + public WebhookNotification() { + } + + /** + * Get the serviceUri property: the service address to receive the notification. + * + * @return the serviceUri value. + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the serviceUri property: the service address to receive the notification. + * + * @param serviceUri the serviceUri value to set. + * @return the WebhookNotification object itself. + */ + public WebhookNotification withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + + /** + * Get the properties property: a property bag of settings. This value can be empty. + * + * @return the properties value. + */ + public Map properties() { + return this.properties; + } + + /** + * Set the properties property: a property bag of settings. This value can be empty. + * + * @param properties the properties value to set. + * @return the WebhookNotification object itself. + */ + public WebhookNotification withProperties(Map properties) { + this.properties = properties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebhookReceiver.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebhookReceiver.java new file mode 100644 index 0000000000000..85c0dc69f8e20 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebhookReceiver.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A webhook receiver. */ +@Fluent +public final class WebhookReceiver { + /* + * The name of the webhook receiver. Names must be unique across all receivers within an action group. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The URI where webhooks should be sent. + */ + @JsonProperty(value = "serviceUri", required = true) + private String serviceUri; + + /* + * Indicates whether to use common alert schema. + */ + @JsonProperty(value = "useCommonAlertSchema") + private Boolean useCommonAlertSchema; + + /* + * Indicates whether or not use AAD authentication. + */ + @JsonProperty(value = "useAadAuth") + private Boolean useAadAuth; + + /* + * Indicates the webhook app object Id for aad auth. + */ + @JsonProperty(value = "objectId") + private String objectId; + + /* + * Indicates the identifier uri for aad auth. + */ + @JsonProperty(value = "identifierUri") + private String identifierUri; + + /* + * Indicates the tenant id for aad auth. + */ + @JsonProperty(value = "tenantId") + private String tenantId; + + /** Creates an instance of WebhookReceiver class. */ + public WebhookReceiver() { + } + + /** + * Get the name property: The name of the webhook receiver. Names must be unique across all receivers within an + * action group. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the webhook receiver. Names must be unique across all receivers within an + * action group. + * + * @param name the name value to set. + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withName(String name) { + this.name = name; + return this; + } + + /** + * Get the serviceUri property: The URI where webhooks should be sent. + * + * @return the serviceUri value. + */ + public String serviceUri() { + return this.serviceUri; + } + + /** + * Set the serviceUri property: The URI where webhooks should be sent. + * + * @param serviceUri the serviceUri value to set. + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withServiceUri(String serviceUri) { + this.serviceUri = serviceUri; + return this; + } + + /** + * Get the useCommonAlertSchema property: Indicates whether to use common alert schema. + * + * @return the useCommonAlertSchema value. + */ + public Boolean useCommonAlertSchema() { + return this.useCommonAlertSchema; + } + + /** + * Set the useCommonAlertSchema property: Indicates whether to use common alert schema. + * + * @param useCommonAlertSchema the useCommonAlertSchema value to set. + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withUseCommonAlertSchema(Boolean useCommonAlertSchema) { + this.useCommonAlertSchema = useCommonAlertSchema; + return this; + } + + /** + * Get the useAadAuth property: Indicates whether or not use AAD authentication. + * + * @return the useAadAuth value. + */ + public Boolean useAadAuth() { + return this.useAadAuth; + } + + /** + * Set the useAadAuth property: Indicates whether or not use AAD authentication. + * + * @param useAadAuth the useAadAuth value to set. + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withUseAadAuth(Boolean useAadAuth) { + this.useAadAuth = useAadAuth; + return this; + } + + /** + * Get the objectId property: Indicates the webhook app object Id for aad auth. + * + * @return the objectId value. + */ + public String objectId() { + return this.objectId; + } + + /** + * Set the objectId property: Indicates the webhook app object Id for aad auth. + * + * @param objectId the objectId value to set. + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withObjectId(String objectId) { + this.objectId = objectId; + return this; + } + + /** + * Get the identifierUri property: Indicates the identifier uri for aad auth. + * + * @return the identifierUri value. + */ + public String identifierUri() { + return this.identifierUri; + } + + /** + * Set the identifierUri property: Indicates the identifier uri for aad auth. + * + * @param identifierUri the identifierUri value to set. + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withIdentifierUri(String identifierUri) { + this.identifierUri = identifierUri; + return this; + } + + /** + * Get the tenantId property: Indicates the tenant id for aad auth. + * + * @return the tenantId value. + */ + public String tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: Indicates the tenant id for aad auth. + * + * @param tenantId the tenantId value to set. + * @return the WebhookReceiver object itself. + */ + public WebhookReceiver withTenantId(String tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (name() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property name in model WebhookReceiver")); + } + if (serviceUri() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property serviceUri in model WebhookReceiver")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WebhookReceiver.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebtestLocationAvailabilityCriteria.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebtestLocationAvailabilityCriteria.java new file mode 100644 index 0000000000000..edf7d283e2e61 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebtestLocationAvailabilityCriteria.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** Specifies the metric alert rule criteria for a web test resource. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName("Microsoft.Azure.Monitor.WebtestLocationAvailabilityCriteria") +@Fluent +public final class WebtestLocationAvailabilityCriteria extends MetricAlertCriteria { + /* + * The Application Insights web test Id. + */ + @JsonProperty(value = "webTestId", required = true) + private String webTestId; + + /* + * The Application Insights resource Id. + */ + @JsonProperty(value = "componentId", required = true) + private String componentId; + + /* + * The number of failed locations. + */ + @JsonProperty(value = "failedLocationCount", required = true) + private float failedLocationCount; + + /** Creates an instance of WebtestLocationAvailabilityCriteria class. */ + public WebtestLocationAvailabilityCriteria() { + } + + /** + * Get the webTestId property: The Application Insights web test Id. + * + * @return the webTestId value. + */ + public String webTestId() { + return this.webTestId; + } + + /** + * Set the webTestId property: The Application Insights web test Id. + * + * @param webTestId the webTestId value to set. + * @return the WebtestLocationAvailabilityCriteria object itself. + */ + public WebtestLocationAvailabilityCriteria withWebTestId(String webTestId) { + this.webTestId = webTestId; + return this; + } + + /** + * Get the componentId property: The Application Insights resource Id. + * + * @return the componentId value. + */ + public String componentId() { + return this.componentId; + } + + /** + * Set the componentId property: The Application Insights resource Id. + * + * @param componentId the componentId value to set. + * @return the WebtestLocationAvailabilityCriteria object itself. + */ + public WebtestLocationAvailabilityCriteria withComponentId(String componentId) { + this.componentId = componentId; + return this; + } + + /** + * Get the failedLocationCount property: The number of failed locations. + * + * @return the failedLocationCount value. + */ + public float failedLocationCount() { + return this.failedLocationCount; + } + + /** + * Set the failedLocationCount property: The number of failed locations. + * + * @param failedLocationCount the failedLocationCount value to set. + * @return the WebtestLocationAvailabilityCriteria object itself. + */ + public WebtestLocationAvailabilityCriteria withFailedLocationCount(float failedLocationCount) { + this.failedLocationCount = failedLocationCount; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (webTestId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property webTestId in model WebtestLocationAvailabilityCriteria")); + } + if (componentId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property componentId in model WebtestLocationAvailabilityCriteria")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WebtestLocationAvailabilityCriteria.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WindowsEventLogDataSource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WindowsEventLogDataSource.java new file mode 100644 index 0000000000000..8265fe163d555 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WindowsEventLogDataSource.java @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * Definition of which Windows Event Log events will be collected and how they will be collected. Only collected from + * Windows machines. + */ +@Fluent +public final class WindowsEventLogDataSource { + /* + * List of streams that this data source will be sent to. + * A stream indicates what schema will be used for this data and usually what table in Log Analytics the data will + * be sent to. + */ + @JsonProperty(value = "streams") + private List streams; + + /* + * A list of Windows Event Log queries in XPATH format. + */ + @JsonProperty(value = "xPathQueries") + private List xPathQueries; + + /* + * A friendly name for the data source. + * This name should be unique across all data sources (regardless of type) within the data collection rule. + */ + @JsonProperty(value = "name") + private String name; + + /** Creates an instance of WindowsEventLogDataSource class. */ + public WindowsEventLogDataSource() { + } + + /** + * Get the streams property: List of streams that this data source will be sent to. A stream indicates what schema + * will be used for this data and usually what table in Log Analytics the data will be sent to. + * + * @return the streams value. + */ + public List streams() { + return this.streams; + } + + /** + * Set the streams property: List of streams that this data source will be sent to. A stream indicates what schema + * will be used for this data and usually what table in Log Analytics the data will be sent to. + * + * @param streams the streams value to set. + * @return the WindowsEventLogDataSource object itself. + */ + public WindowsEventLogDataSource withStreams(List streams) { + this.streams = streams; + return this; + } + + /** + * Get the xPathQueries property: A list of Windows Event Log queries in XPATH format. + * + * @return the xPathQueries value. + */ + public List xPathQueries() { + return this.xPathQueries; + } + + /** + * Set the xPathQueries property: A list of Windows Event Log queries in XPATH format. + * + * @param xPathQueries the xPathQueries value to set. + * @return the WindowsEventLogDataSource object itself. + */ + public WindowsEventLogDataSource withXPathQueries(List xPathQueries) { + this.xPathQueries = xPathQueries; + return this; + } + + /** + * Get the name property: A friendly name for the data source. This name should be unique across all data sources + * (regardless of type) within the data collection rule. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: A friendly name for the data source. This name should be unique across all data sources + * (regardless of type) within the data collection rule. + * + * @param name the name value to set. + * @return the WindowsEventLogDataSource object itself. + */ + public WindowsEventLogDataSource withName(String name) { + this.name = name; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WorkspaceInfo.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WorkspaceInfo.java new file mode 100644 index 0000000000000..a306686685dff --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WorkspaceInfo.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.WorkspaceInfoProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about a Log Analytics Workspace. */ +@Fluent +public final class WorkspaceInfo { + /* + * Azure Resource Manager identifier of the Log Analytics Workspace. + */ + @JsonProperty(value = "id", required = true) + private String id; + + /* + * Location of the Log Analytics workspace. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /* + * Resource properties. + */ + @JsonProperty(value = "properties", required = true) + private WorkspaceInfoProperties innerProperties = new WorkspaceInfoProperties(); + + /** Creates an instance of WorkspaceInfo class. */ + public WorkspaceInfo() { + } + + /** + * Get the id property: Azure Resource Manager identifier of the Log Analytics Workspace. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Azure Resource Manager identifier of the Log Analytics Workspace. + * + * @param id the id value to set. + * @return the WorkspaceInfo object itself. + */ + public WorkspaceInfo withId(String id) { + this.id = id; + return this; + } + + /** + * Get the location property: Location of the Log Analytics workspace. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: Location of the Log Analytics workspace. + * + * @param location the location value to set. + * @return the WorkspaceInfo object itself. + */ + public WorkspaceInfo withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private WorkspaceInfoProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the customerId property: Log Analytics workspace identifier. + * + * @return the customerId value. + */ + public String customerId() { + return this.innerProperties() == null ? null : this.innerProperties().customerId(); + } + + /** + * Set the customerId property: Log Analytics workspace identifier. + * + * @param customerId the customerId value to set. + * @return the WorkspaceInfo object itself. + */ + public WorkspaceInfo withCustomerId(String customerId) { + if (this.innerProperties() == null) { + this.innerProperties = new WorkspaceInfoProperties(); + } + this.innerProperties().withCustomerId(customerId); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (id() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property id in model WorkspaceInfo")); + } + if (location() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property location in model WorkspaceInfo")); + } + if (innerProperties() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property innerProperties in model WorkspaceInfo")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(WorkspaceInfo.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/package-info.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/package-info.java new file mode 100644 index 0000000000000..68a5871166842 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the data models for MonitorClient. Monitor Management Client. */ +package com.azure.resourcemanager.monitor.generated.models; diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/package-info.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/package-info.java new file mode 100644 index 0000000000000..a2864a4af8b17 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/package-info.java @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +/** Package containing the classes for MonitorClient. Monitor Management Client. */ +package com.azure.resourcemanager.monitor.generated; diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/module-info.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/module-info.java new file mode 100644 index 0000000000000..881ba4bcd0ba6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/module-info.java @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +module com.azure.resourcemanager.monitor.generated { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.monitor.generated; + exports com.azure.resourcemanager.monitor.generated.fluent; + exports com.azure.resourcemanager.monitor.generated.fluent.models; + exports com.azure.resourcemanager.monitor.generated.models; + + opens com.azure.resourcemanager.monitor.generated.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.monitor.generated.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsCreateNotificationsAtActionGroupResourceLevelSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsCreateNotificationsAtActionGroupResourceLevelSamples.java new file mode 100644 index 0000000000000..12672bad6e4a3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsCreateNotificationsAtActionGroupResourceLevelSamples.java @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.ArmRoleReceiver; +import com.azure.resourcemanager.monitor.generated.models.AutomationRunbookReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureAppPushReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureFunctionReceiver; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +import com.azure.resourcemanager.monitor.generated.models.EventHubReceiver; +import com.azure.resourcemanager.monitor.generated.models.ItsmReceiver; +import com.azure.resourcemanager.monitor.generated.models.LogicAppReceiver; +import com.azure.resourcemanager.monitor.generated.models.NotificationRequestBody; +import com.azure.resourcemanager.monitor.generated.models.SmsReceiver; +import com.azure.resourcemanager.monitor.generated.models.VoiceReceiver; +import com.azure.resourcemanager.monitor.generated.models.WebhookReceiver; +import java.util.Arrays; + +/** Samples for ActionGroups CreateNotificationsAtActionGroupResourceLevel. */ +public final class ActionGroupsCreateNotificationsAtActionGroupResourceLevelSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/postTestNotificationsAtActionGroupResourceLevel.json + */ + /** + * Sample code: Create notifications at resource group level. + * + * @param manager Entry point to MonitorManager. + */ + public static void createNotificationsAtResourceGroupLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .actionGroups() + .createNotificationsAtActionGroupResourceLevel( + "TestRgName", + "TestAgName", + new NotificationRequestBody() + .withAlertType("budget") + .withEmailReceivers( + Arrays + .asList( + new EmailReceiver() + .withName("John Doe's email") + .withEmailAddress("johndoe@email.com") + .withUseCommonAlertSchema(false), + new EmailReceiver() + .withName("Jane Smith's email") + .withEmailAddress("janesmith@email.com") + .withUseCommonAlertSchema(true))) + .withSmsReceivers( + Arrays + .asList( + new SmsReceiver() + .withName("John Doe's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"), + new SmsReceiver() + .withName("Jane Smith's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("0987654321"))) + .withWebhookReceivers( + Arrays + .asList( + new WebhookReceiver() + .withName("Sample webhook 1") + .withServiceUri("http://www.example.com/webhook1") + .withUseCommonAlertSchema(true), + new WebhookReceiver() + .withName("Sample webhook 2") + .withServiceUri("http://www.example.com/webhook2") + .withUseCommonAlertSchema(true) + .withUseAadAuth(true) + .withObjectId("d3bb868c-fe44-452c-aa26-769a6538c808") + .withIdentifierUri("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84"))) + .withItsmReceivers( + Arrays + .asList( + new ItsmReceiver() + .withName("Sample itsm") + .withWorkspaceId( + "5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c") + .withConnectionId("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1") + .withTicketConfiguration( + "{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}") + .withRegion("westcentralus"))) + .withAzureAppPushReceivers( + Arrays + .asList( + new AzureAppPushReceiver() + .withName("Sample azureAppPush") + .withEmailAddress("johndoe@email.com"))) + .withAutomationRunbookReceivers( + Arrays + .asList( + new AutomationRunbookReceiver() + .withAutomationAccountId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest") + .withRunbookName("Sample runbook") + .withWebhookResourceId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084") + .withIsGlobalRunbook(false) + .withName("testRunbook") + .withServiceUri("http://test.me") + .withUseCommonAlertSchema(true))) + .withVoiceReceivers( + Arrays + .asList( + new VoiceReceiver() + .withName("Sample voice") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"))) + .withLogicAppReceivers( + Arrays + .asList( + new LogicAppReceiver() + .withName("Sample logicApp") + .withResourceId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp") + .withCallbackUrl( + "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") + .withUseCommonAlertSchema(false))) + .withAzureFunctionReceivers( + Arrays + .asList( + new AzureFunctionReceiver() + .withName("Sample azureFunction") + .withFunctionAppResourceId( + "/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp") + .withFunctionName("HttpTriggerCSharp1") + .withHttpTriggerUrl("http://test.me") + .withUseCommonAlertSchema(true))) + .withArmRoleReceivers( + Arrays + .asList( + new ArmRoleReceiver() + .withName("ArmRole-Common") + .withRoleId("11111111-1111-1111-1111-111111111111") + .withUseCommonAlertSchema(true), + new ArmRoleReceiver() + .withName("ArmRole-nonCommon") + .withRoleId("11111111-1111-1111-1111-111111111111") + .withUseCommonAlertSchema(false))) + .withEventHubReceivers( + Arrays + .asList( + new EventHubReceiver() + .withName("Sample eventHub") + .withEventHubNameSpace("testEventHubNameSpace") + .withEventHubName("testEventHub") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84") + .withSubscriptionId("187f412d-1758-44d9-b052-169e2564721d"))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsCreateNotificationsAtResourceGroupLevelSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsCreateNotificationsAtResourceGroupLevelSamples.java new file mode 100644 index 0000000000000..de0108da68485 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsCreateNotificationsAtResourceGroupLevelSamples.java @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.ArmRoleReceiver; +import com.azure.resourcemanager.monitor.generated.models.AutomationRunbookReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureAppPushReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureFunctionReceiver; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +import com.azure.resourcemanager.monitor.generated.models.EventHubReceiver; +import com.azure.resourcemanager.monitor.generated.models.ItsmReceiver; +import com.azure.resourcemanager.monitor.generated.models.LogicAppReceiver; +import com.azure.resourcemanager.monitor.generated.models.NotificationRequestBody; +import com.azure.resourcemanager.monitor.generated.models.SmsReceiver; +import com.azure.resourcemanager.monitor.generated.models.VoiceReceiver; +import com.azure.resourcemanager.monitor.generated.models.WebhookReceiver; +import java.util.Arrays; + +/** Samples for ActionGroups CreateNotificationsAtResourceGroupLevel. */ +public final class ActionGroupsCreateNotificationsAtResourceGroupLevelSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/postTestNotificationsAtResourceGroupLevel.json + */ + /** + * Sample code: Create notifications at resource group level. + * + * @param manager Entry point to MonitorManager. + */ + public static void createNotificationsAtResourceGroupLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .actionGroups() + .createNotificationsAtResourceGroupLevel( + "Default-TestNotifications", + new NotificationRequestBody() + .withAlertType("budget") + .withEmailReceivers( + Arrays + .asList( + new EmailReceiver() + .withName("John Doe's email") + .withEmailAddress("johndoe@email.com") + .withUseCommonAlertSchema(false), + new EmailReceiver() + .withName("Jane Smith's email") + .withEmailAddress("janesmith@email.com") + .withUseCommonAlertSchema(true))) + .withSmsReceivers( + Arrays + .asList( + new SmsReceiver() + .withName("John Doe's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"), + new SmsReceiver() + .withName("Jane Smith's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("0987654321"))) + .withWebhookReceivers( + Arrays + .asList( + new WebhookReceiver() + .withName("Sample webhook 1") + .withServiceUri("http://www.example.com/webhook1") + .withUseCommonAlertSchema(true), + new WebhookReceiver() + .withName("Sample webhook 2") + .withServiceUri("http://www.example.com/webhook2") + .withUseCommonAlertSchema(true) + .withUseAadAuth(true) + .withObjectId("d3bb868c-fe44-452c-aa26-769a6538c808") + .withIdentifierUri("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84"))) + .withItsmReceivers( + Arrays + .asList( + new ItsmReceiver() + .withName("Sample itsm") + .withWorkspaceId( + "5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c") + .withConnectionId("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1") + .withTicketConfiguration( + "{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}") + .withRegion("westcentralus"))) + .withAzureAppPushReceivers( + Arrays + .asList( + new AzureAppPushReceiver() + .withName("Sample azureAppPush") + .withEmailAddress("johndoe@email.com"))) + .withAutomationRunbookReceivers( + Arrays + .asList( + new AutomationRunbookReceiver() + .withAutomationAccountId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest") + .withRunbookName("Sample runbook") + .withWebhookResourceId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084") + .withIsGlobalRunbook(false) + .withName("testRunbook") + .withServiceUri("http://test.me") + .withUseCommonAlertSchema(true))) + .withVoiceReceivers( + Arrays + .asList( + new VoiceReceiver() + .withName("Sample voice") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"))) + .withLogicAppReceivers( + Arrays + .asList( + new LogicAppReceiver() + .withName("Sample logicApp") + .withResourceId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp") + .withCallbackUrl( + "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") + .withUseCommonAlertSchema(false))) + .withAzureFunctionReceivers( + Arrays + .asList( + new AzureFunctionReceiver() + .withName("Sample azureFunction") + .withFunctionAppResourceId( + "/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp") + .withFunctionName("HttpTriggerCSharp1") + .withHttpTriggerUrl("http://test.me") + .withUseCommonAlertSchema(true))) + .withArmRoleReceivers( + Arrays + .asList( + new ArmRoleReceiver() + .withName("ArmRole-Common") + .withRoleId("11111111-1111-1111-1111-111111111111") + .withUseCommonAlertSchema(true), + new ArmRoleReceiver() + .withName("ArmRole-nonCommon") + .withRoleId("11111111-1111-1111-1111-111111111111") + .withUseCommonAlertSchema(false))) + .withEventHubReceivers( + Arrays + .asList( + new EventHubReceiver() + .withName("Sample eventHub") + .withEventHubNameSpace("testEventHubNameSpace") + .withEventHubName("testEventHub") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84") + .withSubscriptionId("187f412d-1758-44d9-b052-169e2564721d"))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsCreateOrUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..a683785832001 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsCreateOrUpdateSamples.java @@ -0,0 +1,164 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.ArmRoleReceiver; +import com.azure.resourcemanager.monitor.generated.models.AutomationRunbookReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureAppPushReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureFunctionReceiver; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +import com.azure.resourcemanager.monitor.generated.models.EventHubReceiver; +import com.azure.resourcemanager.monitor.generated.models.ItsmReceiver; +import com.azure.resourcemanager.monitor.generated.models.LogicAppReceiver; +import com.azure.resourcemanager.monitor.generated.models.SmsReceiver; +import com.azure.resourcemanager.monitor.generated.models.VoiceReceiver; +import com.azure.resourcemanager.monitor.generated.models.WebhookReceiver; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ActionGroups CreateOrUpdate. */ +public final class ActionGroupsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/createOrUpdateActionGroup.json + */ + /** + * Sample code: Create or update an action group. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnActionGroup(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .actionGroups() + .define("SampleActionGroup") + .withRegion("Global") + .withExistingResourceGroup("Default-NotificationRules") + .withTags(mapOf()) + .withGroupShortName("sample") + .withEnabled(true) + .withEmailReceivers( + Arrays + .asList( + new EmailReceiver() + .withName("John Doe's email") + .withEmailAddress("johndoe@email.com") + .withUseCommonAlertSchema(false), + new EmailReceiver() + .withName("Jane Smith's email") + .withEmailAddress("janesmith@email.com") + .withUseCommonAlertSchema(true))) + .withSmsReceivers( + Arrays + .asList( + new SmsReceiver() + .withName("John Doe's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"), + new SmsReceiver() + .withName("Jane Smith's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("0987654321"))) + .withWebhookReceivers( + Arrays + .asList( + new WebhookReceiver() + .withName("Sample webhook 1") + .withServiceUri("http://www.example.com/webhook1") + .withUseCommonAlertSchema(true), + new WebhookReceiver() + .withName("Sample webhook 2") + .withServiceUri("http://www.example.com/webhook2") + .withUseCommonAlertSchema(true) + .withUseAadAuth(true) + .withObjectId("d3bb868c-fe44-452c-aa26-769a6538c808") + .withIdentifierUri("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84"))) + .withItsmReceivers( + Arrays + .asList( + new ItsmReceiver() + .withName("Sample itsm") + .withWorkspaceId( + "5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c") + .withConnectionId("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1") + .withTicketConfiguration( + "{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}") + .withRegion("westcentralus"))) + .withAzureAppPushReceivers( + Arrays + .asList( + new AzureAppPushReceiver() + .withName("Sample azureAppPush") + .withEmailAddress("johndoe@email.com"))) + .withAutomationRunbookReceivers( + Arrays + .asList( + new AutomationRunbookReceiver() + .withAutomationAccountId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest") + .withRunbookName("Sample runbook") + .withWebhookResourceId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084") + .withIsGlobalRunbook(false) + .withName("testRunbook") + .withServiceUri("") + .withUseCommonAlertSchema(true))) + .withVoiceReceivers( + Arrays + .asList( + new VoiceReceiver() + .withName("Sample voice") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"))) + .withLogicAppReceivers( + Arrays + .asList( + new LogicAppReceiver() + .withName("Sample logicApp") + .withResourceId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp") + .withCallbackUrl( + "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") + .withUseCommonAlertSchema(false))) + .withAzureFunctionReceivers( + Arrays + .asList( + new AzureFunctionReceiver() + .withName("Sample azureFunction") + .withFunctionAppResourceId( + "/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp") + .withFunctionName("HttpTriggerCSharp1") + .withHttpTriggerUrl("http://test.me") + .withUseCommonAlertSchema(true))) + .withArmRoleReceivers( + Arrays + .asList( + new ArmRoleReceiver() + .withName("Sample armRole") + .withRoleId("8e3af657-a8ff-443c-a75c-2fe8c4bcb635") + .withUseCommonAlertSchema(true))) + .withEventHubReceivers( + Arrays + .asList( + new EventHubReceiver() + .withName("Sample eventHub") + .withEventHubNameSpace("testEventHubNameSpace") + .withEventHubName("testEventHub") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84") + .withSubscriptionId("187f412d-1758-44d9-b052-169e2564721d"))) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsDeleteSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsDeleteSamples.java new file mode 100644 index 0000000000000..c270baea9dbdd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for ActionGroups Delete. */ +public final class ActionGroupsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/deleteActionGroup.json + */ + /** + * Sample code: Delete an action group. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteAnActionGroup(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .actionGroups() + .deleteByResourceGroupWithResponse( + "Default-NotificationRules", "SampleActionGroup", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsEnableReceiverSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsEnableReceiverSamples.java new file mode 100644 index 0000000000000..01bac4e156148 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsEnableReceiverSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.EnableRequest; + +/** Samples for ActionGroups EnableReceiver. */ +public final class ActionGroupsEnableReceiverSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/enableReceiver.json + */ + /** + * Sample code: Enable the receiver. + * + * @param manager Entry point to MonitorManager. + */ + public static void enableTheReceiver(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .actionGroups() + .enableReceiverWithResponse( + "Default-NotificationRules", + "SampleActionGroup", + new EnableRequest().withReceiverName("John Doe's mobile"), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..28a6c6f53a895 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for ActionGroups GetByResourceGroup. */ +public final class ActionGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/getActionGroup.json + */ + /** + * Sample code: Get an action group. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnActionGroup(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .actionGroups() + .getByResourceGroupWithResponse( + "Default-NotificationRules", "SampleActionGroup", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetTestNotificationsAtActionGroupResourceLevelSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetTestNotificationsAtActionGroupResourceLevelSamples.java new file mode 100644 index 0000000000000..6f455713eceb2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetTestNotificationsAtActionGroupResourceLevelSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for ActionGroups GetTestNotificationsAtActionGroupResourceLevel. */ +public final class ActionGroupsGetTestNotificationsAtActionGroupResourceLevelSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/getTestNotificationsAtActionGroupResourceLevel.json + */ + /** + * Sample code: Get notification details at resource group level. + * + * @param manager Entry point to MonitorManager. + */ + public static void getNotificationDetailsAtResourceGroupLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .actionGroups() + .getTestNotificationsAtActionGroupResourceLevelWithResponse( + "TestRgName", "TestAgName", "11000222191287", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetTestNotificationsAtResourceGroupLevelSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetTestNotificationsAtResourceGroupLevelSamples.java new file mode 100644 index 0000000000000..ae23c99182c5e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetTestNotificationsAtResourceGroupLevelSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for ActionGroups GetTestNotificationsAtResourceGroupLevel. */ +public final class ActionGroupsGetTestNotificationsAtResourceGroupLevelSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/getTestNotificationsAtResourceGroupLevel.json + */ + /** + * Sample code: Get notification details at resource group level. + * + * @param manager Entry point to MonitorManager. + */ + public static void getNotificationDetailsAtResourceGroupLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .actionGroups() + .getTestNotificationsAtResourceGroupLevelWithResponse( + "Default-TestNotifications", "11000222191287", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetTestNotificationsSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetTestNotificationsSamples.java new file mode 100644 index 0000000000000..f4ae781bd4971 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetTestNotificationsSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for ActionGroups GetTestNotifications. */ +public final class ActionGroupsGetTestNotificationsSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/getTestNotifications.json + */ + /** + * Sample code: Get notification details at subscription level. + * + * @param manager Entry point to MonitorManager. + */ + public static void getNotificationDetailsAtSubscriptionLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.actionGroups().getTestNotificationsWithResponse("11000222191287", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsListByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..bd629b81e0b55 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for ActionGroups ListByResourceGroup. */ +public final class ActionGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/listActionGroups.json + */ + /** + * Sample code: List action groups at resource group level. + * + * @param manager Entry point to MonitorManager. + */ + public static void listActionGroupsAtResourceGroupLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.actionGroups().listByResourceGroup("Default-NotificationRules", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsListSamples.java new file mode 100644 index 0000000000000..cdd62a0c3be75 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for ActionGroups List. */ +public final class ActionGroupsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/listActionGroups.json + */ + /** + * Sample code: List action groups at subscription level. + * + * @param manager Entry point to MonitorManager. + */ + public static void listActionGroupsAtSubscriptionLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.actionGroups().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsPostTestNotificationsSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsPostTestNotificationsSamples.java new file mode 100644 index 0000000000000..67c45d8ee1205 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsPostTestNotificationsSamples.java @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.ArmRoleReceiver; +import com.azure.resourcemanager.monitor.generated.models.AutomationRunbookReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureAppPushReceiver; +import com.azure.resourcemanager.monitor.generated.models.AzureFunctionReceiver; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +import com.azure.resourcemanager.monitor.generated.models.EventHubReceiver; +import com.azure.resourcemanager.monitor.generated.models.ItsmReceiver; +import com.azure.resourcemanager.monitor.generated.models.LogicAppReceiver; +import com.azure.resourcemanager.monitor.generated.models.NotificationRequestBody; +import com.azure.resourcemanager.monitor.generated.models.SmsReceiver; +import com.azure.resourcemanager.monitor.generated.models.VoiceReceiver; +import com.azure.resourcemanager.monitor.generated.models.WebhookReceiver; +import java.util.Arrays; + +/** Samples for ActionGroups PostTestNotifications. */ +public final class ActionGroupsPostTestNotificationsSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/postTestNotifications.json + */ + /** + * Sample code: Create notifications at subscription level. + * + * @param manager Entry point to MonitorManager. + */ + public static void createNotificationsAtSubscriptionLevel( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .actionGroups() + .postTestNotifications( + new NotificationRequestBody() + .withAlertType("budget") + .withEmailReceivers( + Arrays + .asList( + new EmailReceiver() + .withName("John Doe's email") + .withEmailAddress("johndoe@email.com") + .withUseCommonAlertSchema(false), + new EmailReceiver() + .withName("Jane Smith's email") + .withEmailAddress("janesmith@email.com") + .withUseCommonAlertSchema(true))) + .withSmsReceivers( + Arrays + .asList( + new SmsReceiver() + .withName("John Doe's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"), + new SmsReceiver() + .withName("Jane Smith's mobile") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("0987654321"))) + .withWebhookReceivers( + Arrays + .asList( + new WebhookReceiver() + .withName("Sample webhook 1") + .withServiceUri("http://www.example.com/webhook1") + .withUseCommonAlertSchema(true), + new WebhookReceiver() + .withName("Sample webhook 2") + .withServiceUri("http://www.example.com/webhook2") + .withUseCommonAlertSchema(true) + .withUseAadAuth(true) + .withObjectId("d3bb868c-fe44-452c-aa26-769a6538c808") + .withIdentifierUri("http://someidentifier/d7811ba3-7996-4a93-99b6-6b2f3f355f8a") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84"))) + .withItsmReceivers( + Arrays + .asList( + new ItsmReceiver() + .withName("Sample itsm") + .withWorkspaceId( + "5def922a-3ed4-49c1-b9fd-05ec533819a3|55dfd1f8-7e59-4f89-bf56-4c82f5ace23c") + .withConnectionId("a3b9076c-ce8e-434e-85b4-aff10cb3c8f1") + .withTicketConfiguration( + "{\"PayloadRevision\":0,\"WorkItemType\":\"Incident\",\"UseTemplate\":false,\"WorkItemData\":\"{}\",\"CreateOneWIPerCI\":false}") + .withRegion("westcentralus"))) + .withAzureAppPushReceivers( + Arrays + .asList( + new AzureAppPushReceiver() + .withName("Sample azureAppPush") + .withEmailAddress("johndoe@email.com"))) + .withAutomationRunbookReceivers( + Arrays + .asList( + new AutomationRunbookReceiver() + .withAutomationAccountId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest") + .withRunbookName("Sample runbook") + .withWebhookResourceId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/runbookTest/providers/Microsoft.Automation/automationAccounts/runbooktest/webhooks/Alert1510184037084") + .withIsGlobalRunbook(false) + .withName("testRunbook") + .withServiceUri("http://test.me") + .withUseCommonAlertSchema(true))) + .withVoiceReceivers( + Arrays + .asList( + new VoiceReceiver() + .withName("Sample voice") + .withCountryCode("fakeTokenPlaceholder") + .withPhoneNumber("1234567890"))) + .withLogicAppReceivers( + Arrays + .asList( + new LogicAppReceiver() + .withName("Sample logicApp") + .withResourceId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/LogicApp/providers/Microsoft.Logic/workflows/testLogicApp") + .withCallbackUrl( + "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") + .withUseCommonAlertSchema(false))) + .withAzureFunctionReceivers( + Arrays + .asList( + new AzureFunctionReceiver() + .withName("Sample azureFunction") + .withFunctionAppResourceId( + "/subscriptions/5def922a-3ed4-49c1-b9fd-05ec533819a3/resourceGroups/aznsTest/providers/Microsoft.Web/sites/testFunctionApp") + .withFunctionName("HttpTriggerCSharp1") + .withHttpTriggerUrl("http://test.me") + .withUseCommonAlertSchema(true))) + .withArmRoleReceivers( + Arrays + .asList( + new ArmRoleReceiver() + .withName("ArmRole-Common") + .withRoleId("11111111-1111-1111-1111-111111111111") + .withUseCommonAlertSchema(true), + new ArmRoleReceiver() + .withName("ArmRole-nonCommon") + .withRoleId("11111111-1111-1111-1111-111111111111") + .withUseCommonAlertSchema(false))) + .withEventHubReceivers( + Arrays + .asList( + new EventHubReceiver() + .withName("Sample eventHub") + .withEventHubNameSpace("testEventHubNameSpace") + .withEventHubName("testEventHub") + .withTenantId("68a4459a-ccb8-493c-b9da-dd30457d1b84") + .withSubscriptionId("187f412d-1758-44d9-b052-169e2564721d"))), + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsUpdateSamples.java new file mode 100644 index 0000000000000..c035f736e7c3a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.ActionGroupResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ActionGroups Update. */ +public final class ActionGroupsUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/examples/patchActionGroup.json + */ + /** + * Sample code: Patch an action group. + * + * @param manager Entry point to MonitorManager. + */ + public static void patchAnActionGroup(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + ActionGroupResource resource = + manager + .actionGroups() + .getByResourceGroupWithResponse( + "Default-NotificationRules", "SampleActionGroup", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key1", "value1", "key2", "value2")).withEnabled(false).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsCreateOrUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..3871ae53150df --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsCreateOrUpdateSamples.java @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.ActionList; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertActionGroup; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertAllOfCondition; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertLeafCondition; +import com.azure.resourcemanager.monitor.generated.models.AlertRuleLeafCondition; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ActivityLogAlerts CreateOrUpdate. */ +public final class ActivityLogAlertsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_CreateOrUpdateRuleWithContainsAny.json + */ + /** + * Sample code: Create or update an Activity Log Alert rule with 'containsAny'. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnActivityLogAlertRuleWithContainsAny( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .activityLogAlerts() + .define("SampleActivityLogAlertRuleWithContainsAny") + .withRegion("Global") + .withExistingResourceGroup("MyResourceGroup") + .withTags(mapOf()) + .withScopes(Arrays.asList("subscriptions/187f412d-1758-44d9-b052-169e2564721d")) + .withCondition( + new ActivityLogAlertAllOfCondition() + .withAllOf( + Arrays + .asList( + new ActivityLogAlertLeafCondition().withField("category").withEquals("ServiceHealth"), + new ActivityLogAlertLeafCondition() + .withField("properties.impactedServices[*].ImpactedRegions[*].RegionName") + .withContainsAny(Arrays.asList("North Europe", "West Europe"))))) + .withActions( + new ActionList() + .withActionGroups( + Arrays + .asList( + new ActivityLogAlertActionGroup() + .withActionGroupId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup") + .withWebhookProperties(mapOf("sampleWebhookProperty", "SamplePropertyValue"))))) + .withEnabled(true) + .withDescription("Description of sample Activity Log Alert rule with 'containsAny'.") + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_CreateOrUpdateRuleWithAnyOfCondition.json + */ + /** + * Sample code: Create or update an Activity Log Alert rule with 'anyOf' condition. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnActivityLogAlertRuleWithAnyOfCondition( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .activityLogAlerts() + .define("SampleActivityLogAlertRuleWithAnyOfCondition") + .withRegion("Global") + .withExistingResourceGroup("MyResourceGroup") + .withTags(mapOf()) + .withScopes(Arrays.asList("subscriptions/187f412d-1758-44d9-b052-169e2564721d")) + .withCondition( + new ActivityLogAlertAllOfCondition() + .withAllOf( + Arrays + .asList( + new ActivityLogAlertLeafCondition().withField("category").withEquals("ServiceHealth"), + new ActivityLogAlertLeafCondition() + .withAnyOf( + Arrays + .asList( + new AlertRuleLeafCondition() + .withField("properties.incidentType") + .withEquals("Incident"), + new AlertRuleLeafCondition() + .withField("properties.incidentType") + .withEquals("Maintenance")))))) + .withActions( + new ActionList() + .withActionGroups( + Arrays + .asList( + new ActivityLogAlertActionGroup() + .withActionGroupId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup") + .withWebhookProperties(mapOf("sampleWebhookProperty", "SamplePropertyValue"))))) + .withEnabled(true) + .withDescription("Description of sample Activity Log Alert rule with 'anyOf' condition.") + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_CreateOrUpdate.json + */ + /** + * Sample code: Create or update an Activity Log Alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnActivityLogAlertRule( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .activityLogAlerts() + .define("SampleActivityLogAlertRule") + .withRegion("Global") + .withExistingResourceGroup("MyResourceGroup") + .withTags(mapOf()) + .withScopes(Arrays.asList("/subscriptions/187f412d-1758-44d9-b052-169e2564721d")) + .withCondition( + new ActivityLogAlertAllOfCondition() + .withAllOf( + Arrays + .asList( + new ActivityLogAlertLeafCondition().withField("category").withEquals("Administrative"), + new ActivityLogAlertLeafCondition().withField("level").withEquals("Error")))) + .withActions( + new ActionList() + .withActionGroups( + Arrays + .asList( + new ActivityLogAlertActionGroup() + .withActionGroupId( + "/subscriptions/187f412d-1758-44d9-b052-169e2564721d/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/actionGroups/SampleActionGroup") + .withWebhookProperties(mapOf("sampleWebhookProperty", "SamplePropertyValue"))))) + .withEnabled(true) + .withDescription("Description of sample Activity Log Alert rule.") + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsDeleteSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsDeleteSamples.java new file mode 100644 index 0000000000000..a9c81476d7bc3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for ActivityLogAlerts Delete. */ +public final class ActivityLogAlertsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Delete.json + */ + /** + * Sample code: Delete an Activity Log Alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteAnActivityLogAlertRule( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .activityLogAlerts() + .deleteByResourceGroupWithResponse( + "MyResourceGroup", "SampleActivityLogAlertRule", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsGetByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..dbfeed0fdd9da --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for ActivityLogAlerts GetByResourceGroup. */ +public final class ActivityLogAlertsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Get.json + */ + /** + * Sample code: Get an Activity Log Alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnActivityLogAlertRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .activityLogAlerts() + .getByResourceGroupWithResponse( + "MyResourceGroup", "SampleActivityLogAlertRule", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsListByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..1b32077cea78d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsListByResourceGroupSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for ActivityLogAlerts ListByResourceGroup. */ +public final class ActivityLogAlertsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_ListByResourceGroupName.json + */ + /** + * Sample code: List activity log alerts. + * + * @param manager Entry point to MonitorManager. + */ + public static void listActivityLogAlerts(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.activityLogAlerts().listByResourceGroup("MyResourceGroup", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsListSamples.java new file mode 100644 index 0000000000000..6cb8b7c3bbf5a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for ActivityLogAlerts List. */ +public final class ActivityLogAlertsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_ListBySubscriptionId.json + */ + /** + * Sample code: Get list of all Activity Log Alert rules under a subscription. + * + * @param manager Entry point to MonitorManager. + */ + public static void getListOfAllActivityLogAlertRulesUnderASubscription( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.activityLogAlerts().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsUpdateSamples.java new file mode 100644 index 0000000000000..635ac39ec5f59 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ActivityLogAlerts Update. */ +public final class ActivityLogAlertsUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/examples/ActivityLogAlertRule_Update.json + */ + /** + * Sample code: Patch an Activity Log Alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void patchAnActivityLogAlertRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + ActivityLogAlertResource resource = + manager + .activityLogAlerts() + .getByResourceGroupWithResponse( + "MyResourceGroup", "SampleActivityLogAlertRule", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("key1", "value1", "key2", "value2")).withEnabled(false).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogsListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogsListSamples.java new file mode 100644 index 0000000000000..e196feaf837b3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogsListSamples.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for ActivityLogs List. */ +public final class ActivityLogsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetActivityLogsFilteredAndSelected.json + */ + /** + * Sample code: Get Activity Logs with filter and select. + * + * @param manager Entry point to MonitorManager. + */ + public static void getActivityLogsWithFilterAndSelect( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .activityLogs() + .list( + "eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and" + + " resourceGroupName eq 'MSSupportGroup'", + "eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetActivityLogsFiltered.json + */ + /** + * Sample code: Get Activity Logs with filter. + * + * @param manager Entry point to MonitorManager. + */ + public static void getActivityLogsWithFilter(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .activityLogs() + .list( + "eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and" + + " resourceGroupName eq 'MSSupportGroup'", + null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRuleIncidentsGetSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRuleIncidentsGetSamples.java new file mode 100644 index 0000000000000..eb05a420863a0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRuleIncidentsGetSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for AlertRuleIncidents Get. */ +public final class AlertRuleIncidentsGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getAlertRuleIncident.json + */ + /** + * Sample code: Get a single alert rule incident. + * + * @param manager Entry point to MonitorManager. + */ + public static void getASingleAlertRuleIncident(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .alertRuleIncidents() + .getWithResponse("Rac46PostSwapRG", "myRuleName", "Website_started", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRuleIncidentsListByAlertRuleSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRuleIncidentsListByAlertRuleSamples.java new file mode 100644 index 0000000000000..5ab15e165b862 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRuleIncidentsListByAlertRuleSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for AlertRuleIncidents ListByAlertRule. */ +public final class AlertRuleIncidentsListByAlertRuleSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listAlertRuleIncidents.json + */ + /** + * Sample code: List alert rule incidents. + * + * @param manager Entry point to MonitorManager. + */ + public static void listAlertRuleIncidents(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.alertRuleIncidents().listByAlertRule("Rac46PostSwapRG", "myRuleName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesCreateOrUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..982e2c98f05ee --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesCreateOrUpdateSamples.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.ConditionOperator; +import com.azure.resourcemanager.monitor.generated.models.RuleMetricDataSource; +import com.azure.resourcemanager.monitor.generated.models.ThresholdRuleCondition; +import com.azure.resourcemanager.monitor.generated.models.TimeAggregationOperator; +import java.time.Duration; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AlertRules CreateOrUpdate. */ +public final class AlertRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/createOrUpdateAlertRule.json + */ + /** + * Sample code: Create or update an alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnAlertRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .alertRules() + .define("chiricutin") + .withRegion("West US") + .withExistingResourceGroup("Rac46PostSwapRG") + .withNamePropertiesName("chiricutin") + .withIsEnabled(true) + .withCondition( + new ThresholdRuleCondition() + .withDataSource( + new RuleMetricDataSource() + .withResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest") + .withMetricName("Requests")) + .withOperator(ConditionOperator.GREATER_THAN) + .withThreshold(3.0) + .withWindowSize(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationOperator.TOTAL)) + .withTags(mapOf()) + .withDescription("Pura Vida") + .withActions(Arrays.asList()) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesDeleteSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesDeleteSamples.java new file mode 100644 index 0000000000000..d0b6bc66577be --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for AlertRules Delete. */ +public final class AlertRulesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/deleteAlertRule.json + */ + /** + * Sample code: Delete an alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteAnAlertRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .alertRules() + .deleteByResourceGroupWithResponse("Rac46PostSwapRG", "chiricutin", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesGetByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..974b6cdfd954f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for AlertRules GetByResourceGroup. */ +public final class AlertRulesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getAlertRule.json + */ + /** + * Sample code: Get an alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnAlertRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .alertRules() + .getByResourceGroupWithResponse("Rac46PostSwapRG", "chiricutin", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesListByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..bd7e59a76575c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesListByResourceGroupSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for AlertRules ListByResourceGroup. */ +public final class AlertRulesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listAlertRule.json + */ + /** + * Sample code: List alert rules. + * + * @param manager Entry point to MonitorManager. + */ + public static void listAlertRules(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.alertRules().listByResourceGroup("Rac46PostSwapRG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesListSamples.java new file mode 100644 index 0000000000000..8e19cef1126c9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for AlertRules List. */ +public final class AlertRulesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listAlertRuleBySubscription.json + */ + /** + * Sample code: List alert rules. + * + * @param manager Entry point to MonitorManager. + */ + public static void listAlertRules(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.alertRules().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesUpdateSamples.java new file mode 100644 index 0000000000000..a024bc6061317 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesUpdateSamples.java @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.AlertRuleResource; +import com.azure.resourcemanager.monitor.generated.models.ConditionOperator; +import com.azure.resourcemanager.monitor.generated.models.RuleMetricDataSource; +import com.azure.resourcemanager.monitor.generated.models.ThresholdRuleCondition; +import com.azure.resourcemanager.monitor.generated.models.TimeAggregationOperator; +import java.time.Duration; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AlertRules Update. */ +public final class AlertRulesUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/patchAlertRule.json + */ + /** + * Sample code: Patch an alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void patchAnAlertRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + AlertRuleResource resource = + manager + .alertRules() + .getByResourceGroupWithResponse("Rac46PostSwapRG", "chiricutin", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("$type", "Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary")) + .withName("chiricutin") + .withDescription("Pura Vida") + .withIsEnabled(true) + .withCondition( + new ThresholdRuleCondition() + .withDataSource( + new RuleMetricDataSource() + .withResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/leoalerttest") + .withMetricName("Requests")) + .withOperator(ConditionOperator.GREATER_THAN) + .withThreshold(3.0) + .withWindowSize(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationOperator.TOTAL)) + .withActions(Arrays.asList()) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsCreateOrUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..fd9d150659cac --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsCreateOrUpdateSamples.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.AutoscaleNotification; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleProfile; +import com.azure.resourcemanager.monitor.generated.models.ComparisonOperationType; +import com.azure.resourcemanager.monitor.generated.models.EmailNotification; +import com.azure.resourcemanager.monitor.generated.models.MetricStatisticType; +import com.azure.resourcemanager.monitor.generated.models.MetricTrigger; +import com.azure.resourcemanager.monitor.generated.models.PredictiveAutoscalePolicy; +import com.azure.resourcemanager.monitor.generated.models.PredictiveAutoscalePolicyScaleMode; +import com.azure.resourcemanager.monitor.generated.models.Recurrence; +import com.azure.resourcemanager.monitor.generated.models.RecurrenceFrequency; +import com.azure.resourcemanager.monitor.generated.models.RecurrentSchedule; +import com.azure.resourcemanager.monitor.generated.models.ScaleAction; +import com.azure.resourcemanager.monitor.generated.models.ScaleCapacity; +import com.azure.resourcemanager.monitor.generated.models.ScaleDirection; +import com.azure.resourcemanager.monitor.generated.models.ScaleRule; +import com.azure.resourcemanager.monitor.generated.models.ScaleType; +import com.azure.resourcemanager.monitor.generated.models.TimeAggregationType; +import com.azure.resourcemanager.monitor.generated.models.TimeWindow; +import com.azure.resourcemanager.monitor.generated.models.WebhookNotification; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AutoscaleSettings CreateOrUpdate. */ +public final class AutoscaleSettingsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/createOrUpdateAutoscaleSetting.json + */ + /** + * Sample code: Create or update an autoscale setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnAutoscaleSetting( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .autoscaleSettings() + .define("MySetting") + .withRegion("West US") + .withExistingResourceGroup("TestingMetricsScaleSet") + .withProfiles( + Arrays + .asList( + new AutoscaleProfile() + .withName("adios") + .withCapacity( + new ScaleCapacity().withMinimum("1").withMaximum("10").withDefaultProperty("1")) + .withRules( + Arrays + .asList( + new ScaleRule() + .withMetricTrigger( + new MetricTrigger() + .withMetricName("Percentage CPU") + .withMetricResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .withTimeGrain(Duration.parse("PT1M")) + .withStatistic(MetricStatisticType.AVERAGE) + .withTimeWindow(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationType.AVERAGE) + .withOperator(ComparisonOperationType.GREATER_THAN) + .withThreshold(10.0) + .withDividePerInstance(false)) + .withScaleAction( + new ScaleAction() + .withDirection(ScaleDirection.INCREASE) + .withType(ScaleType.CHANGE_COUNT) + .withValue("1") + .withCooldown(Duration.parse("PT5M"))), + new ScaleRule() + .withMetricTrigger( + new MetricTrigger() + .withMetricName("Percentage CPU") + .withMetricResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .withTimeGrain(Duration.parse("PT2M")) + .withStatistic(MetricStatisticType.AVERAGE) + .withTimeWindow(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationType.AVERAGE) + .withOperator(ComparisonOperationType.GREATER_THAN) + .withThreshold(15.0) + .withDividePerInstance(false)) + .withScaleAction( + new ScaleAction() + .withDirection(ScaleDirection.DECREASE) + .withType(ScaleType.CHANGE_COUNT) + .withValue("2") + .withCooldown(Duration.parse("PT6M"))))) + .withFixedDate( + new TimeWindow() + .withTimeZone("UTC") + .withStart(OffsetDateTime.parse("2015-03-05T14:00:00Z")) + .withEnd(OffsetDateTime.parse("2015-03-05T14:30:00Z"))), + new AutoscaleProfile() + .withName("saludos") + .withCapacity( + new ScaleCapacity().withMinimum("1").withMaximum("10").withDefaultProperty("1")) + .withRules( + Arrays + .asList( + new ScaleRule() + .withMetricTrigger( + new MetricTrigger() + .withMetricName("Percentage CPU") + .withMetricResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .withTimeGrain(Duration.parse("PT1M")) + .withStatistic(MetricStatisticType.AVERAGE) + .withTimeWindow(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationType.AVERAGE) + .withOperator(ComparisonOperationType.GREATER_THAN) + .withThreshold(10.0) + .withDividePerInstance(false)) + .withScaleAction( + new ScaleAction() + .withDirection(ScaleDirection.INCREASE) + .withType(ScaleType.CHANGE_COUNT) + .withValue("1") + .withCooldown(Duration.parse("PT5M"))), + new ScaleRule() + .withMetricTrigger( + new MetricTrigger() + .withMetricName("Percentage CPU") + .withMetricResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .withTimeGrain(Duration.parse("PT2M")) + .withStatistic(MetricStatisticType.AVERAGE) + .withTimeWindow(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationType.AVERAGE) + .withOperator(ComparisonOperationType.GREATER_THAN) + .withThreshold(15.0) + .withDividePerInstance(false)) + .withScaleAction( + new ScaleAction() + .withDirection(ScaleDirection.DECREASE) + .withType(ScaleType.CHANGE_COUNT) + .withValue("2") + .withCooldown(Duration.parse("PT6M"))))) + .withRecurrence( + new Recurrence() + .withFrequency(RecurrenceFrequency.WEEK) + .withSchedule( + new RecurrentSchedule() + .withTimeZone("UTC") + .withDays(Arrays.asList("1")) + .withHours(Arrays.asList(5)) + .withMinutes(Arrays.asList(15)))))) + .withTags(mapOf("key1", "value1", "key2", "value2")) + .withNotifications( + Arrays + .asList( + new AutoscaleNotification() + .withEmail( + new EmailNotification() + .withSendToSubscriptionAdministrator(true) + .withSendToSubscriptionCoAdministrators(true) + .withCustomEmails(Arrays.asList("gu@ms.com", "ge@ns.net"))) + .withWebhooks( + Arrays + .asList( + new WebhookNotification() + .withServiceUri("http://myservice.com") + .withProperties(mapOf()))))) + .withEnabled(true) + .withPredictiveAutoscalePolicy( + new PredictiveAutoscalePolicy().withScaleMode(PredictiveAutoscalePolicyScaleMode.ENABLED)) + .withTargetResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsDeleteSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsDeleteSamples.java new file mode 100644 index 0000000000000..8a196f59b4db5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for AutoscaleSettings Delete. */ +public final class AutoscaleSettingsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/deleteAutoscaleSetting.json + */ + /** + * Sample code: Delete an autoscale setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteAnAutoscaleSetting(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .autoscaleSettings() + .deleteByResourceGroupWithResponse("TestingMetricsScaleSet", "MySetting", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsGetByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..941bc88a2b6e4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for AutoscaleSettings GetByResourceGroup. */ +public final class AutoscaleSettingsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/getAutoscaleSetting.json + */ + /** + * Sample code: Get an autoscale setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnAutoscaleSetting(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .autoscaleSettings() + .getByResourceGroupWithResponse("TestingMetricsScaleSet", "MySetting", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsListByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..55ec692f0cff4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsListByResourceGroupSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for AutoscaleSettings ListByResourceGroup. */ +public final class AutoscaleSettingsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/listAutoscaleSetting.json + */ + /** + * Sample code: List autoscale settings. + * + * @param manager Entry point to MonitorManager. + */ + public static void listAutoscaleSettings(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.autoscaleSettings().listByResourceGroup("TestingMetricsScaleSet", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsListSamples.java new file mode 100644 index 0000000000000..093f59c7ae59b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for AutoscaleSettings List. */ +public final class AutoscaleSettingsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/listAutoscaleSettingBySubscription.json + */ + /** + * Sample code: List autoscale settings by subs. + * + * @param manager Entry point to MonitorManager. + */ + public static void listAutoscaleSettingsBySubs(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.autoscaleSettings().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsUpdateSamples.java new file mode 100644 index 0000000000000..0c058c4aa81ac --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsUpdateSamples.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.AutoscaleNotification; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleProfile; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleSettingResource; +import com.azure.resourcemanager.monitor.generated.models.ComparisonOperationType; +import com.azure.resourcemanager.monitor.generated.models.EmailNotification; +import com.azure.resourcemanager.monitor.generated.models.MetricStatisticType; +import com.azure.resourcemanager.monitor.generated.models.MetricTrigger; +import com.azure.resourcemanager.monitor.generated.models.PredictiveAutoscalePolicy; +import com.azure.resourcemanager.monitor.generated.models.PredictiveAutoscalePolicyScaleMode; +import com.azure.resourcemanager.monitor.generated.models.Recurrence; +import com.azure.resourcemanager.monitor.generated.models.RecurrenceFrequency; +import com.azure.resourcemanager.monitor.generated.models.RecurrentSchedule; +import com.azure.resourcemanager.monitor.generated.models.ScaleAction; +import com.azure.resourcemanager.monitor.generated.models.ScaleCapacity; +import com.azure.resourcemanager.monitor.generated.models.ScaleDirection; +import com.azure.resourcemanager.monitor.generated.models.ScaleRule; +import com.azure.resourcemanager.monitor.generated.models.ScaleType; +import com.azure.resourcemanager.monitor.generated.models.TimeAggregationType; +import com.azure.resourcemanager.monitor.generated.models.TimeWindow; +import com.azure.resourcemanager.monitor.generated.models.WebhookNotification; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AutoscaleSettings Update. */ +public final class AutoscaleSettingsUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/patchAutoscaleSetting.json + */ + /** + * Sample code: Patch an autoscale setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void patchAnAutoscaleSetting(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + AutoscaleSettingResource resource = + manager + .autoscaleSettings() + .getByResourceGroupWithResponse("TestingMetricsScaleSet", "MySetting", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("key1", "value1")) + .withProfiles( + Arrays + .asList( + new AutoscaleProfile() + .withName("adios") + .withCapacity( + new ScaleCapacity().withMinimum("1").withMaximum("10").withDefaultProperty("1")) + .withRules( + Arrays + .asList( + new ScaleRule() + .withMetricTrigger( + new MetricTrigger() + .withMetricName("Percentage CPU") + .withMetricResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .withTimeGrain(Duration.parse("PT1M")) + .withStatistic(MetricStatisticType.AVERAGE) + .withTimeWindow(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationType.AVERAGE) + .withOperator(ComparisonOperationType.GREATER_THAN) + .withThreshold(10.0) + .withDividePerInstance(false)) + .withScaleAction( + new ScaleAction() + .withDirection(ScaleDirection.INCREASE) + .withType(ScaleType.CHANGE_COUNT) + .withValue("1") + .withCooldown(Duration.parse("PT5M"))), + new ScaleRule() + .withMetricTrigger( + new MetricTrigger() + .withMetricName("Percentage CPU") + .withMetricResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .withTimeGrain(Duration.parse("PT2M")) + .withStatistic(MetricStatisticType.AVERAGE) + .withTimeWindow(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationType.AVERAGE) + .withOperator(ComparisonOperationType.GREATER_THAN) + .withThreshold(15.0) + .withDividePerInstance(false)) + .withScaleAction( + new ScaleAction() + .withDirection(ScaleDirection.DECREASE) + .withType(ScaleType.CHANGE_COUNT) + .withValue("2") + .withCooldown(Duration.parse("PT6M"))))) + .withFixedDate( + new TimeWindow() + .withTimeZone("UTC") + .withStart(OffsetDateTime.parse("2015-03-05T14:00:00Z")) + .withEnd(OffsetDateTime.parse("2015-03-05T14:30:00Z"))), + new AutoscaleProfile() + .withName("saludos") + .withCapacity( + new ScaleCapacity().withMinimum("1").withMaximum("10").withDefaultProperty("1")) + .withRules( + Arrays + .asList( + new ScaleRule() + .withMetricTrigger( + new MetricTrigger() + .withMetricName("Percentage CPU") + .withMetricResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .withTimeGrain(Duration.parse("PT1M")) + .withStatistic(MetricStatisticType.AVERAGE) + .withTimeWindow(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationType.AVERAGE) + .withOperator(ComparisonOperationType.GREATER_THAN) + .withThreshold(10.0) + .withDividePerInstance(false)) + .withScaleAction( + new ScaleAction() + .withDirection(ScaleDirection.INCREASE) + .withType(ScaleType.CHANGE_COUNT) + .withValue("1") + .withCooldown(Duration.parse("PT5M"))), + new ScaleRule() + .withMetricTrigger( + new MetricTrigger() + .withMetricName("Percentage CPU") + .withMetricResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .withTimeGrain(Duration.parse("PT2M")) + .withStatistic(MetricStatisticType.AVERAGE) + .withTimeWindow(Duration.parse("PT5M")) + .withTimeAggregation(TimeAggregationType.AVERAGE) + .withOperator(ComparisonOperationType.GREATER_THAN) + .withThreshold(15.0) + .withDividePerInstance(false)) + .withScaleAction( + new ScaleAction() + .withDirection(ScaleDirection.DECREASE) + .withType(ScaleType.CHANGE_COUNT) + .withValue("2") + .withCooldown(Duration.parse("PT6M"))))) + .withRecurrence( + new Recurrence() + .withFrequency(RecurrenceFrequency.WEEK) + .withSchedule( + new RecurrentSchedule() + .withTimeZone("UTC") + .withDays(Arrays.asList("1")) + .withHours(Arrays.asList(5)) + .withMinutes(Arrays.asList(15)))))) + .withNotifications( + Arrays + .asList( + new AutoscaleNotification() + .withEmail( + new EmailNotification() + .withSendToSubscriptionAdministrator(true) + .withSendToSubscriptionCoAdministrators(true) + .withCustomEmails(Arrays.asList("gu@ms.com", "ge@ns.net"))) + .withWebhooks( + Arrays + .asList( + new WebhookNotification() + .withServiceUri("http://myservice.com") + .withProperties(mapOf()))))) + .withEnabled(true) + .withPredictiveAutoscalePolicy( + new PredictiveAutoscalePolicy().withScaleMode(PredictiveAutoscalePolicyScaleMode.ENABLED)) + .withTargetResourceUri( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/TestingMetricsScaleSet/providers/Microsoft.Compute/virtualMachineScaleSets/testingsc") + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesCreateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesCreateSamples.java new file mode 100644 index 0000000000000..54dee9c7b6a0f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesCreateSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for AzureMonitorWorkspaces Create. */ +public final class AzureMonitorWorkspacesCreateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesCreate.json + */ + /** + * Sample code: Create or update workspace. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateWorkspace(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .azureMonitorWorkspaces() + .define("myAzureMonitorWorkspace") + .withRegion("eastus") + .withExistingResourceGroup("myResourceGroup") + .create(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesDeleteSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesDeleteSamples.java new file mode 100644 index 0000000000000..06c2d1022ca86 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for AzureMonitorWorkspaces Delete. */ +public final class AzureMonitorWorkspacesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesDelete.json + */ + /** + * Sample code: Delete workspace. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteWorkspace(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .azureMonitorWorkspaces() + .deleteByResourceGroupWithResponse( + "myResourceGroup", "myAzureMonitorWorkspace", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesGetByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..6c1b519afc0ee --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for AzureMonitorWorkspaces GetByResourceGroup. */ +public final class AzureMonitorWorkspacesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesGet.json + */ + /** + * Sample code: Get workspace. + * + * @param manager Entry point to MonitorManager. + */ + public static void getWorkspace(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .azureMonitorWorkspaces() + .getByResourceGroupWithResponse( + "myResourceGroup", "myAzureMonitorWorkspace", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesListByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..31b4c17f24adc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for AzureMonitorWorkspaces ListByResourceGroup. */ +public final class AzureMonitorWorkspacesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesListByResourceGroup.json + */ + /** + * Sample code: List monitor workspaces by resource group. + * + * @param manager Entry point to MonitorManager. + */ + public static void listMonitorWorkspacesByResourceGroup( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.azureMonitorWorkspaces().listByResourceGroup("myResourceGroup", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesListSamples.java new file mode 100644 index 0000000000000..6027d5858d509 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for AzureMonitorWorkspaces List. */ +public final class AzureMonitorWorkspacesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesListBySubscription.json + */ + /** + * Sample code: List workspaces by subscription. + * + * @param manager Entry point to MonitorManager. + */ + public static void listWorkspacesBySubscription( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.azureMonitorWorkspaces().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesUpdateSamples.java new file mode 100644 index 0000000000000..e7198b0deb7e0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AzureMonitorWorkspacesUpdateSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorWorkspaceResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for AzureMonitorWorkspaces Update. */ +public final class AzureMonitorWorkspacesUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/AzureMonitorWorkspacesUpdate.json + */ + /** + * Sample code: Update workspace. + * + * @param manager Entry point to MonitorManager. + */ + public static void updateWorkspace(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + AzureMonitorWorkspaceResource resource = + manager + .azureMonitorWorkspaces() + .getByResourceGroupWithResponse( + "myResourceGroup", "myAzureMonitorWorkspace", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tag1", "A", "tag2", "B", "tag3", "C")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/BaselinesListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/BaselinesListSamples.java new file mode 100644 index 0000000000000..96d578fb78e3a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/BaselinesListSamples.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import java.time.Duration; + +/** Samples for Baselines List. */ +public final class BaselinesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2019-03-01/examples/metricBaselines.json + */ + /** + * Sample code: Get metric baselines. + * + * @param manager Entry point to MonitorManager. + */ + public static void getMetricBaselines(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .baselines() + .list( + "subscriptions/b368ca2f-e298-46b7-b0ab-012281956afa/resourceGroups/vms/providers/Microsoft.Compute/virtualMachines/vm1", + null, + null, + "2019-03-12T11:00:00.000Z/2019-03-12T12:00:00.000Z", + Duration.parse("PT1H"), + "average", + "Low,Medium", + null, + null, + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsCreateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsCreateSamples.java new file mode 100644 index 0000000000000..27f6f72f4a1ac --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsCreateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointNetworkAcls; +import com.azure.resourcemanager.monitor.generated.models.KnownPublicNetworkAccessOptions; + +/** Samples for DataCollectionEndpoints Create. */ +public final class DataCollectionEndpointsCreateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionEndpointsCreate.json + */ + /** + * Sample code: Create or update data collection endpoint. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateDataCollectionEndpoint( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionEndpoints() + .define("myCollectionEndpoint") + .withRegion("eastus") + .withExistingResourceGroup("myResourceGroup") + .withNetworkAcls( + new DataCollectionEndpointNetworkAcls() + .withPublicNetworkAccess(KnownPublicNetworkAccessOptions.ENABLED)) + .create(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsDeleteSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsDeleteSamples.java new file mode 100644 index 0000000000000..ac25fae80e3e8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsDeleteSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DataCollectionEndpoints Delete. */ +public final class DataCollectionEndpointsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionEndpointsDelete.json + */ + /** + * Sample code: Delete data collection endpoint. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteDataCollectionEndpoint( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionEndpoints() + .deleteByResourceGroupWithResponse( + "myResourceGroup", "myCollectionEndpoint", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsGetByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..7a324f11fd988 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DataCollectionEndpoints GetByResourceGroup. */ +public final class DataCollectionEndpointsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionEndpointsGet.json + */ + /** + * Sample code: Get data collection endpoint. + * + * @param manager Entry point to MonitorManager. + */ + public static void getDataCollectionEndpoint(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionEndpoints() + .getByResourceGroupWithResponse( + "myResourceGroup", "myCollectionEndpoint", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsListByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..2c7718c9017b0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DataCollectionEndpoints ListByResourceGroup. */ +public final class DataCollectionEndpointsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionEndpointsListByResourceGroup.json + */ + /** + * Sample code: List data collection endpoints by resource group. + * + * @param manager Entry point to MonitorManager. + */ + public static void listDataCollectionEndpointsByResourceGroup( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.dataCollectionEndpoints().listByResourceGroup("myResourceGroup", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsListSamples.java new file mode 100644 index 0000000000000..27be79ac7619a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DataCollectionEndpoints List. */ +public final class DataCollectionEndpointsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionEndpointsListBySubscription.json + */ + /** + * Sample code: List data collection endpoints by subscription. + * + * @param manager Entry point to MonitorManager. + */ + public static void listDataCollectionEndpointsBySubscription( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.dataCollectionEndpoints().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsUpdateSamples.java new file mode 100644 index 0000000000000..f6701b0642f86 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsUpdateSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DataCollectionEndpoints Update. */ +public final class DataCollectionEndpointsUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionEndpointsUpdate.json + */ + /** + * Sample code: Update data collection endpoint. + * + * @param manager Entry point to MonitorManager. + */ + public static void updateDataCollectionEndpoint( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + DataCollectionEndpointResource resource = + manager + .dataCollectionEndpoints() + .getByResourceGroupWithResponse( + "myResourceGroup", "myCollectionEndpoint", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tag1", "A", "tag2", "B", "tag3", "C")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsCreateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsCreateSamples.java new file mode 100644 index 0000000000000..dc63ed67f4e5f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsCreateSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DataCollectionRuleAssociations Create. */ +public final class DataCollectionRuleAssociationsCreateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRuleAssociationsCreate.json + */ + /** + * Sample code: Create or update association. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAssociation(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionRuleAssociations() + .define("myAssociation") + .withExistingResourceUri( + "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm") + .withDataCollectionRuleId( + "/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Insights/dataCollectionRules/myCollectionRule") + .create(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsDeleteSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsDeleteSamples.java new file mode 100644 index 0000000000000..28414095d7bd4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DataCollectionRuleAssociations Delete. */ +public final class DataCollectionRuleAssociationsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRuleAssociationsDelete.json + */ + /** + * Sample code: Delete association. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteAssociation(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionRuleAssociations() + .deleteByResourceGroupWithResponse( + "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", + "myAssociation", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsGetSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsGetSamples.java new file mode 100644 index 0000000000000..4dea58691eed5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DataCollectionRuleAssociations Get. */ +public final class DataCollectionRuleAssociationsGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRuleAssociationsGet.json + */ + /** + * Sample code: Get association. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAssociation(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionRuleAssociations() + .getWithResponse( + "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", + "myAssociation", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsListByDataCollectionEndpointSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsListByDataCollectionEndpointSamples.java new file mode 100644 index 0000000000000..22a5fe513890e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsListByDataCollectionEndpointSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DataCollectionRuleAssociations ListByDataCollectionEndpoint. */ +public final class DataCollectionRuleAssociationsListByDataCollectionEndpointSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRuleAssociationsListByDataCollectionEndpoint.json + */ + /** + * Sample code: List associations for specified data collection endpoint. + * + * @param manager Entry point to MonitorManager. + */ + public static void listAssociationsForSpecifiedDataCollectionEndpoint( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionRuleAssociations() + .listByDataCollectionEndpoint( + "myResourceGroup", "myDataCollectionEndpointName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsListByResourceSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsListByResourceSamples.java new file mode 100644 index 0000000000000..7007e6a92100f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsListByResourceSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DataCollectionRuleAssociations ListByResource. */ +public final class DataCollectionRuleAssociationsListByResourceSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRuleAssociationsListByResource.json + */ + /** + * Sample code: List associations for specified resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void listAssociationsForSpecifiedResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionRuleAssociations() + .listByResource( + "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsListByRuleSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsListByRuleSamples.java new file mode 100644 index 0000000000000..22869fa0deed1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsListByRuleSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DataCollectionRuleAssociations ListByRule. */ +public final class DataCollectionRuleAssociationsListByRuleSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRuleAssociationsListByRule.json + */ + /** + * Sample code: List associations for specified data collection rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void listAssociationsForSpecifiedDataCollectionRule( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionRuleAssociations() + .listByRule("myResourceGroup", "myCollectionRule", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesCreateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesCreateSamples.java new file mode 100644 index 0000000000000..75a2520d87b51 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesCreateSamples.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleDataSources; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleDestinations; +import com.azure.resourcemanager.monitor.generated.models.DataFlow; +import com.azure.resourcemanager.monitor.generated.models.KnownDataFlowStreams; +import com.azure.resourcemanager.monitor.generated.models.KnownPerfCounterDataSourceStreams; +import com.azure.resourcemanager.monitor.generated.models.KnownSyslogDataSourceFacilityNames; +import com.azure.resourcemanager.monitor.generated.models.KnownSyslogDataSourceLogLevels; +import com.azure.resourcemanager.monitor.generated.models.KnownSyslogDataSourceStreams; +import com.azure.resourcemanager.monitor.generated.models.KnownWindowsEventLogDataSourceStreams; +import com.azure.resourcemanager.monitor.generated.models.LogAnalyticsDestination; +import com.azure.resourcemanager.monitor.generated.models.PerfCounterDataSource; +import com.azure.resourcemanager.monitor.generated.models.SyslogDataSource; +import com.azure.resourcemanager.monitor.generated.models.WindowsEventLogDataSource; +import java.util.Arrays; + +/** Samples for DataCollectionRules Create. */ +public final class DataCollectionRulesCreateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRulesCreate.json + */ + /** + * Sample code: Create or update data collection rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateDataCollectionRule( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionRules() + .define("myCollectionRule") + .withRegion("eastus") + .withExistingResourceGroup("myResourceGroup") + .withDataSources( + new DataCollectionRuleDataSources() + .withPerformanceCounters( + Arrays + .asList( + new PerfCounterDataSource() + .withStreams(Arrays.asList(KnownPerfCounterDataSourceStreams.MICROSOFT_PERF)) + .withSamplingFrequencyInSeconds(15) + .withCounterSpecifiers( + Arrays + .asList( + "\\Processor(_Total)\\% Processor Time", + "\\Memory\\Committed Bytes", + "\\LogicalDisk(_Total)\\Free Megabytes", + "\\PhysicalDisk(_Total)\\Avg. Disk Queue Length")) + .withName("cloudTeamCoreCounters"), + new PerfCounterDataSource() + .withStreams(Arrays.asList(KnownPerfCounterDataSourceStreams.MICROSOFT_PERF)) + .withSamplingFrequencyInSeconds(30) + .withCounterSpecifiers(Arrays.asList("\\Process(_Total)\\Thread Count")) + .withName("appTeamExtraCounters"))) + .withWindowsEventLogs( + Arrays + .asList( + new WindowsEventLogDataSource() + .withStreams( + Arrays.asList(KnownWindowsEventLogDataSourceStreams.MICROSOFT_WINDOWS_EVENT)) + .withXPathQueries(Arrays.asList("Security!")) + .withName("cloudSecurityTeamEvents"), + new WindowsEventLogDataSource() + .withStreams( + Arrays.asList(KnownWindowsEventLogDataSourceStreams.MICROSOFT_WINDOWS_EVENT)) + .withXPathQueries( + Arrays + .asList( + "System![System[(Level = 1 or Level = 2 or Level = 3)]]", + "Application!*[System[(Level = 1 or Level = 2 or Level = 3)]]")) + .withName("appTeam1AppEvents"))) + .withSyslog( + Arrays + .asList( + new SyslogDataSource() + .withStreams(Arrays.asList(KnownSyslogDataSourceStreams.MICROSOFT_SYSLOG)) + .withFacilityNames(Arrays.asList(KnownSyslogDataSourceFacilityNames.CRON)) + .withLogLevels( + Arrays + .asList( + KnownSyslogDataSourceLogLevels.DEBUG, + KnownSyslogDataSourceLogLevels.CRITICAL, + KnownSyslogDataSourceLogLevels.EMERGENCY)) + .withName("cronSyslog"), + new SyslogDataSource() + .withStreams(Arrays.asList(KnownSyslogDataSourceStreams.MICROSOFT_SYSLOG)) + .withFacilityNames(Arrays.asList(KnownSyslogDataSourceFacilityNames.SYSLOG)) + .withLogLevels( + Arrays + .asList( + KnownSyslogDataSourceLogLevels.ALERT, + KnownSyslogDataSourceLogLevels.CRITICAL, + KnownSyslogDataSourceLogLevels.EMERGENCY)) + .withName("syslogBase")))) + .withDestinations( + new DataCollectionRuleDestinations() + .withLogAnalytics( + Arrays + .asList( + new LogAnalyticsDestination() + .withWorkspaceResourceId( + "/subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.OperationalInsights/workspaces/centralTeamWorkspace") + .withName("centralWorkspace")))) + .withDataFlows( + Arrays + .asList( + new DataFlow() + .withStreams( + Arrays + .asList( + KnownDataFlowStreams.MICROSOFT_PERF, + KnownDataFlowStreams.MICROSOFT_SYSLOG, + KnownDataFlowStreams.MICROSOFT_WINDOWS_EVENT)) + .withDestinations(Arrays.asList("centralWorkspace")))) + .create(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesDeleteSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesDeleteSamples.java new file mode 100644 index 0000000000000..3ea1fc70c2f1e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DataCollectionRules Delete. */ +public final class DataCollectionRulesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRulesDelete.json + */ + /** + * Sample code: Delete data collection rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteDataCollectionRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionRules() + .deleteByResourceGroupWithResponse("myResourceGroup", "myCollectionRule", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesGetByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..ccc972087196d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesGetByResourceGroupSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DataCollectionRules GetByResourceGroup. */ +public final class DataCollectionRulesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRulesGet.json + */ + /** + * Sample code: Get data collection rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void getDataCollectionRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .dataCollectionRules() + .getByResourceGroupWithResponse("myResourceGroup", "myCollectionRule", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesListByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..b99e6f937935d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DataCollectionRules ListByResourceGroup. */ +public final class DataCollectionRulesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRulesListByResourceGroup.json + */ + /** + * Sample code: List data collection rules by resource group. + * + * @param manager Entry point to MonitorManager. + */ + public static void listDataCollectionRulesByResourceGroup( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.dataCollectionRules().listByResourceGroup("myResourceGroup", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesListSamples.java new file mode 100644 index 0000000000000..e8b4c51879590 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DataCollectionRules List. */ +public final class DataCollectionRulesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRulesListBySubscription.json + */ + /** + * Sample code: List data collection rules by subscription. + * + * @param manager Entry point to MonitorManager. + */ + public static void listDataCollectionRulesBySubscription( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.dataCollectionRules().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesUpdateSamples.java new file mode 100644 index 0000000000000..9e662a092804a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesUpdateSamples.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleResource; +import java.util.HashMap; +import java.util.Map; + +/** Samples for DataCollectionRules Update. */ +public final class DataCollectionRulesUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-09-01-preview/examples/DataCollectionRulesUpdate.json + */ + /** + * Sample code: Update data collection rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void updateDataCollectionRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + DataCollectionRuleResource resource = + manager + .dataCollectionRules() + .getByResourceGroupWithResponse("myResourceGroup", "myCollectionRule", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("tag1", "A", "tag2", "B", "tag3", "C")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsCategoryGetSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsCategoryGetSamples.java new file mode 100644 index 0000000000000..2bdec2914ba29 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsCategoryGetSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DiagnosticSettingsCategory Get. */ +public final class DiagnosticSettingsCategoryGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSettingsCategory.json + */ + /** + * Sample code: Gets the diagnostic setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsTheDiagnosticSetting(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .diagnosticSettingsCategories() + .getWithResponse( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + "WorkflowRuntime", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsCategoryListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsCategoryListSamples.java new file mode 100644 index 0000000000000..96c97f618839f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsCategoryListSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DiagnosticSettingsCategory List. */ +public final class DiagnosticSettingsCategoryListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettingsCategories.json + */ + /** + * Sample code: Gets the diagnostic setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsTheDiagnosticSetting(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .diagnosticSettingsCategories() + .list( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationCreateOrUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..aa909187fa7df --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationCreateOrUpdateSamples.java @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.LogSettings; +import com.azure.resourcemanager.monitor.generated.models.MetricSettings; +import com.azure.resourcemanager.monitor.generated.models.RetentionPolicy; +import java.util.Arrays; + +/** Samples for DiagnosticSettingsOperation CreateOrUpdate. */ +public final class DiagnosticSettingsOperationCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/createOrUpdateDiagnosticSetting.json + */ + /** + * Sample code: Creates or Updates the diagnostic setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void createsOrUpdatesTheDiagnosticSetting( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .diagnosticSettingsOperations() + .define("mysetting") + .withExistingResourceUri( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6") + .withStorageAccountId( + "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1") + .withEventHubAuthorizationRuleId( + "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule") + .withEventHubName("myeventhub") + .withMetrics( + Arrays + .asList( + new MetricSettings() + .withCategory("WorkflowMetrics") + .withEnabled(true) + .withRetentionPolicy(new RetentionPolicy().withEnabled(false).withDays(0)))) + .withLogs( + Arrays + .asList( + new LogSettings() + .withCategoryGroup("allLogs") + .withEnabled(true) + .withRetentionPolicy(new RetentionPolicy().withEnabled(false).withDays(0)))) + .withWorkspaceId("") + .withMarketplacePartnerId( + "/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1") + .withLogAnalyticsDestinationType("Dedicated") + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/createOrUpdateDiagnosticSettingCategory.json + */ + /** + * Sample code: Creates or Updates the diagnostic setting for category. + * + * @param manager Entry point to MonitorManager. + */ + public static void createsOrUpdatesTheDiagnosticSettingForCategory( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .diagnosticSettingsOperations() + .define("mysetting") + .withExistingResourceUri( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6") + .withStorageAccountId( + "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/apptest/providers/Microsoft.Storage/storageAccounts/appteststorage1") + .withEventHubAuthorizationRuleId( + "/subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourceGroups/montest/providers/microsoft.eventhub/namespaces/mynamespace/authorizationrules/myrule") + .withEventHubName("myeventhub") + .withMetrics( + Arrays + .asList( + new MetricSettings() + .withCategory("WorkflowMetrics") + .withEnabled(true) + .withRetentionPolicy(new RetentionPolicy().withEnabled(false).withDays(0)))) + .withLogs( + Arrays + .asList( + new LogSettings() + .withCategory("WorkflowRuntime") + .withEnabled(true) + .withRetentionPolicy(new RetentionPolicy().withEnabled(false).withDays(0)))) + .withWorkspaceId("") + .withMarketplacePartnerId( + "/subscriptions/abcdeabc-1234-1234-ab12-123a1234567a/resourceGroups/test-rg/providers/Microsoft.Datadog/monitors/dd1") + .withLogAnalyticsDestinationType("Dedicated") + .create(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationDeleteSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationDeleteSamples.java new file mode 100644 index 0000000000000..259c97edbda32 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationDeleteSamples.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DiagnosticSettingsOperation Delete. */ +public final class DiagnosticSettingsOperationDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/deleteDiagnosticSetting.json + */ + /** + * Sample code: Deletes the diagnostic setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void deletesTheDiagnosticSetting(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .diagnosticSettingsOperations() + .deleteByResourceGroupWithResponse( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + "mysetting", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationGetSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationGetSamples.java new file mode 100644 index 0000000000000..2456862ecc76d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationGetSamples.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DiagnosticSettingsOperation Get. */ +public final class DiagnosticSettingsOperationGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSetting.json + */ + /** + * Sample code: Gets the diagnostic setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsTheDiagnosticSetting(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .diagnosticSettingsOperations() + .getWithResponse( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + "mysetting", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/getDiagnosticSettingCategory.json + */ + /** + * Sample code: Gets the diagnostic setting for category. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsTheDiagnosticSettingForCategory( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .diagnosticSettingsOperations() + .getWithResponse( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + "mysetting", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationListSamples.java new file mode 100644 index 0000000000000..ec74e28066c90 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationListSamples.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for DiagnosticSettingsOperation List. */ +public final class DiagnosticSettingsOperationListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettings.json + */ + /** + * Sample code: Gets the diagnostic setting. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsTheDiagnosticSetting(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .diagnosticSettingsOperations() + .list( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/examples/listDiagnosticSettingsCategory.json + */ + /** + * Sample code: Gets the diagnostic setting for category. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsTheDiagnosticSettingForCategory( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .diagnosticSettingsOperations() + .list( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/EventCategoriesListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/EventCategoriesListSamples.java new file mode 100644 index 0000000000000..66655ec3aecd8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/EventCategoriesListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for EventCategories List. */ +public final class EventCategoriesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetEventCategories.json + */ + /** + * Sample code: Get event categories. + * + * @param manager Entry point to MonitorManager. + */ + public static void getEventCategories(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.eventCategories().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesCreateOrUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..8701660d5554b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesCreateOrUpdateSamples.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.RetentionPolicy; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for LogProfiles CreateOrUpdate. */ +public final class LogProfilesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/createOrUpdateLogProfile.json + */ + /** + * Sample code: Create or update a log profile. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateALogProfile(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .logProfiles() + .define("Rac46PostSwapRG") + .withRegion("") + .withLocations(Arrays.asList("global")) + .withCategories(Arrays.asList("Write", "Delete", "Action")) + .withRetentionPolicy(new RetentionPolicy().withEnabled(true).withDays(3)) + .withTags(mapOf()) + .withStorageAccountId( + "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162") + .withServiceBusRuleId("") + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesDeleteSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesDeleteSamples.java new file mode 100644 index 0000000000000..3e7f2e324143d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesDeleteSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for LogProfiles Delete. */ +public final class LogProfilesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/deleteLogProfile.json + */ + /** + * Sample code: Delete log profile. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteLogProfile(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.logProfiles().deleteWithResponse("Rac46PostSwapRG", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesGetSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesGetSamples.java new file mode 100644 index 0000000000000..03ea0b47265e1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesGetSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for LogProfiles Get. */ +public final class LogProfilesGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/getLogProfile.json + */ + /** + * Sample code: Get log profile. + * + * @param manager Entry point to MonitorManager. + */ + public static void getLogProfile(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.logProfiles().getWithResponse("default", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesListSamples.java new file mode 100644 index 0000000000000..d09ff9f8977b7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for LogProfiles List. */ +public final class LogProfilesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/listLogProfile.json + */ + /** + * Sample code: List log profiles. + * + * @param manager Entry point to MonitorManager. + */ + public static void listLogProfiles(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.logProfiles().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesUpdateSamples.java new file mode 100644 index 0000000000000..24132e9799d16 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesUpdateSamples.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.LogProfileResource; +import com.azure.resourcemanager.monitor.generated.models.RetentionPolicy; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for LogProfiles Update. */ +public final class LogProfilesUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/examples/patchLogProfile.json + */ + /** + * Sample code: Patch a log profile. + * + * @param manager Entry point to MonitorManager. + */ + public static void patchALogProfile(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + LogProfileResource resource = + manager.logProfiles().getWithResponse("Rac46PostSwapRG", com.azure.core.util.Context.NONE).getValue(); + resource + .update() + .withTags(mapOf("key1", "value1")) + .withStorageAccountId( + "/subscriptions/df602c9c-7aa0-407d-a6fb-eb20c8bd1192/resourceGroups/JohnKemTest/providers/Microsoft.Storage/storageAccounts/johnkemtest8162") + .withServiceBusRuleId("") + .withLocations(Arrays.asList("global")) + .withCategories(Arrays.asList("Write", "Delete", "Action")) + .withRetentionPolicy(new RetentionPolicy().withEnabled(true).withDays(3)) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsCreateOrUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..22f68cc8c1917 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsCreateOrUpdateSamples.java @@ -0,0 +1,448 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.AggregationTypeEnum; +import com.azure.resourcemanager.monitor.generated.models.DynamicMetricCriteria; +import com.azure.resourcemanager.monitor.generated.models.DynamicThresholdFailingPeriods; +import com.azure.resourcemanager.monitor.generated.models.DynamicThresholdOperator; +import com.azure.resourcemanager.monitor.generated.models.DynamicThresholdSensitivity; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertAction; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertMultipleResourceMultipleMetricCriteria; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertSingleResourceMultipleMetricCriteria; +import com.azure.resourcemanager.monitor.generated.models.MetricCriteria; +import com.azure.resourcemanager.monitor.generated.models.MetricDimension; +import com.azure.resourcemanager.monitor.generated.models.Operator; +import com.azure.resourcemanager.monitor.generated.models.WebtestLocationAvailabilityCriteria; +import java.time.Duration; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for MetricAlerts CreateOrUpdate. */ +public final class MetricAlertsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertSubscription.json + */ + /** + * Sample code: Create or update an alert rule on Subscription. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnAlertRuleOnSubscription( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .define("MetricAlertAtSubscriptionLevel") + .withRegion("global") + .withExistingResourceGroup("gigtest") + .withSeverity(3) + .withEnabled(true) + .withScopes(Arrays.asList("/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7")) + .withEvaluationFrequency(Duration.parse("PT1M")) + .withWindowSize(Duration.parse("PT15M")) + .withCriteria( + new MetricAlertMultipleResourceMultipleMetricCriteria() + .withAllOf( + Arrays + .asList( + new MetricCriteria() + .withName("High_CPU_80") + .withMetricName("Percentage CPU") + .withMetricNamespace("microsoft.compute/virtualmachines") + .withTimeAggregation(AggregationTypeEnum.AVERAGE) + .withDimensions(Arrays.asList()) + .withOperator(Operator.GREATER_THAN) + .withThreshold(80.5)))) + .withTags(mapOf()) + .withDescription("This is the description of the rule1") + .withTargetResourceType("Microsoft.Compute/virtualMachines") + .withTargetResourceRegion("southcentralus") + .withAutoMitigate(true) + .withActions( + Arrays + .asList( + new MetricAlertAction() + .withActionGroupId( + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2") + .withWebhookProperties(mapOf("key11", "value11", "key12", "value12")))) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertResourceGroup.json + */ + /** + * Sample code: Create or update an alert rule on Resource group(s). + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnAlertRuleOnResourceGroupS( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .define("MetricAlertAtResourceGroupLevel") + .withRegion("global") + .withExistingResourceGroup("gigtest1") + .withSeverity(3) + .withEnabled(true) + .withScopes( + Arrays + .asList( + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest1", + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest2")) + .withEvaluationFrequency(Duration.parse("PT1M")) + .withWindowSize(Duration.parse("PT15M")) + .withCriteria( + new MetricAlertMultipleResourceMultipleMetricCriteria() + .withAllOf( + Arrays + .asList( + new MetricCriteria() + .withName("High_CPU_80") + .withMetricName("Percentage CPU") + .withMetricNamespace("microsoft.compute/virtualmachines") + .withTimeAggregation(AggregationTypeEnum.AVERAGE) + .withDimensions(Arrays.asList()) + .withOperator(Operator.GREATER_THAN) + .withThreshold(80.5)))) + .withTags(mapOf()) + .withDescription("This is the description of the rule1") + .withTargetResourceType("Microsoft.Compute/virtualMachines") + .withTargetResourceRegion("southcentralus") + .withAutoMitigate(true) + .withActions( + Arrays + .asList( + new MetricAlertAction() + .withActionGroupId( + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2") + .withWebhookProperties(mapOf("key11", "value11", "key12", "value12")))) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertWithDimensions.json + */ + /** + * Sample code: Create or update an alert rules with dimensions. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnAlertRulesWithDimensions( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .define("MetricAlertOnMultipleDimensions") + .withRegion("global") + .withExistingResourceGroup("gigtest") + .withSeverity(3) + .withEnabled(true) + .withScopes( + Arrays + .asList( + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.KeyVault/vaults/keyVaultResource")) + .withEvaluationFrequency(Duration.parse("PT1H")) + .withWindowSize(Duration.parse("P1D")) + .withCriteria( + new MetricAlertMultipleResourceMultipleMetricCriteria() + .withAllOf( + Arrays + .asList( + new MetricCriteria() + .withName("Metric1") + .withMetricName("Availability") + .withMetricNamespace("Microsoft.KeyVault/vaults") + .withTimeAggregation(AggregationTypeEnum.AVERAGE) + .withDimensions( + Arrays + .asList( + new MetricDimension() + .withName("ActivityName") + .withOperator("Include") + .withValues(Arrays.asList("*")), + new MetricDimension() + .withName("StatusCode") + .withOperator("Include") + .withValues(Arrays.asList("200")))) + .withOperator(Operator.GREATER_THAN) + .withThreshold(55.0)))) + .withTags(mapOf()) + .withDescription("This is the description of the rule1") + .withAutoMitigate(true) + .withActions( + Arrays + .asList( + new MetricAlertAction() + .withActionGroupId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2") + .withWebhookProperties(mapOf("key11", "value11", "key12", "value12")))) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateWebTestMetricAlert.json + */ + /** + * Sample code: Create or update a web test alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAWebTestAlertRule( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .define("webtest-name-example") + .withRegion("global") + .withExistingResourceGroup("rg-example") + .withSeverity(4) + .withEnabled(true) + .withScopes( + Arrays + .asList( + "/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")) + .withEvaluationFrequency(Duration.parse("PT1M")) + .withWindowSize(Duration.parse("PT15M")) + .withCriteria( + new WebtestLocationAvailabilityCriteria() + .withWebTestId( + "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/webtests/component-example") + .withComponentId( + "/subscriptions/12345678-1234-1234-1234-123456789101/resourcegroups/rg-example/providers/microsoft.insights/components/webtest-name-example") + .withFailedLocationCount(2f)) + .withTags( + mapOf( + "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")) + .withDescription("Automatically created alert rule for availability test \"component-example\" a") + .withActions(Arrays.asList()) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateDynamicMetricAlertSingleResource.json + */ + /** + * Sample code: Create or update a dynamic alert rule for Single Resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateADynamicAlertRuleForSingleResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .define("chiricutin") + .withRegion("global") + .withExistingResourceGroup("gigtest") + .withSeverity(3) + .withEnabled(true) + .withScopes( + Arrays + .asList( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")) + .withEvaluationFrequency(Duration.parse("PT1M")) + .withWindowSize(Duration.parse("PT15M")) + .withCriteria( + new MetricAlertMultipleResourceMultipleMetricCriteria() + .withAllOf( + Arrays + .asList( + new DynamicMetricCriteria() + .withName("High_CPU_80") + .withMetricName("Percentage CPU") + .withMetricNamespace("microsoft.compute/virtualmachines") + .withTimeAggregation(AggregationTypeEnum.AVERAGE) + .withDimensions(Arrays.asList()) + .withOperator(DynamicThresholdOperator.GREATER_OR_LESS_THAN) + .withAlertSensitivity(DynamicThresholdSensitivity.MEDIUM) + .withFailingPeriods( + new DynamicThresholdFailingPeriods() + .withNumberOfEvaluationPeriods(4f) + .withMinFailingPeriodsToAlert(4f)) + .withIgnoreDataBefore(OffsetDateTime.parse("2019-04-04T21:00:00.000Z"))))) + .withTags(mapOf()) + .withDescription("This is the description of the rule1") + .withAutoMitigate(true) + .withActions( + Arrays + .asList( + new MetricAlertAction() + .withActionGroupId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2") + .withWebhookProperties(mapOf("key11", "value11", "key12", "value12")))) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertSingleResource.json + */ + /** + * Sample code: Create or update an alert rule for Single Resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnAlertRuleForSingleResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .define("chiricutin") + .withRegion("global") + .withExistingResourceGroup("gigtest") + .withSeverity(3) + .withEnabled(true) + .withScopes( + Arrays + .asList( + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")) + .withEvaluationFrequency(Duration.parse("Pt1m")) + .withWindowSize(Duration.parse("Pt15m")) + .withCriteria( + new MetricAlertSingleResourceMultipleMetricCriteria() + .withAllOf( + Arrays + .asList( + new MetricCriteria() + .withName("High_CPU_80") + .withMetricName("\\Processor(_Total)\\% Processor Time") + .withTimeAggregation(AggregationTypeEnum.AVERAGE) + .withDimensions(Arrays.asList()) + .withOperator(Operator.GREATER_THAN) + .withThreshold(80.5)))) + .withTags(mapOf()) + .withDescription("This is the description of the rule1") + .withAutoMitigate(true) + .withActions( + Arrays + .asList( + new MetricAlertAction() + .withActionGroupId( + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2") + .withWebhookProperties(mapOf("key11", "value11", "key12", "value12")))) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateMetricAlertMultipleResource.json + */ + /** + * Sample code: Create or update an alert rule for Multiple Resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnAlertRuleForMultipleResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .define("MetricAlertOnMultipleResources") + .withRegion("global") + .withExistingResourceGroup("gigtest") + .withSeverity(3) + .withEnabled(true) + .withScopes( + Arrays + .asList( + "/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")) + .withEvaluationFrequency(Duration.parse("PT1M")) + .withWindowSize(Duration.parse("PT15M")) + .withCriteria( + new MetricAlertMultipleResourceMultipleMetricCriteria() + .withAllOf( + Arrays + .asList( + new MetricCriteria() + .withName("High_CPU_80") + .withMetricName("Percentage CPU") + .withMetricNamespace("microsoft.compute/virtualmachines") + .withTimeAggregation(AggregationTypeEnum.AVERAGE) + .withDimensions(Arrays.asList()) + .withOperator(Operator.GREATER_THAN) + .withThreshold(80.5)))) + .withTags(mapOf()) + .withDescription("This is the description of the rule1") + .withTargetResourceType("Microsoft.Compute/virtualMachines") + .withTargetResourceRegion("southcentralus") + .withAutoMitigate(true) + .withActions( + Arrays + .asList( + new MetricAlertAction() + .withActionGroupId( + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2") + .withWebhookProperties(mapOf("key11", "value11", "key12", "value12")))) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/createOrUpdateDynamicMetricAlertMultipleResource.json + */ + /** + * Sample code: Create or update a dynamic alert rule for Multiple Resources. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateADynamicAlertRuleForMultipleResources( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .define("MetricAlertOnMultipleResources") + .withRegion("global") + .withExistingResourceGroup("gigtest") + .withSeverity(3) + .withEnabled(true) + .withScopes( + Arrays + .asList( + "/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")) + .withEvaluationFrequency(Duration.parse("PT1M")) + .withWindowSize(Duration.parse("PT15M")) + .withCriteria( + new MetricAlertMultipleResourceMultipleMetricCriteria() + .withAllOf( + Arrays + .asList( + new DynamicMetricCriteria() + .withName("High_CPU_80") + .withMetricName("Percentage CPU") + .withMetricNamespace("microsoft.compute/virtualmachines") + .withTimeAggregation(AggregationTypeEnum.AVERAGE) + .withDimensions(Arrays.asList()) + .withOperator(DynamicThresholdOperator.GREATER_OR_LESS_THAN) + .withAlertSensitivity(DynamicThresholdSensitivity.MEDIUM) + .withFailingPeriods( + new DynamicThresholdFailingPeriods() + .withNumberOfEvaluationPeriods(4f) + .withMinFailingPeriodsToAlert(4f))))) + .withTags(mapOf()) + .withDescription("This is the description of the rule1") + .withTargetResourceType("Microsoft.Compute/virtualMachines") + .withTargetResourceRegion("southcentralus") + .withAutoMitigate(true) + .withActions( + Arrays + .asList( + new MetricAlertAction() + .withActionGroupId( + "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2") + .withWebhookProperties(mapOf("key11", "value11", "key12", "value12")))) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsDeleteSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsDeleteSamples.java new file mode 100644 index 0000000000000..687972922c7f4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for MetricAlerts Delete. */ +public final class MetricAlertsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/deleteMetricAlert.json + */ + /** + * Sample code: Delete an alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteAnAlertRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .deleteByResourceGroupWithResponse("gigtest", "chiricutin", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsGetByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..df3f876e426cc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsGetByResourceGroupSamples.java @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for MetricAlerts GetByResourceGroup. */ +public final class MetricAlertsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertResourceGroup.json + */ + /** + * Sample code: Get an alert rule on resource group(s). + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnAlertRuleOnResourceGroupS( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .getByResourceGroupWithResponse( + "gigtest1", "MetricAlertAtResourceGroupLevel", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getDynamicMetricAlertMultipleResource.json + */ + /** + * Sample code: Get a dynamic alert rule for multiple resources. + * + * @param manager Entry point to MonitorManager. + */ + public static void getADynamicAlertRuleForMultipleResources( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .getByResourceGroupWithResponse( + "gigtest", "MetricAlertOnMultipleResources", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getWebTestMetricAlert.json + */ + /** + * Sample code: Get a web test alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAWebTestAlertRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .getByResourceGroupWithResponse("rg-example", "webtest-name-example", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertSingleResource.json + */ + /** + * Sample code: Get an alert rule for single resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnAlertRuleForSingleResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .getByResourceGroupWithResponse("gigtest", "chiricutin", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertSubscription.json + */ + /** + * Sample code: Get an alert rule on subscription. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnAlertRuleOnSubscription( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .getByResourceGroupWithResponse( + "gigtest", "MetricAlertAtSubscriptionLevel", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getDynamicMetricAlertSingleResource.json + */ + /** + * Sample code: Get a dynamic alert rule for single resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void getADynamicAlertRuleForSingleResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .getByResourceGroupWithResponse("gigtest", "chiricutin", com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertMultipleResource.json + */ + /** + * Sample code: Get an alert rule for multiple resources. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnAlertRuleForMultipleResources( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlerts() + .getByResourceGroupWithResponse( + "gigtest", "MetricAlertOnMultipleResources", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsListByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsListByResourceGroupSamples.java new file mode 100644 index 0000000000000..2b9b315c26972 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsListByResourceGroupSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for MetricAlerts ListByResourceGroup. */ +public final class MetricAlertsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/listMetricAlert.json + */ + /** + * Sample code: List metric alert rules. + * + * @param manager Entry point to MonitorManager. + */ + public static void listMetricAlertRules(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.metricAlerts().listByResourceGroup("gigtest", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsListSamples.java new file mode 100644 index 0000000000000..24c3dba2e93a7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for MetricAlerts List. */ +public final class MetricAlertsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/listMetricAlert.json + */ + /** + * Sample code: List metric alert rules. + * + * @param manager Entry point to MonitorManager. + */ + public static void listMetricAlertRules(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.metricAlerts().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsStatusListByNameSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsStatusListByNameSamples.java new file mode 100644 index 0000000000000..e05a7cc7e75d7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsStatusListByNameSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for MetricAlertsStatus ListByName. */ +public final class MetricAlertsStatusListByNameSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertStatusByName.json + */ + /** + * Sample code: Get an alert rule status. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnAlertRuleStatus(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricAlertsStatus() + .listByNameWithResponse( + "EastUs", + "custom1", + "cmVzb3VyY2VJZD0vc3Vic2NyaXB0aW9ucy8xNGRkZjBjNS03N2M1LTRiNTMtODRmNi1lMWZhNDNhZDY4ZjcvcmVzb3VyY2VHcm91cHMvZ2lndGVzdC9wcm92aWRlcnMvTWljcm9zb2Z0LkNvbXB1dGUvdmlydHVhbE1hY2hpbmVzL2dpZ3dhZG1l", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsStatusListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsStatusListSamples.java new file mode 100644 index 0000000000000..53f4e46b97221 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsStatusListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for MetricAlertsStatus List. */ +public final class MetricAlertsStatusListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/getMetricAlertStatus.json + */ + /** + * Sample code: Get an alert rule status. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAnAlertRuleStatus(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.metricAlertsStatus().listWithResponse("gigtest", "chiricutin", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsUpdateSamples.java new file mode 100644 index 0000000000000..f4ce5e17b2198 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsUpdateSamples.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.AggregationTypeEnum; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertAction; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertResource; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertSingleResourceMultipleMetricCriteria; +import com.azure.resourcemanager.monitor.generated.models.MetricCriteria; +import com.azure.resourcemanager.monitor.generated.models.Operator; +import java.time.Duration; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for MetricAlerts Update. */ +public final class MetricAlertsUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/examples/UpdateMetricAlert.json + */ + /** + * Sample code: Create or update an alert rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAnAlertRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + MetricAlertResource resource = + manager + .metricAlerts() + .getByResourceGroupWithResponse("gigtest", "chiricutin", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf()) + .withDescription("This is the description of the rule1") + .withSeverity(3) + .withEnabled(true) + .withScopes( + Arrays + .asList( + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourceGroups/gigtest/providers/Microsoft.Compute/virtualMachines/gigwadme")) + .withEvaluationFrequency(Duration.parse("Pt1m")) + .withWindowSize(Duration.parse("Pt15m")) + .withCriteria( + new MetricAlertSingleResourceMultipleMetricCriteria() + .withAllOf( + Arrays + .asList( + new MetricCriteria() + .withName("High_CPU_80") + .withMetricName("\\Processor(_Total)\\% Processor Time") + .withTimeAggregation(AggregationTypeEnum.AVERAGE) + .withDimensions(Arrays.asList()) + .withOperator(Operator.GREATER_THAN) + .withThreshold(80.5)))) + .withAutoMitigate(true) + .withActions( + Arrays + .asList( + new MetricAlertAction() + .withActionGroupId( + "/subscriptions/14ddf0c5-77c5-4b53-84f6-e1fa43ad68f7/resourcegroups/gigtest/providers/microsoft.insights/actiongroups/group2") + .withWebhookProperties(mapOf("key11", "value11", "key12", "value12")))) + .apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricDefinitionsListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricDefinitionsListSamples.java new file mode 100644 index 0000000000000..05204ea31d1e4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricDefinitionsListSamples.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for MetricDefinitions List. */ +public final class MetricDefinitionsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetricDefinitions.json + */ + /** + * Sample code: Get Metric Definitions without filter. + * + * @param manager Entry point to MonitorManager. + */ + public static void getMetricDefinitionsWithoutFilter( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricDefinitions() + .list( + "subscriptions/07c0b09d-9f69-4e6e-8d05-f59f67299cb2/resourceGroups/Rac46PostSwapRG/providers/Microsoft.Web/sites/alertruleTest/providers/microsoft.insights/metricDefinitions", + "Microsoft.Web/sites", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetricDefinitionsApplicationInsights.json + */ + /** + * Sample code: Get Application Insights Metric Definitions without filter. + * + * @param manager Entry point to MonitorManager. + */ + public static void getApplicationInsightsMetricDefinitionsWithoutFilter( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricDefinitions() + .list( + "subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill/providers/microsoft.insights/metricdefinitions", + "microsoft.insights/components", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetricDefinitionsMetricClass.json + */ + /** + * Sample code: Get StorageCache Metric Definitions with metric class. + * + * @param manager Entry point to MonitorManager. + */ + public static void getStorageCacheMetricDefinitionsWithMetricClass( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricDefinitions() + .list( + "subscriptions/46841c0e-69c8-4b17-af46-6626ecb15fc2/resourceGroups/adgarntptestrg/providers/Microsoft.StorageCache/caches/adgarntptestcache", + "microsoft.storagecache/caches", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricNamespacesListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricNamespacesListSamples.java new file mode 100644 index 0000000000000..47c36ab131894 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricNamespacesListSamples.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for MetricNamespaces List. */ +public final class MetricNamespacesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/examples/GetMetricNamespaces.json + */ + /** + * Sample code: Get Metric Namespaces without filter. + * + * @param manager Entry point to MonitorManager. + */ + public static void getMetricNamespacesWithoutFilter( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricNamespaces() + .list( + "subscriptions/182c901a-129a-4f5d-86e4-cc6b294590a2/resourceGroups/hyr-log/providers/microsoft.insights/components/f1-bill", + "2020-08-31T15:53:00Z", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricsOperationListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricsOperationListSamples.java new file mode 100644 index 0000000000000..e9faa60f44dd3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricsOperationListSamples.java @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import java.time.Duration; + +/** Samples for MetricsOperation List. */ +public final class MetricsOperationListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetric.json + */ + /** + * Sample code: Get Metric for data. + * + * @param manager Entry point to MonitorManager. + */ + public static void getMetricForData(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricsOperations() + .listWithResponse( + "subscriptions/b324c52b-4073-4807-93af-e07d289c093e/resourceGroups/test/providers/Microsoft.Storage/storageAccounts/larryshoebox/blobServices/default", + "2017-04-14T02:20:00Z/2017-04-14T04:20:00Z", + Duration.parse("PT1M"), + null, + "Average,count", + 3, + "Average asc", + "BlobType eq '*'", + null, + "Microsoft.Storage/storageAccounts/blobServices", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetricMetadata.json + */ + /** + * Sample code: Get Metric for metadata. + * + * @param manager Entry point to MonitorManager. + */ + public static void getMetricForMetadata(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricsOperations() + .listWithResponse( + "subscriptions/b324c52b-4073-4807-93af-e07d289c093e/resourceGroups/test/providers/Microsoft.Storage/storageAccounts/larryshoebox/blobServices/default", + "2017-04-14T02:20:00Z/2017-04-14T04:20:00Z", + Duration.parse("PT1M"), + null, + "Average,count", + 3, + "Average asc", + "BlobType eq '*'", + null, + "Microsoft.Storage/storageAccounts/blobServices", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/examples/GetMetricError.json + */ + /** + * Sample code: Get Metric with error. + * + * @param manager Entry point to MonitorManager. + */ + public static void getMetricWithError(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .metricsOperations() + .listWithResponse( + "subscriptions/ac41e21f-afd6-4a79-8070-f01eba278f97/resourceGroups/todking/providers/Microsoft.DocumentDb/databaseAccounts/tk-cosmos-mongo", + "2021-06-07T21:51:00Z/2021-06-08T01:51:00Z", + Duration.parse("FULL"), + "MongoRequestsCount,MongoRequests", + "average", + null, + null, + null, + null, + "microsoft.documentdb/databaseaccounts", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MonitorOperationsListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MonitorOperationsListSamples.java new file mode 100644 index 0000000000000..7cfe9c0d479fc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MonitorOperationsListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for MonitorOperations List. */ +public final class MonitorOperationsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Monitor/preview/2021-06-03-preview/examples/OperationsGet.json + */ + /** + * Sample code: Get operations list. + * + * @param manager Entry point to MonitorManager. + */ + public static void getOperationsList(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.monitorOperations().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/OperationsListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/OperationsListSamples.java new file mode 100644 index 0000000000000..5e0700f407517 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/OperationsListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for Operations List. */ +public final class OperationsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/OperationList.json + */ + /** + * Sample code: Get a list of operations for a resource provider. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAListOfOperationsForAResourceProvider( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.operations().listWithResponse(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PredictiveMetricGetSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PredictiveMetricGetSamples.java new file mode 100644 index 0000000000000..ac6b764f690c8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PredictiveMetricGetSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import java.time.Duration; + +/** Samples for PredictiveMetric Get. */ +public final class PredictiveMetricGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/examples/GetPredictiveMetric.json + */ + /** + * Sample code: Get Metric for data. + * + * @param manager Entry point to MonitorManager. + */ + public static void getMetricForData(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .predictiveMetrics() + .getWithResponse( + "myRG", + "vmss1-Autoscale-775", + "2021-10-14T22:00:00.000Z/2021-10-16T22:00:00.000Z", + Duration.parse("PT1H"), + "Microsoft.Compute/virtualMachineScaleSets", + "PercentageCPU", + "Total", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..ba51fc480037b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointServiceConnectionStatus; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkServiceConnectionState; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionUpdate.json + */ + /** + * Sample code: Approve or reject a private endpoint connection with a given name. + * + * @param manager Entry point to MonitorManager. + */ + public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateEndpointConnections() + .define("private-endpoint-connection-name") + .withExistingPrivateLinkScope("MyResourceGroup", "MyPrivateLinkScope") + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionState() + .withStatus(PrivateEndpointServiceConnectionStatus.APPROVED) + .withDescription("Approved by johndoe@contoso.com")) + .create(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsDeleteSamples.java new file mode 100644 index 0000000000000..9328acdeed969 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsDeleteSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionDelete.json + */ + /** + * Sample code: Deletes a private endpoint connection with a given name. + * + * @param manager Entry point to MonitorManager. + */ + public static void deletesAPrivateEndpointConnectionWithAGivenName( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateEndpointConnections() + .delete( + "MyResourceGroup", + "MyPrivateLinkScope", + "private-endpoint-connection-name", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsGetSamples.java new file mode 100644 index 0000000000000..931fed871b199 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsGetSamples.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateEndpointConnections() + .getWithResponse( + "MyResourceGroup", + "MyPrivateLinkScope", + "private-endpoint-connection-name", + com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsListByPrivateLinkScopeSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsListByPrivateLinkScopeSamples.java new file mode 100644 index 0000000000000..67a344a062a8d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsListByPrivateLinkScopeSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for PrivateEndpointConnections ListByPrivateLinkScope. */ +public final class PrivateEndpointConnectionsListByPrivateLinkScopeSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateEndpointConnectionList.json + */ + /** + * Sample code: Gets list of private endpoint connections on a private link scope. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsListOfPrivateEndpointConnectionsOnAPrivateLinkScope( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateEndpointConnections() + .listByPrivateLinkScopeWithResponse( + "MyResourceGroup", "MyPrivateLinkScope", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkResourcesGetSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkResourcesGetSamples.java new file mode 100644 index 0000000000000..13404b8cd2f94 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkResourcesGetSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopePrivateLinkResourceGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkResources() + .getWithResponse("MyResourceGroup", "MyPrivateLinkScope", "azuremonitor", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkResourcesListByPrivateLinkScopeSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkResourcesListByPrivateLinkScopeSamples.java new file mode 100644 index 0000000000000..fce13e553ec25 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkResourcesListByPrivateLinkScopeSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for PrivateLinkResources ListByPrivateLinkScope. */ +public final class PrivateLinkResourcesListByPrivateLinkScopeSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopePrivateLinkResourceListGet.json + */ + /** + * Sample code: Gets private endpoint connection. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsPrivateEndpointConnection( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkResources() + .listByPrivateLinkScopeWithResponse( + "MyResourceGroup", "MyPrivateLinkScope", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopeOperationStatusGetByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopeOperationStatusGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..0c9464ae6d004 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopeOperationStatusGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for PrivateLinkScopeOperationStatus GetByResourceGroup. */ +public final class PrivateLinkScopeOperationStatusGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/privateLinkScopeOperationStatuses.json + */ + /** + * Sample code: Get specific operation status. + * + * @param manager Entry point to MonitorManager. + */ + public static void getSpecificOperationStatus(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkScopeOperationStatus() + .getByResourceGroupWithResponse( + "MyResourceGroup", "713192d7-503f-477a-9cfe-4efc3ee2bd11", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesCreateOrUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..1d1dd2d8d4d67 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesCreateOrUpdateSamples.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.ScopedResource; + +/** Samples for PrivateLinkScopedResources CreateOrUpdate. */ +public final class PrivateLinkScopedResourcesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceUpdate.json + */ + /** + * Sample code: Update a scoped resource in a private link scope. + * + * @param manager Entry point to MonitorManager. + */ + public static void updateAScopedResourceInAPrivateLinkScope( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + ScopedResource resource = + manager + .privateLinkScopedResources() + .getWithResponse( + "MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", com.azure.core.util.Context.NONE) + .getValue(); + resource + .update() + .withLinkedResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/my-component") + .apply(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesDeleteSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesDeleteSamples.java new file mode 100644 index 0000000000000..00b5328f4722b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesDeleteSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for PrivateLinkScopedResources Delete. */ +public final class PrivateLinkScopedResourcesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceDelete.json + */ + /** + * Sample code: Deletes a scoped resource with a given name. + * + * @param manager Entry point to MonitorManager. + */ + public static void deletesAScopedResourceWithAGivenName( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkScopedResources() + .delete("MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesGetSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesGetSamples.java new file mode 100644 index 0000000000000..f29108c743e75 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesGetSamples.java @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for PrivateLinkScopedResources Get. */ +public final class PrivateLinkScopedResourcesGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceGet.json + */ + /** + * Sample code: Gets private link scoped resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsPrivateLinkScopedResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkScopedResources() + .getWithResponse( + "MyResourceGroup", "MyPrivateLinkScope", "scoped-resource-name", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesListByPrivateLinkScopeSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesListByPrivateLinkScopeSamples.java new file mode 100644 index 0000000000000..465344e0d867e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesListByPrivateLinkScopeSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for PrivateLinkScopedResources ListByPrivateLinkScope. */ +public final class PrivateLinkScopedResourcesListByPrivateLinkScopeSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopedResourceList.json + */ + /** + * Sample code: Gets list of scoped resources in a private link scope. + * + * @param manager Entry point to MonitorManager. + */ + public static void getsListOfScopedResourcesInAPrivateLinkScope( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkScopedResources() + .listByPrivateLinkScope("MyResourceGroup", "MyPrivateLinkScope", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesCreateOrUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..c04c7133a4cf8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesCreateOrUpdateSamples.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.AccessMode; +import com.azure.resourcemanager.monitor.generated.models.AccessModeSettings; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for PrivateLinkScopes CreateOrUpdate. */ +public final class PrivateLinkScopesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesCreate.json + */ + /** + * Sample code: PrivateLinkScopeCreate. + * + * @param manager Entry point to MonitorManager. + */ + public static void privateLinkScopeCreate(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkScopes() + .define("my-privatelinkscope") + .withRegion("Global") + .withExistingResourceGroup("my-resource-group") + .withAccessModeSettings( + new AccessModeSettings() + .withQueryAccessMode(AccessMode.OPEN) + .withIngestionAccessMode(AccessMode.OPEN) + .withExclusions(Arrays.asList())) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesUpdate.json + */ + /** + * Sample code: PrivateLinkScopeUpdate. + * + * @param manager Entry point to MonitorManager. + */ + public static void privateLinkScopeUpdate(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkScopes() + .define("my-privatelinkscope") + .withRegion("Global") + .withExistingResourceGroup("my-resource-group") + .withAccessModeSettings( + new AccessModeSettings() + .withQueryAccessMode(AccessMode.OPEN) + .withIngestionAccessMode(AccessMode.OPEN) + .withExclusions(Arrays.asList())) + .withTags(mapOf("Tag1", "Value1")) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesDeleteSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesDeleteSamples.java new file mode 100644 index 0000000000000..ae427e2d0b27b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for PrivateLinkScopes Delete. */ +public final class PrivateLinkScopesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesDelete.json + */ + /** + * Sample code: PrivateLinkScopesDelete. + * + * @param manager Entry point to MonitorManager. + */ + public static void privateLinkScopesDelete(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkScopes() + .delete("my-resource-group", "my-privatelinkscope", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesGetByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..a420fa3c503ac --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for PrivateLinkScopes GetByResourceGroup. */ +public final class PrivateLinkScopesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesGet.json + */ + /** + * Sample code: PrivateLinkScopeGet. + * + * @param manager Entry point to MonitorManager. + */ + public static void privateLinkScopeGet(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .privateLinkScopes() + .getByResourceGroupWithResponse( + "my-resource-group", "my-privatelinkscope", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesListByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..6a36c998a4b59 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for PrivateLinkScopes ListByResourceGroup. */ +public final class PrivateLinkScopesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesListByResourceGroup.json + */ + /** + * Sample code: PrivateLinkScopeListByResourceGroup. + * + * @param manager Entry point to MonitorManager. + */ + public static void privateLinkScopeListByResourceGroup( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.privateLinkScopes().listByResourceGroup("my-resource-group", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesListSamples.java new file mode 100644 index 0000000000000..9549bd15da59a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesListSamples.java @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for PrivateLinkScopes List. */ +public final class PrivateLinkScopesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesList.json + */ + /** + * Sample code: PrivateLinkScopesList.json. + * + * @param manager Entry point to MonitorManager. + */ + public static void privateLinkScopesListJson(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.privateLinkScopes().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesUpdateTagsSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesUpdateTagsSamples.java new file mode 100644 index 0000000000000..69e21653ae705 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesUpdateTagsSamples.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.AzureMonitorPrivateLinkScope; +import java.util.HashMap; +import java.util.Map; + +/** Samples for PrivateLinkScopes UpdateTags. */ +public final class PrivateLinkScopesUpdateTagsSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/examples/PrivateLinkScopesUpdateTagsOnly.json + */ + /** + * Sample code: PrivateLinkScopeUpdateTagsOnly. + * + * @param manager Entry point to MonitorManager. + */ + public static void privateLinkScopeUpdateTagsOnly( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + AzureMonitorPrivateLinkScope resource = + manager + .privateLinkScopes() + .getByResourceGroupWithResponse( + "my-resource-group", "my-privatelinkscope", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withTags(mapOf("Tag1", "Value1", "Tag2", "Value2")).apply(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesCreateOrUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesCreateOrUpdateSamples.java new file mode 100644 index 0000000000000..79ee23f6e6ac8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesCreateOrUpdateSamples.java @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.Actions; +import com.azure.resourcemanager.monitor.generated.models.AlertSeverity; +import com.azure.resourcemanager.monitor.generated.models.Condition; +import com.azure.resourcemanager.monitor.generated.models.ConditionFailingPeriods; +import com.azure.resourcemanager.monitor.generated.models.ConditionOperator; +import com.azure.resourcemanager.monitor.generated.models.Dimension; +import com.azure.resourcemanager.monitor.generated.models.DimensionOperator; +import com.azure.resourcemanager.monitor.generated.models.RuleResolveConfiguration; +import com.azure.resourcemanager.monitor.generated.models.ScheduledQueryRuleCriteria; +import com.azure.resourcemanager.monitor.generated.models.TimeAggregation; +import java.time.Duration; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** Samples for ScheduledQueryRules CreateOrUpdate. */ +public final class ScheduledQueryRulesCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/createOrUpdateScheduledQueryRuleSubscription.json + */ + /** + * Sample code: Create or update a scheduled query rule on Subscription. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAScheduledQueryRuleOnSubscription( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .scheduledQueryRules() + .define("perf") + .withRegion("eastus") + .withExistingResourceGroup("QueryResourceGroupName") + .withDescription("Performance rule") + .withSeverity(AlertSeverity.FOUR) + .withEnabled(true) + .withScopes(Arrays.asList("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147")) + .withEvaluationFrequency(Duration.parse("PT5M")) + .withWindowSize(Duration.parse("PT10M")) + .withTargetResourceTypes(Arrays.asList("Microsoft.Compute/virtualMachines")) + .withCriteria( + new ScheduledQueryRuleCriteria() + .withAllOf( + Arrays + .asList( + new Condition() + .withQuery("Perf | where ObjectName == \"Processor\"") + .withTimeAggregation(TimeAggregation.AVERAGE) + .withMetricMeasureColumn("% Processor Time") + .withResourceIdColumn("resourceId") + .withDimensions( + Arrays + .asList( + new Dimension() + .withName("ComputerIp") + .withOperator(DimensionOperator.EXCLUDE) + .withValues(Arrays.asList("192.168.1.1")), + new Dimension() + .withName("OSType") + .withOperator(DimensionOperator.INCLUDE) + .withValues(Arrays.asList("*")))) + .withOperator(ConditionOperator.GREATER_THAN) + .withThreshold(70.0D) + .withFailingPeriods( + new ConditionFailingPeriods() + .withNumberOfEvaluationPeriods(1L) + .withMinFailingPeriodsToAlert(1L))))) + .withMuteActionsDuration(Duration.parse("PT30M")) + .withActions( + new Actions() + .withActionGroups( + Arrays + .asList( + "/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")) + .withCustomProperties(mapOf("key11", "value11", "key12", "value12"))) + .withCheckWorkspaceAlertsStorageConfigured(true) + .withSkipQueryValidation(true) + .withRuleResolveConfiguration( + new RuleResolveConfiguration().withAutoResolved(true).withTimeToResolve(Duration.parse("PT10M"))) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/createOrUpdateScheduledQueryRuleResourceGroup.json + */ + /** + * Sample code: Create or update a scheduled query rule on Resource group(s). + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAScheduledQueryRuleOnResourceGroupS( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .scheduledQueryRules() + .define("heartbeat") + .withRegion("eastus") + .withExistingResourceGroup("QueryResourceGroupName") + .withDescription("Health check rule") + .withSeverity(AlertSeverity.FOUR) + .withEnabled(true) + .withScopes( + Arrays.asList("/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1")) + .withEvaluationFrequency(Duration.parse("PT5M")) + .withWindowSize(Duration.parse("PT10M")) + .withTargetResourceTypes(Arrays.asList("Microsoft.Compute/virtualMachines")) + .withCriteria( + new ScheduledQueryRuleCriteria() + .withAllOf( + Arrays + .asList( + new Condition() + .withQuery("Heartbeat") + .withTimeAggregation(TimeAggregation.COUNT) + .withDimensions(Arrays.asList()) + .withOperator(ConditionOperator.GREATER_THAN) + .withThreshold(360.0D) + .withFailingPeriods( + new ConditionFailingPeriods() + .withNumberOfEvaluationPeriods(1L) + .withMinFailingPeriodsToAlert(1L))))) + .withMuteActionsDuration(Duration.parse("PT30M")) + .withActions( + new Actions() + .withActionGroups( + Arrays + .asList( + "/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")) + .withCustomProperties(mapOf("key11", "value11", "key12", "value12"))) + .withCheckWorkspaceAlertsStorageConfigured(true) + .withSkipQueryValidation(true) + .withRuleResolveConfiguration( + new RuleResolveConfiguration().withAutoResolved(true).withTimeToResolve(Duration.parse("PT10M"))) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/createOrUpdateScheduledQueryRule.json + */ + /** + * Sample code: Create or update a scheduled query rule for Single Resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAScheduledQueryRuleForSingleResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .scheduledQueryRules() + .define("perf") + .withRegion("eastus") + .withExistingResourceGroup("QueryResourceGroupName") + .withDescription("Performance rule") + .withSeverity(AlertSeverity.FOUR) + .withEnabled(true) + .withScopes( + Arrays + .asList( + "/subscriptions/aaf177ed-1330-a9f2-80ea-fd3d7783b147/resourceGroups/scopeResourceGroup1/providers/Microsoft.Compute/virtualMachines/vm1")) + .withEvaluationFrequency(Duration.parse("PT5M")) + .withWindowSize(Duration.parse("PT10M")) + .withCriteria( + new ScheduledQueryRuleCriteria() + .withAllOf( + Arrays + .asList( + new Condition() + .withQuery("Perf | where ObjectName == \"Processor\"") + .withTimeAggregation(TimeAggregation.AVERAGE) + .withMetricMeasureColumn("% Processor Time") + .withResourceIdColumn("resourceId") + .withDimensions( + Arrays + .asList( + new Dimension() + .withName("ComputerIp") + .withOperator(DimensionOperator.EXCLUDE) + .withValues(Arrays.asList("192.168.1.1")), + new Dimension() + .withName("OSType") + .withOperator(DimensionOperator.INCLUDE) + .withValues(Arrays.asList("*")))) + .withOperator(ConditionOperator.GREATER_THAN) + .withThreshold(70.0D) + .withFailingPeriods( + new ConditionFailingPeriods() + .withNumberOfEvaluationPeriods(1L) + .withMinFailingPeriodsToAlert(1L))))) + .withMuteActionsDuration(Duration.parse("PT30M")) + .withActions( + new Actions() + .withActionGroups( + Arrays + .asList( + "/subscriptions/1cf177ed-1330-4692-80ea-fd3d7783b147/resourcegroups/sqrapi/providers/microsoft.insights/actiongroups/myactiongroup")) + .withCustomProperties(mapOf("key11", "value11", "key12", "value12"))) + .withCheckWorkspaceAlertsStorageConfigured(true) + .withSkipQueryValidation(true) + .withRuleResolveConfiguration( + new RuleResolveConfiguration().withAutoResolved(true).withTimeToResolve(Duration.parse("PT10M"))) + .create(); + } + + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesDeleteSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesDeleteSamples.java new file mode 100644 index 0000000000000..b43481d72c0b3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesDeleteSamples.java @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for ScheduledQueryRules Delete. */ +public final class ScheduledQueryRulesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/deleteScheduledQueryRule.json + */ + /** + * Sample code: Delete a scheduled query rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteAScheduledQueryRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .scheduledQueryRules() + .deleteByResourceGroupWithResponse("QueryResourceGroupName", "heartbeat", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesGetByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesGetByResourceGroupSamples.java new file mode 100644 index 0000000000000..6d6d461ce20a3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesGetByResourceGroupSamples.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for ScheduledQueryRules GetByResourceGroup. */ +public final class ScheduledQueryRulesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/getScheduledQueryRule.json + */ + /** + * Sample code: Get a scheduled query rule for single resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void getAScheduledQueryRuleForSingleResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .scheduledQueryRules() + .getByResourceGroupWithResponse("QueryResourceGroupName", "perf", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesListByResourceGroupSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesListByResourceGroupSamples.java new file mode 100644 index 0000000000000..60f09dac502b7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesListByResourceGroupSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for ScheduledQueryRules ListByResourceGroup. */ +public final class ScheduledQueryRulesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/listScheduledQueryRulesByResourceGroup.json + */ + /** + * Sample code: List scheduled query rules by resource group. + * + * @param manager Entry point to MonitorManager. + */ + public static void listScheduledQueryRulesByResourceGroup( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.scheduledQueryRules().listByResourceGroup("QueryResourceGroupName", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesListSamples.java new file mode 100644 index 0000000000000..af2fd863a0631 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesListSamples.java @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for ScheduledQueryRules List. */ +public final class ScheduledQueryRulesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/listScheduledQueryRulesBySubscription.json + */ + /** + * Sample code: List scheduled query rules by subscription. + * + * @param manager Entry point to MonitorManager. + */ + public static void listScheduledQueryRulesBySubscription( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.scheduledQueryRules().list(com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesUpdateSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesUpdateSamples.java new file mode 100644 index 0000000000000..b43512d829fb3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesUpdateSamples.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +import com.azure.resourcemanager.monitor.generated.models.ScheduledQueryRuleResource; + +/** Samples for ScheduledQueryRules Update. */ +public final class ScheduledQueryRulesUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2022-08-01-preview/examples/patchScheduledQueryRule.json + */ + /** + * Sample code: Create or update a scheduled query rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateAScheduledQueryRule( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + ScheduledQueryRuleResource resource = + manager + .scheduledQueryRules() + .getByResourceGroupWithResponse("QueryResourceGroupName", "heartbeat", com.azure.core.util.Context.NONE) + .getValue(); + resource.update().withEnabled(false).apply(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActivityLogsListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActivityLogsListSamples.java new file mode 100644 index 0000000000000..03c53dfbd5f1e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActivityLogsListSamples.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for TenantActivityLogs List. */ +public final class TenantActivityLogsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsFilteredAndSelected.json + */ + /** + * Sample code: Get Tenant Activity Logs with filter and select. + * + * @param manager Entry point to MonitorManager. + */ + public static void getTenantActivityLogsWithFilterAndSelect( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .tenantActivityLogs() + .list( + "eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and" + + " resourceGroupName eq 'MSSupportGroup'", + "eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsSelected.json + */ + /** + * Sample code: Get Tenant Activity Logs with select. + * + * @param manager Entry point to MonitorManager. + */ + public static void getTenantActivityLogsWithSelect( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .tenantActivityLogs() + .list( + null, + "eventName,id,resourceGroupName,resourceProviderName,operationName,status,eventTimestamp,correlationId,submissionTimestamp,level", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsFiltered.json + */ + /** + * Sample code: Get Tenant Activity Logs with filter. + * + * @param manager Entry point to MonitorManager. + */ + public static void getTenantActivityLogsWithFilter( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .tenantActivityLogs() + .list( + "eventTimestamp ge '2015-01-21T20:00:00Z' and eventTimestamp le '2015-01-23T20:00:00Z' and" + + " resourceGroupName eq 'MSSupportGroup'", + null, + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/GetTenantActivityLogsNoParams.json + */ + /** + * Sample code: Get Tenant Activity Logs without filter or select. + * + * @param manager Entry point to MonitorManager. + */ + public static void getTenantActivityLogsWithoutFilterOrSelect( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.tenantActivityLogs().list(null, null, com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/VMInsightsGetOnboardingStatusSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/VMInsightsGetOnboardingStatusSamples.java new file mode 100644 index 0000000000000..8c6ac6f0368a3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/VMInsightsGetOnboardingStatusSamples.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.generated; + +/** Samples for VMInsights GetOnboardingStatus. */ +public final class VMInsightsGetOnboardingStatusSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusResourceGroup.json + */ + /** + * Sample code: Get status for a resource group that has at least one VM that is actively reporting data. + * + * @param manager Entry point to MonitorManager. + */ + public static void getStatusForAResourceGroupThatHasAtLeastOneVMThatIsActivelyReportingData( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .vMInsights() + .getOnboardingStatusWithResponse( + "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/resource-group-with-vms", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSingleVMUnknown.json + */ + /** + * Sample code: Get status for a VM that has not yet reported data. + * + * @param manager Entry point to MonitorManager. + */ + public static void getStatusForAVMThatHasNotYetReportedData( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .vMInsights() + .getOnboardingStatusWithResponse( + "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSingleVM.json + */ + /** + * Sample code: Get status for a VM that is actively reporting data. + * + * @param manager Entry point to MonitorManager. + */ + public static void getStatusForAVMThatIsActivelyReportingData( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .vMInsights() + .getOnboardingStatusWithResponse( + "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/vm-resource-group/providers/Microsoft.Compute/virtualMachines/ubuntu-vm", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusVMScaleSet.json + */ + /** + * Sample code: Get status for a VM scale set that is actively reporting data. + * + * @param manager Entry point to MonitorManager. + */ + public static void getStatusForAVMScaleSetThatIsActivelyReportingData( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .vMInsights() + .getOnboardingStatusWithResponse( + "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87/resourceGroups/my-service-cluster/providers/Microsoft.Compute/virtualMachineScaleSets/scale-set-01", + com.azure.core.util.Context.NONE); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/examples/getOnboardingStatusSubscription.json + */ + /** + * Sample code: Get status for a subscription that has at least one VM that is actively reporting data. + * + * @param manager Entry point to MonitorManager. + */ + public static void getStatusForASubscriptionThatHasAtLeastOneVMThatIsActivelyReportingData( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .vMInsights() + .getOnboardingStatusWithResponse( + "subscriptions/3d51de47-8d1c-4d24-b42f-bcae075dfa87", com.azure.core.util.Context.NONE); + } +} diff --git a/sdk/monitor/ci.yml b/sdk/monitor/ci.yml index 03d57b62561aa..9a341a713d08e 100644 --- a/sdk/monitor/ci.yml +++ b/sdk/monitor/ci.yml @@ -39,22 +39,26 @@ pr: - sdk/monitor/azure-monitor-query/pom.xml parameters: -- name: release_dependsonlivetests - displayName: 'Release depends on live tests' - type: boolean - default: true -- name: release_azuremonitoringestion - displayName: 'azure-monitor-ingestion' - type: boolean - default: true -- name: release_azuremonitoropentelemetryexporter - displayName: 'azure-monitor-opentelemetry-exporter' - type: boolean - default: true -- name: release_azuremonitorquery - displayName: 'azure-monitor-query' - type: boolean - default: true + - name: release_dependsonlivetests + displayName: Release depends on live tests + type: boolean + default: true + - name: release_azuremonitoringestion + displayName: azure-monitor-ingestion + type: boolean + default: true + - name: release_azuremonitoropentelemetryexporter + displayName: azure-monitor-opentelemetry-exporter + type: boolean + default: true + - name: release_azuremonitorquery + displayName: azure-monitor-query + type: boolean + default: true + - name: release_azureresourcemanagermonitorgenerated + displayName: azure-resourcemanager-monitor-generated + type: boolean + default: false extends: template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -74,11 +78,14 @@ extends: groupId: com.azure safeName: azuremonitorquery releaseInBatch: ${{ parameters.release_azuremonitorquery }} + - name: azure-resourcemanager-monitor-generated + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermonitorgenerated + releaseInBatch: ${{ parameters.release_azureresourcemanagermonitorgenerated }} AdditionalModules: - name: azure-monitor-query-perf groupId: com.azure - name: azure-monitor-ingestion-perf groupId: com.azure - # required by the above perf library - name: perf-test-core groupId: com.azure diff --git a/sdk/monitor/pom.xml b/sdk/monitor/pom.xml index 980a179f91a42..770181ac3fc74 100644 --- a/sdk/monitor/pom.xml +++ b/sdk/monitor/pom.xml @@ -10,10 +10,11 @@ 1.0.0 - azure-monitor-ingestion - azure-monitor-ingestion-perf - azure-monitor-opentelemetry-exporter - azure-monitor-query - azure-monitor-query-perf + azure-monitor-ingestion + azure-monitor-ingestion-perf + azure-monitor-opentelemetry-exporter + azure-monitor-query + azure-monitor-query-perf + azure-resourcemanager-monitor-generated