From 1d3c028d7e27cbe853d3b74612faf36b919f612b Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 29 Mar 2022 06:25:50 +0000 Subject: [PATCH] CodeGen from PR 18156 in Azure/azure-rest-api-specs Merge bf789de8d12b152e871e1f67b601d5ff17e915c8 into 568e394c3634d052ddec89f685b4afb5ab21aaec --- eng/versioning/version_client.txt | 1 + .../CHANGELOG.md | 5 + .../README.md | 102 + .../SAMPLE.md | 4578 +++++++++++++++++ .../pom.xml | 55 + .../monitor/generated/MonitorManager.java | 575 +++ .../generated/fluent/ActionGroupsClient.java | 383 ++ .../fluent/ActivityLogAlertsClient.java | 191 + .../generated/fluent/ActivityLogsClient.java | 68 + .../fluent/AlertRuleIncidentsClient.java | 72 + .../generated/fluent/AlertRulesClient.java | 177 + .../fluent/AutoscaleSettingsClient.java | 185 + .../generated/fluent/BaselinesClient.java | 70 + .../fluent/DataCollectionEndpointsClient.java | 178 + .../DataCollectionRuleAssociationsClient.java | 185 + .../fluent/DataCollectionRulesClient.java | 175 + .../DiagnosticSettingsCategoriesClient.java | 67 + .../DiagnosticSettingsOperationsClient.java | 124 + .../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 + .../generated/fluent/MetricsClient.java | 74 + .../generated/fluent/MonitorClient.java | 235 + .../generated/fluent/OperationsClient.java | 36 + .../PrivateEndpointConnectionsClient.java | 216 + .../fluent/PrivateLinkResourcesClient.java | 76 + ...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 | 420 ++ .../fluent/models/ActionGroupPatch.java | 49 + .../models/ActionGroupResourceInner.java | 374 ++ .../models/ActivityLogAlertResourceInner.java | 180 + .../generated/fluent/models/AlertRule.java | 248 + .../models/AlertRulePatchProperties.java | 50 + .../fluent/models/AlertRuleProperties.java | 185 + .../fluent/models/AlertRuleResourceInner.java | 240 + .../fluent/models/AutoscaleSetting.java | 205 + .../models/AutoscaleSettingResourceInner.java | 211 + .../AzureMonitorPrivateLinkScopeInner.java | 85 + ...zureMonitorPrivateLinkScopeProperties.java | 59 + .../DataCollectionEndpointResourceInner.java | 112 + ...aCollectionEndpointResourceProperties.java | 62 + ...RuleAssociationProxyOnlyResourceInner.java | 70 + ...ssociationProxyOnlyResourceProperties.java | 45 + .../DataCollectionRuleResourceInner.java | 112 + .../DataCollectionRuleResourceProperties.java | 71 + .../fluent/models/DiagnosticSettings.java | 262 + .../models/DiagnosticSettingsCategory.java | 47 + ...ttingsCategoryResourceCollectionInner.java | 51 + ...agnosticSettingsCategoryResourceInner.java | 65 + ...nosticSettingsResourceCollectionInner.java | 50 + .../DiagnosticSettingsResourceInner.java | 244 + .../fluent/models/EventDataInner.java | 452 ++ .../fluent/models/IncidentInner.java | 98 + .../fluent/models/LocalizableStringInner.java | 80 + .../fluent/models/LogProfileProperties.java | 191 + .../models/LogProfileResourceInner.java | 189 + .../fluent/models/LogSearchRule.java | 295 ++ .../fluent/models/LogSearchRulePatch.java | 50 + .../models/LogSearchRuleResourceInner.java | 312 ++ .../fluent/models/MetadataValueInner.java | 75 + .../fluent/models/MetricAlertProperties.java | 392 ++ .../models/MetricAlertPropertiesPatch.java | 366 ++ .../models/MetricAlertResourceInner.java | 350 ++ .../MetricAlertStatusCollectionInner.java | 51 + .../models/MetricBaselinesProperties.java | 163 + .../fluent/models/MetricDefinitionInner.java | 378 ++ .../generated/fluent/models/MetricInner.java | 263 + .../fluent/models/MetricNamespaceInner.java | 155 + .../models/OperationListResultInner.java | 80 + .../fluent/models/OperationStatusInner.java | 181 + .../PrivateEndpointConnectionInner.java | 97 + .../PrivateEndpointConnectionProperties.java | 96 + .../models/PrivateLinkResourceInner.java | 58 + .../models/PrivateLinkResourceProperties.java | 51 + .../fluent/models/ResponseInner.java | 206 + .../fluent/models/ScopedResourceInner.java | 71 + .../models/ScopedResourceProperties.java | 61 + .../models/SingleMetricBaselineInner.java | 242 + .../TestNotificationDetailsResponseInner.java | 168 + .../models/TestNotificationResponseInner.java | 119 + .../VMInsightsOnboardingStatusInner.java | 143 + .../VMInsightsOnboardingStatusProperties.java | 166 + .../models/WorkspaceInfoProperties.java | 55 + .../generated/fluent/models/package-info.java | 6 + .../generated/fluent/package-info.java | 6 + .../ActionGroupResourceImpl.java | 386 ++ .../ActionGroupsClientImpl.java | 2113 ++++++++ .../implementation/ActionGroupsImpl.java | 282 + .../ActivityLogAlertResourceImpl.java | 236 + .../ActivityLogAlertsClientImpl.java | 1298 +++++ .../implementation/ActivityLogAlertsImpl.java | 181 + .../ActivityLogsClientImpl.java | 439 ++ .../implementation/ActivityLogsImpl.java | 45 + .../AlertRuleIncidentsClientImpl.java | 424 ++ .../AlertRuleIncidentsImpl.java | 72 + .../implementation/AlertRuleResourceImpl.java | 286 + .../implementation/AlertRulesClientImpl.java | 1059 ++++ .../implementation/AlertRulesImpl.java | 170 + .../AutoscaleSettingResourceImpl.java | 275 + .../AutoscaleSettingsClientImpl.java | 1283 +++++ .../implementation/AutoscaleSettingsImpl.java | 181 + .../AzureMonitorPrivateLinkScopeImpl.java | 201 + .../implementation/BaselinesClientImpl.java | 458 ++ .../implementation/BaselinesImpl.java | 70 + .../DataCollectionEndpointResourceImpl.java | 198 + .../DataCollectionEndpointsClientImpl.java | 1332 +++++ .../DataCollectionEndpointsImpl.java | 190 + ...nRuleAssociationProxyOnlyResourceImpl.java | 109 + ...aCollectionRuleAssociationsClientImpl.java | 1323 +++++ .../DataCollectionRuleAssociationsImpl.java | 250 + .../DataCollectionRuleResourceImpl.java | 196 + .../DataCollectionRulesClientImpl.java | 1319 +++++ .../DataCollectionRulesImpl.java | 181 + ...iagnosticSettingsCategoriesClientImpl.java | 313 ++ .../DiagnosticSettingsCategoriesImpl.java | 87 + ...ettingsCategoryResourceCollectionImpl.java | 49 + ...iagnosticSettingsCategoryResourceImpl.java | 46 + ...iagnosticSettingsOperationsClientImpl.java | 585 +++ .../DiagnosticSettingsOperationsImpl.java | 201 + ...gnosticSettingsResourceCollectionImpl.java | 48 + .../DiagnosticSettingsResourceImpl.java | 219 + .../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 | 805 +++ .../implementation/LogProfilesImpl.java | 125 + .../LogSearchRuleResourceImpl.java | 274 + .../implementation/MetadataValueImpl.java | 43 + .../MetricAlertResourceImpl.java | 353 ++ .../MetricAlertStatusCollectionImpl.java | 41 + .../MetricAlertsClientImpl.java | 1057 ++++ .../implementation/MetricAlertsImpl.java | 170 + .../MetricAlertsStatusClientImpl.java | 405 ++ .../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 + .../implementation/MetricsClientImpl.java | 425 ++ .../generated/implementation/MetricsImpl.java | 85 + .../implementation/MonitorClientBuilder.java | 146 + .../implementation/MonitorClientImpl.java | 658 +++ .../OperationListResultImpl.java | 45 + .../implementation/OperationStatusImpl.java | 54 + .../implementation/OperationsClientImpl.java | 156 + .../implementation/OperationsImpl.java | 58 + .../PrivateEndpointConnectionImpl.java | 154 + .../PrivateEndpointConnectionsClientImpl.java | 1176 +++++ .../PrivateEndpointConnectionsImpl.java | 216 + .../PrivateLinkResourceImpl.java | 56 + .../PrivateLinkResourcesClientImpl.java | 533 ++ .../PrivateLinkResourcesImpl.java | 75 + ...ateLinkScopeOperationStatusClientImpl.java | 230 + .../PrivateLinkScopeOperationStatusImpl.java | 61 + .../PrivateLinkScopedResourcesClientImpl.java | 1103 ++++ .../PrivateLinkScopedResourcesImpl.java | 203 + .../PrivateLinkScopesClientImpl.java | 1391 +++++ .../implementation/PrivateLinkScopesImpl.java | 180 + .../implementation/ResponseModelImpl.java | 65 + .../ScheduledQueryRulesClientImpl.java | 1122 ++++ .../ScheduledQueryRulesImpl.java | 180 + .../implementation/ScopedResourceImpl.java | 135 + .../SingleMetricBaselineImpl.java | 66 + .../TenantActivityLogsClientImpl.java | 428 ++ .../TenantActivityLogsImpl.java | 46 + .../TestNotificationDetailsResponseImpl.java | 58 + .../TestNotificationResponseImpl.java | 41 + .../generated/implementation/Utils.java | 204 + .../implementation/VMInsightsClientImpl.java | 181 + .../implementation/VMInsightsImpl.java | 59 + .../VMInsightsOnboardingStatusImpl.java | 67 + .../implementation/package-info.java | 6 + .../monitor/generated/models/Action.java | 40 + .../generated/models/ActionDetail.java | 176 + .../models/ActionGroupAutoGenerated.java | 87 + .../generated/models/ActionGroupList.java | 77 + .../models/ActionGroupPatchBody.java | 93 + .../generated/models/ActionGroupResource.java | 495 ++ .../generated/models/ActionGroups.java | 287 ++ .../monitor/generated/models/ActionList.java | 50 + .../models/ActivityLogAlertResource.java | 305 ++ .../generated/models/ActivityLogAlerts.java | 162 + .../generated/models/ActivityLogs.java | 63 + .../generated/models/AggregationType.java | 59 + .../generated/models/AggregationTypeEnum.java | 43 + .../models/AlertRuleAllOfCondition.java | 57 + .../models/AlertRuleAnyOfOrLeafCondition.java | 84 + .../generated/models/AlertRuleIncidents.java | 64 + .../models/AlertRuleLeafCondition.java | 119 + .../generated/models/AlertRuleList.java | 77 + .../models/AlertRulePatchObject.java | 93 + .../generated/models/AlertRuleResource.java | 418 ++ .../models/AlertRuleResourceCollection.java | 51 + .../models/AlertRuleResourcePatch.java | 244 + .../monitor/generated/models/AlertRules.java | 158 + .../generated/models/AlertSeverity.java | 43 + .../generated/models/AlertingAction.java | 150 + .../generated/models/ArmRoleReceiver.java | 114 + .../models/AutomationRunbookReceiver.java | 226 + .../models/AutoscaleNotification.java | 111 + .../generated/models/AutoscaleProfile.java | 188 + .../models/AutoscaleSettingResource.java | 387 ++ .../AutoscaleSettingResourceCollection.java | 85 + .../models/AutoscaleSettingResourcePatch.java | 215 + .../generated/models/AutoscaleSettings.java | 158 + .../generated/models/AzNsActionGroup.java | 99 + .../models/AzureAppPushReceiver.java | 89 + .../models/AzureFunctionReceiver.java | 179 + .../AzureMonitorMetricsDestination.java | 50 + .../models/AzureMonitorPrivateLinkScope.java | 210 + ...zureMonitorPrivateLinkScopeListResult.java | 89 + .../generated/models/AzureResource.java | 66 + .../models/AzureResourceAutoGenerated.java | 35 + .../generated/models/BaselineMetadata.java | 85 + .../generated/models/BaselineSensitivity.java | 37 + .../monitor/generated/models/Baselines.java | 64 + .../generated/models/CategoryType.java | 47 + .../generated/models/ColumnDefinition.java | 72 + .../models/ComparisonOperationType.java | 59 + .../generated/models/ConditionOperator.java | 53 + .../generated/models/ConditionalOperator.java | 43 + .../ConfigurationAccessEndpointSpec.java | 35 + .../monitor/generated/models/Context.java | 72 + .../monitor/generated/models/Criteria.java | 84 + .../generated/models/CriterionType.java | 34 + .../models/DataCollectionEndpoint.java | 178 + ...CollectionEndpointConfigurationAccess.java | 21 + .../DataCollectionEndpointLogsIngestion.java | 21 + .../DataCollectionEndpointNetworkAcls.java | 29 + .../DataCollectionEndpointResource.java | 225 + ...aCollectionEndpointResourceListResult.java | 85 + .../models/DataCollectionEndpoints.java | 158 + .../generated/models/DataCollectionRule.java | 255 + .../models/DataCollectionRuleAssociation.java | 134 + ...DataCollectionRuleAssociationMetadata.java | 21 + ...ctionRuleAssociationProxyOnlyResource.java | 114 + ...ssociationProxyOnlyResourceListResult.java | 88 + .../DataCollectionRuleAssociations.java | 192 + .../models/DataCollectionRuleDataSources.java | 67 + .../DataCollectionRuleDestinations.java | 37 + .../models/DataCollectionRuleMetadata.java | 21 + .../models/DataCollectionRuleResource.java | 224 + .../DataCollectionRuleResourceListResult.java | 85 + .../generated/models/DataCollectionRules.java | 158 + .../generated/models/DataContainer.java | 56 + .../monitor/generated/models/DataFlow.java | 128 + .../generated/models/DataSourcesSpec.java | 195 + .../monitor/generated/models/DataStatus.java | 34 + .../generated/models/DestinationsSpec.java | 79 + .../DestinationsSpecAzureMonitorMetrics.java | 28 + .../models/DiagnosticSettingsCategories.java | 59 + .../DiagnosticSettingsCategoryResource.java | 46 + ...ticSettingsCategoryResourceCollection.java | 27 + .../models/DiagnosticSettingsOperations.java | 136 + .../models/DiagnosticSettingsResource.java | 395 ++ .../DiagnosticSettingsResourceCollection.java | 26 + .../monitor/generated/models/Dimension.java | 116 + .../models/DynamicMetricCriteria.java | 205 + .../DynamicThresholdFailingPeriods.java | 79 + .../models/DynamicThresholdOperator.java | 37 + .../models/DynamicThresholdSensitivity.java | 37 + .../generated/models/EmailNotification.java | 107 + .../generated/models/EmailReceiver.java | 129 + .../generated/models/EnableRequest.java | 54 + .../monitor/generated/models/Enabled.java | 34 + .../generated/models/ErrorResponseCommon.java | 40 + .../generated/models/EventCategories.java | 37 + .../models/EventCategoryCollection.java | 61 + .../monitor/generated/models/EventData.java | 203 + .../generated/models/EventDataCollection.java | 84 + .../generated/models/EventHubReceiver.java | 203 + .../monitor/generated/models/EventLevel.java | 56 + .../generated/models/ExtensionDataSource.java | 171 + .../generated/models/HttpRequestInfo.java | 124 + .../generated/models/IisLogsDataSource.java | 111 + .../monitor/generated/models/Incident.java | 54 + .../generated/models/IncidentListResult.java | 51 + .../generated/models/ItsmReceiver.java | 191 + .../models/KnownColumnDefinitionType.java | 49 + ...taCollectionEndpointProvisioningState.java | 44 + ...ownDataCollectionEndpointResourceKind.java | 35 + ...ctionRuleAssociationProvisioningState.java | 44 + ...wnDataCollectionRuleProvisioningState.java | 44 + .../KnownDataCollectionRuleResourceKind.java | 35 + .../models/KnownDataFlowStreams.java | 43 + .../KnownExtensionDataSourceStreams.java | 44 + ...extSettingsRecordStartTimestampFormat.java | 64 + .../models/KnownLogFilesDataSourceFormat.java | 31 + .../KnownPerfCounterDataSourceStreams.java | 35 + .../KnownPublicNetworkAccessOptions.java | 34 + .../KnownSyslogDataSourceFacilityNames.java | 91 + .../KnownSyslogDataSourceLogLevels.java | 55 + .../models/KnownSyslogDataSourceStreams.java | 31 + ...KnownWindowsEventLogDataSourceStreams.java | 36 + .../generated/models/LocalizableString.java | 31 + .../LocationThresholdRuleCondition.java | 90 + .../models/LogAnalyticsDestination.java | 91 + .../generated/models/LogFileSettings.java | 49 + .../generated/models/LogFileSettingsText.java | 29 + .../generated/models/LogFileTextSettings.java | 56 + .../generated/models/LogFilesDataSource.java | 179 + .../models/LogFilesDataSourceSettings.java | 28 + .../generated/models/LogMetricTrigger.java | 124 + .../models/LogProfileCollection.java | 58 + .../generated/models/LogProfileResource.java | 354 ++ .../models/LogProfileResourcePatch.java | 194 + .../monitor/generated/models/LogProfiles.java | 130 + .../models/LogSearchRuleResource.java | 387 ++ .../LogSearchRuleResourceCollection.java | 51 + .../models/LogSearchRuleResourcePatch.java | 93 + .../monitor/generated/models/LogSettings.java | 105 + .../generated/models/LogToMetricAction.java | 65 + .../generated/models/LogicAppReceiver.java | 145 + .../models/LogsIngestionEndpointSpec.java | 35 + .../ManagementEventAggregationCondition.java | 103 + .../models/ManagementEventRuleCondition.java | 69 + .../monitor/generated/models/Metadata.java | 35 + .../generated/models/MetadataValue.java | 31 + .../monitor/generated/models/Metric.java | 74 + .../generated/models/MetricAlertAction.java | 78 + .../generated/models/MetricAlertCriteria.java | 78 + ...ultipleResourceMultipleMetricCriteria.java | 56 + .../generated/models/MetricAlertResource.java | 565 ++ .../models/MetricAlertResourceCollection.java | 51 + .../models/MetricAlertResourcePatch.java | 354 ++ ...tSingleResourceMultipleMetricCriteria.java | 56 + .../generated/models/MetricAlertStatus.java | 127 + .../models/MetricAlertStatusCollection.java | 25 + .../models/MetricAlertStatusProperties.java | 102 + .../generated/models/MetricAlerts.java | 158 + .../generated/models/MetricAlertsStatus.java | 64 + .../generated/models/MetricAvailability.java | 82 + .../models/MetricBaselinesResponse.java | 51 + .../monitor/generated/models/MetricClass.java | 43 + .../generated/models/MetricCriteria.java | 129 + .../generated/models/MetricDefinition.java | 110 + .../models/MetricDefinitionCollection.java | 59 + .../generated/models/MetricDefinitions.java | 35 + .../generated/models/MetricDimension.java | 117 + .../generated/models/MetricNamespace.java | 52 + .../models/MetricNamespaceCollection.java | 58 + .../generated/models/MetricNamespaceName.java | 46 + .../generated/models/MetricNamespaces.java | 35 + .../generated/models/MetricSettings.java | 134 + .../models/MetricSingleDimension.java | 85 + .../generated/models/MetricStatisticType.java | 56 + .../generated/models/MetricTrigger.java | 395 ++ .../generated/models/MetricTriggerType.java | 34 + .../monitor/generated/models/MetricUnit.java | 67 + .../monitor/generated/models/MetricValue.java | 188 + .../monitor/generated/models/Metrics.java | 68 + .../generated/models/MultiMetricCriteria.java | 254 + .../models/NamespaceClassification.java | 37 + .../generated/models/NetworkRuleSet.java | 49 + .../models/NotificationRequestBody.java | 382 ++ .../monitor/generated/models/Odatatype.java | 40 + .../generated/models/OnboardingStatus.java | 37 + .../monitor/generated/models/Operation.java | 75 + .../generated/models/OperationDisplay.java | 99 + .../generated/models/OperationListResult.java | 32 + .../generated/models/OperationStatus.java | 60 + .../monitor/generated/models/Operations.java | 31 + .../monitor/generated/models/Operator.java | 46 + .../models/PerfCounterDataSource.java | 147 + .../models/PrivateEndpointConnection.java | 190 + .../PrivateEndpointConnectionListResult.java | 55 + .../models/PrivateEndpointConnections.java | 145 + .../models/PrivateEndpointProperty.java | 46 + .../generated/models/PrivateLinkResource.java | 53 + .../models/PrivateLinkResourceListResult.java | 55 + .../models/PrivateLinkResources.java | 69 + .../PrivateLinkScopeOperationStatus.java | 38 + .../models/PrivateLinkScopedResources.java | 143 + .../generated/models/PrivateLinkScopes.java | 160 + .../models/PrivateLinkScopesResource.java | 35 + ...ateLinkServiceConnectionStateProperty.java | 102 + .../generated/models/ProvisioningState.java | 40 + .../generated/models/ProxyOnlyResource.java | 20 + .../monitor/generated/models/QueryType.java | 31 + .../generated/models/ReceiverStatus.java | 50 + .../monitor/generated/models/Recurrence.java | 95 + .../generated/models/RecurrenceFrequency.java | 65 + .../generated/models/RecurrentSchedule.java | 240 + .../generated/models/ResourceForUpdate.java | 49 + .../generated/models/ResponseModel.java | 65 + .../monitor/generated/models/ResultType.java | 47 + .../generated/models/RetentionPolicy.java | 75 + .../monitor/generated/models/RuleAction.java | 36 + .../generated/models/RuleCondition.java | 72 + .../generated/models/RuleDataSource.java | 147 + .../generated/models/RuleEmailAction.java | 88 + .../RuleManagementEventClaimsDataSource.java | 46 + .../models/RuleManagementEventDataSource.java | 299 ++ .../models/RuleMetricDataSource.java | 80 + .../generated/models/RuleWebhookAction.java | 88 + .../monitor/generated/models/ScaleAction.java | 153 + .../generated/models/ScaleCapacity.java | 124 + .../generated/models/ScaleDirection.java | 50 + .../monitor/generated/models/ScaleRule.java | 89 + .../models/ScaleRuleMetricDimension.java | 123 + ...ScaleRuleMetricDimensionOperationType.java | 35 + .../monitor/generated/models/ScaleType.java | 53 + .../monitor/generated/models/Schedule.java | 75 + .../generated/models/ScheduledQueryRules.java | 162 + .../generated/models/ScopedResource.java | 156 + .../models/ScopedResourceListResult.java | 55 + .../generated/models/SenderAuthorization.java | 102 + .../generated/models/SingleBaseline.java | 117 + .../models/SingleMetricBaseline.java | 72 + .../monitor/generated/models/SmsReceiver.java | 134 + .../monitor/generated/models/Source.java | 133 + .../generated/models/StreamDeclaration.java | 50 + .../generated/models/SyslogDataSource.java | 135 + .../generated/models/TagsResource.java | 52 + .../generated/models/TenantActivityLogs.java | 63 + .../TestNotificationDetailsResponse.java | 54 + .../models/TestNotificationResponse.java | 38 + .../models/ThresholdRuleCondition.java | 154 + .../models/TimeAggregationOperator.java | 56 + .../generated/models/TimeAggregationType.java | 59 + .../generated/models/TimeSeriesBaseline.java | 178 + .../generated/models/TimeSeriesElement.java | 83 + .../monitor/generated/models/TimeWindow.java | 197 + .../generated/models/TriggerCondition.java | 110 + .../monitor/generated/models/VMInsights.java | 36 + .../models/VMInsightsOnboardingStatus.java | 71 + .../generated/models/VoiceReceiver.java | 119 + .../generated/models/WebhookNotification.java | 75 + .../generated/models/WebhookReceiver.java | 218 + .../WebtestLocationAvailabilityCriteria.java | 119 + .../models/WindowsEventLogDataSource.java | 110 + .../generated/models/WorkspaceInfo.java | 131 + .../generated/models/package-info.java | 6 + .../monitor/generated/package-info.java | 6 + .../src/main/java/module-info.java | 19 + ...ificationsAtResourceGroupLevelSamples.java | 156 + .../ActionGroupsCreateOrUpdateSamples.java | 164 + .../generated/ActionGroupsDeleteSamples.java | 22 + .../ActionGroupsEnableReceiverSamples.java | 29 + ...ActionGroupsGetByResourceGroupSamples.java | 24 + ...ificationsAtResourceGroupLevelSamples.java | 26 + ...tionGroupsGetTestNotificationsSamples.java | 23 + ...ctionGroupsListByResourceGroupSamples.java | 23 + .../generated/ActionGroupsListSamples.java | 23 + ...ionGroupsPostTestNotificationsSamples.java | 155 + .../generated/ActionGroupsUpdateSamples.java | 41 + ...ctivityLogAlertsCreateOrUpdateSamples.java | 153 + .../ActivityLogAlertsDeleteSamples.java | 23 + ...ityLogAlertsGetByResourceGroupSamples.java | 24 + ...tyLogAlertsListByResourceGroupSamples.java | 22 + .../ActivityLogAlertsListSamples.java | 23 + .../ActivityLogAlertsUpdateSamples.java | 41 + .../generated/ActivityLogsListSamples.java | 47 + .../AlertRuleIncidentsGetSamples.java | 22 + ...rtRuleIncidentsListByAlertRuleSamples.java | 22 + .../AlertRulesCreateOrUpdateSamples.java | 61 + .../generated/AlertRulesDeleteSamples.java | 22 + .../AlertRulesGetByResourceGroupSamples.java | 22 + .../AlertRulesListByResourceGroupSamples.java | 22 + .../generated/AlertRulesListSamples.java | 22 + .../generated/AlertRulesUpdateSamples.java | 65 + ...utoscaleSettingsCreateOrUpdateSamples.java | 186 + .../AutoscaleSettingsDeleteSamples.java | 22 + ...caleSettingsGetByResourceGroupSamples.java | 22 + ...aleSettingsListByResourceGroupSamples.java | 22 + .../AutoscaleSettingsListSamples.java | 22 + .../AutoscaleSettingsUpdateSamples.java | 189 + .../generated/BaselinesListSamples.java | 35 + .../DataCollectionEndpointsCreateSamples.java | 26 + .../DataCollectionEndpointsDeleteSamples.java | 23 + ...ionEndpointsGetByResourceGroupSamples.java | 24 + ...onEndpointsListByResourceGroupSamples.java | 23 + .../DataCollectionEndpointsListSamples.java | 23 + .../DataCollectionEndpointsUpdateSamples.java | 42 + ...llectionRuleAssociationsCreateSamples.java | 25 + ...llectionRuleAssociationsDeleteSamples.java | 27 + ...aCollectionRuleAssociationsGetSamples.java | 27 + ...nsListByDataCollectionEndpointSamples.java | 25 + ...RuleAssociationsListByResourceSamples.java | 27 + ...tionRuleAssociationsListByRuleSamples.java | 23 + .../DataCollectionRulesCreateSamples.java | 26 + .../DataCollectionRulesDeleteSamples.java | 22 + ...lectionRulesGetByResourceGroupSamples.java | 24 + ...ectionRulesListByResourceGroupSamples.java | 23 + .../DataCollectionRulesListSamples.java | 23 + .../DataCollectionRulesUpdateSamples.java | 41 + .../DiagnosticSettingsCategoryGetSamples.java | 27 + ...DiagnosticSettingsCategoryListSamples.java | 26 + ...ettingsOperationCreateOrUpdateSamples.java | 52 + ...gnosticSettingsOperationDeleteSamples.java | 27 + ...DiagnosticSettingsOperationGetSamples.java | 27 + ...iagnosticSettingsOperationListSamples.java | 26 + .../generated/EventCategoriesListSamples.java | 22 + .../LogProfilesCreateOrUpdateSamples.java | 47 + .../generated/LogProfilesDeleteSamples.java | 22 + .../generated/LogProfilesGetSamples.java | 22 + .../generated/LogProfilesListSamples.java | 22 + .../generated/LogProfilesUpdateSamples.java | 48 + .../MetricAlertsCreateOrUpdateSamples.java | 448 ++ .../generated/MetricAlertsDeleteSamples.java | 22 + ...MetricAlertsGetByResourceGroupSamples.java | 108 + ...etricAlertsListByResourceGroupSamples.java | 22 + .../generated/MetricAlertsListSamples.java | 22 + .../MetricAlertsStatusListByNameSamples.java | 28 + .../MetricAlertsStatusListSamples.java | 22 + .../generated/MetricAlertsUpdateSamples.java | 77 + .../MetricDefinitionsListSamples.java | 64 + .../MetricNamespacesListSamples.java | 28 + .../generated/MetricsListSamples.java | 86 + .../generated/OperationsListSamples.java | 23 + ...pointConnectionsCreateOrUpdateSamples.java | 31 + ...ivateEndpointConnectionsDeleteSamples.java | 25 + .../PrivateEndpointConnectionsGetSamples.java | 25 + ...nectionsListByPrivateLinkScopeSamples.java | 25 + .../PrivateLinkResourcesGetSamples.java | 25 + ...esourcesListByPrivateLinkScopeSamples.java | 23 + ...rationStatusGetByResourceGroupSamples.java | 24 + ...kScopedResourcesCreateOrUpdateSamples.java | 33 + ...ivateLinkScopedResourcesDeleteSamples.java | 25 + .../PrivateLinkScopedResourcesGetSamples.java | 25 + ...esourcesListByPrivateLinkScopeSamples.java | 25 + ...rivateLinkScopesCreateOrUpdateSamples.java | 57 + .../PrivateLinkScopesDeleteSamples.java | 22 + ...teLinkScopesGetByResourceGroupSamples.java | 24 + ...eLinkScopesListByResourceGroupSamples.java | 23 + .../PrivateLinkScopesListSamples.java | 22 + .../PrivateLinkScopesUpdateTagsSamples.java | 42 + ...eduledQueryRulesCreateOrUpdateSamples.java | 160 + .../ScheduledQueryRulesDeleteSamples.java | 22 + ...edQueryRulesGetByResourceGroupSamples.java | 22 + ...dQueryRulesListByResourceGroupSamples.java | 22 + .../ScheduledQueryRulesListSamples.java | 22 + .../ScheduledQueryRulesUpdateSamples.java | 29 + .../TenantActivityLogsListSamples.java | 79 + .../VMInsightsGetOnboardingStatusSamples.java | 93 + sdk/monitor/ci.yml | 3 + sdk/monitor/pom.xml | 1 + 551 files changed, 80040 insertions(+) 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/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/MetricsClient.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/OperationsClient.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/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/DiagnosticSettingsCategoryResourceCollectionInner.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/DiagnosticSettingsResourceCollectionInner.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/LogSearchRule.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogSearchRulePatch.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogSearchRuleResourceInner.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/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/PrivateEndpointConnectionInner.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/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/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/TestNotificationResponseInner.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/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/DiagnosticSettingsCategoryResourceCollectionImpl.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/DiagnosticSettingsResourceCollectionImpl.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/LogSearchRuleResourceImpl.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/MetricsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricsImpl.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/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/PrivateEndpointConnectionImpl.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/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/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/TestNotificationResponseImpl.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/Action.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/ActionGroupAutoGenerated.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/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/AlertRuleAllOfCondition.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleAnyOfOrLeafCondition.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/AlertingAction.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/AzNsActionGroup.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/AzureResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureResourceAutoGenerated.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/ConditionOperator.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ConditionalOperator.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/Criteria.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/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/Enabled.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ErrorResponseCommon.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/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/ItsmReceiver.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/LogMetricTrigger.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/LogSearchRuleResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogSearchRuleResourceCollection.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogSearchRuleResourcePatch.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/LogToMetricAction.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/MetricTriggerType.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/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/OperationDisplay.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/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/PerfCounterDataSource.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/PrivateEndpointConnections.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointProperty.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/PrivateLinkScopesResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkServiceConnectionStateProperty.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/ProxyOnlyResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/QueryType.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/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/Schedule.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/Source.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/TestNotificationResponse.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/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/TriggerCondition.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/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/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/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/MetricsListSamples.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/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 acaa38a22cb11..773a70269e425 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -340,6 +340,7 @@ com.azure.resourcemanager:azure-resourcemanager-securityinsights;1.0.0-beta.2;1. com.azure.resourcemanager:azure-resourcemanager-oep;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-dnsresolver;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-mobilenetwork;1.0.0-beta.2;1.0.0-beta.3 +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.0.0 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..883aa3ea3203d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2022-03-29) + +- Azure Resource Manager Monitor client library for Java. This package contains Microsoft Azure SDK for Monitor Management SDK. Monitor Management Client. Package tag package-2022-04. 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..a7c61dd1f0a87 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/README.md @@ -0,0 +1,102 @@ +# 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-2022-04. 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] package and [Azure Core Netty HTTP][azure_core_http_netty] package provide the default implementation. + +### Authentication + +By default, Azure Active Directory token authentication depends on correct configure of 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 environment variable `AZURE_SUBSCRIPTION_ID`. + +With above configuration, `azure` client can be authenticated by 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](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). + +1. Fork it +1. Create your feature branch (`git checkout -b my-new-feature`) +1. Commit your changes (`git commit -am 'Add some feature'`) +1. Push to the branch (`git push origin my-new-feature`) +1. Create new Pull Request + + +[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 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..559c58533ee85 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/SAMPLE.md @@ -0,0 +1,4578 @@ +# Code snippets and samples + + +## ActionGroups + +- [CreateNotificationsAtResourceGroupLevel](#actiongroups_createnotificationsatresourcegrouplevel) +- [CreateOrUpdate](#actiongroups_createorupdate) +- [Delete](#actiongroups_delete) +- [EnableReceiver](#actiongroups_enablereceiver) +- [GetByResourceGroup](#actiongroups_getbyresourcegroup) +- [GetTestNotifications](#actiongroups_gettestnotifications) +- [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) + +## 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) + +## Metrics + +- [List](#metrics_list) + +## Operations + +- [List](#operations_list) + +## 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_CreateNotificationsAtResourceGroupLevel + +```java +import com.azure.core.util.Context; +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-04-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("1") + .withPhoneNumber("1234567890"), + new SmsReceiver() + .withName("Jane Smith's mobile") + .withCountryCode("1") + .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("1") + .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"))), + 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-04-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("1") + .withPhoneNumber("1234567890"), + new SmsReceiver() + .withName("Jane Smith's mobile") + .withCountryCode("1") + .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("1") + .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 +import com.azure.core.util.Context; + +/** Samples for ActionGroups Delete. */ +public final class ActionGroupsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-04-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().deleteWithResponse("Default-NotificationRules", "SampleActionGroup", Context.NONE); + } +} +``` + +### ActionGroups_EnableReceiver + +```java +import com.azure.core.util.Context; +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-04-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"), + Context.NONE); + } +} +``` + +### ActionGroups_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for ActionGroups GetByResourceGroup. */ +public final class ActionGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-04-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", Context.NONE); + } +} +``` + +### ActionGroups_GetTestNotifications + +```java +import com.azure.core.util.Context; + +/** Samples for ActionGroups GetTestNotifications. */ +public final class ActionGroupsGetTestNotificationsSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-04-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", Context.NONE); + } +} +``` + +### ActionGroups_GetTestNotificationsAtResourceGroupLevel + +```java +import com.azure.core.util.Context; + +/** Samples for ActionGroups GetTestNotificationsAtResourceGroupLevel. */ +public final class ActionGroupsGetTestNotificationsAtResourceGroupLevelSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-04-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", Context.NONE); + } +} +``` + +### ActionGroups_List + +```java +import com.azure.core.util.Context; + +/** Samples for ActionGroups List. */ +public final class ActionGroupsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-04-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(Context.NONE); + } +} +``` + +### ActionGroups_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for ActionGroups ListByResourceGroup. */ +public final class ActionGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-04-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", Context.NONE); + } +} +``` + +### ActionGroups_PostTestNotifications + +```java +import com.azure.core.util.Context; +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-04-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("1") + .withPhoneNumber("1234567890"), + new SmsReceiver() + .withName("Jane Smith's mobile") + .withCountryCode("1") + .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("1") + .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"))), + Context.NONE); + } +} +``` + +### ActionGroups_Update + +```java +import com.azure.core.util.Context; +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-04-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", 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.ActionGroupAutoGenerated; +import com.azure.resourcemanager.monitor.generated.models.ActionList; +import com.azure.resourcemanager.monitor.generated.models.AlertRuleAllOfCondition; +import com.azure.resourcemanager.monitor.generated.models.AlertRuleAnyOfOrLeafCondition; +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 AlertRuleAllOfCondition() + .withAllOf( + Arrays + .asList( + new AlertRuleAnyOfOrLeafCondition().withField("category").withEquals("ServiceHealth"), + new AlertRuleAnyOfOrLeafCondition() + .withField("properties.impactedServices[*].ImpactedRegions[*].RegionName") + .withContainsAny(Arrays.asList("North Europe", "West Europe"))))) + .withActions( + new ActionList() + .withActionGroups( + Arrays + .asList( + new ActionGroupAutoGenerated() + .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 AlertRuleAllOfCondition() + .withAllOf( + Arrays + .asList( + new AlertRuleAnyOfOrLeafCondition().withField("category").withEquals("ServiceHealth"), + new AlertRuleAnyOfOrLeafCondition() + .withAnyOf( + Arrays + .asList( + new AlertRuleLeafCondition() + .withField("properties.incidentType") + .withEquals("Incident"), + new AlertRuleLeafCondition() + .withField("properties.incidentType") + .withEquals("Maintenance")))))) + .withActions( + new ActionList() + .withActionGroups( + Arrays + .asList( + new ActionGroupAutoGenerated() + .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 AlertRuleAllOfCondition() + .withAllOf( + Arrays + .asList( + new AlertRuleAnyOfOrLeafCondition().withField("category").withEquals("Administrative"), + new AlertRuleAnyOfOrLeafCondition().withField("level").withEquals("Error")))) + .withActions( + new ActionList() + .withActionGroups( + Arrays + .asList( + new ActionGroupAutoGenerated() + .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 +import com.azure.core.util.Context; + +/** 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().deleteWithResponse("MyResourceGroup", "SampleActivityLogAlertRule", Context.NONE); + } +} +``` + +### ActivityLogAlerts_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### ActivityLogAlerts_List + +```java +import com.azure.core.util.Context; + +/** 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(Context.NONE); + } +} +``` + +### ActivityLogAlerts_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### ActivityLogAlerts_Update + +```java +import com.azure.core.util.Context; +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", 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 +import com.azure.core.util.Context; + +/** 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", + 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, + Context.NONE); + } +} +``` + +### AlertRuleIncidents_Get + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### AlertRuleIncidents_ListByAlertRule + +```java +import com.azure.core.util.Context; + +/** 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", 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 +import com.azure.core.util.Context; + +/** 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().deleteWithResponse("Rac46PostSwapRG", "chiricutin", Context.NONE); + } +} +``` + +### AlertRules_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### AlertRules_List + +```java +import com.azure.core.util.Context; + +/** 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(Context.NONE); + } +} +``` + +### AlertRules_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### AlertRules_Update + +```java +import com.azure.core.util.Context; +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", 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.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/2015-04-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()) + .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) + .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 +import com.azure.core.util.Context; + +/** Samples for AutoscaleSettings Delete. */ +public final class AutoscaleSettingsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-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().deleteWithResponse("TestingMetricsScaleSet", "MySetting", Context.NONE); + } +} +``` + +### AutoscaleSettings_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for AutoscaleSettings GetByResourceGroup. */ +public final class AutoscaleSettingsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-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", Context.NONE); + } +} +``` + +### AutoscaleSettings_List + +```java +import com.azure.core.util.Context; + +/** Samples for AutoscaleSettings List. */ +public final class AutoscaleSettingsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/listAutoscaleSettingBySubscription.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().list(Context.NONE); + } +} +``` + +### AutoscaleSettings_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for AutoscaleSettings ListByResourceGroup. */ +public final class AutoscaleSettingsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-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", Context.NONE); + } +} +``` + +### AutoscaleSettings_Update + +```java +import com.azure.core.util.Context; +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.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/2015-04-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", Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("$type", "Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary")) + .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) + .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; + } +} +``` + +### Baselines_List + +```java +import com.azure.core.util.Context; +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, + Context.NONE); + } +} +``` + +### DataCollectionEndpoints_Create + +```java +/** 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") + .create(); + } +} +``` + +### DataCollectionEndpoints_Delete + +```java +import com.azure.core.util.Context; + +/** 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().deleteWithResponse("myResourceGroup", "myCollectionEndpoint", Context.NONE); + } +} +``` + +### DataCollectionEndpoints_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### DataCollectionEndpoints_List + +```java +import com.azure.core.util.Context; + +/** 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(Context.NONE); + } +} +``` + +### DataCollectionEndpoints_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### DataCollectionEndpoints_Update + +```java +import com.azure.core.util.Context; +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", 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") + .create(); + } +} +``` + +### DataCollectionRuleAssociations_Delete + +```java +import com.azure.core.util.Context; + +/** 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() + .deleteWithResponse( + "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", + "myAssociation", + Context.NONE); + } +} +``` + +### DataCollectionRuleAssociations_Get + +```java +import com.azure.core.util.Context; + +/** 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", + Context.NONE); + } +} +``` + +### DataCollectionRuleAssociations_ListByDataCollectionEndpoint + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### DataCollectionRuleAssociations_ListByResource + +```java +import com.azure.core.util.Context; + +/** 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", + Context.NONE); + } +} +``` + +### DataCollectionRuleAssociations_ListByRule + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### DataCollectionRules_Create + +```java +/** 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") + .create(); + } +} +``` + +### DataCollectionRules_Delete + +```java +import com.azure.core.util.Context; + +/** 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().deleteWithResponse("myResourceGroup", "myCollectionRule", Context.NONE); + } +} +``` + +### DataCollectionRules_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### DataCollectionRules_List + +```java +import com.azure.core.util.Context; + +/** 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(Context.NONE); + } +} +``` + +### DataCollectionRules_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### DataCollectionRules_Update + +```java +import com.azure.core.util.Context; +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", 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 +import com.azure.core.util.Context; + +/** Samples for DiagnosticSettingsCategory Get. */ +public final class DiagnosticSettingsCategoryGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-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", + Context.NONE); + } +} +``` + +### DiagnosticSettingsCategory_List + +```java +import com.azure.core.util.Context; + +/** Samples for DiagnosticSettingsCategory List. */ +public final class DiagnosticSettingsCategoryListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-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() + .listWithResponse( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + 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/2017-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/eventhubs/myeventhub/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("") + .withLogAnalyticsDestinationType("Dedicated") + .create(); + } +} +``` + +### DiagnosticSettingsOperation_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for DiagnosticSettingsOperation Delete. */ +public final class DiagnosticSettingsOperationDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-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() + .deleteWithResponse( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + "mysetting", + Context.NONE); + } +} +``` + +### DiagnosticSettingsOperation_Get + +```java +import com.azure.core.util.Context; + +/** Samples for DiagnosticSettingsOperation Get. */ +public final class DiagnosticSettingsOperationGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-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", + Context.NONE); + } +} +``` + +### DiagnosticSettingsOperation_List + +```java +import com.azure.core.util.Context; + +/** Samples for DiagnosticSettingsOperation List. */ +public final class DiagnosticSettingsOperationListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-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() + .listWithResponse( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + Context.NONE); + } +} +``` + +### EventCategories_List + +```java +import com.azure.core.util.Context; + +/** 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(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 +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### LogProfiles_Get + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### LogProfiles_List + +```java +import com.azure.core.util.Context; + +/** 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(Context.NONE); + } +} +``` + +### LogProfiles_Update + +```java +import com.azure.core.util.Context; +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", 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 +import com.azure.core.util.Context; + +/** 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().deleteWithResponse("gigtest", "chiricutin", Context.NONE); + } +} +``` + +### MetricAlerts_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** 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", 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", 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", 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", 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", 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", 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", Context.NONE); + } +} +``` + +### MetricAlerts_List + +```java +import com.azure.core.util.Context; + +/** 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(Context.NONE); + } +} +``` + +### MetricAlerts_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### MetricAlerts_Update + +```java +import com.azure.core.util.Context; +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", 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 +import com.azure.core.util.Context; + +/** 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", Context.NONE); + } +} +``` + +### MetricAlertsStatus_ListByName + +```java +import com.azure.core.util.Context; + +/** 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", + Context.NONE); + } +} +``` + +### MetricDefinitions_List + +```java +import com.azure.core.util.Context; + +/** 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", + 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", + 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", + Context.NONE); + } +} +``` + +### MetricNamespaces_List + +```java +import com.azure.core.util.Context; + +/** 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", + Context.NONE); + } +} +``` + +### Metrics_List + +```java +import com.azure.core.util.Context; +import java.time.Duration; + +/** Samples for Metrics List. */ +public final class MetricsListSamples { + /* + * 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 + .metrics() + .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", + 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 + .metrics() + .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", + 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 + .metrics() + .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", + Context.NONE); + } +} +``` + +### Operations_List + +```java +import com.azure.core.util.Context; + +/** 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(Context.NONE); + } +} +``` + +### PrivateEndpointConnections_CreateOrUpdate + +```java +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkServiceConnectionStateProperty; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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 PrivateLinkServiceConnectionStateProperty() + .withStatus("Approved") + .withDescription("Approved by johndoe@contoso.com")) + .create(); + } +} +``` + +### PrivateEndpointConnections_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", Context.NONE); + } +} +``` + +### PrivateEndpointConnections_Get + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", Context.NONE); + } +} +``` + +### PrivateEndpointConnections_ListByPrivateLinkScope + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections ListByPrivateLinkScope. */ +public final class PrivateEndpointConnectionsListByPrivateLinkScopeSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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() + .listByPrivateLinkScope("MyResourceGroup", "MyPrivateLinkScope", Context.NONE); + } +} +``` + +### PrivateLinkResources_Get + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", Context.NONE); + } +} +``` + +### PrivateLinkResources_ListByPrivateLinkScope + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListByPrivateLinkScope. */ +public final class PrivateLinkResourcesListByPrivateLinkScopeSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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().listByPrivateLinkScope("MyResourceGroup", "MyPrivateLinkScope", Context.NONE); + } +} +``` + +### PrivateLinkScopeOperationStatus_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopeOperationStatus GetByResourceGroup. */ +public final class PrivateLinkScopeOperationStatusGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", Context.NONE); + } +} +``` + +### PrivateLinkScopedResources_CreateOrUpdate + +```java +import com.azure.core.util.Context; +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/2019-10-17-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", Context.NONE) + .getValue(); + resource + .update() + .withLinkedResourceId( + "/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/MyResourceGroup/providers/Microsoft.Insights/components/my-component") + .apply(); + } +} +``` + +### PrivateLinkScopedResources_Delete + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopedResources Delete. */ +public final class PrivateLinkScopedResourcesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", Context.NONE); + } +} +``` + +### PrivateLinkScopedResources_Get + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopedResources Get. */ +public final class PrivateLinkScopedResourcesGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", Context.NONE); + } +} +``` + +### PrivateLinkScopedResources_ListByPrivateLinkScope + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopedResources ListByPrivateLinkScope. */ +public final class PrivateLinkScopedResourcesListByPrivateLinkScopeSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", Context.NONE); + } +} +``` + +### PrivateLinkScopes_CreateOrUpdate + +```java +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/2019-10-17-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") + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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") + .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 +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes Delete. */ +public final class PrivateLinkScopesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", Context.NONE); + } +} +``` + +### PrivateLinkScopes_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes GetByResourceGroup. */ +public final class PrivateLinkScopesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", Context.NONE); + } +} +``` + +### PrivateLinkScopes_List + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes List. */ +public final class PrivateLinkScopesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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(Context.NONE); + } +} +``` + +### PrivateLinkScopes_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes ListByResourceGroup. */ +public final class PrivateLinkScopesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", Context.NONE); + } +} +``` + +### PrivateLinkScopes_UpdateTags + +```java +import com.azure.core.util.Context; +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/2019-10-17-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", 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.AlertSeverity; +import com.azure.resourcemanager.monitor.generated.models.AlertingAction; +import com.azure.resourcemanager.monitor.generated.models.AzNsActionGroup; +import com.azure.resourcemanager.monitor.generated.models.ConditionalOperator; +import com.azure.resourcemanager.monitor.generated.models.Criteria; +import com.azure.resourcemanager.monitor.generated.models.Enabled; +import com.azure.resourcemanager.monitor.generated.models.LogMetricTrigger; +import com.azure.resourcemanager.monitor.generated.models.LogToMetricAction; +import com.azure.resourcemanager.monitor.generated.models.MetricTriggerType; +import com.azure.resourcemanager.monitor.generated.models.QueryType; +import com.azure.resourcemanager.monitor.generated.models.Schedule; +import com.azure.resourcemanager.monitor.generated.models.Source; +import com.azure.resourcemanager.monitor.generated.models.TriggerCondition; +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/stable/2018-04-16/examples/createOrUpdateScheduledQueryRule-LogToMetricAction.json + */ + /** + * Sample code: Create or Update rule - LogToMetricAction. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateRuleLogToMetricAction( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .scheduledQueryRules() + .define("logtometricfoo") + .withRegion("West Europe") + .withExistingResourceGroup("alertsweu") + .withSource( + new Source() + .withDataSourceId( + "/subscriptions/af52d502-a447-4bc6-8cb7-4780fbb00490/resourceGroups/alertsweu/providers/Microsoft.OperationalInsights/workspaces/alertsweu")) + .withAction( + new LogToMetricAction() + .withCriteria( + Arrays + .asList( + new Criteria().withMetricName("Average_% Idle Time").withDimensions(Arrays.asList())))) + .withTags(mapOf()) + .withDescription("log to metric description") + .withEnabled(Enabled.TRUE) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/createOrUpdateScheduledQueryRuleswithCrossResource.json + */ + /** + * Sample code: Create or Update rule - AlertingAction with Cross-Resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateRuleAlertingActionWithCrossResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .scheduledQueryRules() + .define("SampleCrossResourceAlert") + .withRegion("eastus") + .withExistingResourceGroup("Rac46PostSwapRG") + .withSource( + new Source() + .withQuery("union requests, workspace(\"sampleWorkspace\").Update") + .withAuthorizedResources( + Arrays + .asList( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.OperationalInsights/workspaces/sampleWorkspace", + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI")) + .withDataSourceId( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI") + .withQueryType(QueryType.RESULT_COUNT)) + .withAction( + new AlertingAction() + .withSeverity(AlertSeverity.THREE) + .withAznsAction( + new AzNsActionGroup() + .withActionGroup( + Arrays + .asList( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/actiongroups/test-ag")) + .withEmailSubject("Cross Resource Mail!!")) + .withTrigger( + new TriggerCondition() + .withThresholdOperator(ConditionalOperator.GREATER_THAN) + .withThreshold(5000.0))) + .withTags(mapOf()) + .withDescription("Sample Cross Resource alert") + .withEnabled(Enabled.TRUE) + .withSchedule(new Schedule().withFrequencyInMinutes(60).withTimeWindowInMinutes(60)) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/createOrUpdateScheduledQueryRules.json + */ + /** + * Sample code: Create or Update rule - AlertingAction. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateRuleAlertingAction( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .scheduledQueryRules() + .define("logalertfoo") + .withRegion("eastus") + .withExistingResourceGroup("Rac46PostSwapRG") + .withSource( + new Source() + .withQuery("Heartbeat | summarize AggregatedValue = count() by bin(TimeGenerated, 5m)") + .withDataSourceId( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.OperationalInsights/workspaces/sampleWorkspace") + .withQueryType(QueryType.RESULT_COUNT)) + .withAction( + new AlertingAction() + .withSeverity(AlertSeverity.ONE) + .withAznsAction( + new AzNsActionGroup() + .withActionGroup(Arrays.asList()) + .withEmailSubject("Email Header") + .withCustomWebhookPayload("{}")) + .withTrigger( + new TriggerCondition() + .withThresholdOperator(ConditionalOperator.GREATER_THAN) + .withThreshold(3.0) + .withMetricTrigger( + new LogMetricTrigger() + .withThresholdOperator(ConditionalOperator.GREATER_THAN) + .withThreshold(5.0) + .withMetricTriggerType(MetricTriggerType.CONSECUTIVE) + .withMetricColumn("Computer")))) + .withTags(mapOf()) + .withDescription("log alert description") + .withEnabled(Enabled.TRUE) + .withSchedule(new Schedule().withFrequencyInMinutes(15).withTimeWindowInMinutes(15)) + .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 +import com.azure.core.util.Context; + +/** Samples for ScheduledQueryRules Delete. */ +public final class ScheduledQueryRulesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/deleteScheduledQueryRules.json + */ + /** + * Sample code: Delete rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.scheduledQueryRules().deleteWithResponse("Rac46PostSwapRG", "logalertfoo", Context.NONE); + } +} +``` + +### ScheduledQueryRules_GetByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for ScheduledQueryRules GetByResourceGroup. */ +public final class ScheduledQueryRulesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/getScheduledQueryRules.json + */ + /** + * Sample code: Get rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void getRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.scheduledQueryRules().getByResourceGroupWithResponse("Rac46PostSwapRG", "logalertfoo", Context.NONE); + } +} +``` + +### ScheduledQueryRules_List + +```java +import com.azure.core.util.Context; + +/** Samples for ScheduledQueryRules List. */ +public final class ScheduledQueryRulesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/listScheduledQueryRules.json + */ + /** + * Sample code: List rules. + * + * @param manager Entry point to MonitorManager. + */ + public static void listRules(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.scheduledQueryRules().list(null, Context.NONE); + } +} +``` + +### ScheduledQueryRules_ListByResourceGroup + +```java +import com.azure.core.util.Context; + +/** Samples for ScheduledQueryRules ListByResourceGroup. */ +public final class ScheduledQueryRulesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/listScheduledQueryRules.json + */ + /** + * Sample code: List rules. + * + * @param manager Entry point to MonitorManager. + */ + public static void listRules(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.scheduledQueryRules().listByResourceGroup("gigtest", null, Context.NONE); + } +} +``` + +### ScheduledQueryRules_Update + +```java +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.models.Enabled; +import com.azure.resourcemanager.monitor.generated.models.LogSearchRuleResource; + +/** Samples for ScheduledQueryRules Update. */ +public final class ScheduledQueryRulesUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/patchScheduledQueryRules.json + */ + /** + * Sample code: Patch Log Search Rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void patchLogSearchRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + LogSearchRuleResource resource = + manager + .scheduledQueryRules() + .getByResourceGroupWithResponse("my-resource-group", "logalertfoo", Context.NONE) + .getValue(); + resource.update().withEnabled(Enabled.TRUE).apply(); + } +} +``` + +### TenantActivityLogs_List + +```java +import com.azure.core.util.Context; + +/** 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", + 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", + 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, + 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, Context.NONE); + } +} +``` + +### VMInsights_GetOnboardingStatus + +```java +import com.azure.core.util.Context; + +/** 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", + 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", + 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", + 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", + 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", 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..1c7be692618ff --- /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-2022-04. + 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.26.0 + + + com.azure + azure-core-management + 1.5.3 + + + 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..72bfb23c65928 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/MonitorManager.java @@ -0,0 +1,575 @@ +// Copyright (c) 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.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.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.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.MetricsImpl; +import com.azure.resourcemanager.monitor.generated.implementation.MonitorClientBuilder; +import com.azure.resourcemanager.monitor.generated.implementation.OperationsImpl; +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.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.Metrics; +import com.azure.resourcemanager.monitor.generated.models.Operations; +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 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 Metrics metrics; + + 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 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); + } + + /** + * 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 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 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) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + 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); + } + } + + /** @return Resource collection API of AutoscaleSettings. */ + public AutoscaleSettings autoscaleSettings() { + if (this.autoscaleSettings == null) { + this.autoscaleSettings = new AutoscaleSettingsImpl(clientObject.getAutoscaleSettings(), this); + } + return autoscaleSettings; + } + + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); + } + return operations; + } + + /** @return Resource collection API of AlertRuleIncidents. */ + public AlertRuleIncidents alertRuleIncidents() { + if (this.alertRuleIncidents == null) { + this.alertRuleIncidents = new AlertRuleIncidentsImpl(clientObject.getAlertRuleIncidents(), this); + } + return alertRuleIncidents; + } + + /** @return Resource collection API of AlertRules. */ + public AlertRules alertRules() { + if (this.alertRules == null) { + this.alertRules = new AlertRulesImpl(clientObject.getAlertRules(), this); + } + return alertRules; + } + + /** @return Resource collection API of LogProfiles. */ + public LogProfiles logProfiles() { + if (this.logProfiles == null) { + this.logProfiles = new LogProfilesImpl(clientObject.getLogProfiles(), this); + } + return logProfiles; + } + + /** @return Resource collection API of DiagnosticSettingsOperations. */ + public DiagnosticSettingsOperations diagnosticSettingsOperations() { + if (this.diagnosticSettingsOperations == null) { + this.diagnosticSettingsOperations = + new DiagnosticSettingsOperationsImpl(clientObject.getDiagnosticSettingsOperations(), this); + } + return diagnosticSettingsOperations; + } + + /** @return Resource collection API of DiagnosticSettingsCategories. */ + public DiagnosticSettingsCategories diagnosticSettingsCategories() { + if (this.diagnosticSettingsCategories == null) { + this.diagnosticSettingsCategories = + new DiagnosticSettingsCategoriesImpl(clientObject.getDiagnosticSettingsCategories(), this); + } + return diagnosticSettingsCategories; + } + + /** @return Resource collection API of ActionGroups. */ + public ActionGroups actionGroups() { + if (this.actionGroups == null) { + this.actionGroups = new ActionGroupsImpl(clientObject.getActionGroups(), this); + } + return actionGroups; + } + + /** @return Resource collection API of ActivityLogs. */ + public ActivityLogs activityLogs() { + if (this.activityLogs == null) { + this.activityLogs = new ActivityLogsImpl(clientObject.getActivityLogs(), this); + } + return activityLogs; + } + + /** @return Resource collection API of EventCategories. */ + public EventCategories eventCategories() { + if (this.eventCategories == null) { + this.eventCategories = new EventCategoriesImpl(clientObject.getEventCategories(), this); + } + return eventCategories; + } + + /** @return Resource collection API of TenantActivityLogs. */ + public TenantActivityLogs tenantActivityLogs() { + if (this.tenantActivityLogs == null) { + this.tenantActivityLogs = new TenantActivityLogsImpl(clientObject.getTenantActivityLogs(), this); + } + return tenantActivityLogs; + } + + /** @return Resource collection API of MetricDefinitions. */ + public MetricDefinitions metricDefinitions() { + if (this.metricDefinitions == null) { + this.metricDefinitions = new MetricDefinitionsImpl(clientObject.getMetricDefinitions(), this); + } + return metricDefinitions; + } + + /** @return Resource collection API of Metrics. */ + public Metrics metrics() { + if (this.metrics == null) { + this.metrics = new MetricsImpl(clientObject.getMetrics(), this); + } + return metrics; + } + + /** @return Resource collection API of Baselines. */ + public Baselines baselines() { + if (this.baselines == null) { + this.baselines = new BaselinesImpl(clientObject.getBaselines(), this); + } + return baselines; + } + + /** @return Resource collection API of MetricAlerts. */ + public MetricAlerts metricAlerts() { + if (this.metricAlerts == null) { + this.metricAlerts = new MetricAlertsImpl(clientObject.getMetricAlerts(), this); + } + return metricAlerts; + } + + /** @return Resource collection API of MetricAlertsStatus. */ + public MetricAlertsStatus metricAlertsStatus() { + if (this.metricAlertsStatus == null) { + this.metricAlertsStatus = new MetricAlertsStatusImpl(clientObject.getMetricAlertsStatus(), this); + } + return metricAlertsStatus; + } + + /** @return Resource collection API of ScheduledQueryRules. */ + public ScheduledQueryRules scheduledQueryRules() { + if (this.scheduledQueryRules == null) { + this.scheduledQueryRules = new ScheduledQueryRulesImpl(clientObject.getScheduledQueryRules(), this); + } + return scheduledQueryRules; + } + + /** @return Resource collection API of MetricNamespaces. */ + public MetricNamespaces metricNamespaces() { + if (this.metricNamespaces == null) { + this.metricNamespaces = new MetricNamespacesImpl(clientObject.getMetricNamespaces(), this); + } + return metricNamespaces; + } + + /** @return Resource collection API of VMInsights. */ + public VMInsights vMInsights() { + if (this.vMInsights == null) { + this.vMInsights = new VMInsightsImpl(clientObject.getVMInsights(), this); + } + return vMInsights; + } + + /** @return Resource collection API of PrivateLinkScopes. */ + public PrivateLinkScopes privateLinkScopes() { + if (this.privateLinkScopes == null) { + this.privateLinkScopes = new PrivateLinkScopesImpl(clientObject.getPrivateLinkScopes(), this); + } + return privateLinkScopes; + } + + /** @return Resource collection API of PrivateLinkScopeOperationStatus. */ + public PrivateLinkScopeOperationStatus privateLinkScopeOperationStatus() { + if (this.privateLinkScopeOperationStatus == null) { + this.privateLinkScopeOperationStatus = + new PrivateLinkScopeOperationStatusImpl(clientObject.getPrivateLinkScopeOperationStatus(), this); + } + return privateLinkScopeOperationStatus; + } + + /** @return Resource collection API of PrivateLinkResources. */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** @return Resource collection API of PrivateEndpointConnections. */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections = + new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); + } + return privateEndpointConnections; + } + + /** @return Resource collection API of PrivateLinkScopedResources. */ + public PrivateLinkScopedResources privateLinkScopedResources() { + if (this.privateLinkScopedResources == null) { + this.privateLinkScopedResources = + new PrivateLinkScopedResourcesImpl(clientObject.getPrivateLinkScopedResources(), this); + } + return privateLinkScopedResources; + } + + /** @return Resource collection API of ActivityLogAlerts. */ + public ActivityLogAlerts activityLogAlerts() { + if (this.activityLogAlerts == null) { + this.activityLogAlerts = new ActivityLogAlertsImpl(clientObject.getActivityLogAlerts(), this); + } + return activityLogAlerts; + } + + /** @return Resource collection API of DataCollectionEndpoints. */ + public DataCollectionEndpoints dataCollectionEndpoints() { + if (this.dataCollectionEndpoints == null) { + this.dataCollectionEndpoints = + new DataCollectionEndpointsImpl(clientObject.getDataCollectionEndpoints(), this); + } + return dataCollectionEndpoints; + } + + /** @return Resource collection API of DataCollectionRuleAssociations. */ + public DataCollectionRuleAssociations dataCollectionRuleAssociations() { + if (this.dataCollectionRuleAssociations == null) { + this.dataCollectionRuleAssociations = + new DataCollectionRuleAssociationsImpl(clientObject.getDataCollectionRuleAssociations(), this); + } + return dataCollectionRuleAssociations; + } + + /** @return Resource collection API of DataCollectionRules. */ + public DataCollectionRules dataCollectionRules() { + if (this.dataCollectionRules == null) { + this.dataCollectionRules = new DataCollectionRulesImpl(clientObject.getDataCollectionRules(), this); + } + return dataCollectionRules; + } + + /** + * @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..d53fc86a0c788 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ActionGroupsClient.java @@ -0,0 +1,383 @@ +// Copyright (c) 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.fluent.models.TestNotificationResponseInner; +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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TestNotificationResponseInner> 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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TestNotificationResponseInner> 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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestNotificationResponseInner 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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestNotificationResponseInner 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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TestNotificationResponseInner> + 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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + SyncPoller, TestNotificationResponseInner> + 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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestNotificationResponseInner 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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + TestNotificationResponseInner createNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest, 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 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 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 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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); + + /** + * 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); +} 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..e243dbaea16ca --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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..3d39b8074e953 --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 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 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..a1da41fb51cd0 --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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..7fd8fdc4e8077 --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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/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..b5cd2efbaf038 --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); +} 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..4d1d62713bb1a --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); +} 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..3ba6ad84ae723 --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); +} 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..1ebb3614d5935 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DiagnosticSettingsCategoriesClient.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.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.DiagnosticSettingsCategoryResourceCollectionInner; +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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * 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); + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiagnosticSettingsCategoryResourceCollectionInner 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(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..25134b1ca5690 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DiagnosticSettingsOperationsClient.java @@ -0,0 +1,124 @@ +// Copyright (c) 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.DiagnosticSettingsResourceCollectionInner; +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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DiagnosticSettingsResourceCollectionInner 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 along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(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..3a05b4c7d7e16 --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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..b230ab97ce172 --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); +} 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..be9730e1be00b --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 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. + * @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); + + /** + * 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); +} 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/MetricsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricsClient.java new file mode 100644 index 0000000000000..053d8c76e518d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MetricsClient.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 MetricsClient. */ +public interface MetricsClient { + /** + * **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); + + /** + * **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); +} 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..b805c3869586f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/MonitorClient.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; + +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 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 MetricsClient object to access its operations. + * + * @return the MetricsClient object. + */ + MetricsClient getMetrics(); + + /** + * 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(); +} 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..6a7c030bab64b --- /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. + * + * @throws com.azure.core.management.exception.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(); + + /** + * 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); +} 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..0de75eaa79b48 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,216 @@ +// Copyright (c) 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.PrivateEndpointConnectionInner; + +/** 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * 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); + + /** + * 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 A 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 a private endpoint connection. + */ + @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 A 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 a private endpoint connection. + */ + @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 A 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 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 A 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. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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/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..2d1450b38f82b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkResourcesClient.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.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.PrivateLinkResourceInner; + +/** 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable 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 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 as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByPrivateLinkScope( + 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. + * @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); + + /** + * 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); +} 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..df539129bf2a6 --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * 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); +} 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..a60070a943dae --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * 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); + + /** + * 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..fd3d8d0602923 --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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); +} 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..4fa07b874a9f7 --- /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.LogSearchRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.LogSearchRuleResourcePatch; + +/** An instance of this class provides access to all the operations defined in ScheduledQueryRulesClient. */ +public interface ScheduledQueryRulesClient { + /** + * Creates or updates an log search 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 Log Search Rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogSearchRuleResourceInner createOrUpdate( + String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters); + + /** + * Creates or updates an log search 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 Log Search Rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters, Context context); + + /** + * Gets an Log Search 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 an Log Search rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogSearchRuleResourceInner getByResourceGroup(String resourceGroupName, String ruleName); + + /** + * Gets an Log Search 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 an Log Search rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context); + + /** + * Update log search 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 Log Search Rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + LogSearchRuleResourceInner update(String resourceGroupName, String ruleName, LogSearchRuleResourcePatch parameters); + + /** + * Update log search 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 Log Search Rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String ruleName, LogSearchRuleResourcePatch parameters, Context context); + + /** + * Deletes a Log Search 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); + + /** + * Deletes a Log Search 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); + + /** + * List the Log Search rules within a subscription group. + * + * @throws com.azure.core.management.exception.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 Search rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List the Log Search rules within a subscription group. + * + * @param filter The filter to apply on the operation. For more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. + * @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 Search rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String filter, Context context); + + /** + * List the Log Search 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 Log Search rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter The filter to apply on the operation. For more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. + * @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 Search rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup( + String resourceGroupName, String filter, Context context); +} 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..37faad1c387ba --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); + + /** + * 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); +} 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..cc68b08673e7e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroup.java @@ -0,0 +1,420 @@ +// Copyright (c) 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; + + /** + * 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..d01f3ffb62bc8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroupPatch.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.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; + + /** + * 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..8a80e5e971922 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroupResourceInner.java @@ -0,0 +1,374 @@ +// Copyright (c) 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.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.AzureResource; +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 AzureResource { + /* + * The action groups properties of the resource. + */ + @JsonProperty(value = "properties") + private ActionGroup innerProperties; + + /** + * 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. + */ + @Override + public void validate() { + super.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..18568d5220a95 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActivityLogAlertResourceInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.models.ActionList; +import com.azure.resourcemanager.monitor.generated.models.AlertRuleAllOfCondition; +import com.azure.resourcemanager.monitor.generated.models.AzureResourceAutoGenerated; +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 AzureResourceAutoGenerated { + /* + * The Activity Log Alert rule properties of the resource. + */ + @JsonProperty(value = "properties") + private AlertRuleProperties innerProperties; + + /** + * 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 AlertRuleAllOfCondition 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(AlertRuleAllOfCondition 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. + */ + @Override + public void validate() { + super.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..0c1bf74b5516f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRule.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.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; + + /** + * 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..e208e81de0d07 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRulePatchProperties.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.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; + + /** + * 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..3323b90147730 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRuleProperties.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.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.AlertRuleAllOfCondition; +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 AlertRuleAllOfCondition 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; + + /** + * 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 AlertRuleAllOfCondition 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(AlertRuleAllOfCondition 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..2dc8bd19e73a9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRuleResourceInner.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.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(); + + /** + * 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..bb957b0be9cc6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AutoscaleSetting.java @@ -0,0 +1,205 @@ +// Copyright (c) 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.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 'true'. + */ + @JsonProperty(value = "enabled") + private Boolean enabled; + + /* + * 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; + + /** + * 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 'true'. + * + * @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 'true'. + * + * @param enabled the enabled value to set. + * @return the AutoscaleSetting object itself. + */ + public AutoscaleSetting withEnabled(Boolean enabled) { + this.enabled = enabled; + 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()); + } + } + + 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..a0501c1fc3f55 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AutoscaleSettingResourceInner.java @@ -0,0 +1,211 @@ +// Copyright (c) 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.AutoscaleNotification; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleProfile; +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(); + + /** + * Get the innerProperties property: The autoscale setting of the resource. + * + * @return the innerProperties value. + */ + private AutoscaleSetting innerProperties() { + return this.innerProperties; + } + + /** {@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 'true'. + * + * @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 'true'. + * + * @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 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..1112f16a8c641 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorPrivateLinkScopeInner.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.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkScopesResource; +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 PrivateLinkScopesResource { + /* + * Properties that define a Azure Monitor PrivateLinkScope resource. + */ + @JsonProperty(value = "properties", required = true) + private AzureMonitorPrivateLinkScopeProperties innerProperties = new AzureMonitorPrivateLinkScopeProperties(); + + /** + * Get the innerProperties property: Properties that define a Azure Monitor PrivateLinkScope resource. + * + * @return the innerProperties value. + */ + private AzureMonitorPrivateLinkScopeProperties innerProperties() { + return this.innerProperties; + } + + /** {@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(); + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.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..e756b2c39b237 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorPrivateLinkScopeProperties.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.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties that define a Azure Monitor PrivateLinkScope resource. */ +@Immutable +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; + + /** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.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..267c6f1c41578 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionEndpointResourceInner.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.management.Resource; +import com.azure.core.management.SystemData; +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; + + /** + * 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; + } + + /** + * 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..caba07d986fbe --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionEndpointResourceProperties.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.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 { + /** {@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..0f439646a1835 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleAssociationProxyOnlyResourceInner.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.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; + +/** 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; + + /** + * 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; + } + + /** + * 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..b47b3948a0f90 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleAssociationProxyOnlyResourceProperties.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.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 { + /** {@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..2b7b830f1b388 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleResourceInner.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.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionRuleResourceKind; +import com.fasterxml.jackson.annotation.JsonProperty; +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; + + /** + * 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; + } + + /** + * 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..709b16fcc36b9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleResourceProperties.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.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 { + /** {@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..bd721a4c01935 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettings.java @@ -0,0 +1,262 @@ +// Copyright (c) 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; + + /* + * 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; + + /** + * 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 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..d64f223932d28 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsCategory.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.models.CategoryType; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The diagnostic settings Category. */ +@Fluent +public final class DiagnosticSettingsCategory { + /* + * The type of the diagnostic settings category. + */ + @JsonProperty(value = "categoryType") + private CategoryType categoryType; + + /** + * 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; + } + + /** + * 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/DiagnosticSettingsCategoryResourceCollectionInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsCategoryResourceCollectionInner.java new file mode 100644 index 0000000000000..da07aaedf4f09 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsCategoryResourceCollectionInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of diagnostic setting category resources. */ +@Fluent +public final class DiagnosticSettingsCategoryResourceCollectionInner { + /* + * The collection of diagnostic settings category resources. + */ + @JsonProperty(value = "value") + private List value; + + /** + * 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 DiagnosticSettingsCategoryResourceCollectionInner object itself. + */ + public DiagnosticSettingsCategoryResourceCollectionInner 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/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..177ce2165852c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsCategoryResourceInner.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.azure.resourcemanager.monitor.generated.models.CategoryType; +import com.azure.resourcemanager.monitor.generated.models.ProxyOnlyResource; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The diagnostic settings category resource. */ +@Fluent +public final class DiagnosticSettingsCategoryResourceInner extends ProxyOnlyResource { + /* + * The properties of a Diagnostic Settings Category. + */ + @JsonProperty(value = "properties") + private DiagnosticSettingsCategory innerProperties; + + /** + * Get the innerProperties property: The properties of a Diagnostic Settings Category. + * + * @return the innerProperties value. + */ + private DiagnosticSettingsCategory innerProperties() { + return this.innerProperties; + } + + /** + * 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; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.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/DiagnosticSettingsResourceCollectionInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsResourceCollectionInner.java new file mode 100644 index 0000000000000..cc2c55566b82a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsResourceCollectionInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of alert rule resources. */ +@Fluent +public final class DiagnosticSettingsResourceCollectionInner { + /* + * The collection of diagnostic settings resources;. + */ + @JsonProperty(value = "value") + private List value; + + /** + * 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 DiagnosticSettingsResourceCollectionInner object itself. + */ + public DiagnosticSettingsResourceCollectionInner 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/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..0a8a732993f0c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsResourceInner.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.resourcemanager.monitor.generated.models.LogSettings; +import com.azure.resourcemanager.monitor.generated.models.MetricSettings; +import com.azure.resourcemanager.monitor.generated.models.ProxyOnlyResource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The diagnostic setting resource. */ +@Fluent +public final class DiagnosticSettingsResourceInner extends ProxyOnlyResource { + /* + * Properties of a Diagnostic Settings Resource. + */ + @JsonProperty(value = "properties") + private DiagnosticSettings innerProperties; + + /** + * Get the innerProperties property: Properties of a Diagnostic Settings Resource. + * + * @return the innerProperties value. + */ + private DiagnosticSettings innerProperties() { + return this.innerProperties; + } + + /** + * 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 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. + */ + @Override + public void validate() { + super.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..65cc64b11de55 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/EventDataInner.java @@ -0,0 +1,452 @@ +// Copyright (c) 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; + + /** + * 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..838549a30fb10 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/IncidentInner.java @@ -0,0 +1,98 @@ +// Copyright (c) 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; + + /** + * 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..eb22ddc19719a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LocalizableStringInner.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.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; + + /** + * 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..0a7444a62610a --- /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; + + /** + * 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..c90923eb954b5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogProfileResourceInner.java @@ -0,0 +1,189 @@ +// Copyright (c) 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(); + + /** + * 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/LogSearchRule.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogSearchRule.java new file mode 100644 index 0000000000000..4d4bcfea10d10 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogSearchRule.java @@ -0,0 +1,295 @@ +// Copyright (c) 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.Action; +import com.azure.resourcemanager.monitor.generated.models.Enabled; +import com.azure.resourcemanager.monitor.generated.models.ProvisioningState; +import com.azure.resourcemanager.monitor.generated.models.Schedule; +import com.azure.resourcemanager.monitor.generated.models.Source; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Log Search Rule Definition. */ +@Fluent +public final class LogSearchRule { + /* + * 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 Log Search rule. + */ + @JsonProperty(value = "description") + private String description; + + /* + * The display name of the alert rule + */ + @JsonProperty(value = "displayName") + private String displayName; + + /* + * The flag that indicates whether the alert should be automatically + * resolved or not. The default is false. + */ + @JsonProperty(value = "autoMitigate") + private Boolean autoMitigate; + + /* + * The flag which indicates whether the Log Search rule is enabled. Value + * should be true or false + */ + @JsonProperty(value = "enabled") + private Enabled enabled; + + /* + * Last time the rule was updated in IS08601 format. + */ + @JsonProperty(value = "lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdatedTime; + + /* + * Provisioning state of the scheduled query rule + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Data Source against which rule will Query Data + */ + @JsonProperty(value = "source", required = true) + private Source source; + + /* + * Schedule (Frequency, Time Window) for rule. Required for action type - + * AlertingAction + */ + @JsonProperty(value = "schedule") + private Schedule schedule; + + /* + * Action needs to be taken on rule execution. + */ + @JsonProperty(value = "action", required = true) + private Action action; + + /** + * 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 Log Search rule. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The description of the Log Search rule. + * + * @param description the description value to set. + * @return the LogSearchRule object itself. + */ + public LogSearchRule 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 LogSearchRule object itself. + */ + public LogSearchRule withDisplayName(String displayName) { + this.displayName = displayName; + return this; + } + + /** + * Get the autoMitigate property: The flag that indicates whether the alert should be automatically resolved or not. + * The default is false. + * + * @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 false. + * + * @param autoMitigate the autoMitigate value to set. + * @return the LogSearchRule object itself. + */ + public LogSearchRule withAutoMitigate(Boolean autoMitigate) { + this.autoMitigate = autoMitigate; + return this; + } + + /** + * Get the enabled property: The flag which indicates whether the Log Search rule is enabled. Value should be true + * or false. + * + * @return the enabled value. + */ + public Enabled enabled() { + return this.enabled; + } + + /** + * Set the enabled property: The flag which indicates whether the Log Search rule is enabled. Value should be true + * or false. + * + * @param enabled the enabled value to set. + * @return the LogSearchRule object itself. + */ + public LogSearchRule withEnabled(Enabled enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the lastUpdatedTime property: Last time the rule was updated in IS08601 format. + * + * @return the lastUpdatedTime value. + */ + public OffsetDateTime lastUpdatedTime() { + return this.lastUpdatedTime; + } + + /** + * Get the provisioningState property: Provisioning state of the scheduled query rule. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Get the source property: Data Source against which rule will Query Data. + * + * @return the source value. + */ + public Source source() { + return this.source; + } + + /** + * Set the source property: Data Source against which rule will Query Data. + * + * @param source the source value to set. + * @return the LogSearchRule object itself. + */ + public LogSearchRule withSource(Source source) { + this.source = source; + return this; + } + + /** + * Get the schedule property: Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction. + * + * @return the schedule value. + */ + public Schedule schedule() { + return this.schedule; + } + + /** + * Set the schedule property: Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction. + * + * @param schedule the schedule value to set. + * @return the LogSearchRule object itself. + */ + public LogSearchRule withSchedule(Schedule schedule) { + this.schedule = schedule; + return this; + } + + /** + * Get the action property: Action needs to be taken on rule execution. + * + * @return the action value. + */ + public Action action() { + return this.action; + } + + /** + * Set the action property: Action needs to be taken on rule execution. + * + * @param action the action value to set. + * @return the LogSearchRule object itself. + */ + public LogSearchRule withAction(Action action) { + this.action = action; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (source() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property source in model LogSearchRule")); + } else { + source().validate(); + } + if (schedule() != null) { + schedule().validate(); + } + if (action() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property action in model LogSearchRule")); + } else { + action().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LogSearchRule.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogSearchRulePatch.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogSearchRulePatch.java new file mode 100644 index 0000000000000..0924ec78d08b4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogSearchRulePatch.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.models.Enabled; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Log Search Rule Definition for Patching. */ +@Fluent +public final class LogSearchRulePatch { + /* + * The flag which indicates whether the Log Search rule is enabled. Value + * should be true or false + */ + @JsonProperty(value = "enabled") + private Enabled enabled; + + /** + * Get the enabled property: The flag which indicates whether the Log Search rule is enabled. Value should be true + * or false. + * + * @return the enabled value. + */ + public Enabled enabled() { + return this.enabled; + } + + /** + * Set the enabled property: The flag which indicates whether the Log Search rule is enabled. Value should be true + * or false. + * + * @param enabled the enabled value to set. + * @return the LogSearchRulePatch object itself. + */ + public LogSearchRulePatch withEnabled(Enabled 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/LogSearchRuleResourceInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogSearchRuleResourceInner.java new file mode 100644 index 0000000000000..8c0ebb625d1d0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogSearchRuleResourceInner.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.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.Action; +import com.azure.resourcemanager.monitor.generated.models.Enabled; +import com.azure.resourcemanager.monitor.generated.models.ProvisioningState; +import com.azure.resourcemanager.monitor.generated.models.Schedule; +import com.azure.resourcemanager.monitor.generated.models.Source; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** The Log Search Rule resource. */ +@Fluent +public final class LogSearchRuleResourceInner extends Resource { + /* + * The rule properties of the resource. + */ + @JsonProperty(value = "properties", required = true) + private LogSearchRule innerProperties = new LogSearchRule(); + + /* + * Metadata used by portal/tooling/etc to render different UX experiences + * for resources of the same type; e.g. ApiApps are a kind of + * Microsoft.Web/sites type. If supported, the resource provider must + * validate and persist this value. + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String 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; + + /** + * Get the innerProperties property: The rule properties of the resource. + * + * @return the innerProperties value. + */ + private LogSearchRule innerProperties() { + return this.innerProperties; + } + + /** + * Get the kind property: Metadata used by portal/tooling/etc to render different UX experiences for resources of + * the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must + * validate and persist this value. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * 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; + } + + /** {@inheritDoc} */ + @Override + public LogSearchRuleResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public LogSearchRuleResourceInner 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 Log Search rule. + * + * @return the description value. + */ + public String description() { + return this.innerProperties() == null ? null : this.innerProperties().description(); + } + + /** + * Set the description property: The description of the Log Search rule. + * + * @param description the description value to set. + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withDescription(String description) { + if (this.innerProperties() == null) { + this.innerProperties = new LogSearchRule(); + } + 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 LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withDisplayName(String displayName) { + if (this.innerProperties() == null) { + this.innerProperties = new LogSearchRule(); + } + this.innerProperties().withDisplayName(displayName); + return this; + } + + /** + * Get the autoMitigate property: The flag that indicates whether the alert should be automatically resolved or not. + * The default is false. + * + * @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 false. + * + * @param autoMitigate the autoMitigate value to set. + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withAutoMitigate(Boolean autoMitigate) { + if (this.innerProperties() == null) { + this.innerProperties = new LogSearchRule(); + } + this.innerProperties().withAutoMitigate(autoMitigate); + return this; + } + + /** + * Get the enabled property: The flag which indicates whether the Log Search rule is enabled. Value should be true + * or false. + * + * @return the enabled value. + */ + public Enabled enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: The flag which indicates whether the Log Search rule is enabled. Value should be true + * or false. + * + * @param enabled the enabled value to set. + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withEnabled(Enabled enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new LogSearchRule(); + } + this.innerProperties().withEnabled(enabled); + return this; + } + + /** + * Get the lastUpdatedTime property: Last time the rule was updated in IS08601 format. + * + * @return the lastUpdatedTime value. + */ + public OffsetDateTime lastUpdatedTime() { + return this.innerProperties() == null ? null : this.innerProperties().lastUpdatedTime(); + } + + /** + * Get the provisioningState property: Provisioning state of the scheduled query rule. + * + * @return the provisioningState value. + */ + public ProvisioningState provisioningState() { + return this.innerProperties() == null ? null : this.innerProperties().provisioningState(); + } + + /** + * Get the source property: Data Source against which rule will Query Data. + * + * @return the source value. + */ + public Source source() { + return this.innerProperties() == null ? null : this.innerProperties().source(); + } + + /** + * Set the source property: Data Source against which rule will Query Data. + * + * @param source the source value to set. + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withSource(Source source) { + if (this.innerProperties() == null) { + this.innerProperties = new LogSearchRule(); + } + this.innerProperties().withSource(source); + return this; + } + + /** + * Get the schedule property: Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction. + * + * @return the schedule value. + */ + public Schedule schedule() { + return this.innerProperties() == null ? null : this.innerProperties().schedule(); + } + + /** + * Set the schedule property: Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction. + * + * @param schedule the schedule value to set. + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withSchedule(Schedule schedule) { + if (this.innerProperties() == null) { + this.innerProperties = new LogSearchRule(); + } + this.innerProperties().withSchedule(schedule); + return this; + } + + /** + * Get the action property: Action needs to be taken on rule execution. + * + * @return the action value. + */ + public Action action() { + return this.innerProperties() == null ? null : this.innerProperties().action(); + } + + /** + * Set the action property: Action needs to be taken on rule execution. + * + * @param action the action value to set. + * @return the LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withAction(Action action) { + if (this.innerProperties() == null) { + this.innerProperties = new LogSearchRule(); + } + this.innerProperties().withAction(action); + 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 LogSearchRuleResourceInner")); + } else { + innerProperties().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LogSearchRuleResourceInner.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..bab6045d50b17 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetadataValueInner.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.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; + + /** + * 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..ca02de2f5f611 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertProperties.java @@ -0,0 +1,392 @@ +// Copyright (c) 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; + + /** + * 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..66becb0c83a5b --- /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; + + /** + * 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..1b18d822f3ada --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertResourceInner.java @@ -0,0 +1,350 @@ +// Copyright (c) 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(); + + /** + * 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..51c755aca73fc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertStatusCollectionInner.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.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; + + /** + * 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..83121a3ddfbb1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricBaselinesProperties.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.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; + + /** + * 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..4d02c650c2828 --- /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; + + /** + * 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..bf3bf6c9d4d77 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricInner.java @@ -0,0 +1,263 @@ +// Copyright (c) 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; + + /** + * 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..af464d3ddaf87 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricNamespaceInner.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.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; + + /** + * 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/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..abd5c62f8dd34 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/OperationListResultInner.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.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; + + /** + * 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..5645c08e8e5ca --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/OperationStatusInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.models.ErrorResponseCommon; +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 ErrorResponseCommon error; + + /** + * 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 ErrorResponseCommon 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(ErrorResponseCommon error) { + this.error = error; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (error() != null) { + error().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..c77fb378692a3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateEndpointConnectionInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionInner extends ProxyResource { + /* + * Resource properties. + */ + @JsonProperty(value = "properties") + private PrivateEndpointConnectionProperties innerProperties; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private PrivateEndpointConnectionProperties innerProperties() { + return this.innerProperties; + } + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.innerProperties() == null ? null : this.innerProperties().privateEndpoint(); + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateEndpoint(privateEndpoint); + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerProperties() == null ? null : this.innerProperties().privateLinkServiceConnectionState(); + } + + /** + * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + if (this.innerProperties() == null) { + this.innerProperties = new PrivateEndpointConnectionProperties(); + } + this.innerProperties().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + 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/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..fed5e5901a15b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateEndpointConnectionProperties.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a private endpoint connection. */ +@Fluent +public final class PrivateEndpointConnectionProperties { + /* + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpointProperty privateEndpoint; + + /* + * Connection state of the private endpoint connection. + */ + @JsonProperty(value = "privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /* + * State of the private endpoint connection. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionProperties object itself. + */ + public PrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + 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() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } +} 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..dacaa93b4df12 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateLinkResourceInner.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.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; + + /** + * 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(); + } + + /** + * 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/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..a4a5ddc8d3d5f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateLinkResourceProperties.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a private link resource. */ +@Immutable +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; + + /** + * 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; + } + + /** + * 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..95105e2ff79b0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ResponseInner.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.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; + + /** + * 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/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..50ac45be111df --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScopedResourceInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.ProxyResource; +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; + + /** + * Get the innerProperties property: Resource properties. + * + * @return the innerProperties value. + */ + private ScopedResourceProperties innerProperties() { + return this.innerProperties; + } + + /** + * 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..67793caef72d8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScopedResourceProperties.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.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; + + /** + * 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..247d2afa7150d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/SingleMetricBaselineInner.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.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(); + + /** + * 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..76494a82390dc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/TestNotificationDetailsResponseInner.java @@ -0,0 +1,168 @@ +// Copyright (c) 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; + + /** + * 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/TestNotificationResponseInner.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/TestNotificationResponseInner.java new file mode 100644 index 0000000000000..6390700ee5996 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/TestNotificationResponseInner.java @@ -0,0 +1,119 @@ +// Copyright (c) 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 response when test notification succeeded. */ +@Fluent +public final class TestNotificationResponseInner { + /* + * The notification id + */ + @JsonProperty(value = "notificationId", required = true) + private String notificationId; + + /* + * The correlation id + */ + @JsonProperty(value = "correlationId", required = true) + private String correlationId; + + /* + * The created time + */ + @JsonProperty(value = "createdTime", required = true) + private String createdTime; + + /** + * Get the notificationId property: The notification id. + * + * @return the notificationId value. + */ + public String notificationId() { + return this.notificationId; + } + + /** + * Set the notificationId property: The notification id. + * + * @param notificationId the notificationId value to set. + * @return the TestNotificationResponseInner object itself. + */ + public TestNotificationResponseInner withNotificationId(String notificationId) { + this.notificationId = notificationId; + return this; + } + + /** + * Get the correlationId property: The correlation id. + * + * @return the correlationId value. + */ + public String correlationId() { + return this.correlationId; + } + + /** + * Set the correlationId property: The correlation id. + * + * @param correlationId the correlationId value to set. + * @return the TestNotificationResponseInner object itself. + */ + public TestNotificationResponseInner withCorrelationId(String correlationId) { + this.correlationId = correlationId; + 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 TestNotificationResponseInner object itself. + */ + public TestNotificationResponseInner withCreatedTime(String createdTime) { + this.createdTime = createdTime; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (notificationId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property notificationId in model TestNotificationResponseInner")); + } + if (correlationId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property correlationId in model TestNotificationResponseInner")); + } + if (createdTime() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property createdTime in model TestNotificationResponseInner")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TestNotificationResponseInner.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..9eac77af56d33 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/VMInsightsOnboardingStatusInner.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.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; + + /** + * 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..8cb0375e5e76c --- /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; + + /** + * 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..a2c2a5c2a1431 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/WorkspaceInfoProperties.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.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; + + /** + * 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..ed98480991712 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActionGroupResourceImpl.java @@ -0,0 +1,386 @@ +// Copyright (c) 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.SmsReceiver; +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 kind() { + return this.innerModel().kind(); + } + + public String identity() { + return this.innerModel().identity(); + } + + 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 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 void enableReceiver(EnableRequest enableRequest) { + serviceManager.actionGroups().enableReceiver(resourceGroupName, actionGroupName, enableRequest); + } + + public Response enableReceiverWithResponse(EnableRequest enableRequest, Context context) { + return serviceManager + .actionGroups() + .enableReceiverWithResponse(resourceGroupName, actionGroupName, enableRequest, context); + } + + 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..8172735fa92f2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActionGroupsClientImpl.java @@ -0,0 +1,2113 @@ +// Copyright (c) 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.fluent.models.TestNotificationResponseInner; +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") + private 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({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({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"}) + @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}/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-04-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-04-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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 createOrUpdateAsync(resourceGroupName, actionGroupName, actionGroup).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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(); + } + + /** + * 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-04-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-04-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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getByResourceGroupAsync(resourceGroupName, actionGroupName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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(); + } + + /** + * 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-04-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-04-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((Response res) -> 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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) { + deleteAsync(resourceGroupName, actionGroupName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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-04-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-04-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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 updateAsync(resourceGroupName, actionGroupName, actionGroupPatch).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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(); + } + + /** + * 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 response when test notification succeeded 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-04-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 response when test notification succeeded 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-04-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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TestNotificationResponseInner> + beginPostTestNotificationsAsync(NotificationRequestBody notificationRequest) { + Mono>> mono = postTestNotificationsWithResponseAsync(notificationRequest); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TestNotificationResponseInner.class, + TestNotificationResponseInner.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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TestNotificationResponseInner> + beginPostTestNotificationsAsync(NotificationRequestBody notificationRequest, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = postTestNotificationsWithResponseAsync(notificationRequest, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TestNotificationResponseInner.class, + TestNotificationResponseInner.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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TestNotificationResponseInner> + beginPostTestNotifications(NotificationRequestBody notificationRequest) { + return 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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TestNotificationResponseInner> + beginPostTestNotifications(NotificationRequestBody notificationRequest, Context context) { + return 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 response when test notification succeeded 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 response when test notification succeeded 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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestNotificationResponseInner 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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestNotificationResponseInner 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 response when test notification succeeded 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-04-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 response when test notification succeeded 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-04-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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TestNotificationResponseInner> + beginCreateNotificationsAtResourceGroupLevelAsync( + String resourceGroupName, NotificationRequestBody notificationRequest) { + Mono>> mono = + createNotificationsAtResourceGroupLevelWithResponseAsync(resourceGroupName, notificationRequest); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + TestNotificationResponseInner.class, + TestNotificationResponseInner.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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + private PollerFlux, TestNotificationResponseInner> + 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(), + TestNotificationResponseInner.class, + TestNotificationResponseInner.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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TestNotificationResponseInner> + beginCreateNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest) { + return 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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, TestNotificationResponseInner> + beginCreateNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest, Context context) { + return 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 response when test notification succeeded 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 response when test notification succeeded 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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestNotificationResponseInner 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 response when test notification succeeded. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public TestNotificationResponseInner createNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest, Context context) { + return createNotificationsAtResourceGroupLevelAsync(resourceGroupName, 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-04-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-04-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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getTestNotificationsAsync(notificationId).block(); + } + + /** + * 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 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-04-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-04-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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getTestNotificationsAtResourceGroupLevelAsync(resourceGroupName, notificationId).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 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-04-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-04-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-04-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-04-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-04-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-04-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((Response res) -> 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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) { + enableReceiverAsync(resourceGroupName, actionGroupName, enableRequest).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } +} 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..b810ad4ed10e0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActionGroupsImpl.java @@ -0,0 +1,282 @@ +// Copyright (c) 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.fluent.models.TestNotificationResponseInner; +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; +import com.azure.resourcemanager.monitor.generated.models.TestNotificationResponse; + +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 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 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 void deleteByResourceGroup(String resourceGroupName, String actionGroupName) { + this.serviceClient().delete(resourceGroupName, actionGroupName); + } + + public Response deleteWithResponse(String resourceGroupName, String actionGroupName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, actionGroupName, context); + } + + public TestNotificationResponse postTestNotifications(NotificationRequestBody notificationRequest) { + TestNotificationResponseInner inner = this.serviceClient().postTestNotifications(notificationRequest); + if (inner != null) { + return new TestNotificationResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public TestNotificationResponse postTestNotifications( + NotificationRequestBody notificationRequest, Context context) { + TestNotificationResponseInner inner = this.serviceClient().postTestNotifications(notificationRequest, context); + if (inner != null) { + return new TestNotificationResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public TestNotificationResponse createNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest) { + TestNotificationResponseInner inner = + this.serviceClient().createNotificationsAtResourceGroupLevel(resourceGroupName, notificationRequest); + if (inner != null) { + return new TestNotificationResponseImpl(inner, this.manager()); + } else { + return null; + } + } + + public TestNotificationResponse createNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest, Context context) { + TestNotificationResponseInner inner = + this + .serviceClient() + .createNotificationsAtResourceGroupLevel(resourceGroupName, notificationRequest, context); + if (inner != null) { + return new TestNotificationResponseImpl(inner, 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 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 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 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 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 void enableReceiver(String resourceGroupName, String actionGroupName, EnableRequest enableRequest) { + this.serviceClient().enableReceiver(resourceGroupName, actionGroupName, enableRequest); + } + + public Response enableReceiverWithResponse( + String resourceGroupName, String actionGroupName, EnableRequest enableRequest, Context context) { + return this + .serviceClient() + .enableReceiverWithResponse(resourceGroupName, actionGroupName, enableRequest, context); + } + + 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.deleteWithResponse(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.deleteWithResponse(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..9a2d637df947a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogAlertResourceImpl.java @@ -0,0 +1,236 @@ +// Copyright (c) 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.ActivityLogAlertResource; +import com.azure.resourcemanager.monitor.generated.models.AlertRuleAllOfCondition; +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 AlertRuleAllOfCondition 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 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(AlertRuleAllOfCondition 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..a06b301cdcf89 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogAlertsClientImpl.java @@ -0,0 +1,1298 @@ +// Copyright (c) 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") + private 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 createOrUpdateAsync(resourceGroupName, activityLogAlertName, activityLogAlertRule).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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(); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getByResourceGroupAsync(resourceGroupName, activityLogAlertName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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(); + } + + /** + * 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((Response res) -> 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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) { + deleteAsync(resourceGroupName, activityLogAlertName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 updateAsync(resourceGroupName, activityLogAlertName, activityLogAlertRulePatch).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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(); + } + + /** + * 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 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 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 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 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..84c2b6692abbb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogAlertsImpl.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.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 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 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 void deleteByResourceGroup(String resourceGroupName, String activityLogAlertName) { + this.serviceClient().delete(resourceGroupName, activityLogAlertName); + } + + public Response deleteWithResponse(String resourceGroupName, String activityLogAlertName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, activityLogAlertName, context); + } + + 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.deleteWithResponse(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.deleteWithResponse(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..3e43590c86eb1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogsClientImpl.java @@ -0,0 +1,439 @@ +// Copyright (c) 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") + private 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 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 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..7cb6766c5b16e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRuleIncidentsClientImpl.java @@ -0,0 +1,424 @@ +// Copyright (c) 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") + private 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getAsync(resourceGroupName, ruleName, incidentName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 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..4ccad634d2697 --- /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 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 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 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..7f84513659848 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRuleResourceImpl.java @@ -0,0 +1,286 @@ +// Copyright (c) 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 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..b851e68a6f86b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRulesClientImpl.java @@ -0,0 +1,1059 @@ +// Copyright (c) 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") + private 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 createOrUpdateAsync(resourceGroupName, ruleName, parameters).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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((Response res) -> 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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) { + deleteAsync(resourceGroupName, ruleName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getByResourceGroupAsync(resourceGroupName, ruleName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 updateAsync(resourceGroupName, ruleName, alertRulesResource).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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..26f411420daa3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRulesImpl.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.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 void deleteByResourceGroup(String resourceGroupName, String ruleName) { + this.serviceClient().delete(resourceGroupName, ruleName); + } + + public Response deleteWithResponse(String resourceGroupName, String ruleName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, ruleName, context); + } + + 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 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 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.deleteWithResponse(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.deleteWithResponse(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..6a76b386b58ca --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AutoscaleSettingResourceImpl.java @@ -0,0 +1,275 @@ +// Copyright (c) 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.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 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 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 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 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 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..4ac7e7c6cd588 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AutoscaleSettingsClientImpl.java @@ -0,0 +1,1283 @@ +// Copyright (c) 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") + private 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 = "2015-04-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 = "2015-04-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 = "2015-04-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 = "2015-04-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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 createOrUpdateAsync(resourceGroupName, autoscaleSettingName, parameters).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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 = "2015-04-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 = "2015-04-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((Response res) -> 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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) { + deleteAsync(resourceGroupName, autoscaleSettingName).block(); + } + + /** + * 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(); + } + + /** + * 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 = "2015-04-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 = "2015-04-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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getByResourceGroupAsync(resourceGroupName, autoscaleSettingName).block(); + } + + /** + * 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(); + } + + /** + * 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 = "2015-04-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 = "2015-04-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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 updateAsync(resourceGroupName, autoscaleSettingName, autoscaleSettingResource).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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 = "2015-04-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 = "2015-04-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 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 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 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 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..408c022b08529 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AutoscaleSettingsImpl.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.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 void deleteByResourceGroup(String resourceGroupName, String autoscaleSettingName) { + this.serviceClient().delete(resourceGroupName, autoscaleSettingName); + } + + public Response deleteWithResponse(String resourceGroupName, String autoscaleSettingName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, autoscaleSettingName, context); + } + + 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 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 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.deleteWithResponse(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.deleteWithResponse(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..87f75d4921553 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AzureMonitorPrivateLinkScopeImpl.java @@ -0,0 +1,201 @@ +// Copyright (c) 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.AzureMonitorPrivateLinkScopeInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionInner; +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 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 Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + 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 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/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..c3328847001d3 --- /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") + private 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..e3d30877fe502 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointResourceImpl.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.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.DataCollectionEndpointResource; +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 Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + 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; + } + + 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..53fe8e43da0a9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointsClientImpl.java @@ -0,0 +1,1332 @@ +// Copyright (c) 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") + private 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getByResourceGroupAsync(resourceGroupName, dataCollectionEndpointName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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(); + } + + /** + * 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String dataCollectionEndpointName, DataCollectionEndpointResourceInner body) { + return createWithResponseAsync(resourceGroupName, dataCollectionEndpointName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 createAsync(resourceGroupName, dataCollectionEndpointName, body).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. + * @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(); + } + + /** + * 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String dataCollectionEndpointName, ResourceForUpdate body) { + return updateWithResponseAsync(resourceGroupName, dataCollectionEndpointName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 updateAsync(resourceGroupName, dataCollectionEndpointName, body).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. + * @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(); + } + + /** + * 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((Response res) -> 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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) { + deleteAsync(resourceGroupName, dataCollectionEndpointName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 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 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 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..0a83ef5421176 --- /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 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 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 void deleteByResourceGroup(String resourceGroupName, String dataCollectionEndpointName) { + this.serviceClient().delete(resourceGroupName, dataCollectionEndpointName); + } + + public Response deleteWithResponse( + String resourceGroupName, String dataCollectionEndpointName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, dataCollectionEndpointName, context); + } + + 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.deleteWithResponse(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.deleteWithResponse(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..d78503716ba0e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationProxyOnlyResourceImpl.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.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.DataCollectionRuleAssociationProxyOnlyResource; + +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 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; + } +} 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..6e04cc9c04066 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationsClientImpl.java @@ -0,0 +1,1323 @@ +// Copyright (c) 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") + private 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getAsync(resourceUri, associationName).block(); + } + + /** + * 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(); + } + + /** + * 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceUri, String associationName, DataCollectionRuleAssociationProxyOnlyResourceInner body) { + return createWithResponseAsync(resourceUri, associationName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 createAsync(resourceUri, associationName, body).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. + * @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(); + } + + /** + * 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((Response res) -> Mono.empty()); + } + + /** + * 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) { + deleteAsync(resourceUri, associationName).block(); + } + + /** + * 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(); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 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 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 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 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 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..5d0b3f273d5f5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationsImpl.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.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 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 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 void deleteByResourceGroup(String resourceUri, String associationName) { + this.serviceClient().delete(resourceUri, associationName); + } + + public Response deleteWithResponse(String resourceUri, String associationName, Context context) { + return this.serviceClient().deleteWithResponse(resourceUri, associationName, context); + } + + 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.deleteWithResponse(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.deleteWithResponse(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..473c4887425b0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleResourceImpl.java @@ -0,0 +1,196 @@ +// Copyright (c) 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.DataCollectionRuleResource; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionRuleResourceKind; +import com.azure.resourcemanager.monitor.generated.models.ResourceForUpdate; +import java.util.Collections; +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 Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + 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; + } + + 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..6d1ef91904471 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRulesClientImpl.java @@ -0,0 +1,1319 @@ +// Copyright (c) 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") + private 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getByResourceGroupAsync(resourceGroupName, dataCollectionRuleName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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(); + } + + /** + * 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String dataCollectionRuleName, DataCollectionRuleResourceInner body) { + return createWithResponseAsync(resourceGroupName, dataCollectionRuleName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 createAsync(resourceGroupName, dataCollectionRuleName, body).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. + * @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(); + } + + /** + * 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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String dataCollectionRuleName, ResourceForUpdate body) { + return updateWithResponseAsync(resourceGroupName, dataCollectionRuleName, body) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 updateAsync(resourceGroupName, dataCollectionRuleName, body).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. + * @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(); + } + + /** + * 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((Response res) -> 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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) { + deleteAsync(resourceGroupName, dataCollectionRuleName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 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 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 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..177242c33f271 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRulesImpl.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.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 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 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 void deleteByResourceGroup(String resourceGroupName, String dataCollectionRuleName) { + this.serviceClient().delete(resourceGroupName, dataCollectionRuleName); + } + + public Response deleteWithResponse(String resourceGroupName, String dataCollectionRuleName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, dataCollectionRuleName, context); + } + + 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.deleteWithResponse(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.deleteWithResponse(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..58ac4d1324c50 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoriesClientImpl.java @@ -0,0 +1,313 @@ +// Copyright (c) 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.DiagnosticSettingsCategoriesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsCategoryResourceCollectionInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsCategoryResourceInner; +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") + private 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 = "2017-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 = "2017-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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getAsync(resourceUri, name).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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 Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + 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 = "2017-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), resourceUri, apiVersion, accept, context)) + .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 Response} on + * successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + 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 = "2017-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), resourceUri, apiVersion, accept, 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 on successful completion of {@link + * Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String resourceUri) { + return listWithResponseAsync(resourceUri) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiagnosticSettingsCategoryResourceCollectionInner list(String resourceUri) { + return listAsync(resourceUri).block(); + } + + /** + * 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 Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse( + String resourceUri, Context context) { + return listWithResponseAsync(resourceUri, context).block(); + } +} 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..be775e536c462 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoriesImpl.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.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.DiagnosticSettingsCategoriesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsCategoryResourceCollectionInner; +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; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsCategoryResourceCollection; + +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 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 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 DiagnosticSettingsCategoryResourceCollection list(String resourceUri) { + DiagnosticSettingsCategoryResourceCollectionInner inner = this.serviceClient().list(resourceUri); + if (inner != null) { + return new DiagnosticSettingsCategoryResourceCollectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse( + String resourceUri, Context context) { + Response inner = + this.serviceClient().listWithResponse(resourceUri, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DiagnosticSettingsCategoryResourceCollectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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/DiagnosticSettingsCategoryResourceCollectionImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoryResourceCollectionImpl.java new file mode 100644 index 0000000000000..f9afdb4b12d98 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoryResourceCollectionImpl.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.implementation; + +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsCategoryResourceCollectionInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsCategoryResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsCategoryResource; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsCategoryResourceCollection; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class DiagnosticSettingsCategoryResourceCollectionImpl + implements DiagnosticSettingsCategoryResourceCollection { + private DiagnosticSettingsCategoryResourceCollectionInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + DiagnosticSettingsCategoryResourceCollectionImpl( + DiagnosticSettingsCategoryResourceCollectionInner 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 DiagnosticSettingsCategoryResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public DiagnosticSettingsCategoryResourceCollectionInner 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/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..5cb53bf3d7866 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoryResourceImpl.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.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsCategoryResourceInner; +import com.azure.resourcemanager.monitor.generated.models.CategoryType; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsCategoryResource; + +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 CategoryType categoryType() { + return this.innerModel().categoryType(); + } + + 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..3d94cba78c34c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsOperationsClientImpl.java @@ -0,0 +1,585 @@ +// Copyright (c) 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.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.resourcemanager.monitor.generated.fluent.DiagnosticSettingsOperationsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsResourceCollectionInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsResourceInner; +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") + private 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 = "2017-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 = "2017-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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getAsync(resourceUri, name).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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 = "2017-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 = "2017-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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 createOrUpdateAsync(resourceUri, name, parameters).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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 = "2017-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 = "2017-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((Response res) -> 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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) { + deleteAsync(resourceUri, name).block(); + } + + /** + * 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(); + } + + /** + * 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 Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync(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 = "2017-05-01-preview"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), resourceUri, apiVersion, accept, context)) + .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 Response} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listWithResponseAsync( + 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 = "2017-05-01-preview"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service.list(this.client.getEndpoint(), resourceUri, apiVersion, accept, 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync(String resourceUri) { + return listWithResponseAsync(resourceUri) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DiagnosticSettingsResourceCollectionInner list(String resourceUri) { + return listAsync(resourceUri).block(); + } + + /** + * 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 Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(String resourceUri, Context context) { + return listWithResponseAsync(resourceUri, context).block(); + } +} 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..d048141dc0b9f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsOperationsImpl.java @@ -0,0 +1,201 @@ +// Copyright (c) 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.DiagnosticSettingsOperationsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsResourceCollectionInner; +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; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsResourceCollection; + +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 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 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 void deleteByResourceGroup(String resourceUri, String name) { + this.serviceClient().delete(resourceUri, name); + } + + public Response deleteWithResponse(String resourceUri, String name, Context context) { + return this.serviceClient().deleteWithResponse(resourceUri, name, context); + } + + public DiagnosticSettingsResourceCollection list(String resourceUri) { + DiagnosticSettingsResourceCollectionInner inner = this.serviceClient().list(resourceUri); + if (inner != null) { + return new DiagnosticSettingsResourceCollectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response listWithResponse(String resourceUri, Context context) { + Response inner = + this.serviceClient().listWithResponse(resourceUri, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DiagnosticSettingsResourceCollectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + 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.deleteWithResponse(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.deleteWithResponse(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/DiagnosticSettingsResourceCollectionImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsResourceCollectionImpl.java new file mode 100644 index 0000000000000..eeb22f68337e4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsResourceCollectionImpl.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.DiagnosticSettingsResourceCollectionInner; +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsResource; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsResourceCollection; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class DiagnosticSettingsResourceCollectionImpl implements DiagnosticSettingsResourceCollection { + private DiagnosticSettingsResourceCollectionInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + DiagnosticSettingsResourceCollectionImpl( + DiagnosticSettingsResourceCollectionInner 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 DiagnosticSettingsResourceImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public DiagnosticSettingsResourceCollectionInner 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/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..89495493e0a20 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsResourceImpl.java @@ -0,0 +1,219 @@ +// Copyright (c) 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.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 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 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 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..5737b7806b3b6 --- /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") + private 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..4f35014f11eb4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LogProfilesClientImpl.java @@ -0,0 +1,805 @@ +// Copyright (c) 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") + private 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((Response res) -> Mono.empty()); + } + + /** + * 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) { + deleteAsync(logProfileName).block(); + } + + /** + * 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(); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getAsync(logProfileName).block(); + } + + /** + * 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(); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 createOrUpdateAsync(logProfileName, parameters).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 updateAsync(logProfileName, logProfilesResource).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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..e24cef10bfbbd --- /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 void delete(String logProfileName) { + this.serviceClient().delete(logProfileName); + } + + public Response deleteWithResponse(String logProfileName, Context context) { + return this.serviceClient().deleteWithResponse(logProfileName, context); + } + + public LogProfileResource get(String logProfileName) { + LogProfileResourceInner inner = this.serviceClient().get(logProfileName); + if (inner != null) { + return new LogProfileResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + 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 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/LogSearchRuleResourceImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LogSearchRuleResourceImpl.java new file mode 100644 index 0000000000000..98b2a9f0e97c4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LogSearchRuleResourceImpl.java @@ -0,0 +1,274 @@ +// Copyright (c) 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.LogSearchRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.Action; +import com.azure.resourcemanager.monitor.generated.models.Enabled; +import com.azure.resourcemanager.monitor.generated.models.LogSearchRuleResource; +import com.azure.resourcemanager.monitor.generated.models.LogSearchRuleResourcePatch; +import com.azure.resourcemanager.monitor.generated.models.ProvisioningState; +import com.azure.resourcemanager.monitor.generated.models.Schedule; +import com.azure.resourcemanager.monitor.generated.models.Source; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class LogSearchRuleResourceImpl + implements LogSearchRuleResource, LogSearchRuleResource.Definition, LogSearchRuleResource.Update { + private LogSearchRuleResourceInner 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 kind() { + return this.innerModel().kind(); + } + + public String etag() { + return this.innerModel().etag(); + } + + 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 Boolean autoMitigate() { + return this.innerModel().autoMitigate(); + } + + public Enabled enabled() { + return this.innerModel().enabled(); + } + + public OffsetDateTime lastUpdatedTime() { + return this.innerModel().lastUpdatedTime(); + } + + public ProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Source source() { + return this.innerModel().source(); + } + + public Schedule schedule() { + return this.innerModel().schedule(); + } + + public Action action() { + return this.innerModel().action(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public LogSearchRuleResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String ruleName; + + private LogSearchRuleResourcePatch updateParameters; + + public LogSearchRuleResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public LogSearchRuleResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getScheduledQueryRules() + .createOrUpdateWithResponse(resourceGroupName, ruleName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public LogSearchRuleResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getScheduledQueryRules() + .createOrUpdateWithResponse(resourceGroupName, ruleName, this.innerModel(), context) + .getValue(); + return this; + } + + LogSearchRuleResourceImpl(String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new LogSearchRuleResourceInner(); + this.serviceManager = serviceManager; + this.ruleName = name; + } + + public LogSearchRuleResourceImpl update() { + this.updateParameters = new LogSearchRuleResourcePatch(); + return this; + } + + public LogSearchRuleResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getScheduledQueryRules() + .updateWithResponse(resourceGroupName, ruleName, updateParameters, Context.NONE) + .getValue(); + return this; + } + + public LogSearchRuleResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getScheduledQueryRules() + .updateWithResponse(resourceGroupName, ruleName, updateParameters, context) + .getValue(); + return this; + } + + LogSearchRuleResourceImpl( + LogSearchRuleResourceInner 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 LogSearchRuleResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getScheduledQueryRules() + .getByResourceGroupWithResponse(resourceGroupName, ruleName, Context.NONE) + .getValue(); + return this; + } + + public LogSearchRuleResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getScheduledQueryRules() + .getByResourceGroupWithResponse(resourceGroupName, ruleName, context) + .getValue(); + return this; + } + + public LogSearchRuleResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public LogSearchRuleResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public LogSearchRuleResourceImpl withSource(Source source) { + this.innerModel().withSource(source); + return this; + } + + public LogSearchRuleResourceImpl withAction(Action action) { + this.innerModel().withAction(action); + return this; + } + + public LogSearchRuleResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public LogSearchRuleResourceImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public LogSearchRuleResourceImpl withDisplayName(String displayName) { + this.innerModel().withDisplayName(displayName); + return this; + } + + public LogSearchRuleResourceImpl withAutoMitigate(Boolean autoMitigate) { + this.innerModel().withAutoMitigate(autoMitigate); + return this; + } + + public LogSearchRuleResourceImpl withEnabled(Enabled enabled) { + if (isInCreateMode()) { + this.innerModel().withEnabled(enabled); + return this; + } else { + this.updateParameters.withEnabled(enabled); + return this; + } + } + + public LogSearchRuleResourceImpl withSchedule(Schedule schedule) { + this.innerModel().withSchedule(schedule); + 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/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..888dd5db918f7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertResourceImpl.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.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 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..f14217c3b7bbb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsClientImpl.java @@ -0,0 +1,1057 @@ +// Copyright (c) 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") + private 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getByResourceGroupAsync(resourceGroupName, ruleName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 createOrUpdateAsync(resourceGroupName, ruleName, parameters).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 updateAsync(resourceGroupName, ruleName, parameters).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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((Response res) -> 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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) { + deleteAsync(resourceGroupName, ruleName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } +} 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..87f21aaee37af --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsImpl.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.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 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 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 void deleteByResourceGroup(String resourceGroupName, String ruleName) { + this.serviceClient().delete(resourceGroupName, ruleName); + } + + public Response deleteWithResponse(String resourceGroupName, String ruleName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, ruleName, context); + } + + 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.deleteWithResponse(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.deleteWithResponse(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..3521157767cec --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsStatusClientImpl.java @@ -0,0 +1,405 @@ +// Copyright (c) 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") + private 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 listAsync(resourceGroupName, ruleName).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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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. + * @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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 listByNameAsync(resourceGroupName, ruleName, statusName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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(); + } +} 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..43890413345fe --- /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 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 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 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; + } + } + + 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; + } + } + + 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..90eaf8d871d58 --- /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") + private 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..efc0786845e3f --- /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") + private 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/MetricsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricsClientImpl.java new file mode 100644 index 0000000000000..10b23fc77360b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricsClientImpl.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.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.MetricsClient; +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 MetricsClient. */ +public final class MetricsClientImpl implements MetricsClient { + /** The proxy service used to perform REST calls. */ + private final MetricsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of MetricsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + MetricsClientImpl(MonitorClientImpl client) { + this.service = RestProxy.create(MetricsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientMetrics to be used by the proxy service to perform REST + * calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientMetrics") + private interface MetricsService { + @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. + * @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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listAsync( + String resourceUri, + String timespan, + Duration interval, + String metricnames, + String aggregation, + Integer top, + String orderby, + String filter, + ResultType resultType, + String metricnamespace) { + return listWithResponseAsync( + resourceUri, + timespan, + interval, + metricnames, + aggregation, + top, + orderby, + filter, + resultType, + metricnamespace) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * **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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * **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 listAsync( + resourceUri, + timespan, + interval, + metricnames, + aggregation, + top, + orderby, + filter, + resultType, + metricnamespace) + .block(); + } + + /** + * **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(); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricsImpl.java new file mode 100644 index 0000000000000..27bac19c43ebc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricsImpl.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.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.MetricsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.ResponseInner; +import com.azure.resourcemanager.monitor.generated.models.Metrics; +import com.azure.resourcemanager.monitor.generated.models.ResponseModel; +import com.azure.resourcemanager.monitor.generated.models.ResultType; +import java.time.Duration; + +public final class MetricsImpl implements Metrics { + private static final ClientLogger LOGGER = new ClientLogger(MetricsImpl.class); + + private final MetricsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public MetricsImpl( + MetricsClient innerClient, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ResponseModel list(String resourceUri) { + ResponseInner inner = this.serviceClient().list(resourceUri); + if (inner != null) { + return new ResponseModelImpl(inner, this.manager()); + } else { + return null; + } + } + + 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; + } + } + + private MetricsClient 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..95114498d4dd0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorClientBuilder.java @@ -0,0 +1,146 @@ +// Copyright (c) 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.CookiePolicy; +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 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 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 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() { + if (endpoint == null) { + this.endpoint = "https://management.azure.com"; + } + if (environment == null) { + this.environment = AzureEnvironment.AZURE; + } + if (defaultPollInterval == null) { + this.defaultPollInterval = Duration.ofSeconds(30); + } + if (pipeline == null) { + this.pipeline = + new HttpPipelineBuilder() + .policies(new UserAgentPolicy(), new RetryPolicy(), new CookiePolicy()) + .build(); + } + if (serializerAdapter == null) { + this.serializerAdapter = SerializerFactory.createDefaultManagementSerializerAdapter(); + } + MonitorClientImpl client = + new MonitorClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + 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..31fbefc4b0eeb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MonitorClientImpl.java @@ -0,0 +1,658 @@ +// Copyright (c) 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.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.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.MetricsClient; +import com.azure.resourcemanager.monitor.generated.fluent.MonitorClient; +import com.azure.resourcemanager.monitor.generated.fluent.OperationsClient; +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 java.util.Map; +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 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 MetricsClient object to access its operations. */ + private final MetricsClient metrics; + + /** + * Gets the MetricsClient object to access its operations. + * + * @return the MetricsClient object. + */ + public MetricsClient getMetrics() { + return this.metrics; + } + + /** 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; + } + + /** + * 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.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.metrics = new MetricsClientImpl(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); + } + + /** + * 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) { + for (Map.Entry entry : this.getContext().getValues().entrySet()) { + context = context.addData(entry.getKey(), entry.getValue()); + } + return 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/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..86eedbff37e5d --- /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.resourcemanager.monitor.generated.fluent.models.OperationStatusInner; +import com.azure.resourcemanager.monitor.generated.models.ErrorResponseCommon; +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 ErrorResponseCommon 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..0aa48914294ce --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationsClientImpl.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.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") + private 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 listAsync().block(); + } + + /** + * 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(); + } +} 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..0d6f7230adb01 --- /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 OperationListResult list() { + OperationListResultInner inner = this.serviceClient().list(); + if (inner != null) { + return new OperationListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + 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; + } + } + + 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/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..9893bde39712b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionImpl.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.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointConnection; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkServiceConnectionStateProperty; + +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 PrivateEndpointProperty privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + 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(PrivateEndpointProperty privateEndpoint) { + this.innerModel().withPrivateEndpoint(privateEndpoint); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty 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/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..a3a20d33cc8c6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1176 @@ +// Copyright (c) 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.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointConnectionListResult; +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") + private 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({"Accept: application/json;q=0.9", "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, + 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); + + @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 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 = "2019-10-17-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 = "2019-10-17-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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getAsync(resourceGroupName, scopeName, privateEndpointConnectionName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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 A 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>> 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 = "2019-10-17-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 A 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>> 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 = "2019-10-17-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 A 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 a private endpoint connection. + */ + @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 A 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 a private endpoint connection. + */ + @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 A 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String scopeName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return 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 A 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String scopeName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return 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 A 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 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 A 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 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 A 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 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 A 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. + */ + @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 = "2019-10-17-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + privateEndpointConnectionName, + 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 = "2019-10-17-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + privateEndpointConnectionName, + 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 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 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 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 = "2019-10-17-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 = "2019-10-17-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 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 private endpoint connections 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 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 private endpoint connections 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/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..cba2032bb431a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,216 @@ +// Copyright (c) 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.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointConnection; +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 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 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 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 PagedIterable listByPrivateLinkScope(String resourceGroupName, String scopeName) { + PagedIterable inner = + this.serviceClient().listByPrivateLinkScope(resourceGroupName, scopeName); + return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(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 PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + 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..5f722c1cbb243 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourceImpl.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.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 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/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..921e48906a781 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,533 @@ +// Copyright (c) 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.PrivateLinkResourcesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkResourceListResult; +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") + private 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); + + @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 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 + * 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 = "2019-10-17-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 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 + * 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 = "2019-10-17-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 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 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 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 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 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 as paginated + * response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByPrivateLinkScope(String resourceGroupName, String scopeName) { + return new PagedIterable<>(listByPrivateLinkScopeAsync(resourceGroupName, 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 context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 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)); + } + + /** + * 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 = "2019-10-17-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 = "2019-10-17-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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getAsync(resourceGroupName, scopeName, groupName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 private link resources 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 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 private link resources 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/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..c93941fe9804b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourcesImpl.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.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.PrivateLinkResourcesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkResource; +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 PagedIterable listByPrivateLinkScope(String resourceGroupName, String scopeName) { + PagedIterable inner = + this.serviceClient().listByPrivateLinkScope(resourceGroupName, scopeName); + return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(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 PrivateLinkResourceImpl(inner1, this.manager())); + } + + 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; + } + } + + 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; + } + } + + 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..37139114e5d9c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopeOperationStatusClientImpl.java @@ -0,0 +1,230 @@ +// Copyright (c) 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") + private 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 = "2019-10-17-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 = "2019-10-17-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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getByResourceGroupAsync(resourceGroupName, asyncOperationId).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } +} 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..603347e77093e --- /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 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; + } + } + + 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; + } + } + + 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..65ed982fcb2af --- /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") + private 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({"Accept: application/json;q=0.9", "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, + 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 = "2019-10-17-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 = "2019-10-17-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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getAsync(resourceGroupName, scopeName, name).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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(); + } + + /** + * 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 = "2019-10-17-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 = "2019-10-17-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 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 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 = "2019-10-17-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + name, + 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 = "2019-10-17-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + apiVersion, + scopeName, + name, + 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 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 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 = "2019-10-17-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 = "2019-10-17-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 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 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..e6e0158b6c148 --- /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 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 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 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..0c26566becbcf --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopesClientImpl.java @@ -0,0 +1,1391 @@ +// Copyright (c) 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") + private 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({"Accept: application/json;q=0.9", "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, + 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 = "2019-10-17-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 = "2019-10-17-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 = "2019-10-17-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 = "2019-10-17-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 = "2019-10-17-preview"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + scopeName, + 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 = "2019-10-17-preview"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + this.client.getSubscriptionId(), + scopeName, + 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 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 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 = "2019-10-17-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 = "2019-10-17-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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getByResourceGroupAsync(resourceGroupName, scopeName).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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(); + } + + /** + * 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 = "2019-10-17-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 = "2019-10-17-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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 createOrUpdateAsync(resourceGroupName, scopeName, azureMonitorPrivateLinkScopePayload).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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(); + } + + /** + * 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 = "2019-10-17-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 = "2019-10-17-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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 updateTagsAsync(resourceGroupName, scopeName, privateLinkScopeTags).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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(); + } + + /** + * Get the next page of items. + * + * @param nextLink 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 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 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 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..69db07d1d9f58 --- /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 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 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 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/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..ea6af712ed1f2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScheduledQueryRulesClientImpl.java @@ -0,0 +1,1122 @@ +// Copyright (c) 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.LogSearchRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.LogSearchRuleResourceCollection; +import com.azure.resourcemanager.monitor.generated.models.LogSearchRuleResourcePatch; +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") + private interface ScheduledQueryRulesService { + @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") LogSearchRuleResourceInner parameters, + @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("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" + + "/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") LogSearchRuleResourcePatch 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("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}/providers/Microsoft.Insights/scheduledQueryRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @PathParam("subscriptionId") String subscriptionId, + @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("resourceGroupName") String resourceGroupName, + @QueryParam("api-version") String apiVersion, + @QueryParam("$filter") String filter, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates or updates an log search 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 Log Search Rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String ruleName, LogSearchRuleResourceInner 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-04-16"; + 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 an log search 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 Log Search Rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String ruleName, LogSearchRuleResourceInner 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-04-16"; + 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 an log search 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 Log Search Rule resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters) { + return createOrUpdateWithResponseAsync(resourceGroupName, ruleName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Creates or updates an log search 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 Log Search Rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogSearchRuleResourceInner createOrUpdate( + String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters) { + return createOrUpdateAsync(resourceGroupName, ruleName, parameters).block(); + } + + /** + * Creates or updates an log search 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 Log Search Rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, String ruleName, LogSearchRuleResourceInner parameters, Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, ruleName, parameters, context).block(); + } + + /** + * Gets an Log Search 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 an Log Search 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 = "2018-04-16"; + 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 an Log Search 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 an Log Search 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 = "2018-04-16"; + 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 an Log Search 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 an Log Search rule on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String ruleName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, ruleName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets an Log Search 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 an Log Search rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogSearchRuleResourceInner getByResourceGroup(String resourceGroupName, String ruleName) { + return getByResourceGroupAsync(resourceGroupName, ruleName).block(); + } + + /** + * Gets an Log Search 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 an Log Search rule along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, ruleName, context).block(); + } + + /** + * Update log search 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 Log Search Rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String ruleName, LogSearchRuleResourcePatch 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-04-16"; + 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 log search 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 Log Search Rule resource along with {@link Response} on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String ruleName, LogSearchRuleResourcePatch 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-04-16"; + 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 log search 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 Log Search Rule resource on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String ruleName, LogSearchRuleResourcePatch parameters) { + return updateWithResponseAsync(resourceGroupName, ruleName, parameters) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Update log search 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 Log Search Rule resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public LogSearchRuleResourceInner update( + String resourceGroupName, String ruleName, LogSearchRuleResourcePatch parameters) { + return updateAsync(resourceGroupName, ruleName, parameters).block(); + } + + /** + * Update log search 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 Log Search Rule resource along with {@link Response}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String ruleName, LogSearchRuleResourcePatch parameters, Context context) { + return updateWithResponseAsync(resourceGroupName, ruleName, parameters, context).block(); + } + + /** + * Deletes a Log Search 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 = "2018-04-16"; + 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 Log Search 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 = "2018-04-16"; + 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 Log Search 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((Response res) -> Mono.empty()); + } + + /** + * Deletes a Log Search 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) { + deleteAsync(resourceGroupName, ruleName).block(); + } + + /** + * Deletes a Log Search 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(); + } + + /** + * List the Log Search rules within a subscription group. + * + * @param filter The filter to apply on the operation. For more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Search rule resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter) { + 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-04-16"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + filter, + 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 Search rules within a subscription group. + * + * @param filter The filter to apply on the operation. For more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Search rule resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String filter, 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-04-16"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, filter, this.client.getSubscriptionId(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List the Log Search rules within a subscription group. + * + * @param filter The filter to apply on the operation. For more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Search rule resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter) { + return new PagedFlux<>(() -> listSinglePageAsync(filter)); + } + + /** + * List the Log Search rules within a subscription group. + * + * @throws 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 Search rule resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + final String filter = null; + return new PagedFlux<>(() -> listSinglePageAsync(filter)); + } + + /** + * List the Log Search rules within a subscription group. + * + * @param filter The filter to apply on the operation. For more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Search rule resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String filter, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(filter, context)); + } + + /** + * List the Log Search rules within a subscription group. + * + * @throws 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 Search rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + final String filter = null; + return new PagedIterable<>(listAsync(filter)); + } + + /** + * List the Log Search rules within a subscription group. + * + * @param filter The filter to apply on the operation. For more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Search rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String filter, Context context) { + return new PagedIterable<>(listAsync(filter, context)); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter The filter to apply on the operation. For more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Search rule resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String filter) { + 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 = "2018-04-16"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + filter, + 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 Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter The filter to apply on the operation. For more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Search rule resources along with {@link PagedResponse} on successful + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByResourceGroupSinglePageAsync( + String resourceGroupName, String filter, 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 = "2018-04-16"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + apiVersion, + filter, + this.client.getSubscriptionId(), + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter The filter to apply on the operation. For more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Search rule resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, String filter) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, filter)); + } + + /** + * List the Log Search 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 Log Search rule resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + final String filter = null; + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, filter)); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter The filter to apply on the operation. For more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Search rule resources as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, String filter, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, filter, context)); + } + + /** + * List the Log Search 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 Log Search rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + final String filter = null; + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter)); + } + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter The filter to apply on the operation. For more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Search rule resources as paginated response with {@link PagedIterable}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup( + String resourceGroupName, String filter, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, filter, context)); + } +} 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..57e33f175bd14 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScheduledQueryRulesImpl.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.ScheduledQueryRulesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.LogSearchRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.LogSearchRuleResource; +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 LogSearchRuleResource getByResourceGroup(String resourceGroupName, String ruleName) { + LogSearchRuleResourceInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, ruleName); + if (inner != null) { + return new LogSearchRuleResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + 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 LogSearchRuleResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String ruleName) { + this.serviceClient().delete(resourceGroupName, ruleName); + } + + public Response deleteWithResponse(String resourceGroupName, String ruleName, Context context) { + return this.serviceClient().deleteWithResponse(resourceGroupName, ruleName, context); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return Utils.mapPage(inner, inner1 -> new LogSearchRuleResourceImpl(inner1, this.manager())); + } + + public PagedIterable list(String filter, Context context) { + PagedIterable inner = this.serviceClient().list(filter, context); + return Utils.mapPage(inner, inner1 -> new LogSearchRuleResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return Utils.mapPage(inner, inner1 -> new LogSearchRuleResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup( + String resourceGroupName, String filter, Context context) { + PagedIterable inner = + this.serviceClient().listByResourceGroup(resourceGroupName, filter, context); + return Utils.mapPage(inner, inner1 -> new LogSearchRuleResourceImpl(inner1, this.manager())); + } + + public LogSearchRuleResource 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.deleteWithResponse(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.deleteWithResponse(resourceGroupName, ruleName, context); + } + + private ScheduledQueryRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + public LogSearchRuleResourceImpl define(String name) { + return new LogSearchRuleResourceImpl(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..b376a07e3bf6a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScopedResourceImpl.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.implementation; + +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 String linkedResourceId() { + return this.innerModel().linkedResourceId(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + 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..bbb64eed0dab0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActivityLogsClientImpl.java @@ -0,0 +1,428 @@ +// Copyright (c) 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") + private 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 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 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/TestNotificationResponseImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TestNotificationResponseImpl.java new file mode 100644 index 0000000000000..3a5765d1a6af9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TestNotificationResponseImpl.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.TestNotificationResponseInner; +import com.azure.resourcemanager.monitor.generated.models.TestNotificationResponse; + +public final class TestNotificationResponseImpl implements TestNotificationResponse { + private TestNotificationResponseInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + TestNotificationResponseImpl( + TestNotificationResponseInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String notificationId() { + return this.innerModel().notificationId(); + } + + public String correlationId() { + return this.innerModel().correlationId(); + } + + public String createdTime() { + return this.innerModel().createdTime(); + } + + public TestNotificationResponseInner 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..c45f55387c966 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/VMInsightsClientImpl.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.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") + private 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( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * 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 getOnboardingStatusAsync(resourceUri).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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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(); + } +} 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..15e6f769824a2 --- /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 VMInsightsOnboardingStatus getOnboardingStatus(String resourceUri) { + VMInsightsOnboardingStatusInner inner = this.serviceClient().getOnboardingStatus(resourceUri); + if (inner != null) { + return new VMInsightsOnboardingStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + 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; + } + } + + 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/Action.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Action.java new file mode 100644 index 0000000000000..c2b07d00e7a54 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Action.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; + +/** Action descriptor. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "odata.type", + defaultImpl = Action.class) +@JsonTypeName("Action") +@JsonSubTypes({ + @JsonSubTypes.Type( + name = + "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts" + + ".Resources.ScheduledQueryRules.AlertingAction", + value = AlertingAction.class), + @JsonSubTypes.Type( + name = + "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts" + + ".Resources.ScheduledQueryRules.LogToMetricAction", + value = LogToMetricAction.class) +}) +@Immutable +public class Action { + /** + * 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..b22668e542fcc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionDetail.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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/ActionGroupAutoGenerated.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupAutoGenerated.java new file mode 100644 index 0000000000000..87c663e221d86 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupAutoGenerated.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.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 ActionGroupAutoGenerated { + /* + * 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; + + /** + * 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 ActionGroupAutoGenerated object itself. + */ + public ActionGroupAutoGenerated 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 ActionGroupAutoGenerated object itself. + */ + public ActionGroupAutoGenerated 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 ActionGroupAutoGenerated")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ActionGroupAutoGenerated.class); +} 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..52368ad07a2e3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupList.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.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; + + /** + * 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..37ff5a5d53065 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupPatchBody.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.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; + + /** + * 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..a71d2c78e5ed9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupResource.java @@ -0,0 +1,495 @@ +// Copyright (c) Microsoft Corporation. All rights 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 kind property: Azure resource kind. + * + * @return the kind value. + */ + String kind(); + + /** + * Gets the identity property: Azure resource identity. + * + * @return the identity value. + */ + String identity(); + + /** + * 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 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); + + /** + * 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); + + /** + * 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); +} 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..499baf242e454 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroups.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.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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); + + /** + * 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); + + /** + * 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); + + /** + * 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 deleteWithResponse(String resourceGroupName, String actionGroupName, 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 response when test notification succeeded. + */ + TestNotificationResponse 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 response when test notification succeeded. + */ + TestNotificationResponse 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 response when test notification succeeded. + */ + TestNotificationResponse 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 response when test notification succeeded. + */ + TestNotificationResponse createNotificationsAtResourceGroupLevel( + String resourceGroupName, NotificationRequestBody notificationRequest, 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 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 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 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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); + + /** + * 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); + + /** + * 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..89963da538101 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionList.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; +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; + + /** + * 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/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..491d16fe68100 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertResource.java @@ -0,0 +1,305 @@ +// Copyright (c) Microsoft Corporation. All rights 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. + */ + AlertRuleAllOfCondition 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 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(AlertRuleAllOfCondition 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..6c4068353d060 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlerts.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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); + + /** + * 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); + + /** + * 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); + + /** + * 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 deleteWithResponse(String resourceGroupName, String activityLogAlertName, Context context); + + /** + * 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..b34fc737243af --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AggregationType.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for AggregationType. */ +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) { + AggregationType[] items = AggregationType.values(); + for (AggregationType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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..225eabe5b70eb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AggregationTypeEnum.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AggregationTypeEnum. */ +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 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); + } + + /** @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/AlertRuleAllOfCondition.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleAllOfCondition.java new file mode 100644 index 0000000000000..474f103582c34 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleAllOfCondition.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.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 AlertRuleAllOfCondition { + /* + * The list of Activity Log Alert rule conditions. + */ + @JsonProperty(value = "allOf", required = true) + private List allOf; + + /** + * 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 AlertRuleAllOfCondition object itself. + */ + public AlertRuleAllOfCondition 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 AlertRuleAllOfCondition")); + } else { + allOf().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AlertRuleAllOfCondition.class); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleAnyOfOrLeafCondition.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleAnyOfOrLeafCondition.java new file mode 100644 index 0000000000000..03d51d84a1ccc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleAnyOfOrLeafCondition.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.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 AlertRuleAnyOfOrLeafCondition 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; + + /** + * 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 AlertRuleAnyOfOrLeafCondition object itself. + */ + public AlertRuleAnyOfOrLeafCondition withAnyOf(List anyOf) { + this.anyOf = anyOf; + return this; + } + + /** {@inheritDoc} */ + @Override + public AlertRuleAnyOfOrLeafCondition withField(String field) { + super.withField(field); + return this; + } + + /** {@inheritDoc} */ + @Override + public AlertRuleAnyOfOrLeafCondition withEquals(String equals) { + super.withEquals(equals); + return this; + } + + /** {@inheritDoc} */ + @Override + public AlertRuleAnyOfOrLeafCondition 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/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..8e1068f62c351 --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 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 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..8346edce49442 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleLeafCondition.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..aad6372db57e7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleList.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.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; + + /** + * 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..a162d97a54324 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRulePatchObject.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.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; + + /** + * 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..6865bf888f2dd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleResource.java @@ -0,0 +1,418 @@ +// Copyright (c) Microsoft Corporation. All rights 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 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..35dd7bccf1801 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleResourceCollection.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.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; + + /** + * 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..10c8aaf82d43e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleResourcePatch.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.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; + + /** + * 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..fc9360aae83d4 --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); + + /** + * 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 deleteWithResponse(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); + + /** + * 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); + + /** + * 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..a09f1c07c7b5e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertSeverity.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for AlertSeverity. */ +public final class AlertSeverity extends ExpandableStringEnum { + /** Static value 0 for AlertSeverity. */ + public static final AlertSeverity ZERO = fromString("0"); + + /** Static value 1 for AlertSeverity. */ + public static final AlertSeverity ONE = fromString("1"); + + /** Static value 2 for AlertSeverity. */ + public static final AlertSeverity TWO = fromString("2"); + + /** Static value 3 for AlertSeverity. */ + public static final AlertSeverity THREE = fromString("3"); + + /** Static value 4 for AlertSeverity. */ + public static final AlertSeverity FOUR = fromString("4"); + + /** + * Creates or finds a AlertSeverity from its string representation. + * + * @param name a name to look for. + * @return the corresponding AlertSeverity. + */ + @JsonCreator + public static AlertSeverity fromString(String name) { + return fromString(name, AlertSeverity.class); + } + + /** @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/AlertingAction.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertingAction.java new file mode 100644 index 0000000000000..70bedf971110b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertingAction.java @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + +/** Specify action need to be taken when rule type is Alert. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName( + "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources" + + ".ScheduledQueryRules.AlertingAction") +@Fluent +public final class AlertingAction extends Action { + /* + * Severity of the alert + */ + @JsonProperty(value = "severity", required = true) + private AlertSeverity severity; + + /* + * Azure action group reference. + */ + @JsonProperty(value = "aznsAction") + private AzNsActionGroup aznsAction; + + /* + * time (in minutes) for which Alerts should be throttled or suppressed. + */ + @JsonProperty(value = "throttlingInMin") + private Integer throttlingInMin; + + /* + * The trigger condition that results in the alert rule being. + */ + @JsonProperty(value = "trigger", required = true) + private TriggerCondition trigger; + + /** + * Get the severity property: Severity of the alert. + * + * @return the severity value. + */ + public AlertSeverity severity() { + return this.severity; + } + + /** + * Set the severity property: Severity of the alert. + * + * @param severity the severity value to set. + * @return the AlertingAction object itself. + */ + public AlertingAction withSeverity(AlertSeverity severity) { + this.severity = severity; + return this; + } + + /** + * Get the aznsAction property: Azure action group reference. + * + * @return the aznsAction value. + */ + public AzNsActionGroup aznsAction() { + return this.aznsAction; + } + + /** + * Set the aznsAction property: Azure action group reference. + * + * @param aznsAction the aznsAction value to set. + * @return the AlertingAction object itself. + */ + public AlertingAction withAznsAction(AzNsActionGroup aznsAction) { + this.aznsAction = aznsAction; + return this; + } + + /** + * Get the throttlingInMin property: time (in minutes) for which Alerts should be throttled or suppressed. + * + * @return the throttlingInMin value. + */ + public Integer throttlingInMin() { + return this.throttlingInMin; + } + + /** + * Set the throttlingInMin property: time (in minutes) for which Alerts should be throttled or suppressed. + * + * @param throttlingInMin the throttlingInMin value to set. + * @return the AlertingAction object itself. + */ + public AlertingAction withThrottlingInMin(Integer throttlingInMin) { + this.throttlingInMin = throttlingInMin; + return this; + } + + /** + * Get the trigger property: The trigger condition that results in the alert rule being. + * + * @return the trigger value. + */ + public TriggerCondition trigger() { + return this.trigger; + } + + /** + * Set the trigger property: The trigger condition that results in the alert rule being. + * + * @param trigger the trigger value to set. + * @return the AlertingAction object itself. + */ + public AlertingAction withTrigger(TriggerCondition trigger) { + this.trigger = trigger; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (severity() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property severity in model AlertingAction")); + } + if (aznsAction() != null) { + aznsAction().validate(); + } + if (trigger() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property trigger in model AlertingAction")); + } else { + trigger().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(AlertingAction.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..1599537f72e60 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ArmRoleReceiver.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; + +/** 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; + + /** + * 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..38c5b8bdaf39a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutomationRunbookReceiver.java @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..c9a46a27a866b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleNotification.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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..0e1e23d51fc3b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleProfile.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..a6cd80044bf64 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettingResource.java @@ -0,0 +1,387 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 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 'true'. + * + * @return the enabled value. + */ + Boolean enabled(); + + /** + * 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 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.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 'true'.. + * + * @param enabled the enabled flag. Specifies whether automatic scaling is enabled for the resource. The + * default value is 'true'. + * @return the next definition stage. + */ + WithCreate withEnabled(Boolean enabled); + } + /** 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.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 'true'.. + * + * @param enabled the enabled flag. Specifies whether automatic scaling is enabled for the resource. The + * default value is 'true'. + * @return the next definition stage. + */ + Update withEnabled(Boolean enabled); + } + /** 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..92c2556dd4fbd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettingResourceCollection.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.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; + + /** + * 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..11018eec6acfa --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettingResourcePatch.java @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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 'true'. + * + * @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 'true'. + * + * @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 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..13ca5a1c6b3e3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettings.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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); + + /** + * 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 deleteWithResponse(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); + + /** + * 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); + + /** + * 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/AzNsActionGroup.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzNsActionGroup.java new file mode 100644 index 0000000000000..1f4d3305aa987 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzNsActionGroup.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + +/** Azure action group. */ +@Fluent +public final class AzNsActionGroup { + /* + * Azure Action Group reference. + */ + @JsonProperty(value = "actionGroup") + private List actionGroup; + + /* + * Custom subject override for all email ids in Azure action group + */ + @JsonProperty(value = "emailSubject") + private String emailSubject; + + /* + * Custom payload to be sent for all webhook URI in Azure action group + */ + @JsonProperty(value = "customWebhookPayload") + private String customWebhookPayload; + + /** + * Get the actionGroup property: Azure Action Group reference. + * + * @return the actionGroup value. + */ + public List actionGroup() { + return this.actionGroup; + } + + /** + * Set the actionGroup property: Azure Action Group reference. + * + * @param actionGroup the actionGroup value to set. + * @return the AzNsActionGroup object itself. + */ + public AzNsActionGroup withActionGroup(List actionGroup) { + this.actionGroup = actionGroup; + return this; + } + + /** + * Get the emailSubject property: Custom subject override for all email ids in Azure action group. + * + * @return the emailSubject value. + */ + public String emailSubject() { + return this.emailSubject; + } + + /** + * Set the emailSubject property: Custom subject override for all email ids in Azure action group. + * + * @param emailSubject the emailSubject value to set. + * @return the AzNsActionGroup object itself. + */ + public AzNsActionGroup withEmailSubject(String emailSubject) { + this.emailSubject = emailSubject; + return this; + } + + /** + * Get the customWebhookPayload property: Custom payload to be sent for all webhook URI in Azure action group. + * + * @return the customWebhookPayload value. + */ + public String customWebhookPayload() { + return this.customWebhookPayload; + } + + /** + * Set the customWebhookPayload property: Custom payload to be sent for all webhook URI in Azure action group. + * + * @param customWebhookPayload the customWebhookPayload value to set. + * @return the AzNsActionGroup object itself. + */ + public AzNsActionGroup withCustomWebhookPayload(String customWebhookPayload) { + this.customWebhookPayload = customWebhookPayload; + 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/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..b9d46f69186d9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureAppPushReceiver.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 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; + + /** + * 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..4c31292b80239 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureFunctionReceiver.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..fd1a37159a747 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorMetricsDestination.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; + +/** 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; + + /** + * 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..aeddab34549e5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorPrivateLinkScope.java @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 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 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.AzureMonitorPrivateLinkScopeInner + * object. + * + * @return the inner object. + */ + AzureMonitorPrivateLinkScopeInner innerModel(); + + /** The entirety of the AzureMonitorPrivateLinkScope definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + 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. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * 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..0a017b789d77f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorPrivateLinkScopeListResult.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.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; + + /** + * 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/AzureResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureResource.java new file mode 100644 index 0000000000000..7daee8a0973b8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureResource.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.annotation.Fluent; +import com.azure.core.management.Resource; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An azure resource object. */ +@Fluent +public class AzureResource extends Resource { + /* + * Azure resource kind + */ + @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) + private String kind; + + /* + * Azure resource identity + */ + @JsonProperty(value = "identity", access = JsonProperty.Access.WRITE_ONLY) + private String identity; + + /** + * Get the kind property: Azure resource kind. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the identity property: Azure resource identity. + * + * @return the identity value. + */ + public String identity() { + return this.identity; + } + + /** {@inheritDoc} */ + @Override + public AzureResource withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureResource withTags(Map tags) { + super.withTags(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/AzureResourceAutoGenerated.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureResourceAutoGenerated.java new file mode 100644 index 0000000000000..b0492d794f13a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureResourceAutoGenerated.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.annotation.Fluent; +import com.azure.core.management.Resource; +import java.util.Map; + +/** An Azure resource object. */ +@Fluent +public class AzureResourceAutoGenerated extends Resource { + /** {@inheritDoc} */ + @Override + public AzureResourceAutoGenerated withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureResourceAutoGenerated withTags(Map tags) { + super.withTags(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/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..c6ba8c19b8b8b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/BaselineMetadata.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; + +/** 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; + + /** + * 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..3732ae124e702 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/BaselineSensitivity.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for BaselineSensitivity. */ +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 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); + } + + /** @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..18cac8a4be62b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/CategoryType.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for CategoryType. */ +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) { + CategoryType[] items = CategoryType.values(); + for (CategoryType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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..697714825c206 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ColumnDefinition.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; + +/** 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; + + /** + * 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..4c2be67c05d5a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ComparisonOperationType.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ComparisonOperationType. */ +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) { + ComparisonOperationType[] items = ComparisonOperationType.values(); + for (ComparisonOperationType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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/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..9ebad20e91b3e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ConditionOperator.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ConditionOperator. */ +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"); + + /** 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) { + ConditionOperator[] items = ConditionOperator.values(); + for (ConditionOperator item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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/ConditionalOperator.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ConditionalOperator.java new file mode 100644 index 0000000000000..55a33070b65b9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ConditionalOperator.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ConditionalOperator. */ +public final class ConditionalOperator extends ExpandableStringEnum { + /** Static value GreaterThanOrEqual for ConditionalOperator. */ + public static final ConditionalOperator GREATER_THAN_OR_EQUAL = fromString("GreaterThanOrEqual"); + + /** Static value LessThanOrEqual for ConditionalOperator. */ + public static final ConditionalOperator LESS_THAN_OR_EQUAL = fromString("LessThanOrEqual"); + + /** Static value GreaterThan for ConditionalOperator. */ + public static final ConditionalOperator GREATER_THAN = fromString("GreaterThan"); + + /** Static value LessThan for ConditionalOperator. */ + public static final ConditionalOperator LESS_THAN = fromString("LessThan"); + + /** Static value Equal for ConditionalOperator. */ + public static final ConditionalOperator EQUAL = fromString("Equal"); + + /** + * Creates or finds a ConditionalOperator from its string representation. + * + * @param name a name to look for. + * @return the corresponding ConditionalOperator. + */ + @JsonCreator + public static ConditionalOperator fromString(String name) { + return fromString(name, ConditionalOperator.class); + } + + /** @return known ConditionalOperator values. */ + public static Collection values() { + return values(ConditionalOperator.class); + } +} 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..5e018e83f64bd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ConfigurationAccessEndpointSpec.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.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; + + /** + * 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..6babb948d05ed --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Context.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; + +/** 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; + + /** + * 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/Criteria.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Criteria.java new file mode 100644 index 0000000000000..9128dd8ed2f16 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Criteria.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specifies the criteria for converting log to metric. */ +@Fluent +public final class Criteria { + /* + * Name of the metric + */ + @JsonProperty(value = "metricName", required = true) + private String metricName; + + /* + * List of Dimensions for creating metric + */ + @JsonProperty(value = "dimensions") + private List dimensions; + + /** + * 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 Criteria object itself. + */ + public Criteria withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * Get the dimensions property: List of Dimensions for creating metric. + * + * @return the dimensions value. + */ + public List dimensions() { + return this.dimensions; + } + + /** + * Set the dimensions property: List of Dimensions for creating metric. + * + * @param dimensions the dimensions value to set. + * @return the Criteria object itself. + */ + public Criteria withDimensions(List dimensions) { + this.dimensions = dimensions; + 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 Criteria")); + } + if (dimensions() != null) { + dimensions().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Criteria.class); +} 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..a7b2dffdef442 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/CriterionType.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CriterionType. */ +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 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); + } + + /** @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..27c4414332acd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpoint.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.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; + + /** + * 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..86049a38a5257 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointConfigurationAccess.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.models; + +import com.azure.core.annotation.Immutable; + +/** The endpoint used by clients to access their configuration. */ +@Immutable +public final class DataCollectionEndpointConfigurationAccess extends ConfigurationAccessEndpointSpec { + /** + * 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..43f49d49ef119 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointLogsIngestion.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.models; + +import com.azure.core.annotation.Immutable; + +/** The endpoint used by clients to ingest logs. */ +@Immutable +public final class DataCollectionEndpointLogsIngestion extends LogsIngestionEndpointSpec { + /** + * 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..ccc3b518fb5b5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointNetworkAcls.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights 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 { + /** {@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..5b0ccc0f9e1b3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointResource.java @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights 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 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.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 { + /** + * 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); + } + } + /** + * 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..18f54aa0ed001 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointResourceListResult.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.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; + + /** + * 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..f46cd57924605 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpoints.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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); + + /** + * 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); + + /** + * 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); + + /** + * 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 deleteWithResponse(String resourceGroupName, String dataCollectionEndpointName, Context context); + + /** + * 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..d373d4aafe161 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRule.java @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..05cef61cf2e4e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociation.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..03a8f27184bc5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationMetadata.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.models; + +import com.azure.core.annotation.Immutable; + +/** Metadata about the resource. */ +@Immutable +public final class DataCollectionRuleAssociationMetadata extends Metadata { + /** + * 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..ab528529522c3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationProxyOnlyResource.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.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 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 { + /** + * 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); + } + } + /** + * 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..bda6674177123 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationProxyOnlyResourceListResult.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.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; + + /** + * 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..77f54a597b39b --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); + + /** + * 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); + + /** + * 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); + + /** + * 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 deleteWithResponse(String resourceUri, String associationName, Context context); + + /** + * 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..c5cb5eb026258 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleDataSources.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.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 { + /** {@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..abe24f1e2e3e1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleDestinations.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.annotation.Fluent; +import java.util.List; + +/** The specification of destinations. */ +@Fluent +public final class DataCollectionRuleDestinations extends DestinationsSpec { + /** {@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..f4f6b0ee2ac19 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleMetadata.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.models; + +import com.azure.core.annotation.Immutable; + +/** Metadata about the resource. */ +@Immutable +public final class DataCollectionRuleMetadata extends Metadata { + /** + * 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..d5b0dc7a7bcbc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleResource.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 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.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 { + /** + * 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); + } + } + /** + * 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..fc395d05331b0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleResourceListResult.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.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; + + /** + * 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..94de5de6c3308 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRules.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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); + + /** + * 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); + + /** + * 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); + + /** + * 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 deleteWithResponse(String resourceGroupName, String dataCollectionRuleName, Context context); + + /** + * 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..51c4a4218461f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataContainer.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.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; + + /** + * 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..5c74594c01eb3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataFlow.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; +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; + + /** + * 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..985de9050eb79 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataSourcesSpec.java @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..ea55fd2fd6a8a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataStatus.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DataStatus. */ +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 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); + } + + /** @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..f4afe3a5a50df --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DestinationsSpec.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; +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; + + /** + * 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..4c6321ec32912 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DestinationsSpecAzureMonitorMetrics.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.models; + +import com.azure.core.annotation.Fluent; + +/** Azure Monitor Metrics destination. */ +@Fluent +public final class DestinationsSpecAzureMonitorMetrics extends AzureMonitorMetricsDestination { + /** {@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..9bf71d0af9236 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsCategories.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.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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * 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); + + /** + * 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. + */ + DiagnosticSettingsCategoryResourceCollection 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 along with {@link Response}. + */ + Response listWithResponse(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..ef7fb569aae74 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsCategoryResource.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.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsCategoryResourceInner; + +/** 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 categoryType property: The type of the diagnostic settings category. + * + * @return the categoryType value. + */ + CategoryType categoryType(); + + /** + * 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..4d126ee36f1f5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsCategoryResourceCollection.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.models; + +import com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsCategoryResourceCollectionInner; +import java.util.List; + +/** An immutable client-side representation of DiagnosticSettingsCategoryResourceCollection. */ +public interface DiagnosticSettingsCategoryResourceCollection { + /** + * Gets the value property: The collection of diagnostic settings category resources. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner + * com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsCategoryResourceCollectionInner + * object. + * + * @return the inner object. + */ + DiagnosticSettingsCategoryResourceCollectionInner innerModel(); +} 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..6147fb63267fa --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsOperations.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights 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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * 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); + + /** + * 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); + + /** + * 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 deleteWithResponse(String resourceUri, String name, Context 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 com.azure.core.management.exception.ManagementException 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. + */ + DiagnosticSettingsResourceCollection 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 along with {@link Response}. + */ + Response listWithResponse(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..2ad9ac613aef5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsResource.java @@ -0,0 +1,395 @@ +// Copyright (c) Microsoft Corporation. All rights 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.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 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 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.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 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.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 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..b6b10534b6ae7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettingsResourceCollection.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.DiagnosticSettingsResourceCollectionInner; +import java.util.List; + +/** An immutable client-side representation of DiagnosticSettingsResourceCollection. */ +public interface DiagnosticSettingsResourceCollection { + /** + * Gets the value property: The collection of diagnostic settings resources;. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner + * com.azure.resourcemanager.monitor.generated.fluent.models.DiagnosticSettingsResourceCollectionInner object. + * + * @return the inner object. + */ + DiagnosticSettingsResourceCollectionInner innerModel(); +} 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..4c8fe9cb47be8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Dimension.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.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 the criteria for converting log to metric. */ +@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 Operator operator; + + /* + * List of dimension values + */ + @JsonProperty(value = "values", required = true) + private List values; + + /** + * 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 Operator 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(Operator 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/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..078bc2ac54f65 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicMetricCriteria.java @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..1a600ca78c2a5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicThresholdFailingPeriods.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; + +/** 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; + + /** + * 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..75f830bd4903b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicThresholdOperator.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DynamicThresholdOperator. */ +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 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); + } + + /** @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..ab89de311e55a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicThresholdSensitivity.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for DynamicThresholdSensitivity. */ +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 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); + } + + /** @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..4e5bf0ac85648 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EmailNotification.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.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; + + /** + * 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..298c1720af8a9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EmailReceiver.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.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; + + /** + * 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..5b623a25c78e5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EnableRequest.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.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; + + /** + * 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/Enabled.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Enabled.java new file mode 100644 index 0000000000000..5dade673f7241 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Enabled.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Enabled. */ +public final class Enabled extends ExpandableStringEnum { + /** Static value true for Enabled. */ + public static final Enabled TRUE = fromString("true"); + + /** Static value false for Enabled. */ + public static final Enabled FALSE = fromString("false"); + + /** + * Creates or finds a Enabled from its string representation. + * + * @param name a name to look for. + * @return the corresponding Enabled. + */ + @JsonCreator + public static Enabled fromString(String name) { + return fromString(name, Enabled.class); + } + + /** @return known Enabled values. */ + public static Collection values() { + return values(Enabled.class); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ErrorResponseCommon.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ErrorResponseCommon.java new file mode 100644 index 0000000000000..0ade5e49dc328 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ErrorResponseCommon.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.azure.core.management.exception.ManagementError; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The resource management error response. */ +@Immutable +public final class ErrorResponseCommon extends ManagementError { + /* + * The error details. + */ + @JsonProperty(value = "details", access = JsonProperty.Access.WRITE_ONLY) + private List details; + + /** + * Get the details property: The error details. + * + * @return the details value. + */ + public List getDetails() { + return this.details; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (getDetails() != null) { + getDetails().forEach(e -> e.validate()); + } + } +} 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..270a56630439c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventCategoryCollection.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.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; + + /** + * 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..99b3ebeca7792 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventDataCollection.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.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; + + /** + * 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..3c5fdac5e2cc6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventHubReceiver.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.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; + + /** + * 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..384c80e7d8817 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventLevel.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for EventLevel. */ +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) { + EventLevel[] items = EventLevel.values(); + for (EventLevel item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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..bad498f80ebc2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ExtensionDataSource.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.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; + + /** + * 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..097a6b8bfbac5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/HttpRequestInfo.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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/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..5ed3126f95ec5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IisLogsDataSource.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..82a20fd064fb1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IncidentListResult.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.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; + + /** + * 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/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..9efb817f45e21 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ItsmReceiver.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.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; + + /** + * 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/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..95b292437ea80 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownColumnDefinitionType.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 KnownColumnDefinitionType. */ +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 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); + } + + /** @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..a2a56c8c3170e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionEndpointProvisioningState.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 KnownDataCollectionEndpointProvisioningState. */ +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 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); + } + + /** @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..3d5b3d5314e98 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionEndpointResourceKind.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for KnownDataCollectionEndpointResourceKind. */ +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 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); + } + + /** @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..64ab653fd2922 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionRuleAssociationProvisioningState.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 KnownDataCollectionRuleAssociationProvisioningState. */ +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 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); + } + + /** @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..15792a87d24e3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionRuleProvisioningState.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 KnownDataCollectionRuleProvisioningState. */ +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 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); + } + + /** @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..7f862a5311928 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataCollectionRuleResourceKind.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for KnownDataCollectionRuleResourceKind. */ +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 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); + } + + /** @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..45bd2d0cf5fdc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownDataFlowStreams.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.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 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); + } + + /** @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..84b02a8bf7e37 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownExtensionDataSourceStreams.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 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 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); + } + + /** @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..4e956aa75e004 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownLogFileTextSettingsRecordStartTimestampFormat.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for KnownLogFileTextSettingsRecordStartTimestampFormat. */ +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 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); + } + + /** @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..12be23945ad62 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownLogFilesDataSourceFormat.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for KnownLogFilesDataSourceFormat. */ +public final class KnownLogFilesDataSourceFormat extends ExpandableStringEnum { + /** Static value text for KnownLogFilesDataSourceFormat. */ + public static final KnownLogFilesDataSourceFormat TEXT = fromString("text"); + + /** + * 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); + } + + /** @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..f9384c5f737d5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownPerfCounterDataSourceStreams.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.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 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); + } + + /** @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..0d23d268d40df --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownPublicNetworkAccessOptions.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for KnownPublicNetworkAccessOptions. */ +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 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); + } + + /** @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..8a3f06c0bd850 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownSyslogDataSourceFacilityNames.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.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 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); + } + + /** @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..eab3a77206100 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownSyslogDataSourceLogLevels.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.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 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); + } + + /** @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..36651a110f368 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownSyslogDataSourceStreams.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.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 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); + } + + /** @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..75861e8d8054d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/KnownWindowsEventLogDataSourceStreams.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.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 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); + } + + /** @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..9434196ac3f15 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LocationThresholdRuleCondition.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 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; + + /** + * 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..13c9e631863f2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogAnalyticsDestination.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; + +/** 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; + + /** + * 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..72d12d12d289d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFileSettings.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.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; + + /** + * 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..92ac9e8e00707 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFileSettingsText.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights 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 { + /** {@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..6d6c8a3927648 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFileTextSettings.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.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; + + /** + * 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..87559b5806a2b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFilesDataSource.java @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..2d6cc949c66b4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogFilesDataSourceSettings.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.models; + +import com.azure.core.annotation.Fluent; + +/** The log files specific settings. */ +@Fluent +public final class LogFilesDataSourceSettings extends LogFileSettings { + /** {@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/LogMetricTrigger.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogMetricTrigger.java new file mode 100644 index 0000000000000..c857f0258038c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogMetricTrigger.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights 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 log metrics trigger descriptor. */ +@Fluent +public final class LogMetricTrigger { + /* + * Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. + */ + @JsonProperty(value = "thresholdOperator") + private ConditionalOperator thresholdOperator; + + /* + * The threshold of the metric trigger. + */ + @JsonProperty(value = "threshold") + private Double threshold; + + /* + * Metric Trigger Type - 'Consecutive' or 'Total' + */ + @JsonProperty(value = "metricTriggerType") + private MetricTriggerType metricTriggerType; + + /* + * Evaluation of metric on a particular column + */ + @JsonProperty(value = "metricColumn") + private String metricColumn; + + /** + * Get the thresholdOperator property: Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. + * + * @return the thresholdOperator value. + */ + public ConditionalOperator thresholdOperator() { + return this.thresholdOperator; + } + + /** + * Set the thresholdOperator property: Evaluation operation for Metric -'GreaterThan' or 'LessThan' or 'Equal'. + * + * @param thresholdOperator the thresholdOperator value to set. + * @return the LogMetricTrigger object itself. + */ + public LogMetricTrigger withThresholdOperator(ConditionalOperator thresholdOperator) { + this.thresholdOperator = thresholdOperator; + return this; + } + + /** + * Get the threshold property: The threshold of the metric trigger. + * + * @return the threshold value. + */ + public Double threshold() { + return this.threshold; + } + + /** + * Set the threshold property: The threshold of the metric trigger. + * + * @param threshold the threshold value to set. + * @return the LogMetricTrigger object itself. + */ + public LogMetricTrigger withThreshold(Double threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the metricTriggerType property: Metric Trigger Type - 'Consecutive' or 'Total'. + * + * @return the metricTriggerType value. + */ + public MetricTriggerType metricTriggerType() { + return this.metricTriggerType; + } + + /** + * Set the metricTriggerType property: Metric Trigger Type - 'Consecutive' or 'Total'. + * + * @param metricTriggerType the metricTriggerType value to set. + * @return the LogMetricTrigger object itself. + */ + public LogMetricTrigger withMetricTriggerType(MetricTriggerType metricTriggerType) { + this.metricTriggerType = metricTriggerType; + return this; + } + + /** + * Get the metricColumn property: Evaluation of metric on a particular column. + * + * @return the metricColumn value. + */ + public String metricColumn() { + return this.metricColumn; + } + + /** + * Set the metricColumn property: Evaluation of metric on a particular column. + * + * @param metricColumn the metricColumn value to set. + * @return the LogMetricTrigger object itself. + */ + public LogMetricTrigger withMetricColumn(String metricColumn) { + this.metricColumn = metricColumn; + 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/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..bbfc81ee3249e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfileCollection.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.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; + + /** + * 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..18b2f56d87093 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfileResourcePatch.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..30fa7960c39dc --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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); + + /** + * 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); + + /** + * 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); + + /** + * 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); + + /** + * 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/LogSearchRuleResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogSearchRuleResource.java new file mode 100644 index 0000000000000..4e262a23a2159 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogSearchRuleResource.java @@ -0,0 +1,387 @@ +// Copyright (c) Microsoft Corporation. All rights 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.LogSearchRuleResourceInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of LogSearchRuleResource. */ +public interface LogSearchRuleResource { + /** + * 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: Metadata used by portal/tooling/etc to render different UX experiences for resources of + * the same type; e.g. ApiApps are a kind of Microsoft.Web/sites type. If supported, the resource provider must + * validate and persist this value. + * + * @return the kind value. + */ + String 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 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 Log Search 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 autoMitigate property: The flag that indicates whether the alert should be automatically resolved or + * not. The default is false. + * + * @return the autoMitigate value. + */ + Boolean autoMitigate(); + + /** + * Gets the enabled property: The flag which indicates whether the Log Search rule is enabled. Value should be true + * or false. + * + * @return the enabled value. + */ + Enabled enabled(); + + /** + * Gets the lastUpdatedTime property: Last time the rule was updated in IS08601 format. + * + * @return the lastUpdatedTime value. + */ + OffsetDateTime lastUpdatedTime(); + + /** + * Gets the provisioningState property: Provisioning state of the scheduled query rule. + * + * @return the provisioningState value. + */ + ProvisioningState provisioningState(); + + /** + * Gets the source property: Data Source against which rule will Query Data. + * + * @return the source value. + */ + Source source(); + + /** + * Gets the schedule property: Schedule (Frequency, Time Window) for rule. Required for action type - + * AlertingAction. + * + * @return the schedule value. + */ + Schedule schedule(); + + /** + * Gets the action property: Action needs to be taken on rule execution. + * + * @return the action value. + */ + Action action(); + + /** + * 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.LogSearchRuleResourceInner object. + * + * @return the inner object. + */ + LogSearchRuleResourceInner innerModel(); + + /** The entirety of the LogSearchRuleResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithSource, + DefinitionStages.WithAction, + DefinitionStages.WithCreate { + } + /** The LogSearchRuleResource definition stages. */ + interface DefinitionStages { + /** The first stage of the LogSearchRuleResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the LogSearchRuleResource 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 LogSearchRuleResource 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. + */ + WithSource withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the LogSearchRuleResource definition allowing to specify source. */ + interface WithSource { + /** + * Specifies the source property: Data Source against which rule will Query Data. + * + * @param source Data Source against which rule will Query Data. + * @return the next definition stage. + */ + WithAction withSource(Source source); + } + /** The stage of the LogSearchRuleResource definition allowing to specify action. */ + interface WithAction { + /** + * Specifies the action property: Action needs to be taken on rule execution.. + * + * @param action Action needs to be taken on rule execution. + * @return the next definition stage. + */ + WithCreate withAction(Action action); + } + /** + * The stage of the LogSearchRuleResource 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.WithDisplayName, + DefinitionStages.WithAutoMitigate, + DefinitionStages.WithEnabled, + DefinitionStages.WithSchedule { + /** + * Executes the create request. + * + * @return the created resource. + */ + LogSearchRuleResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + LogSearchRuleResource create(Context context); + } + /** The stage of the LogSearchRuleResource 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 LogSearchRuleResource definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: The description of the Log Search rule.. + * + * @param description The description of the Log Search rule. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the LogSearchRuleResource 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 LogSearchRuleResource 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 false.. + * + * @param autoMitigate The flag that indicates whether the alert should be automatically resolved or not. + * The default is false. + * @return the next definition stage. + */ + WithCreate withAutoMitigate(Boolean autoMitigate); + } + /** The stage of the LogSearchRuleResource definition allowing to specify enabled. */ + interface WithEnabled { + /** + * Specifies the enabled property: The flag which indicates whether the Log Search rule is enabled. Value + * should be true or false. + * + * @param enabled The flag which indicates whether the Log Search rule is enabled. Value should be true or + * false. + * @return the next definition stage. + */ + WithCreate withEnabled(Enabled enabled); + } + /** The stage of the LogSearchRuleResource definition allowing to specify schedule. */ + interface WithSchedule { + /** + * Specifies the schedule property: Schedule (Frequency, Time Window) for rule. Required for action type - + * AlertingAction. + * + * @param schedule Schedule (Frequency, Time Window) for rule. Required for action type - AlertingAction. + * @return the next definition stage. + */ + WithCreate withSchedule(Schedule schedule); + } + } + /** + * Begins update for the LogSearchRuleResource resource. + * + * @return the stage of resource update. + */ + LogSearchRuleResource.Update update(); + + /** The template for LogSearchRuleResource update. */ + interface Update extends UpdateStages.WithTags, UpdateStages.WithEnabled { + /** + * Executes the update request. + * + * @return the updated resource. + */ + LogSearchRuleResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + LogSearchRuleResource apply(Context context); + } + /** The LogSearchRuleResource update stages. */ + interface UpdateStages { + /** The stage of the LogSearchRuleResource 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 LogSearchRuleResource update allowing to specify enabled. */ + interface WithEnabled { + /** + * Specifies the enabled property: The flag which indicates whether the Log Search rule is enabled. Value + * should be true or false. + * + * @param enabled The flag which indicates whether the Log Search rule is enabled. Value should be true or + * false. + * @return the next definition stage. + */ + Update withEnabled(Enabled enabled); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + LogSearchRuleResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + LogSearchRuleResource refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogSearchRuleResourceCollection.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogSearchRuleResourceCollection.java new file mode 100644 index 0000000000000..6b498490980fb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogSearchRuleResourceCollection.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.annotation.Fluent; +import com.azure.resourcemanager.monitor.generated.fluent.models.LogSearchRuleResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of Log Search rule resources. */ +@Fluent +public final class LogSearchRuleResourceCollection { + /* + * The values for the Log Search Rule resources. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The values for the Log Search Rule resources. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The values for the Log Search Rule resources. + * + * @param value the value value to set. + * @return the LogSearchRuleResourceCollection object itself. + */ + public LogSearchRuleResourceCollection 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/LogSearchRuleResourcePatch.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogSearchRuleResourcePatch.java new file mode 100644 index 0000000000000..a73dcb65d21e5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogSearchRuleResourcePatch.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.resourcemanager.monitor.generated.fluent.models.LogSearchRulePatch; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The log search rule resource for patch operations. */ +@Fluent +public final class LogSearchRuleResourcePatch { + /* + * Resource tags + */ + @JsonProperty(value = "tags") + @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) + private Map tags; + + /* + * The log search rule properties of the resource. + */ + @JsonProperty(value = "properties") + private LogSearchRulePatch innerProperties; + + /** + * 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 LogSearchRuleResourcePatch object itself. + */ + public LogSearchRuleResourcePatch withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the innerProperties property: The log search rule properties of the resource. + * + * @return the innerProperties value. + */ + private LogSearchRulePatch innerProperties() { + return this.innerProperties; + } + + /** + * Get the enabled property: The flag which indicates whether the Log Search rule is enabled. Value should be true + * or false. + * + * @return the enabled value. + */ + public Enabled enabled() { + return this.innerProperties() == null ? null : this.innerProperties().enabled(); + } + + /** + * Set the enabled property: The flag which indicates whether the Log Search rule is enabled. Value should be true + * or false. + * + * @param enabled the enabled value to set. + * @return the LogSearchRuleResourcePatch object itself. + */ + public LogSearchRuleResourcePatch withEnabled(Enabled enabled) { + if (this.innerProperties() == null) { + this.innerProperties = new LogSearchRulePatch(); + } + 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/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..9fa88d776df91 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogSettings.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; + +/** 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; + + /* + * 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; + + /** + * 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 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/LogToMetricAction.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogToMetricAction.java new file mode 100644 index 0000000000000..6a4e1f56a7a54 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogToMetricAction.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.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.util.List; + +/** Specify action need to be taken when rule type is converting log to metric. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "odata.type") +@JsonTypeName( + "Microsoft.WindowsAzure.Management.Monitoring.Alerts.Models.Microsoft.AppInsights.Nexus.DataContracts.Resources" + + ".ScheduledQueryRules.LogToMetricAction") +@Fluent +public final class LogToMetricAction extends Action { + /* + * Criteria of Metric + */ + @JsonProperty(value = "criteria", required = true) + private List criteria; + + /** + * Get the criteria property: Criteria of Metric. + * + * @return the criteria value. + */ + public List criteria() { + return this.criteria; + } + + /** + * Set the criteria property: Criteria of Metric. + * + * @param criteria the criteria value to set. + * @return the LogToMetricAction object itself. + */ + public LogToMetricAction withCriteria(List criteria) { + this.criteria = criteria; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (criteria() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property criteria in model LogToMetricAction")); + } else { + criteria().forEach(e -> e.validate()); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(LogToMetricAction.class); +} 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..dc9b88efba19b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogicAppReceiver.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..7b87763d2f315 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogsIngestionEndpointSpec.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.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; + + /** + * 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..eaf21f803148e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ManagementEventAggregationCondition.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..b9e986183acbe --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ManagementEventRuleCondition.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.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; + + /** + * 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..8bd648faa5e46 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Metadata.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.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; + + /** + * 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..a4cf228598872 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertAction.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.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; + + /** + * 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..3289c2bd06c0b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertCriteria.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.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; + + /** + * 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..1e6d1a7fc390a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertMultipleResourceMultipleMetricCriteria.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.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; + + /** + * 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..93c4a08cfa62b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertResource.java @@ -0,0 +1,565 @@ +// Copyright (c) Microsoft Corporation. All rights 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 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..d5cb4de52f4dc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertResourceCollection.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.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; + + /** + * 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..8883505f006b7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertResourcePatch.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.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; + + /** + * 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..0a494ef8b52ed --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertSingleResourceMultipleMetricCriteria.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.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; + + /** + * 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..a20107d7549ff --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertStatus.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.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; + + /** + * 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..0300dc70322b5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertStatusProperties.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.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; + + /** + * 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..a2eb4e04e303d --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * 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); + + /** + * 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); + + /** + * 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 deleteWithResponse(String resourceGroupName, String ruleName, Context context); + + /** + * 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..296fd3dad01fe --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 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. + * @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); + + /** + * 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); +} 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..828682916b2b9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAvailability.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.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; + + /** + * 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..8f279ee4f24b2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricBaselinesResponse.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.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; + + /** + * 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..f7e514fcb7dd1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricClass.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MetricClass. */ +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 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); + } + + /** @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..73b71c16d9861 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricCriteria.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.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; + + /** + * 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..73442b0b4cea5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDefinitionCollection.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.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; + + /** + * 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..e102ca2e609ed --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDimension.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; +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; + + /** + * 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..6c62df1a2d3af --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespaceCollection.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.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; + + /** + * 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..3dcf8bdb53345 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespaceName.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.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; + + /** + * 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..4d248c1cda2f4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricSettings.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..787219e243875 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricSingleDimension.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; + +/** 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; + + /** + * 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..6e37d0b61cb1e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricStatisticType.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for MetricStatisticType. */ +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) { + MetricStatisticType[] items = MetricStatisticType.values(); + for (MetricStatisticType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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..2b84977adff37 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricTrigger.java @@ -0,0 +1,395 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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/MetricTriggerType.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricTriggerType.java new file mode 100644 index 0000000000000..a1b98ab9fb3f8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricTriggerType.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MetricTriggerType. */ +public final class MetricTriggerType extends ExpandableStringEnum { + /** Static value Consecutive for MetricTriggerType. */ + public static final MetricTriggerType CONSECUTIVE = fromString("Consecutive"); + + /** Static value Total for MetricTriggerType. */ + public static final MetricTriggerType TOTAL = fromString("Total"); + + /** + * Creates or finds a MetricTriggerType from its string representation. + * + * @param name a name to look for. + * @return the corresponding MetricTriggerType. + */ + @JsonCreator + public static MetricTriggerType fromString(String name) { + return fromString(name, MetricTriggerType.class); + } + + /** @return known MetricTriggerType values. */ + public static Collection values() { + return values(MetricTriggerType.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..260526db8e883 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricUnit.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MetricUnit. */ +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 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); + } + + /** @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..00ad29a0e028c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricValue.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..1936910104f12 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Metrics.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 Metrics. */ +public interface Metrics { + /** + * **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); + + /** + * **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); +} 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..137b36be12462 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MultiMetricCriteria.java @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..b196bf148f75a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/NamespaceClassification.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for NamespaceClassification. */ +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 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); + } + + /** @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..5ed9d5e15a565 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/NetworkRuleSet.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.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; + + /** + * 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..781c267dc79cb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/NotificationRequestBody.java @@ -0,0 +1,382 @@ +// Copyright (c) Microsoft Corporation. All rights 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 name of the supported alert type. + */ + @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; + + /** + * Get the alertType property: The name of the supported alert type. + * + * @return the alertType value. + */ + public String alertType() { + return this.alertType; + } + + /** + * Set the alertType property: The name of the supported alert type. + * + * @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..ee6eb8a3aa858 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Odatatype.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for Odatatype. */ +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 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); + } + + /** @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..ce0ae52d2d9ae --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OnboardingStatus.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OnboardingStatus. */ +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 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); + } + + /** @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..b69dfd445799e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Operation.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.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; + + /** + * 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/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..69e0f9dff8bc0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationDisplay.java @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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/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/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..7e8a5e5f58007 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationStatus.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.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. + */ + ErrorResponseCommon 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..368136019992a --- /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. + * + * @throws com.azure.core.management.exception.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(); + + /** + * 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); +} 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..48dbb45a95019 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Operator.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.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for 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"); + + /** Static value Include for Operator. */ + public static final Operator INCLUDE = fromString("Include"); + + /** + * 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); + } + + /** @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/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..1132991a62302 --- /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; + + /** + * 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/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..44ca89cf1a8d6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnection.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.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: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + PrivateEndpointProperty privateEndpoint(); + + /** + * Gets the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState(); + + /** + * Gets the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * 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: Private endpoint which the connection belongs to.. + * + * @param privateEndpoint Private endpoint which the connection belongs to. + * @return the next definition stage. + */ + WithCreate withPrivateEndpoint(PrivateEndpointProperty privateEndpoint); + } + /** + * The stage of the PrivateEndpointConnection definition allowing to specify privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Connection state of the private endpoint + * connection.. + * + * @param privateLinkServiceConnectionState Connection state of the private endpoint connection. + * @return the next definition stage. + */ + WithCreate withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty 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: Private endpoint which the connection belongs to.. + * + * @param privateEndpoint Private endpoint which the connection belongs to. + * @return the next definition stage. + */ + Update withPrivateEndpoint(PrivateEndpointProperty privateEndpoint); + } + /** The stage of the PrivateEndpointConnection update allowing to specify privateLinkServiceConnectionState. */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Connection state of the private endpoint + * connection.. + * + * @param privateLinkServiceConnectionState Connection state of the private endpoint connection. + * @return the next definition stage. + */ + Update withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty 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..b3ec73ada6bbe --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnectionListResult.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.Immutable; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private endpoint connections. */ +@Immutable +public final class PrivateEndpointConnectionListResult { + /* + * 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; + + /** + * 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/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..a314428a362b1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnections.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights 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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * 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); + + /** + * 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 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/PrivateEndpointProperty.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointProperty.java new file mode 100644 index 0000000000000..11902c1cadc57 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointProperty.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Private endpoint which the connection belongs to. */ +@Fluent +public final class PrivateEndpointProperty { + /* + * Resource id of the private endpoint. + */ + @JsonProperty(value = "id") + private String id; + + /** + * Get the id property: Resource id of the private endpoint. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: Resource id of the private endpoint. + * + * @param id the id value to set. + * @return the PrivateEndpointProperty object itself. + */ + public PrivateEndpointProperty withId(String id) { + this.id = id; + 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/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..0b73750246739 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkResource.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.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 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..fdfc407027acc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkResourceListResult.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.Immutable; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Immutable +public final class PrivateLinkResourceListResult { + /* + * 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; + + /** + * 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/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..48fbb2e4dd1a7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkResources.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.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 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 as paginated + * response with {@link PagedIterable}. + */ + PagedIterable 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 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 as paginated + * response with {@link PagedIterable}. + */ + PagedIterable listByPrivateLinkScope( + 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. + * @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); + + /** + * 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); +} 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..7cd235171669d --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * 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); +} 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..4228d4dcb8865 --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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); + + /** + * 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); + + /** + * 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..fac23e7e3830f --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 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 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/PrivateLinkScopesResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkScopesResource.java new file mode 100644 index 0000000000000..944291daddcf9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkScopesResource.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.annotation.Fluent; +import com.azure.core.management.Resource; +import java.util.Map; + +/** An azure resource object. */ +@Fluent +public class PrivateLinkScopesResource extends Resource { + /** {@inheritDoc} */ + @Override + public PrivateLinkScopesResource withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public PrivateLinkScopesResource withTags(Map tags) { + super.withTags(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/PrivateLinkServiceConnectionStateProperty.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkServiceConnectionStateProperty.java new file mode 100644 index 0000000000000..4e0e30b6abb86 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkServiceConnectionStateProperty.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** State of the private endpoint connection. */ +@Fluent +public final class PrivateLinkServiceConnectionStateProperty { + /* + * The private link service connection status. + */ + @JsonProperty(value = "status", required = true) + private String status; + + /* + * The private link service connection description. + */ + @JsonProperty(value = "description", required = true) + private String description; + + /* + * The actions required for private link service connection. + */ + @JsonProperty(value = "actionsRequired", access = JsonProperty.Access.WRITE_ONLY) + private String actionsRequired; + + /** + * Get the status property: The private link service connection status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The private link service connection status. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the description property: The private link service connection description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The private link service connection description. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: The actions required for private link service connection. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property status in model PrivateLinkServiceConnectionStateProperty")); + } + if (description() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property description in model PrivateLinkServiceConnectionStateProperty")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkServiceConnectionStateProperty.class); +} 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..6ab54160a6826 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ProvisioningState.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ProvisioningState. */ +public final class ProvisioningState extends ExpandableStringEnum { + /** Static value Succeeded for ProvisioningState. */ + public static final ProvisioningState SUCCEEDED = fromString("Succeeded"); + + /** Static value Deploying for ProvisioningState. */ + public static final ProvisioningState DEPLOYING = fromString("Deploying"); + + /** Static value Canceled for ProvisioningState. */ + public static final ProvisioningState CANCELED = fromString("Canceled"); + + /** Static value Failed for ProvisioningState. */ + public static final ProvisioningState FAILED = fromString("Failed"); + + /** + * 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); + } + + /** @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/ProxyOnlyResource.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ProxyOnlyResource.java new file mode 100644 index 0000000000000..a07f883477e63 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ProxyOnlyResource.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; + +/** A proxy only azure resource object. */ +@Immutable +public class ProxyOnlyResource extends ProxyResource { + /** + * 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/QueryType.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/QueryType.java new file mode 100644 index 0000000000000..1317fea43d0aa --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/QueryType.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for QueryType. */ +public final class QueryType extends ExpandableStringEnum { + /** Static value ResultCount for QueryType. */ + public static final QueryType RESULT_COUNT = fromString("ResultCount"); + + /** + * Creates or finds a QueryType from its string representation. + * + * @param name a name to look for. + * @return the corresponding QueryType. + */ + @JsonCreator + public static QueryType fromString(String name) { + return fromString(name, QueryType.class); + } + + /** @return known QueryType values. */ + public static Collection values() { + return values(QueryType.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..bcb24d2908755 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ReceiverStatus.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ReceiverStatus. */ +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) { + ReceiverStatus[] items = ReceiverStatus.values(); + for (ReceiverStatus item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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..487e620bca534 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Recurrence.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.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; + + /** + * 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..8ae0222173a3c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RecurrenceFrequency.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for RecurrenceFrequency. */ +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) { + RecurrenceFrequency[] items = RecurrenceFrequency.values(); + for (RecurrenceFrequency item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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..6ff70813cfc16 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RecurrentSchedule.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.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; + + /** + * 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..be793f563c49e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResourceForUpdate.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.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; + + /** + * 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..ae0e8d47dfe14 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResultType.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.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) { + ResultType[] items = ResultType.values(); + for (ResultType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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..e6bdca9957c6e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RetentionPolicy.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.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; + + /** + * 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..26e2d285ca12b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleAction.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.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 { + /** + * 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..1d8bb715c275a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleCondition.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.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; + + /** + * 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..c03f299eadd7d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleDataSource.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 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; + + /** + * 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..03c61b264d13a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleEmailAction.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.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; + + /** + * 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..9ccfa3a891d12 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleManagementEventClaimsDataSource.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.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; + + /** + * 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..4db469748d81e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleManagementEventDataSource.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..a127c54dec721 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleMetricDataSource.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 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; + + /** + * 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/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..40abfd1df6908 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleWebhookAction.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.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; + + /** + * 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..83f4fe5ad5dc0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleAction.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.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; + + /** + * 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..19a11c789db9e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleCapacity.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..cc0530458f29f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleDirection.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ScaleDirection. */ +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) { + ScaleDirection[] items = ScaleDirection.values(); + for (ScaleDirection item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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..80faf0bde458d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleRule.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; + +/** 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; + + /** + * 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..eac254e577034 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleRuleMetricDimension.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 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; + + /** + * 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..5576be78c4275 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleRuleMetricDimensionOperationType.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.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ScaleRuleMetricDimensionOperationType. */ +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 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); + } + + /** @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..3ab555801c7d4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleType.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ScaleType. */ +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) { + ScaleType[] items = ScaleType.values(); + for (ScaleType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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/Schedule.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Schedule.java new file mode 100644 index 0000000000000..1917f2ff8ab1a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Schedule.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.models; + +import com.azure.core.annotation.Fluent; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines how often to run the search and the time interval. */ +@Fluent +public final class Schedule { + /* + * frequency (in minutes) at which rule condition should be evaluated. + */ + @JsonProperty(value = "frequencyInMinutes", required = true) + private int frequencyInMinutes; + + /* + * Time window for which data needs to be fetched for query (should be + * greater than or equal to frequencyInMinutes). + */ + @JsonProperty(value = "timeWindowInMinutes", required = true) + private int timeWindowInMinutes; + + /** + * Get the frequencyInMinutes property: frequency (in minutes) at which rule condition should be evaluated. + * + * @return the frequencyInMinutes value. + */ + public int frequencyInMinutes() { + return this.frequencyInMinutes; + } + + /** + * Set the frequencyInMinutes property: frequency (in minutes) at which rule condition should be evaluated. + * + * @param frequencyInMinutes the frequencyInMinutes value to set. + * @return the Schedule object itself. + */ + public Schedule withFrequencyInMinutes(int frequencyInMinutes) { + this.frequencyInMinutes = frequencyInMinutes; + return this; + } + + /** + * Get the timeWindowInMinutes property: Time window for which data needs to be fetched for query (should be greater + * than or equal to frequencyInMinutes). + * + * @return the timeWindowInMinutes value. + */ + public int timeWindowInMinutes() { + return this.timeWindowInMinutes; + } + + /** + * Set the timeWindowInMinutes property: Time window for which data needs to be fetched for query (should be greater + * than or equal to frequencyInMinutes). + * + * @param timeWindowInMinutes the timeWindowInMinutes value to set. + * @return the Schedule object itself. + */ + public Schedule withTimeWindowInMinutes(int timeWindowInMinutes) { + this.timeWindowInMinutes = timeWindowInMinutes; + 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/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..9695861ea115b --- /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 { + /** + * Gets an Log Search 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 an Log Search rule. + */ + LogSearchRuleResource getByResourceGroup(String resourceGroupName, String ruleName); + + /** + * Gets an Log Search 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 an Log Search rule along with {@link Response}. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context); + + /** + * Deletes a Log Search 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); + + /** + * Deletes a Log Search 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 deleteWithResponse(String resourceGroupName, String ruleName, Context context); + + /** + * List the Log Search rules within a subscription group. + * + * @throws com.azure.core.management.exception.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 Search rule resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(); + + /** + * List the Log Search rules within a subscription group. + * + * @param filter The filter to apply on the operation. For more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. + * @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 Search rule resources as paginated response with {@link PagedIterable}. + */ + PagedIterable list(String filter, Context context); + + /** + * List the Log Search 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 Log Search rule resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param filter The filter to apply on the operation. For more information please see + * https://msdn.microsoft.com/en-us/library/azure/dn931934.aspx. + * @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 Search rule resources as paginated response with {@link PagedIterable}. + */ + PagedIterable listByResourceGroup(String resourceGroupName, String filter, Context context); + + /** + * Gets an Log Search 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 Log Search rule along with {@link Response}. + */ + LogSearchRuleResource getById(String id); + + /** + * Gets an Log Search 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 Log Search rule along with {@link Response}. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a Log Search 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 Log Search 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 LogSearchRuleResource resource. + * + * @param name resource name. + * @return the first stage of the new LogSearchRuleResource definition. + */ + LogSearchRuleResource.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..f4a6befb1b2c6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScopedResource.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.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 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 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..84dd91f330fb0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScopedResourceListResult.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.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; + + /** + * 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..ca8a26082e65c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SenderAuthorization.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; + +/** + * 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; + + /** + * 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..c0a5480fa825c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SingleBaseline.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; +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; + + /** + * 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..be74fb7637981 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SmsReceiver.java @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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/Source.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Source.java new file mode 100644 index 0000000000000..1ab02e3345449 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Source.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 java.util.List; + +/** Specifies the log search query. */ +@Fluent +public final class Source { + /* + * Log search query. Required for action type - AlertingAction + */ + @JsonProperty(value = "query") + private String query; + + /* + * List of Resource referred into query + */ + @JsonProperty(value = "authorizedResources") + private List authorizedResources; + + /* + * The resource uri over which log search query is to be run. + */ + @JsonProperty(value = "dataSourceId", required = true) + private String dataSourceId; + + /* + * Set value to 'ResultCount' . + */ + @JsonProperty(value = "queryType") + private QueryType queryType; + + /** + * Get the query property: Log search query. Required for action type - AlertingAction. + * + * @return the query value. + */ + public String query() { + return this.query; + } + + /** + * Set the query property: Log search query. Required for action type - AlertingAction. + * + * @param query the query value to set. + * @return the Source object itself. + */ + public Source withQuery(String query) { + this.query = query; + return this; + } + + /** + * Get the authorizedResources property: List of Resource referred into query. + * + * @return the authorizedResources value. + */ + public List authorizedResources() { + return this.authorizedResources; + } + + /** + * Set the authorizedResources property: List of Resource referred into query. + * + * @param authorizedResources the authorizedResources value to set. + * @return the Source object itself. + */ + public Source withAuthorizedResources(List authorizedResources) { + this.authorizedResources = authorizedResources; + return this; + } + + /** + * Get the dataSourceId property: The resource uri over which log search query is to be run. + * + * @return the dataSourceId value. + */ + public String dataSourceId() { + return this.dataSourceId; + } + + /** + * Set the dataSourceId property: The resource uri over which log search query is to be run. + * + * @param dataSourceId the dataSourceId value to set. + * @return the Source object itself. + */ + public Source withDataSourceId(String dataSourceId) { + this.dataSourceId = dataSourceId; + return this; + } + + /** + * Get the queryType property: Set value to 'ResultCount' . + * + * @return the queryType value. + */ + public QueryType queryType() { + return this.queryType; + } + + /** + * Set the queryType property: Set value to 'ResultCount' . + * + * @param queryType the queryType value to set. + * @return the Source object itself. + */ + public Source withQueryType(QueryType queryType) { + this.queryType = queryType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (dataSourceId() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException("Missing required property dataSourceId in model Source")); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(Source.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..27059144e6553 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/StreamDeclaration.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; +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; + + /** + * 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..c9b027a201a1d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SyslogDataSource.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.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; + + /** + * 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..ef958a43d20af --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TagsResource.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.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; + + /** + * 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/TestNotificationResponse.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TestNotificationResponse.java new file mode 100644 index 0000000000000..0d14222f1da32 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TestNotificationResponse.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.resourcemanager.monitor.generated.fluent.models.TestNotificationResponseInner; + +/** An immutable client-side representation of TestNotificationResponse. */ +public interface TestNotificationResponse { + /** + * Gets the notificationId property: The notification id. + * + * @return the notificationId value. + */ + String notificationId(); + + /** + * Gets the correlationId property: The correlation id. + * + * @return the correlationId value. + */ + String correlationId(); + + /** + * Gets the createdTime property: The created time. + * + * @return the createdTime value. + */ + String createdTime(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.TestNotificationResponseInner object. + * + * @return the inner object. + */ + TestNotificationResponseInner 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..2cfc860052ee7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ThresholdRuleCondition.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.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; + + /** + * 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/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..2e94f49effe54 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeAggregationOperator.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for TimeAggregationOperator. */ +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) { + TimeAggregationOperator[] items = TimeAggregationOperator.values(); + for (TimeAggregationOperator item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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..14768ccff92e8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeAggregationType.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.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for TimeAggregationType. */ +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) { + TimeAggregationType[] items = TimeAggregationType.values(); + for (TimeAggregationType item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @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..c004f189f4ba1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeSeriesBaseline.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.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; + + /** + * 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..e88bf32c9ac76 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeSeriesElement.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.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; + + /** + * 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..48f1d23c1a390 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeWindow.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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/TriggerCondition.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TriggerCondition.java new file mode 100644 index 0000000000000..6f27d4c8be05c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TriggerCondition.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The condition that results in the Log Search rule. */ +@Fluent +public final class TriggerCondition { + /* + * Evaluation operation for rule - 'GreaterThan' or 'LessThan. + */ + @JsonProperty(value = "thresholdOperator", required = true) + private ConditionalOperator thresholdOperator; + + /* + * Result or count threshold based on which rule should be triggered. + */ + @JsonProperty(value = "threshold", required = true) + private double threshold; + + /* + * Trigger condition for metric query rule + */ + @JsonProperty(value = "metricTrigger") + private LogMetricTrigger metricTrigger; + + /** + * Get the thresholdOperator property: Evaluation operation for rule - 'GreaterThan' or 'LessThan. + * + * @return the thresholdOperator value. + */ + public ConditionalOperator thresholdOperator() { + return this.thresholdOperator; + } + + /** + * Set the thresholdOperator property: Evaluation operation for rule - 'GreaterThan' or 'LessThan. + * + * @param thresholdOperator the thresholdOperator value to set. + * @return the TriggerCondition object itself. + */ + public TriggerCondition withThresholdOperator(ConditionalOperator thresholdOperator) { + this.thresholdOperator = thresholdOperator; + return this; + } + + /** + * Get the threshold property: Result or count threshold based on which rule should be triggered. + * + * @return the threshold value. + */ + public double threshold() { + return this.threshold; + } + + /** + * Set the threshold property: Result or count threshold based on which rule should be triggered. + * + * @param threshold the threshold value to set. + * @return the TriggerCondition object itself. + */ + public TriggerCondition withThreshold(double threshold) { + this.threshold = threshold; + return this; + } + + /** + * Get the metricTrigger property: Trigger condition for metric query rule. + * + * @return the metricTrigger value. + */ + public LogMetricTrigger metricTrigger() { + return this.metricTrigger; + } + + /** + * Set the metricTrigger property: Trigger condition for metric query rule. + * + * @param metricTrigger the metricTrigger value to set. + * @return the TriggerCondition object itself. + */ + public TriggerCondition withMetricTrigger(LogMetricTrigger metricTrigger) { + this.metricTrigger = metricTrigger; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (thresholdOperator() == null) { + throw LOGGER + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property thresholdOperator in model TriggerCondition")); + } + if (metricTrigger() != null) { + metricTrigger().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(TriggerCondition.class); +} 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..4c9992819f10c --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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); + + /** + * 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); +} 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..dab716d9d5a33 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/VoiceReceiver.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..d19bdc8e58801 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebhookNotification.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.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; + + /** + * 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..5213696d7c88c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebhookReceiver.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.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; + + /** + * 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..e422ff6776587 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebtestLocationAvailabilityCriteria.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights 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; + + /** + * 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..b0b80bb53993d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WindowsEventLogDataSource.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; + +/** + * 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; + + /** + * 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..3823f7755725b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WorkspaceInfo.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.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(); + + /** + * 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/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..ba8aac6cc7a19 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsCreateNotificationsAtResourceGroupLevelSamples.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.core.util.Context; +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-04-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("1") + .withPhoneNumber("1234567890"), + new SmsReceiver() + .withName("Jane Smith's mobile") + .withCountryCode("1") + .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("1") + .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"))), + 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..d0cbd649edfe9 --- /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-04-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("1") + .withPhoneNumber("1234567890"), + new SmsReceiver() + .withName("Jane Smith's mobile") + .withCountryCode("1") + .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("1") + .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..ccafdb303d7c2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsDeleteSamples.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; + +import com.azure.core.util.Context; + +/** Samples for ActionGroups Delete. */ +public final class ActionGroupsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-04-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().deleteWithResponse("Default-NotificationRules", "SampleActionGroup", 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..ab89f88c3c875 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsEnableReceiverSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) 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.core.util.Context; +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-04-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"), + 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..fbab86d5ce85b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** Samples for ActionGroups GetByResourceGroup. */ +public final class ActionGroupsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-04-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", 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..3cb47368d3897 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetTestNotificationsAtResourceGroupLevelSamples.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; + +import com.azure.core.util.Context; + +/** Samples for ActionGroups GetTestNotificationsAtResourceGroupLevel. */ +public final class ActionGroupsGetTestNotificationsAtResourceGroupLevelSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-04-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", 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..e41f4436d4f34 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsGetTestNotificationsSamples.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; + +import com.azure.core.util.Context; + +/** Samples for ActionGroups GetTestNotifications. */ +public final class ActionGroupsGetTestNotificationsSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-04-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", 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..c6098a8477bdd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsListByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** Samples for ActionGroups ListByResourceGroup. */ +public final class ActionGroupsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-04-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", 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..7ff28312e015a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsListSamples.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; + +import com.azure.core.util.Context; + +/** Samples for ActionGroups List. */ +public final class ActionGroupsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2022-04-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(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..8e76b24b39bd1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActionGroupsPostTestNotificationsSamples.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.core.util.Context; +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-04-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("1") + .withPhoneNumber("1234567890"), + new SmsReceiver() + .withName("Jane Smith's mobile") + .withCountryCode("1") + .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("1") + .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"))), + 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..8bbff68abd271 --- /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.core.util.Context; +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-04-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", 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..df90c5c93cb65 --- /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.ActionGroupAutoGenerated; +import com.azure.resourcemanager.monitor.generated.models.ActionList; +import com.azure.resourcemanager.monitor.generated.models.AlertRuleAllOfCondition; +import com.azure.resourcemanager.monitor.generated.models.AlertRuleAnyOfOrLeafCondition; +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 AlertRuleAllOfCondition() + .withAllOf( + Arrays + .asList( + new AlertRuleAnyOfOrLeafCondition().withField("category").withEquals("ServiceHealth"), + new AlertRuleAnyOfOrLeafCondition() + .withField("properties.impactedServices[*].ImpactedRegions[*].RegionName") + .withContainsAny(Arrays.asList("North Europe", "West Europe"))))) + .withActions( + new ActionList() + .withActionGroups( + Arrays + .asList( + new ActionGroupAutoGenerated() + .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 AlertRuleAllOfCondition() + .withAllOf( + Arrays + .asList( + new AlertRuleAnyOfOrLeafCondition().withField("category").withEquals("ServiceHealth"), + new AlertRuleAnyOfOrLeafCondition() + .withAnyOf( + Arrays + .asList( + new AlertRuleLeafCondition() + .withField("properties.incidentType") + .withEquals("Incident"), + new AlertRuleLeafCondition() + .withField("properties.incidentType") + .withEquals("Maintenance")))))) + .withActions( + new ActionList() + .withActionGroups( + Arrays + .asList( + new ActionGroupAutoGenerated() + .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 AlertRuleAllOfCondition() + .withAllOf( + Arrays + .asList( + new AlertRuleAnyOfOrLeafCondition().withField("category").withEquals("Administrative"), + new AlertRuleAnyOfOrLeafCondition().withField("level").withEquals("Error")))) + .withActions( + new ActionList() + .withActionGroups( + Arrays + .asList( + new ActionGroupAutoGenerated() + .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..3f822308c7734 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsDeleteSamples.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; + +import com.azure.core.util.Context; + +/** 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().deleteWithResponse("MyResourceGroup", "SampleActivityLogAlertRule", 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..6a41f040b713e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsGetByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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..1d820a707c186 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsListByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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..4f507d958f2f8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogAlertsListSamples.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; + +import com.azure.core.util.Context; + +/** 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(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..fd05d4867a040 --- /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.core.util.Context; +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", 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..92e80775d5d3a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ActivityLogsListSamples.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.core.util.Context; + +/** 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", + 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, + 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..c68593db0ddea --- /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; + +import com.azure.core.util.Context; + +/** 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", 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..c15e4802a34bc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRuleIncidentsListByAlertRuleSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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..74c7dc35486a2 --- /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; + +import com.azure.core.util.Context; + +/** 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().deleteWithResponse("Rac46PostSwapRG", "chiricutin", 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..a0da02a92154c --- /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; + +import com.azure.core.util.Context; + +/** 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", 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..b86eda0fd95af --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesListByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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..5994d67cf12bb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesListSamples.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; + +import com.azure.core.util.Context; + +/** 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(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..42091ab85a68f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AlertRulesUpdateSamples.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.generated; + +import com.azure.core.util.Context; +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", 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..acdd626e1de98 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsCreateOrUpdateSamples.java @@ -0,0 +1,186 @@ +// Copyright (c) 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.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/2015-04-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()) + .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) + .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..3e3ab53a47ee7 --- /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; + +import com.azure.core.util.Context; + +/** Samples for AutoscaleSettings Delete. */ +public final class AutoscaleSettingsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-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().deleteWithResponse("TestingMetricsScaleSet", "MySetting", 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..68fa36f04a00b --- /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; + +import com.azure.core.util.Context; + +/** Samples for AutoscaleSettings GetByResourceGroup. */ +public final class AutoscaleSettingsGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-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", 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..9d85d9087af99 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsListByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** Samples for AutoscaleSettings ListByResourceGroup. */ +public final class AutoscaleSettingsListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-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", 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..24da1439d0afa --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsListSamples.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; + +import com.azure.core.util.Context; + +/** Samples for AutoscaleSettings List. */ +public final class AutoscaleSettingsListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/examples/listAutoscaleSettingBySubscription.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().list(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..edb6a74c1f974 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/AutoscaleSettingsUpdateSamples.java @@ -0,0 +1,189 @@ +// Copyright (c) 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.core.util.Context; +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.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/2015-04-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", Context.NONE) + .getValue(); + resource + .update() + .withTags(mapOf("$type", "Microsoft.WindowsAzure.Management.Common.Storage.CasePreservedDictionary")) + .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) + .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/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..fd0fcea10c2ad --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/BaselinesListSamples.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.generated; + +import com.azure.core.util.Context; +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, + 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..4c111a58c98c9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsCreateSamples.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 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") + .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..cd080371d5389 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsDeleteSamples.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; + +import com.azure.core.util.Context; + +/** 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().deleteWithResponse("myResourceGroup", "myCollectionEndpoint", 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..e2eca417e2fb3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsGetByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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..5848bc0e7258b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsListByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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..3ca977e97c19c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionEndpointsListSamples.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; + +import com.azure.core.util.Context; + +/** 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(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..9a451af33b545 --- /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.core.util.Context; +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", 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..9b3e6a1e7187f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsCreateSamples.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 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") + .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..1b0cac4c56c1f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsDeleteSamples.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; + +import com.azure.core.util.Context; + +/** 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() + .deleteWithResponse( + "subscriptions/703362b3-f278-4e4b-9179-c76eaf41ffc2/resourceGroups/myResourceGroup/providers/Microsoft.Compute/virtualMachines/myVm", + "myAssociation", + 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..c62272b30f303 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsGetSamples.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; + +import com.azure.core.util.Context; + +/** 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", + 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..6cb4ebb530123 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsListByDataCollectionEndpointSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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..0b855c05d4f07 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRuleAssociationsListByResourceSamples.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; + +import com.azure.core.util.Context; + +/** 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", + 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..b3ab371878e8f --- /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; + +import com.azure.core.util.Context; + +/** 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", 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..2d9686c11616b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesCreateSamples.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 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") + .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..25d192a2e22cc --- /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; + +import com.azure.core.util.Context; + +/** 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().deleteWithResponse("myResourceGroup", "myCollectionRule", 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..e7224c56c92af --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesGetByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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..dbe945e159ae0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesListByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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..608ad7163a415 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesListSamples.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; + +import com.azure.core.util.Context; + +/** 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(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..a9d259dfe5c28 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DataCollectionRulesUpdateSamples.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.core.util.Context; +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", 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..930b9b1c48342 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsCategoryGetSamples.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; + +import com.azure.core.util.Context; + +/** Samples for DiagnosticSettingsCategory Get. */ +public final class DiagnosticSettingsCategoryGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-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", + 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..a9f7f7970e5ed --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsCategoryListSamples.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; + +import com.azure.core.util.Context; + +/** Samples for DiagnosticSettingsCategory List. */ +public final class DiagnosticSettingsCategoryListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-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() + .listWithResponse( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + 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..e26fccfb005d7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationCreateOrUpdateSamples.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.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/2017-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/eventhubs/myeventhub/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("") + .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..6a44244f58e7d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationDeleteSamples.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; + +import com.azure.core.util.Context; + +/** Samples for DiagnosticSettingsOperation Delete. */ +public final class DiagnosticSettingsOperationDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-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() + .deleteWithResponse( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + "mysetting", + 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..c9ac0e70683ae --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationGetSamples.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; + +import com.azure.core.util.Context; + +/** Samples for DiagnosticSettingsOperation Get. */ +public final class DiagnosticSettingsOperationGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-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", + 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..163bf60aada1d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/DiagnosticSettingsOperationListSamples.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; + +import com.azure.core.util.Context; + +/** Samples for DiagnosticSettingsOperation List. */ +public final class DiagnosticSettingsOperationListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2017-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() + .listWithResponse( + "subscriptions/1a66ce04-b633-4a0b-b2bc-a912ec8986a6/resourcegroups/viruela1/providers/microsoft.logic/workflows/viruela6", + 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..10a0772765622 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/EventCategoriesListSamples.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; + +import com.azure.core.util.Context; + +/** 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(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..24310a15a9208 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesDeleteSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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..0ed87da0308da --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesGetSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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..1fce39a0e0cf8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/LogProfilesListSamples.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; + +import com.azure.core.util.Context; + +/** 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(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..cdd32d3fa51fd --- /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.core.util.Context; +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", 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..136eee2726b6e --- /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; + +import com.azure.core.util.Context; + +/** 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().deleteWithResponse("gigtest", "chiricutin", 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..42f352ddb0ea3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsGetByResourceGroupSamples.java @@ -0,0 +1,108 @@ +// Copyright (c) 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.core.util.Context; + +/** 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", 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", 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", 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", 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", 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", 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", 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..8036542b49c06 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsListByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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..3c0cf69b671ca --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsListSamples.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; + +import com.azure.core.util.Context; + +/** 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(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..704582dec292f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsStatusListByNameSamples.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.core.util.Context; + +/** 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", + 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..33c2fea090fbd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsStatusListSamples.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; + +import com.azure.core.util.Context; + +/** 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", 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..cce0d8e9c3089 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricAlertsUpdateSamples.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; + +import com.azure.core.util.Context; +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", 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..f8a1fc6cbf134 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricDefinitionsListSamples.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.core.util.Context; + +/** 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", + 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", + 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", + 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..370efd1f6c79f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricNamespacesListSamples.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.core.util.Context; + +/** 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", + Context.NONE); + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricsListSamples.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricsListSamples.java new file mode 100644 index 0000000000000..15dd8b973d9cf --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/MetricsListSamples.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.generated; + +import com.azure.core.util.Context; +import java.time.Duration; + +/** Samples for Metrics List. */ +public final class MetricsListSamples { + /* + * 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 + .metrics() + .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", + 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 + .metrics() + .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", + 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 + .metrics() + .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", + 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..0629ba69b0185 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/OperationsListSamples.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; + +import com.azure.core.util.Context; + +/** 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(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..aa74a970f881d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkServiceConnectionStateProperty; + +/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +public final class PrivateEndpointConnectionsCreateOrUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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 PrivateLinkServiceConnectionStateProperty() + .withStatus("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..9a135e280724d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsDeleteSamples.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; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Delete. */ +public final class PrivateEndpointConnectionsDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", 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..ee94e84dbbdde --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsGetSamples.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; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections Get. */ +public final class PrivateEndpointConnectionsGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", 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..e24576984f3aa --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateEndpointConnectionsListByPrivateLinkScopeSamples.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; + +import com.azure.core.util.Context; + +/** Samples for PrivateEndpointConnections ListByPrivateLinkScope. */ +public final class PrivateEndpointConnectionsListByPrivateLinkScopeSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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() + .listByPrivateLinkScope("MyResourceGroup", "MyPrivateLinkScope", 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..32472aef0172a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkResourcesGetSamples.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; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources Get. */ +public final class PrivateLinkResourcesGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", 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..384d27ca20ad0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkResourcesListByPrivateLinkScopeSamples.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; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkResources ListByPrivateLinkScope. */ +public final class PrivateLinkResourcesListByPrivateLinkScopeSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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().listByPrivateLinkScope("MyResourceGroup", "MyPrivateLinkScope", 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..ffab322028d4b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopeOperationStatusGetByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopeOperationStatus GetByResourceGroup. */ +public final class PrivateLinkScopeOperationStatusGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", 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..7ab09aa51bac1 --- /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.core.util.Context; +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/2019-10-17-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", 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..572a8aa5b1cfe --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesDeleteSamples.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; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopedResources Delete. */ +public final class PrivateLinkScopedResourcesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", 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..7091b3853e7ed --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesGetSamples.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; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopedResources Get. */ +public final class PrivateLinkScopedResourcesGetSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", 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..21084d2e0bbdb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopedResourcesListByPrivateLinkScopeSamples.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; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopedResources ListByPrivateLinkScope. */ +public final class PrivateLinkScopedResourcesListByPrivateLinkScopeSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", 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..8b1f9e4d5a0d4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesCreateOrUpdateSamples.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.generated; + +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/2019-10-17-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") + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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") + .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..03950f90e1b51 --- /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; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes Delete. */ +public final class PrivateLinkScopesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", 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..e48ae33bd9886 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesGetByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes GetByResourceGroup. */ +public final class PrivateLinkScopesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", 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..a9c2e8ceb2df1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesListByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes ListByResourceGroup. */ +public final class PrivateLinkScopesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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", 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..2023d1d583fc9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/PrivateLinkScopesListSamples.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; + +import com.azure.core.util.Context; + +/** Samples for PrivateLinkScopes List. */ +public final class PrivateLinkScopesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/preview/2019-10-17-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(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..ea7404d28affa --- /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.core.util.Context; +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/2019-10-17-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", 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..f807909dcd3a0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesCreateOrUpdateSamples.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.generated; + +import com.azure.resourcemanager.monitor.generated.models.AlertSeverity; +import com.azure.resourcemanager.monitor.generated.models.AlertingAction; +import com.azure.resourcemanager.monitor.generated.models.AzNsActionGroup; +import com.azure.resourcemanager.monitor.generated.models.ConditionalOperator; +import com.azure.resourcemanager.monitor.generated.models.Criteria; +import com.azure.resourcemanager.monitor.generated.models.Enabled; +import com.azure.resourcemanager.monitor.generated.models.LogMetricTrigger; +import com.azure.resourcemanager.monitor.generated.models.LogToMetricAction; +import com.azure.resourcemanager.monitor.generated.models.MetricTriggerType; +import com.azure.resourcemanager.monitor.generated.models.QueryType; +import com.azure.resourcemanager.monitor.generated.models.Schedule; +import com.azure.resourcemanager.monitor.generated.models.Source; +import com.azure.resourcemanager.monitor.generated.models.TriggerCondition; +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/stable/2018-04-16/examples/createOrUpdateScheduledQueryRule-LogToMetricAction.json + */ + /** + * Sample code: Create or Update rule - LogToMetricAction. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateRuleLogToMetricAction( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .scheduledQueryRules() + .define("logtometricfoo") + .withRegion("West Europe") + .withExistingResourceGroup("alertsweu") + .withSource( + new Source() + .withDataSourceId( + "/subscriptions/af52d502-a447-4bc6-8cb7-4780fbb00490/resourceGroups/alertsweu/providers/Microsoft.OperationalInsights/workspaces/alertsweu")) + .withAction( + new LogToMetricAction() + .withCriteria( + Arrays + .asList( + new Criteria().withMetricName("Average_% Idle Time").withDimensions(Arrays.asList())))) + .withTags(mapOf()) + .withDescription("log to metric description") + .withEnabled(Enabled.TRUE) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/createOrUpdateScheduledQueryRuleswithCrossResource.json + */ + /** + * Sample code: Create or Update rule - AlertingAction with Cross-Resource. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateRuleAlertingActionWithCrossResource( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .scheduledQueryRules() + .define("SampleCrossResourceAlert") + .withRegion("eastus") + .withExistingResourceGroup("Rac46PostSwapRG") + .withSource( + new Source() + .withQuery("union requests, workspace(\"sampleWorkspace\").Update") + .withAuthorizedResources( + Arrays + .asList( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.OperationalInsights/workspaces/sampleWorkspace", + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI")) + .withDataSourceId( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/components/sampleAI") + .withQueryType(QueryType.RESULT_COUNT)) + .withAction( + new AlertingAction() + .withSeverity(AlertSeverity.THREE) + .withAznsAction( + new AzNsActionGroup() + .withActionGroup( + Arrays + .asList( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/microsoft.insights/actiongroups/test-ag")) + .withEmailSubject("Cross Resource Mail!!")) + .withTrigger( + new TriggerCondition() + .withThresholdOperator(ConditionalOperator.GREATER_THAN) + .withThreshold(5000.0))) + .withTags(mapOf()) + .withDescription("Sample Cross Resource alert") + .withEnabled(Enabled.TRUE) + .withSchedule(new Schedule().withFrequencyInMinutes(60).withTimeWindowInMinutes(60)) + .create(); + } + + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/createOrUpdateScheduledQueryRules.json + */ + /** + * Sample code: Create or Update rule - AlertingAction. + * + * @param manager Entry point to MonitorManager. + */ + public static void createOrUpdateRuleAlertingAction( + com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager + .scheduledQueryRules() + .define("logalertfoo") + .withRegion("eastus") + .withExistingResourceGroup("Rac46PostSwapRG") + .withSource( + new Source() + .withQuery("Heartbeat | summarize AggregatedValue = count() by bin(TimeGenerated, 5m)") + .withDataSourceId( + "/subscriptions/b67f7fec-69fc-4974-9099-a26bd6ffeda3/resourceGroups/Rac46PostSwapRG/providers/Microsoft.OperationalInsights/workspaces/sampleWorkspace") + .withQueryType(QueryType.RESULT_COUNT)) + .withAction( + new AlertingAction() + .withSeverity(AlertSeverity.ONE) + .withAznsAction( + new AzNsActionGroup() + .withActionGroup(Arrays.asList()) + .withEmailSubject("Email Header") + .withCustomWebhookPayload("{}")) + .withTrigger( + new TriggerCondition() + .withThresholdOperator(ConditionalOperator.GREATER_THAN) + .withThreshold(3.0) + .withMetricTrigger( + new LogMetricTrigger() + .withThresholdOperator(ConditionalOperator.GREATER_THAN) + .withThreshold(5.0) + .withMetricTriggerType(MetricTriggerType.CONSECUTIVE) + .withMetricColumn("Computer")))) + .withTags(mapOf()) + .withDescription("log alert description") + .withEnabled(Enabled.TRUE) + .withSchedule(new Schedule().withFrequencyInMinutes(15).withTimeWindowInMinutes(15)) + .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..e8b0146076500 --- /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; + +import com.azure.core.util.Context; + +/** Samples for ScheduledQueryRules Delete. */ +public final class ScheduledQueryRulesDeleteSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/deleteScheduledQueryRules.json + */ + /** + * Sample code: Delete rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void deleteRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.scheduledQueryRules().deleteWithResponse("Rac46PostSwapRG", "logalertfoo", 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..d23891d64dc13 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesGetByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** Samples for ScheduledQueryRules GetByResourceGroup. */ +public final class ScheduledQueryRulesGetByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/getScheduledQueryRules.json + */ + /** + * Sample code: Get rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void getRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.scheduledQueryRules().getByResourceGroupWithResponse("Rac46PostSwapRG", "logalertfoo", 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..7ee4adcccad92 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesListByResourceGroupSamples.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; + +import com.azure.core.util.Context; + +/** Samples for ScheduledQueryRules ListByResourceGroup. */ +public final class ScheduledQueryRulesListByResourceGroupSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/listScheduledQueryRules.json + */ + /** + * Sample code: List rules. + * + * @param manager Entry point to MonitorManager. + */ + public static void listRules(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.scheduledQueryRules().listByResourceGroup("gigtest", null, 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..e9f228b8a96c4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesListSamples.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; + +import com.azure.core.util.Context; + +/** Samples for ScheduledQueryRules List. */ +public final class ScheduledQueryRulesListSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/listScheduledQueryRules.json + */ + /** + * Sample code: List rules. + * + * @param manager Entry point to MonitorManager. + */ + public static void listRules(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + manager.scheduledQueryRules().list(null, 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..c58d9efa9b4f9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/ScheduledQueryRulesUpdateSamples.java @@ -0,0 +1,29 @@ +// Copyright (c) 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.core.util.Context; +import com.azure.resourcemanager.monitor.generated.models.Enabled; +import com.azure.resourcemanager.monitor.generated.models.LogSearchRuleResource; + +/** Samples for ScheduledQueryRules Update. */ +public final class ScheduledQueryRulesUpdateSamples { + /* + * x-ms-original-file: specification/monitor/resource-manager/Microsoft.Insights/stable/2018-04-16/examples/patchScheduledQueryRules.json + */ + /** + * Sample code: Patch Log Search Rule. + * + * @param manager Entry point to MonitorManager. + */ + public static void patchLogSearchRule(com.azure.resourcemanager.monitor.generated.MonitorManager manager) { + LogSearchRuleResource resource = + manager + .scheduledQueryRules() + .getByResourceGroupWithResponse("my-resource-group", "logalertfoo", Context.NONE) + .getValue(); + resource.update().withEnabled(Enabled.TRUE).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..d7164c81a3580 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/TenantActivityLogsListSamples.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.core.util.Context; + +/** 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", + 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", + 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, + 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, 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..7ce569bc51368 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/samples/java/com/azure/resourcemanager/monitor/generated/generated/VMInsightsGetOnboardingStatusSamples.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.generated; + +import com.azure.core.util.Context; + +/** 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", + 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", + 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", + 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", + 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", Context.NONE); + } +} diff --git a/sdk/monitor/ci.yml b/sdk/monitor/ci.yml index fef254d14fd65..d665c461dd509 100644 --- a/sdk/monitor/ci.yml +++ b/sdk/monitor/ci.yml @@ -44,3 +44,6 @@ extends: - name: azure-monitor-query groupId: com.azure safeName: azuremonitorquery + - name: azure-resourcemanager-monitor-generated + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermonitorgenerated diff --git a/sdk/monitor/pom.xml b/sdk/monitor/pom.xml index a4058326a5ede..2ba39f850d4bc 100644 --- a/sdk/monitor/pom.xml +++ b/sdk/monitor/pom.xml @@ -52,6 +52,7 @@ azure-monitor-opentelemetry-exporter azure-monitor-query azure-monitor-query-perf + azure-resourcemanager-monitor-generated