From 001dfaa62d4eed829e23677df0628980bcfda3a2 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 9 Jul 2021 01:25:28 +0000 Subject: [PATCH] CodeGen from PR 14103 in Azure/azure-rest-api-specs Merge 614e1ed0dd89ffd8798cbf5b1d3eaaef543cdac4 into d1bf50cdfe096cc06eeb66df9f682653241772cc --- eng/versioning/version_client.txt | 1 + .../CHANGELOG.md | 5 + .../README.md | 101 ++ .../pom.xml | 86 ++ .../monitor/generated/MonitorManager.java | 557 +++++++ .../generated/fluent/ActionGroupsClient.java | 211 +++ .../fluent/ActivityLogAlertsClient.java | 185 +++ .../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 | 156 ++ .../fluent/DataCollectionRulesClient.java | 175 +++ .../DiagnosticSettingsCategoriesClient.java | 67 + .../fluent/DiagnosticSettingsClient.java | 124 ++ .../fluent/EventCategoriesClient.java | 38 + .../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 | 214 +++ .../fluent/PrivateLinkResourcesClient.java | 73 + ...PrivateLinkScopeOperationStatusClient.java | 42 + .../PrivateLinkScopedResourcesClient.java | 198 +++ .../fluent/PrivateLinkScopesClient.java | 216 +++ .../fluent/ScheduledQueryRulesClient.java | 183 +++ .../fluent/TenantActivityLogsClient.java | 60 + .../generated/fluent/VMInsightsClient.java | 41 + .../models/ActionGroupResourceInner.java | 407 +++++ .../models/ActivityLogAlertResourceInner.java | 190 +++ .../fluent/models/AlertRuleResourceInner.java | 270 ++++ .../models/AutoscaleSettingResourceInner.java | 225 +++ .../AzureMonitorPrivateLinkScopeInner.java | 83 + .../DataCollectionEndpointResourceInner.java | 262 ++++ ...RuleAssociationProxyOnlyResourceInner.java | 157 ++ .../DataCollectionRuleResourceInner.java | 253 +++ ...ttingsCategoryResourceCollectionInner.java | 56 + ...agnosticSettingsCategoryResourceInner.java | 56 + ...nosticSettingsResourceCollectionInner.java | 54 + .../DiagnosticSettingsResourceInner.java | 271 ++++ .../fluent/models/EventDataInner.java | 453 ++++++ .../fluent/models/IncidentInner.java | 102 ++ .../fluent/models/LocalizableStringInner.java | 81 + .../models/LogProfileResourceInner.java | 212 +++ .../models/LogSearchRuleResourceInner.java | 359 +++++ .../fluent/models/MetadataValueInner.java | 79 + .../models/MetricAlertResourceInner.java | 412 +++++ .../MetricAlertStatusCollectionInner.java | 55 + .../fluent/models/MetricDefinitionInner.java | 382 +++++ .../generated/fluent/models/MetricInner.java | 264 ++++ .../fluent/models/MetricNamespaceInner.java | 159 ++ .../models/OperationListResultInner.java | 84 + .../fluent/models/OperationStatusInner.java | 185 +++ .../PrivateEndpointConnectionInner.java | 103 ++ .../models/PrivateLinkResourceInner.java | 58 + .../fluent/models/ResponseInner.java | 207 +++ .../fluent/models/ScopedResourceInner.java | 68 + .../models/SingleMetricBaselineInner.java | 259 ++++ .../VMInsightsOnboardingStatusInner.java | 152 ++ .../generated/fluent/models/package-info.java | 6 + .../generated/fluent/package-info.java | 6 + .../ActionGroupResourceImpl.java | 371 +++++ .../ActionGroupsClientImpl.java | 1254 +++++++++++++++ .../implementation/ActionGroupsImpl.java | 183 +++ .../ActivityLogAlertResourceImpl.java | 235 +++ .../ActivityLogAlertsClientImpl.java | 1086 +++++++++++++ .../implementation/ActivityLogAlertsImpl.java | 182 +++ .../ActivityLogsClientImpl.java | 438 ++++++ .../implementation/ActivityLogsImpl.java | 46 + .../AlertRuleIncidentsClientImpl.java | 423 +++++ .../AlertRuleIncidentsImpl.java | 73 + .../implementation/AlertRuleResourceImpl.java | 286 ++++ .../implementation/AlertRulesClientImpl.java | 1058 +++++++++++++ .../implementation/AlertRulesImpl.java | 171 ++ .../AutoscaleSettingResourceImpl.java | 275 ++++ .../AutoscaleSettingsClientImpl.java | 1278 +++++++++++++++ .../implementation/AutoscaleSettingsImpl.java | 182 +++ .../AzureMonitorPrivateLinkScopeImpl.java | 201 +++ .../implementation/BaselinesClientImpl.java | 461 ++++++ .../implementation/BaselinesImpl.java | 71 + .../DataCollectionEndpointResourceImpl.java | 252 +++ .../DataCollectionEndpointsClientImpl.java | 1329 ++++++++++++++++ .../DataCollectionEndpointsImpl.java | 191 +++ ...nRuleAssociationProxyOnlyResourceImpl.java | 142 ++ ...aCollectionRuleAssociationsClientImpl.java | 1030 +++++++++++++ .../DataCollectionRuleAssociationsImpl.java | 235 +++ .../DataCollectionRuleResourceImpl.java | 250 +++ .../DataCollectionRulesClientImpl.java | 1316 ++++++++++++++++ .../DataCollectionRulesImpl.java | 182 +++ ...iagnosticSettingsCategoriesClientImpl.java | 311 ++++ .../DiagnosticSettingsCategoriesImpl.java | 88 ++ ...ettingsCategoryResourceCollectionImpl.java | 49 + ...iagnosticSettingsCategoryResourceImpl.java | 46 + .../DiagnosticSettingsClientImpl.java | 582 +++++++ .../DiagnosticSettingsImpl.java | 202 +++ ...gnosticSettingsResourceCollectionImpl.java | 48 + .../DiagnosticSettingsResourceImpl.java | 219 +++ .../EventCategoriesClientImpl.java | 183 +++ .../implementation/EventCategoriesImpl.java | 46 + .../implementation/EventDataImpl.java | 177 +++ .../implementation/IncidentImpl.java | 48 + .../implementation/LocalizableStringImpl.java | 36 + .../LogProfileResourceImpl.java | 242 +++ .../implementation/LogProfilesClientImpl.java | 806 ++++++++++ .../implementation/LogProfilesImpl.java | 126 ++ .../LogSearchRuleResourceImpl.java | 274 ++++ .../implementation/MetadataValueImpl.java | 43 + .../MetricAlertResourceImpl.java | 353 +++++ .../MetricAlertStatusCollectionImpl.java | 41 + .../MetricAlertsClientImpl.java | 1056 +++++++++++++ .../implementation/MetricAlertsImpl.java | 171 ++ .../MetricAlertsStatusClientImpl.java | 404 +++++ .../MetricAlertsStatusImpl.java | 87 ++ .../implementation/MetricDefinitionImpl.java | 114 ++ .../MetricDefinitionsClientImpl.java | 219 +++ .../implementation/MetricDefinitionsImpl.java | 47 + .../generated/implementation/MetricImpl.java | 75 + .../implementation/MetricNamespaceImpl.java | 50 + .../MetricNamespacesClientImpl.java | 218 +++ .../implementation/MetricNamespacesImpl.java | 46 + .../implementation/MetricsClientImpl.java | 428 +++++ .../generated/implementation/MetricsImpl.java | 86 ++ .../implementation/MonitorClientBuilder.java | 146 ++ .../implementation/MonitorClientImpl.java | 658 ++++++++ .../OperationListResultImpl.java | 45 + .../implementation/OperationStatusImpl.java | 54 + .../implementation/OperationsClientImpl.java | 157 ++ .../implementation/OperationsImpl.java | 59 + .../PrivateEndpointConnectionImpl.java | 154 ++ .../PrivateEndpointConnectionsClientImpl.java | 1172 ++++++++++++++ .../PrivateEndpointConnectionsImpl.java | 217 +++ .../PrivateLinkResourceImpl.java | 56 + .../PrivateLinkResourcesClientImpl.java | 524 +++++++ .../PrivateLinkResourcesImpl.java | 76 + ...ateLinkScopeOperationStatusClientImpl.java | 229 +++ .../PrivateLinkScopeOperationStatusImpl.java | 62 + .../PrivateLinkScopedResourcesClientImpl.java | 1097 +++++++++++++ .../PrivateLinkScopedResourcesImpl.java | 204 +++ .../PrivateLinkScopesClientImpl.java | 1371 +++++++++++++++++ .../implementation/PrivateLinkScopesImpl.java | 181 +++ .../implementation/ResponseModelImpl.java | 65 + .../ScheduledQueryRulesClientImpl.java | 1121 ++++++++++++++ .../ScheduledQueryRulesImpl.java | 181 +++ .../implementation/ScopedResourceImpl.java | 135 ++ .../SingleMetricBaselineImpl.java | 66 + .../TenantActivityLogsClientImpl.java | 404 +++++ .../TenantActivityLogsImpl.java | 47 + .../generated/implementation/Utils.java | 204 +++ .../implementation/VMInsightsClientImpl.java | 182 +++ .../implementation/VMInsightsImpl.java | 60 + .../VMInsightsOnboardingStatusImpl.java | 67 + .../implementation/package-info.java | 6 + .../monitor/generated/models/Action.java | 46 + .../generated/models/ActionGroupList.java | 81 + .../models/ActionGroupPatchBody.java | 82 + .../generated/models/ActionGroupResource.java | 476 ++++++ .../generated/models/ActionGroups.java | 187 +++ .../models/ActivityLogAlertActionGroup.java | 86 ++ .../models/ActivityLogAlertActionList.java | 54 + .../ActivityLogAlertAllOfCondition.java | 59 + .../models/ActivityLogAlertLeafCondition.java | 99 ++ .../models/ActivityLogAlertList.java | 81 + .../models/ActivityLogAlertPatchBody.java | 82 + .../models/ActivityLogAlertResource.java | 304 ++++ .../generated/models/ActivityLogAlerts.java | 158 ++ .../generated/models/ActivityLogs.java | 63 + .../generated/models/AggregationType.java | 59 + .../generated/models/AggregationTypeEnum.java | 43 + .../generated/models/AlertRuleIncidents.java | 64 + .../generated/models/AlertRuleResource.java | 418 +++++ .../models/AlertRuleResourceCollection.java | 55 + .../models/AlertRuleResourcePatch.java | 268 ++++ .../monitor/generated/models/AlertRules.java | 158 ++ .../generated/models/AlertSeverity.java | 43 + .../generated/models/AlertingAction.java | 153 ++ .../generated/models/ArmRoleReceiver.java | 115 ++ .../models/AutomationRunbookReceiver.java | 227 +++ .../models/AutoscaleNotification.java | 115 ++ .../generated/models/AutoscaleProfile.java | 189 +++ .../models/AutoscaleSettingResource.java | 387 +++++ .../AutoscaleSettingResourceCollection.java | 86 ++ .../models/AutoscaleSettingResourcePatch.java | 229 +++ .../generated/models/AutoscaleSettings.java | 158 ++ .../generated/models/AzNsActionGroup.java | 103 ++ .../models/AzureAppPushReceiver.java | 90 ++ .../models/AzureFunctionReceiver.java | 180 +++ .../AzureMonitorMetricsDestination.java | 54 + .../models/AzureMonitorPrivateLinkScope.java | 210 +++ ...zureMonitorPrivateLinkScopeListResult.java | 90 ++ .../generated/models/AzureResource.java | 70 + .../generated/models/BaselineMetadata.java | 86 ++ .../generated/models/BaselineSensitivity.java | 37 + .../monitor/generated/models/Baselines.java | 64 + .../generated/models/CategoryType.java | 47 + .../models/ComparisonOperationType.java | 59 + .../generated/models/ConditionOperator.java | 53 + .../generated/models/ConditionalOperator.java | 43 + .../ConfigurationAccessEndpointSpec.java | 39 + .../monitor/generated/models/Criteria.java | 85 + .../generated/models/CriterionType.java | 34 + .../models/DataCollectionEndpoint.java | 182 +++ ...CollectionEndpointConfigurationAccess.java | 25 + .../DataCollectionEndpointLogsIngestion.java | 25 + .../DataCollectionEndpointNetworkAcls.java | 33 + .../DataCollectionEndpointResource.java | 327 ++++ ...aCollectionEndpointResourceListResult.java | 86 ++ ...aCollectionEndpointResourceProperties.java | 62 + .../models/DataCollectionEndpoints.java | 158 ++ .../generated/models/DataCollectionRule.java | 173 +++ .../models/DataCollectionRuleAssociation.java | 120 ++ ...ctionRuleAssociationProxyOnlyResource.java | 186 +++ ...ssociationProxyOnlyResourceListResult.java | 90 ++ ...ssociationProxyOnlyResourceProperties.java | 50 + .../DataCollectionRuleAssociations.java | 165 ++ .../models/DataCollectionRuleDataSources.java | 57 + .../DataCollectionRuleDestinations.java | 41 + .../models/DataCollectionRuleResource.java | 316 ++++ .../DataCollectionRuleResourceListResult.java | 86 ++ .../DataCollectionRuleResourceProperties.java | 54 + .../generated/models/DataCollectionRules.java | 158 ++ .../generated/models/DataContainer.java | 57 + .../monitor/generated/models/DataFlow.java | 77 + .../generated/models/DataSourcesSpec.java | 141 ++ .../monitor/generated/models/DataStatus.java | 34 + .../generated/models/DestinationsSpec.java | 83 + .../DestinationsSpecAzureMonitorMetrics.java | 32 + .../generated/models/DiagnosticSettings.java | 136 ++ .../models/DiagnosticSettingsCategories.java | 59 + .../DiagnosticSettingsCategoryResource.java | 46 + ...ticSettingsCategoryResourceCollection.java | 27 + .../models/DiagnosticSettingsResource.java | 395 +++++ .../DiagnosticSettingsResourceCollection.java | 26 + .../monitor/generated/models/Dimension.java | 117 ++ .../models/DynamicMetricCriteria.java | 206 +++ .../DynamicThresholdFailingPeriods.java | 83 + .../models/DynamicThresholdOperator.java | 37 + .../models/DynamicThresholdSensitivity.java | 37 + .../generated/models/EmailNotification.java | 111 ++ .../generated/models/EmailReceiver.java | 130 ++ .../generated/models/EnableRequest.java | 55 + .../monitor/generated/models/Enabled.java | 34 + .../generated/models/ErrorResponseCommon.java | 44 + .../generated/models/EventCategories.java | 33 + .../models/EventCategoryCollection.java | 62 + .../monitor/generated/models/EventData.java | 203 +++ .../generated/models/EventDataCollection.java | 85 + .../monitor/generated/models/EventLevel.java | 56 + .../generated/models/ExtensionDataSource.java | 172 +++ .../generated/models/HttpRequestInfo.java | 128 ++ .../monitor/generated/models/Incident.java | 54 + .../generated/models/IncidentListResult.java | 55 + .../generated/models/ItsmReceiver.java | 192 +++ ...taCollectionEndpointProvisioningState.java | 44 + ...ownDataCollectionEndpointResourceKind.java | 35 + ...ctionRuleAssociationProvisioningState.java | 44 + ...wnDataCollectionRuleProvisioningState.java | 44 + .../KnownDataCollectionRuleResourceKind.java | 35 + .../models/KnownDataFlowStreams.java | 43 + .../KnownExtensionDataSourceStreams.java | 44 + .../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 | 96 ++ .../models/LogAnalyticsDestination.java | 95 ++ .../generated/models/LogMetricTrigger.java | 128 ++ .../models/LogProfileCollection.java | 59 + .../generated/models/LogProfileResource.java | 354 +++++ .../models/LogProfileResourcePatch.java | 205 +++ .../monitor/generated/models/LogProfiles.java | 130 ++ .../models/LogSearchRuleResource.java | 387 +++++ .../LogSearchRuleResourceCollection.java | 55 + .../models/LogSearchRuleResourcePatch.java | 82 + .../monitor/generated/models/LogSettings.java | 109 ++ .../generated/models/LogToMetricAction.java | 68 + .../generated/models/LogicAppReceiver.java | 146 ++ .../models/LogsIngestionEndpointSpec.java | 39 + .../ManagementEventAggregationCondition.java | 107 ++ .../models/ManagementEventRuleCondition.java | 75 + .../generated/models/MetadataValue.java | 31 + .../monitor/generated/models/Metric.java | 74 + .../generated/models/MetricAlertAction.java | 80 + .../generated/models/MetricAlertCriteria.java | 83 + ...ultipleResourceMultipleMetricCriteria.java | 63 + .../generated/models/MetricAlertResource.java | 565 +++++++ .../models/MetricAlertResourceCollection.java | 55 + .../models/MetricAlertResourcePatch.java | 397 +++++ ...tSingleResourceMultipleMetricCriteria.java | 63 + .../generated/models/MetricAlertStatus.java | 131 ++ .../models/MetricAlertStatusCollection.java | 25 + .../models/MetricAlertStatusProperties.java | 104 ++ .../generated/models/MetricAlerts.java | 158 ++ .../generated/models/MetricAlertsStatus.java | 64 + .../generated/models/MetricAvailability.java | 86 ++ .../models/MetricBaselinesResponse.java | 55 + .../monitor/generated/models/MetricClass.java | 43 + .../generated/models/MetricCriteria.java | 130 ++ .../generated/models/MetricDefinition.java | 110 ++ .../models/MetricDefinitionCollection.java | 60 + .../generated/models/MetricDefinitions.java | 35 + .../generated/models/MetricDimension.java | 118 ++ .../generated/models/MetricNamespace.java | 52 + .../models/MetricNamespaceCollection.java | 59 + .../generated/models/MetricNamespaceName.java | 50 + .../generated/models/MetricNamespaces.java | 35 + .../generated/models/MetricSettings.java | 138 ++ .../models/MetricSingleDimension.java | 86 ++ .../generated/models/MetricStatisticType.java | 56 + .../generated/models/MetricTrigger.java | 396 +++++ .../generated/models/MetricTriggerType.java | 34 + .../monitor/generated/models/MetricUnit.java | 67 + .../monitor/generated/models/MetricValue.java | 189 +++ .../monitor/generated/models/Metrics.java | 68 + .../generated/models/MultiMetricCriteria.java | 254 +++ .../models/NamespaceClassification.java | 37 + .../generated/models/NetworkRuleSet.java | 53 + .../monitor/generated/models/Odatatype.java | 40 + .../generated/models/OnboardingStatus.java | 37 + .../monitor/generated/models/Operation.java | 79 + .../generated/models/OperationDisplay.java | 103 ++ .../generated/models/OperationListResult.java | 32 + .../generated/models/OperationStatus.java | 60 + .../monitor/generated/models/Operations.java | 31 + .../monitor/generated/models/Operator.java | 49 + .../models/PerfCounterDataSource.java | 151 ++ .../models/PrivateEndpointConnection.java | 190 +++ .../PrivateEndpointConnectionListResult.java | 59 + .../models/PrivateEndpointConnections.java | 143 ++ .../models/PrivateEndpointProperty.java | 50 + .../generated/models/PrivateLinkResource.java | 53 + .../models/PrivateLinkResourceListResult.java | 59 + .../models/PrivateLinkResources.java | 66 + .../PrivateLinkScopeOperationStatus.java | 37 + .../models/PrivateLinkScopedResources.java | 141 ++ .../generated/models/PrivateLinkScopes.java | 156 ++ .../models/PrivateLinkScopesResource.java | 39 + ...ateLinkServiceConnectionStateProperty.java | 103 ++ .../generated/models/ProvisioningState.java | 40 + .../generated/models/ProxyOnlyResource.java | 24 + .../monitor/generated/models/QueryType.java | 31 + .../generated/models/ReceiverStatus.java | 50 + .../monitor/generated/models/Recurrence.java | 96 ++ .../generated/models/RecurrenceFrequency.java | 65 + .../generated/models/RecurrentSchedule.java | 241 +++ .../models/ResourceAutoGenerated2.java | 39 + .../generated/models/ResourceForUpdate.java | 51 + .../generated/models/ResponseModel.java | 65 + .../monitor/generated/models/ResultType.java | 47 + .../generated/models/RetentionPolicy.java | 79 + .../monitor/generated/models/RuleAction.java | 42 + .../generated/models/RuleCondition.java | 78 + .../generated/models/RuleDataSource.java | 153 ++ .../generated/models/RuleEmailAction.java | 94 ++ .../RuleManagementEventClaimsDataSource.java | 50 + .../models/RuleManagementEventDataSource.java | 305 ++++ .../models/RuleMetricDataSource.java | 86 ++ .../generated/models/RuleWebhookAction.java | 92 ++ .../monitor/generated/models/ScaleAction.java | 154 ++ .../generated/models/ScaleCapacity.java | 125 ++ .../generated/models/ScaleDirection.java | 50 + .../monitor/generated/models/ScaleRule.java | 90 ++ .../models/ScaleRuleMetricDimension.java | 124 ++ ...ScaleRuleMetricDimensionOperationType.java | 35 + .../monitor/generated/models/ScaleType.java | 53 + .../monitor/generated/models/Schedule.java | 79 + .../generated/models/ScheduledQueryRules.java | 162 ++ .../generated/models/ScopedResource.java | 156 ++ .../models/ScopedResourceListResult.java | 59 + .../generated/models/SenderAuthorization.java | 106 ++ .../generated/models/SingleBaseline.java | 118 ++ .../models/SingleMetricBaseline.java | 72 + .../monitor/generated/models/SmsReceiver.java | 135 ++ .../monitor/generated/models/Source.java | 134 ++ .../generated/models/SyslogDataSource.java | 139 ++ .../generated/models/TagsResource.java | 54 + .../generated/models/TenantActivityLogs.java | 55 + .../models/ThresholdRuleCondition.java | 157 ++ .../models/TimeAggregationOperator.java | 56 + .../generated/models/TimeAggregationType.java | 59 + .../generated/models/TimeSeriesBaseline.java | 179 +++ .../generated/models/TimeSeriesElement.java | 87 ++ .../monitor/generated/models/TimeWindow.java | 198 +++ .../generated/models/TriggerCondition.java | 111 ++ .../monitor/generated/models/VMInsights.java | 36 + .../models/VMInsightsOnboardingStatus.java | 71 + .../generated/models/VoiceReceiver.java | 120 ++ .../generated/models/WebhookNotification.java | 77 + .../generated/models/WebhookReceiver.java | 219 +++ .../WebtestLocationAvailabilityCriteria.java | 122 ++ .../models/WindowsEventLogDataSource.java | 114 ++ .../generated/models/WorkspaceInfo.java | 119 ++ .../generated/models/package-info.java | 6 + .../monitor/generated/package-info.java | 6 + .../src/main/java/module-info.java | 19 + sdk/monitor/ci.yml | 3 + sdk/monitor/pom.xml | 1 + 405 files changed, 64670 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/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/DiagnosticSettingsClient.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/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/AlertRuleResourceInner.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/DataCollectionEndpointResourceInner.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/DataCollectionRuleResourceInner.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/LogProfileResourceInner.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/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/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/PrivateLinkResourceInner.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/SingleMetricBaselineInner.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/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/DiagnosticSettingsClientImpl.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsImpl.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/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/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/ActivityLogAlertActionGroup.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertActionList.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertAllOfCondition.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertLeafCondition.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertList.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertPatchBody.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertResource.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlerts.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogs.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AggregationType.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AggregationTypeEnum.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleIncidents.java create mode 100644 sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/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/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/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/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/DataCollectionEndpointResourceProperties.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/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/DataCollectionRuleAssociationProxyOnlyResourceProperties.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/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/DataCollectionRuleResourceProperties.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/DiagnosticSettings.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/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/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/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/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/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/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/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/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/ResourceAutoGenerated2.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/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/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 diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 890a28f12a940..e68941310f00c 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -304,6 +304,7 @@ com.azure.resourcemanager:azure-resourcemanager-recoveryservicesbackup;1.0.0-bet com.azure.resourcemanager:azure-resourcemanager-deviceprovisioningservices;1.0.0;1.1.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-postgresqlflexibleserver;1.0.0-beta.1;1.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-elastic;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-monitor-generated;1.0.0-beta.1;1.0.0-beta.1 # Unreleased dependencies: Copy the entry from above, prepend "unreleased_" and remove the current # version. Unreleased dependencies are only valid for dependency versions. 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..91971b9fb8634 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-07-09) + +- Azure Resource Manager Monitor client library for Java. This package contains Microsoft Azure SDK for Monitor Management SDK. Monitor Management Client. Package tag package-2021-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..d47f2c16f1b89 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/README.md @@ -0,0 +1,101 @@ +# 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-2021-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 + + + +## 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/pom.xml b/sdk/monitor/azure-resourcemanager-monitor-generated/pom.xml new file mode 100644 index 0000000000000..d5d1874c0a1b8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/pom.xml @@ -0,0 +1,86 @@ + + 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-2021-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 + + + + + com.azure + azure-core + 1.18.0 + + + com.azure + azure-core-management + 1.3.1 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + org.revapi + revapi-maven-plugin + 0.11.2 + + + + + java.method.addedToInterface + + + true + .* + com\.azure\.resourcemanager(\.[^.]+)+\.fluent(\.[^.]+)* + + + + + + + + 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..a08f7f0f99e4e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/MonitorManager.java @@ -0,0 +1,557 @@ +// Copyright (c) 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.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.DiagnosticSettingsImpl; +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.DiagnosticSettings; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsCategories; +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; + +/** 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 DiagnosticSettings diagnosticSettings; + + 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 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, "'retryPolicy' cannot be null."); + if (this.defaultPollInterval.isNegative()) { + throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' 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()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.addAll(this.policies); + 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 DiagnosticSettings. */ + public DiagnosticSettings diagnosticSettings() { + if (this.diagnosticSettings == null) { + this.diagnosticSettings = new DiagnosticSettingsImpl(clientObject.getDiagnosticSettings(), this); + } + return diagnosticSettings; + } + + /** @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..6f412984f5141 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ActionGroupsClient.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; + +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.ActionGroupResourceInner; +import com.azure.resourcemanager.monitor.generated.models.ActionGroupPatchBody; +import com.azure.resourcemanager.monitor.generated.models.EnableRequest; + +/** 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. + * @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. + * @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. + */ + @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. + * @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. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String actionGroupName, Context context); + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @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. + * @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 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. + * @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. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch, 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. + */ + @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. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + @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. + * @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. + * @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 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..446b44958b5f2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/ActivityLogAlertsClient.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.ActivityLogAlertResourceInner; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertPatchBody; + +/** An instance of this class provides access to all the operations defined in ActivityLogAlertsClient. */ +public interface ActivityLogAlertsClient { + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert 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 resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ActivityLogAlertResourceInner createOrUpdate( + String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlert); + + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert 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 resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response createOrUpdateWithResponse( + String resourceGroupName, + String activityLogAlertName, + ActivityLogAlertResourceInner activityLogAlert, + Context context); + + /** + * Get an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ActivityLogAlertResourceInner getByResourceGroup(String resourceGroupName, String activityLogAlertName); + + /** + * Get an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String activityLogAlertName, Context context); + + /** + * Delete an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response deleteWithResponse(String resourceGroupName, String activityLogAlertName, Context context); + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch 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 resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ActivityLogAlertResourceInner update( + String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch); + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch 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 resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response updateWithResponse( + String resourceGroupName, + String activityLogAlertName, + ActivityLogAlertPatchBody activityLogAlertPatch, + Context context); + + /** + * Get a list of all activity log alerts 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 alerts in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * Get a list of all activity log alerts 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 alerts in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource 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 a list of all activity log alerts in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource 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 a list of all activity log alerts in a resource group. + */ + @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..23ab5e62e6726 --- /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. + */ + @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. + */ + @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..d38277e124d37 --- /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. + * @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. + * @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. + */ + @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. + * @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. + */ + @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. + * @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. + */ + @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..66ca94d744bc0 --- /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. + * @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. + * @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. + */ + @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. + * @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. + * @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 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. + * @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. + * @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. + */ + @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. + * @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. + * @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. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List the classic metric alert rules within a resource group. + * + * @param resourceGroupName The name of the resource 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 represents a collection of alert rule resources. + */ + @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. + */ + @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. + */ + @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..7280982442553 --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists the autoscale settings for a resource group. + * + * @param resourceGroupName The name of the resource 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 represents a collection of autoscale setting resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Creates or updates an autoscale setting. + * + * @param resourceGroupName The name of the resource group. + * @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. + * @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. + */ + @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. + * @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. + * @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 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. + * @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. + * @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. + */ + @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. + * @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. + * @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. + */ + @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. + */ + @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. + */ + @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..43fda4ee02381 --- /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. + */ + @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. + */ + @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..e92a4e68e5dc0 --- /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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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 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..e7d47bbcabcad --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DataCollectionRuleAssociationsClient.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.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. + */ + @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. + */ + @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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByRule( + String resourceGroupName, String dataCollectionRuleName, 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. + */ + @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. + */ + @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 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..70c9dfedd2345 --- /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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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 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..f9694b67ecb15 --- /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. + */ + @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. + */ + @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/DiagnosticSettingsClient.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DiagnosticSettingsClient.java new file mode 100644 index 0000000000000..b2145bec70adf --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/DiagnosticSettingsClient.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 DiagnosticSettingsClient. */ +public interface DiagnosticSettingsClient { + /** + * 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. + */ + @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. + */ + @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 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. + */ + @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..cd57c4e94fb9b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/EventCategoriesClient.java @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.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. + */ + @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. + */ + @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..58c1201479ef9 --- /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 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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..beee3e8e63c0a --- /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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource 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 represents a collection of alert rule resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource 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 represents a collection of alert rule resources. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @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. + * @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. + */ + @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. + * @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. + * @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. + */ + @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. + * @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. + * @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. + */ + @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. + * @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. + * @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 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..08c071de032bf --- /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. + * @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. + * @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. + */ + @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. + * @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. + * @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. + */ + @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..4bc69d8b1b8c8 --- /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. + */ + @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. + */ + @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..6110d1d9bc358 --- /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. + */ + @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. + */ + @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..58bcd14c6568a --- /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. + */ + @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..daf367369ad18 --- /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 DiagnosticSettingsClient object to access its operations. + * + * @return the DiagnosticSettingsClient object. + */ + DiagnosticSettingsClient getDiagnosticSettings(); + + /** + * 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..5cb2a37260d9c --- /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. + */ + @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. + */ + @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..b21b8dc7fa50d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.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. + * @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. + * @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. + */ + @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. + * @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) + 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. + * @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) + 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. + * @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. + * @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. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @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. + * @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. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope. + */ + @ServiceMethod(returns = ReturnType.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. + * @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. + */ + @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..629320a65ae22 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkResourcesClient.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.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. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + */ + @ServiceMethod(returns = ReturnType.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. + * @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. + */ + @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. + * @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. + * @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. + */ + @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..85abdfd1cc529 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkScopeOperationStatusClient.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.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. + * @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. + * @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. + */ + @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..49dcffce6a455 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkScopedResourcesClient.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.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. + * @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. + * @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. + */ + @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. + * @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) + 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. + * @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) + 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. + * @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. + * @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. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @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. + * @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. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope. + */ + @ServiceMethod(returns = ReturnType.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. + * @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. + */ + @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..92e47d0c44974 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/PrivateLinkScopesClient.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.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. + */ + @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. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String scopeName); + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete(String resourceGroupName, String scopeName, Context context); + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. + * @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. + * @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. + * @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. + * @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. + */ + @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. + * @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. + * @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. + */ + @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. + * @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. + * @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. + */ + @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..3cb624cc0655f --- /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. + * @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. + * @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. + */ + @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. + * @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. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context); + + /** + * Update log search Rule. + * + * @param resourceGroupName The name of the resource group. + * @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. + * @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. + */ + @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. + * @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. + * @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 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. + */ + @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. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + @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. + * @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. + */ + @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..620e7dd80e975 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/TenantActivityLogsClient.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.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. + */ + @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. + */ + @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..b70f7deb64c93 --- /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. + */ + @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/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..db0f5e93c90c5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActionGroupResourceInner.java @@ -0,0 +1,407 @@ +// Copyright (c) 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.annotation.JsonFlatten; +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.AzureResource; +import com.azure.resourcemanager.monitor.generated.models.EmailReceiver; +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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An action group resource. */ +@JsonFlatten +@Fluent +public class ActionGroupResourceInner extends AzureResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ActionGroupResourceInner.class); + + /* + * The short name of the action group. This will be used in SMS messages. + */ + @JsonProperty(value = "properties.groupShortName") + 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 = "properties.enabled") + private Boolean enabled; + + /* + * The list of email receivers that are part of this action group. + */ + @JsonProperty(value = "properties.emailReceivers") + private List emailReceivers; + + /* + * The list of SMS receivers that are part of this action group. + */ + @JsonProperty(value = "properties.smsReceivers") + private List smsReceivers; + + /* + * The list of webhook receivers that are part of this action group. + */ + @JsonProperty(value = "properties.webhookReceivers") + private List webhookReceivers; + + /* + * The list of ITSM receivers that are part of this action group. + */ + @JsonProperty(value = "properties.itsmReceivers") + private List itsmReceivers; + + /* + * The list of AzureAppPush receivers that are part of this action group. + */ + @JsonProperty(value = "properties.azureAppPushReceivers") + private List azureAppPushReceivers; + + /* + * The list of AutomationRunbook receivers that are part of this action + * group. + */ + @JsonProperty(value = "properties.automationRunbookReceivers") + private List automationRunbookReceivers; + + /* + * The list of voice receivers that are part of this action group. + */ + @JsonProperty(value = "properties.voiceReceivers") + private List voiceReceivers; + + /* + * The list of logic app receivers that are part of this action group. + */ + @JsonProperty(value = "properties.logicAppReceivers") + private List logicAppReceivers; + + /* + * The list of azure function receivers that are part of this action group. + */ + @JsonProperty(value = "properties.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 = "properties.armRoleReceivers") + private List armRoleReceivers; + + /** + * 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 ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner 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 ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner 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 ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner 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 ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner 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 ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner 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 ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner 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 ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner 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 ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner 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 ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner 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 ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner 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 ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner 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 ActionGroupResourceInner object itself. + */ + public ActionGroupResourceInner withArmRoleReceivers(List armRoleReceivers) { + this.armRoleReceivers = armRoleReceivers; + return this; + } + + /** {@inheritDoc} */ + @Override + public ActionGroupResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ActionGroupResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + 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()); + } + } +} 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..0ef52e284949a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ActivityLogAlertResourceInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertActionList; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertAllOfCondition; +import com.azure.resourcemanager.monitor.generated.models.ResourceAutoGenerated2; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An activity log alert resource. */ +@JsonFlatten +@Fluent +public class ActivityLogAlertResourceInner extends ResourceAutoGenerated2 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ActivityLogAlertResourceInner.class); + + /* + * A list of resourceIds that will be used as prefixes. The alert will only + * apply to activityLogs with resourceIds that fall under one of these + * prefixes. This list must include at least one item. + */ + @JsonProperty(value = "properties.scopes") + private List scopes; + + /* + * Indicates whether this activity log alert is enabled. If an activity log + * alert is not enabled, then none of its actions will be activated. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /* + * The condition that will cause this alert to activate. + */ + @JsonProperty(value = "properties.condition") + private ActivityLogAlertAllOfCondition condition; + + /* + * The actions that will activate when the condition is met. + */ + @JsonProperty(value = "properties.actions") + private ActivityLogAlertActionList actions; + + /* + * A description of this activity log alert. + */ + @JsonProperty(value = "properties.description") + private String description; + + /** + * Get the scopes property: A list of resourceIds that will be used as prefixes. The alert will only apply to + * activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. + * + * @return the scopes value. + */ + public List scopes() { + return this.scopes; + } + + /** + * Set the scopes property: A list of resourceIds that will be used as prefixes. The alert will only apply to + * activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. + * + * @param scopes the scopes value to set. + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withScopes(List scopes) { + this.scopes = scopes; + return this; + } + + /** + * Get the enabled property: Indicates whether this activity log alert is enabled. If an activity log alert 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 is enabled. If an activity log alert 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) { + this.enabled = enabled; + return this; + } + + /** + * Get the condition property: The condition that will cause this alert to activate. + * + * @return the condition value. + */ + public ActivityLogAlertAllOfCondition condition() { + return this.condition; + } + + /** + * Set the condition property: The condition that will cause this alert to activate. + * + * @param condition the condition value to set. + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withCondition(ActivityLogAlertAllOfCondition condition) { + this.condition = condition; + return this; + } + + /** + * Get the actions property: The actions that will activate when the condition is met. + * + * @return the actions value. + */ + public ActivityLogAlertActionList 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 ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withActions(ActivityLogAlertActionList actions) { + this.actions = actions; + return this; + } + + /** + * Get the description property: A description of this activity log alert. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: A description of this activity log alert. + * + * @param description the description value to set. + * @return the ActivityLogAlertResourceInner object itself. + */ + public ActivityLogAlertResourceInner withDescription(String description) { + this.description = description; + return this; + } + + /** {@inheritDoc} */ + @Override + public ActivityLogAlertResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ActivityLogAlertResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (condition() != null) { + condition().validate(); + } + if (actions() != null) { + actions().validate(); + } + } +} 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..006ac35e46058 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AlertRuleResourceInner.java @@ -0,0 +1,270 @@ +// Copyright (c) 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.annotation.JsonFlatten; +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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** The alert rule resource. */ +@JsonFlatten +@Fluent +public class AlertRuleResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AlertRuleResourceInner.class); + + /* + * the name of the alert rule. + */ + @JsonProperty(value = "properties.name", required = true) + private String namePropertiesName; + + /* + * the description of the alert rule that will be included in the alert + * email. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * the provisioning state. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /* + * the flag that indicates whether the alert rule is enabled. + */ + @JsonProperty(value = "properties.isEnabled", required = true) + private boolean isEnabled; + + /* + * the condition that results in the alert rule being activated. + */ + @JsonProperty(value = "properties.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 = "properties.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 = "properties.actions") + private List actions; + + /* + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdatedTime; + + /** + * Get the namePropertiesName property: the name of the alert rule. + * + * @return the namePropertiesName value. + */ + public String namePropertiesName() { + return this.namePropertiesName; + } + + /** + * Set the namePropertiesName property: the name of the alert rule. + * + * @param namePropertiesName the namePropertiesName value to set. + * @return the AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner withNamePropertiesName(String namePropertiesName) { + this.namePropertiesName = namePropertiesName; + 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 AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner 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 AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner 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 AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner 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 AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner 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 AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner 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 AlertRuleResourceInner object itself. + */ + public AlertRuleResourceInner 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; + } + + /** {@inheritDoc} */ + @Override + public AlertRuleResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AlertRuleResourceInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (namePropertiesName() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property namePropertiesName in model AlertRuleResourceInner")); + } + if (condition() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property condition in model AlertRuleResourceInner")); + } else { + condition().validate(); + } + if (action() != null) { + action().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/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..5e785b19232d6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AutoscaleSettingResourceInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The autoscale setting resource. */ +@JsonFlatten +@Fluent +public class AutoscaleSettingResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoscaleSettingResourceInner.class); + + /* + * 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 = "properties.profiles", required = true) + private List profiles; + + /* + * the collection of notifications. + */ + @JsonProperty(value = "properties.notifications") + private List notifications; + + /* + * the enabled flag. Specifies whether automatic scaling is enabled for the + * resource. The default value is 'true'. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /* + * the name of the autoscale setting. + */ + @JsonProperty(value = "properties.name") + private String namePropertiesName; + + /* + * the resource identifier of the resource that the autoscale setting + * should be added to. + */ + @JsonProperty(value = "properties.targetResourceUri") + private String targetResourceUri; + + /* + * the location of the resource that the autoscale setting should be added + * to. + */ + @JsonProperty(value = "properties.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 AutoscaleSettingResourceInner object itself. + */ + public AutoscaleSettingResourceInner 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 AutoscaleSettingResourceInner object itself. + */ + public AutoscaleSettingResourceInner 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 AutoscaleSettingResourceInner object itself. + */ + public AutoscaleSettingResourceInner withEnabled(Boolean enabled) { + this.enabled = enabled; + return this; + } + + /** + * Get the namePropertiesName property: the name of the autoscale setting. + * + * @return the namePropertiesName value. + */ + public String namePropertiesName() { + return this.namePropertiesName; + } + + /** + * Set the namePropertiesName property: the name of the autoscale setting. + * + * @param namePropertiesName the namePropertiesName value to set. + * @return the AutoscaleSettingResourceInner object itself. + */ + public AutoscaleSettingResourceInner withNamePropertiesName(String namePropertiesName) { + this.namePropertiesName = namePropertiesName; + 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 AutoscaleSettingResourceInner object itself. + */ + public AutoscaleSettingResourceInner 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 AutoscaleSettingResourceInner object itself. + */ + public AutoscaleSettingResourceInner withTargetResourceLocation(String targetResourceLocation) { + this.targetResourceLocation = targetResourceLocation; + return this; + } + + /** {@inheritDoc} */ + @Override + public AutoscaleSettingResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AutoscaleSettingResourceInner withTags(Map tags) { + super.withTags(tags); + 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 AutoscaleSettingResourceInner")); + } else { + profiles().forEach(e -> e.validate()); + } + if (notifications() != null) { + notifications().forEach(e -> e.validate()); + } + } +} 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..62b8d70688296 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/AzureMonitorPrivateLinkScopeInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkScopesResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** An Azure Monitor PrivateLinkScope definition. */ +@JsonFlatten +@Fluent +public class AzureMonitorPrivateLinkScopeInner extends PrivateLinkScopesResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureMonitorPrivateLinkScopeInner.class); + + /* + * 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 = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /* + * List of private endpoint connections. + */ + @JsonProperty(value = "properties.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; + } + + /** {@inheritDoc} */ + @Override + public AzureMonitorPrivateLinkScopeInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public AzureMonitorPrivateLinkScopeInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.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..ff5b56701974c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionEndpointResourceInner.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.core.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointConfigurationAccess; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointLogsIngestion; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointNetworkAcls; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionEndpointProvisioningState; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionEndpointResourceKind; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Definition of ARM tracked top level resource. */ +@JsonFlatten +@Fluent +public class DataCollectionEndpointResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataCollectionEndpointResourceInner.class); + + /* + * 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; + + /* + * Description of the data collection endpoint. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * The immutable ID of this data collection endpoint resource. This + * property is READ-ONLY. + */ + @JsonProperty(value = "properties.immutableId") + private String immutableId; + + /* + * The endpoint used by agents to access their configuration. + */ + @JsonProperty(value = "properties.configurationAccess") + private DataCollectionEndpointConfigurationAccess configurationAccess; + + /* + * The endpoint used by clients to ingest logs. + */ + @JsonProperty(value = "properties.logsIngestion") + private DataCollectionEndpointLogsIngestion logsIngestion; + + /* + * Network access control rules for the endpoints. + */ + @JsonProperty(value = "properties.networkAcls") + private DataCollectionEndpointNetworkAcls networkAcls; + + /* + * The resource provisioning state. This property is READ-ONLY. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private KnownDataCollectionEndpointProvisioningState provisioningState; + + /** + * 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; + } + + /** + * 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 DataCollectionEndpointResourceInner object itself. + */ + public DataCollectionEndpointResourceInner 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 DataCollectionEndpointResourceInner object itself. + */ + public DataCollectionEndpointResourceInner withImmutableId(String immutableId) { + this.immutableId = immutableId; + return this; + } + + /** + * Get the configurationAccess property: The endpoint used by agents to access their configuration. + * + * @return the configurationAccess value. + */ + public DataCollectionEndpointConfigurationAccess configurationAccess() { + return this.configurationAccess; + } + + /** + * Set the configurationAccess property: The endpoint used by agents to access their configuration. + * + * @param configurationAccess the configurationAccess value to set. + * @return the DataCollectionEndpointResourceInner object itself. + */ + public DataCollectionEndpointResourceInner 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 DataCollectionEndpointResourceInner object itself. + */ + public DataCollectionEndpointResourceInner 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 DataCollectionEndpointResourceInner object itself. + */ + public DataCollectionEndpointResourceInner 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; + } + + /** {@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 (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/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..be758530165fb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleAssociationProxyOnlyResourceInner.java @@ -0,0 +1,157 @@ +// Copyright (c) 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.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionRuleAssociationProvisioningState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Definition of generic ARM proxy resource. */ +@JsonFlatten +@Fluent +public class DataCollectionRuleAssociationProxyOnlyResourceInner extends ProxyResource { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(DataCollectionRuleAssociationProxyOnlyResourceInner.class); + + /* + * 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; + + /* + * Description of the association. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * The resource ID of the data collection rule that is to be associated. + */ + @JsonProperty(value = "properties.dataCollectionRuleId") + private String dataCollectionRuleId; + + /* + * The resource ID of the data collection endpoint that is to be + * associated. + */ + @JsonProperty(value = "properties.dataCollectionEndpointId") + private String dataCollectionEndpointId; + + /* + * The resource provisioning state. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private KnownDataCollectionRuleAssociationProvisioningState provisioningState; + + /** + * Get the etag property: Resource entity tag (ETag). + * + * @return the etag value. + */ + public String etag() { + return this.etag; + } + + /** + * Get the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + public SystemData systemData() { + return this.systemData; + } + + /** + * Get the description property: Description of the association. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: Description of the association. + * + * @param description the description value to set. + * @return the DataCollectionRuleAssociationProxyOnlyResourceInner object itself. + */ + public DataCollectionRuleAssociationProxyOnlyResourceInner withDescription(String description) { + 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 DataCollectionRuleAssociationProxyOnlyResourceInner object itself. + */ + public DataCollectionRuleAssociationProxyOnlyResourceInner 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 DataCollectionRuleAssociationProxyOnlyResourceInner object itself. + */ + public DataCollectionRuleAssociationProxyOnlyResourceInner 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; + } + + /** + * 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/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..d0e9a0820dcef --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DataCollectionRuleResourceInner.java @@ -0,0 +1,253 @@ +// Copyright (c) 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.annotation.JsonFlatten; +import com.azure.core.management.Resource; +import com.azure.core.management.SystemData; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleDataSources; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleDestinations; +import com.azure.resourcemanager.monitor.generated.models.DataFlow; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionRuleProvisioningState; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionRuleResourceKind; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** Definition of ARM tracked top level resource. */ +@JsonFlatten +@Fluent +public class DataCollectionRuleResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataCollectionRuleResourceInner.class); + + /* + * 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; + + /* + * Description of the data collection rule. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * The immutable ID of this data collection rule. This property is + * READ-ONLY. + */ + @JsonProperty(value = "properties.immutableId", access = JsonProperty.Access.WRITE_ONLY) + private String immutableId; + + /* + * 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 = "properties.dataSources") + private DataCollectionRuleDataSources dataSources; + + /* + * The specification of destinations. + */ + @JsonProperty(value = "properties.destinations") + private DataCollectionRuleDestinations destinations; + + /* + * The specification of data flows. + */ + @JsonProperty(value = "properties.dataFlows") + private List dataFlows; + + /* + * The resource provisioning state. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private KnownDataCollectionRuleProvisioningState provisioningState; + + /** + * 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; + } + + /** + * 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 DataCollectionRuleResourceInner object itself. + */ + public DataCollectionRuleResourceInner 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 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 DataCollectionRuleResourceInner object itself. + */ + public DataCollectionRuleResourceInner 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 DataCollectionRuleResourceInner object itself. + */ + public DataCollectionRuleResourceInner 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 DataCollectionRuleResourceInner object itself. + */ + public DataCollectionRuleResourceInner 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; + } + + /** {@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 (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/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..d6133674d6d0f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsCategoryResourceCollectionInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of diagnostic setting category resources. */ +@Fluent +public final class DiagnosticSettingsCategoryResourceCollectionInner { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(DiagnosticSettingsCategoryResourceCollectionInner.class); + + /* + * 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..ea027cb3bd518 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsCategoryResourceInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.CategoryType; +import com.azure.resourcemanager.monitor.generated.models.ProxyOnlyResource; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The diagnostic settings category resource. */ +@JsonFlatten +@Fluent +public class DiagnosticSettingsCategoryResourceInner extends ProxyOnlyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiagnosticSettingsCategoryResourceInner.class); + + /* + * The type of the diagnostic settings category. + */ + @JsonProperty(value = "properties.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 DiagnosticSettingsCategoryResourceInner object itself. + */ + public DiagnosticSettingsCategoryResourceInner withCategoryType(CategoryType categoryType) { + this.categoryType = categoryType; + 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/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..def808a83ae4b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsResourceCollectionInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of alert rule resources. */ +@Fluent +public final class DiagnosticSettingsResourceCollectionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiagnosticSettingsResourceCollectionInner.class); + + /* + * 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..c6703fd23792e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/DiagnosticSettingsResourceInner.java @@ -0,0 +1,271 @@ +// Copyright (c) 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.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The diagnostic setting resource. */ +@JsonFlatten +@Fluent +public class DiagnosticSettingsResourceInner extends ProxyOnlyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiagnosticSettingsResourceInner.class); + + /* + * The resource ID of the storage account to which you would like to send + * Diagnostic Logs. + */ + @JsonProperty(value = "properties.storageAccountId") + private String storageAccountId; + + /* + * The service bus rule Id of the diagnostic setting. This is here to + * maintain backwards compatibility. + */ + @JsonProperty(value = "properties.serviceBusRuleId") + private String serviceBusRuleId; + + /* + * The resource Id for the event hub authorization rule. + */ + @JsonProperty(value = "properties.eventHubAuthorizationRuleId") + private String eventHubAuthorizationRuleId; + + /* + * The name of the event hub. If none is specified, the default event hub + * will be selected. + */ + @JsonProperty(value = "properties.eventHubName") + private String eventHubName; + + /* + * The list of metric settings. + */ + @JsonProperty(value = "properties.metrics") + private List metrics; + + /* + * The list of logs settings. + */ + @JsonProperty(value = "properties.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 = "properties.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 = "properties.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 DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner 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 DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner 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 DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner 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 DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner 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 DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner 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 DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner 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 DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner 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 DiagnosticSettingsResourceInner object itself. + */ + public DiagnosticSettingsResourceInner withLogAnalyticsDestinationType(String logAnalyticsDestinationType) { + this.logAnalyticsDestinationType = logAnalyticsDestinationType; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.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/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..471c6fa0445da --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/EventDataInner.java @@ -0,0 +1,453 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +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.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EventDataInner.class); + + /* + * 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) + 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) + 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..f52df684f2d94 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/IncidentInner.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.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IncidentInner.class); + + /* + * 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..7bb7f54ebb59d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LocalizableStringInner.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The localizable string class. */ +@Fluent +public final class LocalizableStringInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LocalizableStringInner.class); + + /* + * 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")); + } + } +} 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..7a1c0e180b14e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogProfileResourceInner.java @@ -0,0 +1,212 @@ +// Copyright (c) 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.annotation.JsonFlatten; +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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The log profile resource. */ +@JsonFlatten +@Fluent +public class LogProfileResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogProfileResourceInner.class); + + /* + * the resource id of the storage account to which you would like to send + * the Activity Log. + */ + @JsonProperty(value = "properties.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 = "properties.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 = "properties.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 = "properties.categories", required = true) + private List categories; + + /* + * the retention policy for the events in the log. + */ + @JsonProperty(value = "properties.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 LogProfileResourceInner object itself. + */ + public LogProfileResourceInner 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 LogProfileResourceInner object itself. + */ + public LogProfileResourceInner 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 LogProfileResourceInner object itself. + */ + public LogProfileResourceInner 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 LogProfileResourceInner object itself. + */ + public LogProfileResourceInner 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 LogProfileResourceInner object itself. + */ + public LogProfileResourceInner withRetentionPolicy(RetentionPolicy retentionPolicy) { + this.retentionPolicy = retentionPolicy; + return this; + } + + /** {@inheritDoc} */ + @Override + public LogProfileResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public LogProfileResourceInner withTags(Map tags) { + super.withTags(tags); + 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 LogProfileResourceInner")); + } + if (categories() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property categories in model LogProfileResourceInner")); + } + if (retentionPolicy() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property retentionPolicy in model LogProfileResourceInner")); + } else { + retentionPolicy().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..343a459fa2115 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/LogSearchRuleResourceInner.java @@ -0,0 +1,359 @@ +// Copyright (c) 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.annotation.JsonFlatten; +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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** The Log Search Rule resource. */ +@JsonFlatten +@Fluent +public class LogSearchRuleResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogSearchRuleResourceInner.class); + + /* + * The api-version used when creating this alert rule + */ + @JsonProperty(value = "properties.createdWithApiVersion", access = JsonProperty.Access.WRITE_ONLY) + private String createdWithApiVersion; + + /* + * True if alert rule is legacy Log Analytic rule + */ + @JsonProperty(value = "properties.isLegacyLogAnalyticsRule", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isLegacyLogAnalyticsRule; + + /* + * The description of the Log Search rule. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * The display name of the alert rule + */ + @JsonProperty(value = "properties.displayName") + private String displayName; + + /* + * The flag that indicates whether the alert should be automatically + * resolved or not. The default is false. + */ + @JsonProperty(value = "properties.autoMitigate") + private Boolean autoMitigate; + + /* + * The flag which indicates whether the Log Search rule is enabled. Value + * should be true or false + */ + @JsonProperty(value = "properties.enabled") + private Enabled enabled; + + /* + * Last time the rule was updated in IS08601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdatedTime; + + /* + * Provisioning state of the scheduled query rule + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private ProvisioningState provisioningState; + + /* + * Data Source against which rule will Query Data + */ + @JsonProperty(value = "properties.source", required = true) + private Source source; + + /* + * Schedule (Frequency, Time Window) for rule. Required for action type - + * AlertingAction + */ + @JsonProperty(value = "properties.schedule") + private Schedule schedule; + + /* + * Action needs to be taken on rule execution. + */ + @JsonProperty(value = "properties.action", required = true) + private Action action; + + /* + * 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 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 LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner 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 LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner 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 LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner 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 LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner 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 LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner 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 LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner 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 LogSearchRuleResourceInner object itself. + */ + public LogSearchRuleResourceInner withAction(Action action) { + this.action = action; + return this; + } + + /** + * 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; + } + + /** + * 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 LogSearchRuleResourceInner")); + } else { + source().validate(); + } + if (schedule() != null) { + schedule().validate(); + } + if (action() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property action in model LogSearchRuleResourceInner")); + } else { + action().validate(); + } + } +} 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..41f638686af82 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetadataValueInner.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a metric metadata value. */ +@Fluent +public final class MetadataValueInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetadataValueInner.class); + + /* + * 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/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..af693e353fc03 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertResourceInner.java @@ -0,0 +1,412 @@ +// Copyright (c) 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.annotation.JsonFlatten; +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.JsonIgnore; +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. */ +@JsonFlatten +@Fluent +public class MetricAlertResourceInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricAlertResourceInner.class); + + /* + * the description of the metric alert that will be included in the alert + * email. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * Alert severity {0, 1, 2, 3, 4} + */ + @JsonProperty(value = "properties.severity", required = true) + private int severity; + + /* + * the flag that indicates whether the metric alert is enabled. + */ + @JsonProperty(value = "properties.enabled", required = true) + private boolean enabled; + + /* + * the list of resource id's that this metric alert is scoped to. + */ + @JsonProperty(value = "properties.scopes", required = true) + private List scopes; + + /* + * how often the metric alert is evaluated represented in ISO 8601 duration + * format. + */ + @JsonProperty(value = "properties.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 = "properties.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 = "properties.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 = "properties.targetResourceRegion") + private String targetResourceRegion; + + /* + * defines the specific alert criteria information. + */ + @JsonProperty(value = "properties.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 = "properties.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 = "properties.actions") + private List actions; + + /* + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdatedTime; + + /* + * the value indicating whether this alert rule is migrated. + */ + @JsonProperty(value = "properties.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 MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner 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 MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner 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 MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner 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 MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner 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 MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner 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 MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner 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 MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner 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 MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner 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 MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner 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 MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner 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 MetricAlertResourceInner object itself. + */ + public MetricAlertResourceInner 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; + } + + /** {@inheritDoc} */ + @Override + public MetricAlertResourceInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public MetricAlertResourceInner withTags(Map tags) { + super.withTags(tags); + 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 MetricAlertResourceInner")); + } + if (evaluationFrequency() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property evaluationFrequency in model MetricAlertResourceInner")); + } + if (windowSize() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property windowSize in model MetricAlertResourceInner")); + } + if (criteria() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property criteria in model MetricAlertResourceInner")); + } else { + 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/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..ee6367fdf3aa9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricAlertStatusCollectionInner.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of alert rule resources. */ +@Fluent +public final class MetricAlertStatusCollectionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricAlertStatusCollectionInner.class); + + /* + * 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/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..bfc7bebc5813a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricDefinitionInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Metric definition class specifies the metadata for a metric. */ +@Fluent +public final class MetricDefinitionInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricDefinitionInner.class); + + /* + * 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..b786aca218fc9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricInner.java @@ -0,0 +1,264 @@ +// Copyright (c) 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The result data of a query. */ +@Fluent +public final class MetricInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricInner.class); + + /* + * 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()); + } + } +} 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..6a037edb9ec80 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/MetricNamespaceInner.java @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.MetricNamespaceName; +import com.azure.resourcemanager.monitor.generated.models.NamespaceClassification; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Metric namespace class specifies the metadata for a metric namespace. */ +@Fluent +public final class MetricNamespaceInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricNamespaceInner.class); + + /* + * 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..961e1145841bc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/OperationListResultInner.java @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.Operation; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResultInner.class); + + /* + * 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..f83c36f548e18 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/OperationStatusInner.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.ErrorResponseCommon; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** The status of operation. */ +@Fluent +public final class OperationStatusInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationStatusInner.class); + + /* + * 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..35bf1888ea83e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/PrivateEndpointConnectionInner.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.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.PrivateEndpointProperty; +import com.azure.resourcemanager.monitor.generated.models.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection. */ +@JsonFlatten +@Fluent +public class PrivateEndpointConnectionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionInner.class); + + /* + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "properties.privateEndpoint") + private PrivateEndpointProperty privateEndpoint; + + /* + * Connection state of the private endpoint connection. + */ + @JsonProperty(value = "properties.privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /* + * State of the private endpoint connection. + */ + @JsonProperty(value = "properties.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 PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner 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 PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner 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..81a71f4d06713 --- /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.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A private link resource. */ +@JsonFlatten +@Immutable +public class PrivateLinkResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceInner.class); + + /* + * The private link resource group id. + */ + @JsonProperty(value = "properties.groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The private link resource required member names. + */ + @JsonProperty(value = "properties.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..b14c00e3739fd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ResponseInner.java @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResponseInner.class); + + /* + * 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()); + } + } +} 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..96b6504abacf0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/ScopedResourceInner.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private link scoped resource. */ +@JsonFlatten +@Fluent +public class ScopedResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScopedResourceInner.class); + + /* + * The resource id of the scoped Azure monitor resource. + */ + @JsonProperty(value = "properties.linkedResourceId") + private String linkedResourceId; + + /* + * State of the private endpoint connection. + */ + @JsonProperty(value = "properties.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 ScopedResourceInner object itself. + */ + public ScopedResourceInner 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..e43f1d21517f0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/SingleMetricBaselineInner.java @@ -0,0 +1,259 @@ +// Copyright (c) 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.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.models.TimeSeriesBaseline; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.util.List; + +/** The baseline results of a single metric. */ +@JsonFlatten +@Fluent +public class SingleMetricBaselineInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SingleMetricBaselineInner.class); + + /* + * 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 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 = "properties.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 = "properties.interval", required = true) + private Duration interval; + + /* + * The namespace of the metrics been queried. + */ + @JsonProperty(value = "properties.namespace") + private String namespace; + + /* + * The baseline for each time series that was queried. + */ + @JsonProperty(value = "properties.baselines", required = true) + private List baselines; + + /** + * 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 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 SingleMetricBaselineInner object itself. + */ + public SingleMetricBaselineInner 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 SingleMetricBaselineInner object itself. + */ + public SingleMetricBaselineInner 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 SingleMetricBaselineInner object itself. + */ + public SingleMetricBaselineInner 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 SingleMetricBaselineInner object itself. + */ + public SingleMetricBaselineInner withBaselines(List baselines) { + this.baselines = 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 (timespan() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property timespan in model SingleMetricBaselineInner")); + } + if (interval() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property interval in model SingleMetricBaselineInner")); + } + if (baselines() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property baselines in model SingleMetricBaselineInner")); + } else { + baselines().forEach(e -> e.validate()); + } + } +} 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..3874f4cafb7ff --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/VMInsightsOnboardingStatusInner.java @@ -0,0 +1,152 @@ +// Copyright (c) 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.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** VM Insights onboarding status for a resource. */ +@JsonFlatten +@Fluent +public class VMInsightsOnboardingStatusInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VMInsightsOnboardingStatusInner.class); + + /* + * Azure Resource Manager identifier of the resource whose onboarding + * status is being represented. + */ + @JsonProperty(value = "properties.resourceId") + 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 = "properties.onboardingStatus") + 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 = "properties.dataStatus") + private DataStatus dataStatus; + + /* + * Containers that currently store VM Insights data for the specified + * resource. + */ + @JsonProperty(value = "properties.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 VMInsightsOnboardingStatusInner object itself. + */ + public VMInsightsOnboardingStatusInner 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 VMInsightsOnboardingStatusInner object itself. + */ + public VMInsightsOnboardingStatusInner 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 VMInsightsOnboardingStatusInner object itself. + */ + public VMInsightsOnboardingStatusInner 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 VMInsightsOnboardingStatusInner object itself. + */ + public VMInsightsOnboardingStatusInner withData(List data) { + this.data = data; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (data() != null) { + data().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/fluent/models/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..a24a59373a507 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActionGroupResourceImpl.java @@ -0,0 +1,371 @@ +// Copyright (c) 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.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 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) { + if (isInCreateMode()) { + this.innerModel().withEnabled(enabled); + return this; + } else { + this.updateActionGroupPatch.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; + } + + 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..325e31ca77b58 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActionGroupsClientImpl.java @@ -0,0 +1,1254 @@ +// Copyright (c) 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.util.Context; +import com.azure.core.util.FluxUtil; +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.models.ActionGroupList; +import com.azure.resourcemanager.monitor.generated.models.ActionGroupPatchBody; +import com.azure.resourcemanager.monitor.generated.models.EnableRequest; +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 { + private final ClientLogger logger = new ClientLogger(ActionGroupsClientImpl.class); + + /** 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"}) + @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, 409}) + @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. + * @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) + 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 = "2019-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + actionGroupName, + this.client.getSubscriptionId(), + apiVersion, + actionGroup, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @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. + */ + @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 = "2019-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + actionGroupName, + this.client.getSubscriptionId(), + apiVersion, + actionGroup, + accept, + context); + } + + /** + * Create a new action group or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @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) + 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 = "2019-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + actionGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. + * @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. + */ + @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 = "2019-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + actionGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get an action group. + * + * @param resourceGroupName The name of the resource group. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @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 completion. + */ + @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 = "2019-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + actionGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @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 completion. + */ + @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 = "2019-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + actionGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @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 completion. + */ + @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. + * @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. + * @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 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. + * @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) + 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 = "2019-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + actionGroupName, + apiVersion, + actionGroupPatch, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @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. + */ + @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 = "2019-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + actionGroupName, + apiVersion, + actionGroupPatch, + accept, + context); + } + + /** + * Updates an existing action group's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @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) + 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. + * @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. + * @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, String actionGroupName, ActionGroupPatchBody actionGroupPatch, Context context) { + return updateWithResponseAsync(resourceGroupName, actionGroupName, actionGroupPatch, 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. + */ + @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-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of all action groups in a subscription. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a subscription. + */ + @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-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), this.client.getSubscriptionId(), apiVersion, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Get a list of all action groups in a subscription. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of all action groups in a subscription. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + resourceGroupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource group. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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. + * @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 completion. + */ + @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 = "2019-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .enableReceiver( + this.client.getEndpoint(), + resourceGroupName, + actionGroupName, + this.client.getSubscriptionId(), + apiVersion, + enableRequest, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation + * is only supported for Email or SMS receivers. + * + * @param resourceGroupName The name of the resource group. + * @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 completion. + */ + @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 = "2019-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .enableReceiver( + this.client.getEndpoint(), + resourceGroupName, + actionGroupName, + this.client.getSubscriptionId(), + apiVersion, + enableRequest, + accept, + context); + } + + /** + * Enable a receiver in an action group. This changes the receiver's status from Disabled to Enabled. This operation + * is only supported for Email or SMS receivers. + * + * @param resourceGroupName The name of the resource group. + * @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 completion. + */ + @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. + * @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. + * @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 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..7795a09bd71ca --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActionGroupsImpl.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.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.models.ActionGroupResource; +import com.azure.resourcemanager.monitor.generated.models.ActionGroups; +import com.azure.resourcemanager.monitor.generated.models.EnableRequest; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ActionGroupsImpl implements ActionGroups { + @JsonIgnore private 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 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).getValue(); + } + + 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..2bcbbd7df5d94 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogAlertResourceImpl.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.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.ActivityLogAlertActionList; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertAllOfCondition; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertPatchBody; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertResource; +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 Boolean enabled() { + return this.innerModel().enabled(); + } + + public ActivityLogAlertAllOfCondition condition() { + return this.innerModel().condition(); + } + + public ActivityLogAlertActionList actions() { + return this.innerModel().actions(); + } + + 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 ActivityLogAlertPatchBody updateActivityLogAlertPatch; + + 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.updateActivityLogAlertPatch = new ActivityLogAlertPatchBody(); + return this; + } + + public ActivityLogAlertResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getActivityLogAlerts() + .updateWithResponse(resourceGroupName, activityLogAlertName, updateActivityLogAlertPatch, Context.NONE) + .getValue(); + return this; + } + + public ActivityLogAlertResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getActivityLogAlerts() + .updateWithResponse(resourceGroupName, activityLogAlertName, updateActivityLogAlertPatch, 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.updateActivityLogAlertPatch.withTags(tags); + return this; + } + } + + public ActivityLogAlertResourceImpl withScopes(List scopes) { + this.innerModel().withScopes(scopes); + return this; + } + + public ActivityLogAlertResourceImpl withEnabled(Boolean enabled) { + if (isInCreateMode()) { + this.innerModel().withEnabled(enabled); + return this; + } else { + this.updateActivityLogAlertPatch.withEnabled(enabled); + return this; + } + } + + public ActivityLogAlertResourceImpl withCondition(ActivityLogAlertAllOfCondition condition) { + this.innerModel().withCondition(condition); + return this; + } + + public ActivityLogAlertResourceImpl withActions(ActivityLogAlertActionList actions) { + this.innerModel().withActions(actions); + 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..4ce12d18d6697 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogAlertsClientImpl.java @@ -0,0 +1,1086 @@ +// Copyright (c) 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.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.ActivityLogAlertList; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertPatchBody; +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 { + private final ClientLogger logger = new ClientLogger(ActivityLogAlertsClientImpl.class); + + /** 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 activityLogAlert, + @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") ActivityLogAlertPatchBody activityLogAlertPatch, + @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); + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert 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 resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlert) { + 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 (activityLogAlert == null) { + return Mono + .error(new IllegalArgumentException("Parameter activityLogAlert is required and cannot be null.")); + } else { + activityLogAlert.validate(); + } + final String apiVersion = "2017-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + activityLogAlertName, + apiVersion, + activityLogAlert, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert 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 resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> createOrUpdateWithResponseAsync( + String resourceGroupName, + String activityLogAlertName, + ActivityLogAlertResourceInner activityLogAlert, + 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 (activityLogAlert == null) { + return Mono + .error(new IllegalArgumentException("Parameter activityLogAlert is required and cannot be null.")); + } else { + activityLogAlert.validate(); + } + final String apiVersion = "2017-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + activityLogAlertName, + apiVersion, + activityLogAlert, + accept, + context); + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert 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 resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlert) { + return createOrUpdateWithResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlert) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert 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 resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ActivityLogAlertResourceInner createOrUpdate( + String resourceGroupName, String activityLogAlertName, ActivityLogAlertResourceInner activityLogAlert) { + return createOrUpdateAsync(resourceGroupName, activityLogAlertName, activityLogAlert).block(); + } + + /** + * Create a new activity log alert or update an existing one. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlert The activity log alert 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 resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response createOrUpdateWithResponse( + String resourceGroupName, + String activityLogAlertName, + ActivityLogAlertResourceInner activityLogAlert, + Context context) { + return createOrUpdateWithResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlert, context) + .block(); + } + + /** + * Get an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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. + */ + @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 = "2017-04-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. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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. + */ + @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 = "2017-04-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. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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. + */ + @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. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ActivityLogAlertResourceInner getByResourceGroup(String resourceGroupName, String activityLogAlertName) { + return getByResourceGroupAsync(resourceGroupName, activityLogAlertName).block(); + } + + /** + * Get an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String activityLogAlertName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, activityLogAlertName, context).block(); + } + + /** + * Delete an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @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 = "2017-04-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. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @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 = "2017-04-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. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @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. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response deleteWithResponse(String resourceGroupName, String activityLogAlertName, Context context) { + return deleteWithResponseAsync(resourceGroupName, activityLogAlertName, context).block(); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch 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 resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch) { + 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 (activityLogAlertPatch == null) { + return Mono + .error(new IllegalArgumentException("Parameter activityLogAlertPatch is required and cannot be null.")); + } else { + activityLogAlertPatch.validate(); + } + final String apiVersion = "2017-04-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + activityLogAlertName, + apiVersion, + activityLogAlertPatch, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch 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 resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> updateWithResponseAsync( + String resourceGroupName, + String activityLogAlertName, + ActivityLogAlertPatchBody activityLogAlertPatch, + 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 (activityLogAlertPatch == null) { + return Mono + .error(new IllegalArgumentException("Parameter activityLogAlertPatch is required and cannot be null.")); + } else { + activityLogAlertPatch.validate(); + } + final String apiVersion = "2017-04-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + this.client.getSubscriptionId(), + resourceGroupName, + activityLogAlertName, + apiVersion, + activityLogAlertPatch, + accept, + context); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch 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 resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch) { + return updateWithResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch 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 resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ActivityLogAlertResourceInner update( + String resourceGroupName, String activityLogAlertName, ActivityLogAlertPatchBody activityLogAlertPatch) { + return updateAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch).block(); + } + + /** + * Updates an existing ActivityLogAlertResource's tags. To update other fields use the CreateOrUpdate method. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param activityLogAlertPatch 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 resource. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response updateWithResponse( + String resourceGroupName, + String activityLogAlertName, + ActivityLogAlertPatchBody activityLogAlertPatch, + Context context) { + return updateWithResponseAsync(resourceGroupName, activityLogAlertName, activityLogAlertPatch, context).block(); + } + + /** + * Get a list of all activity log alerts 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 alerts in a subscription. + */ + @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 = "2017-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 activity log alerts 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 alerts in a subscription. + */ + @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 = "2017-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 activity log alerts 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 alerts in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * Get a list of all activity log alerts 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 alerts in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * Get a list of all activity log alerts 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 alerts in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * Get a list of all activity log alerts 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 alerts in a subscription. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource 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 list of all activity log alerts in a resource group. + */ + @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 = "2017-04-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())); + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource 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 a list of all activity log alerts in a resource group. + */ + @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 = "2017-04-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)); + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource 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 list of all activity log alerts in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName)); + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource 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 a list of all activity log alerts in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync( + String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context)); + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource 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 list of all activity log alerts in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource 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 a list of all activity log alerts in a resource group. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } +} 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..e7367d308712c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogAlertsImpl.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.ActivityLogAlertsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.ActivityLogAlertResourceInner; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlertResource; +import com.azure.resourcemanager.monitor.generated.models.ActivityLogAlerts; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ActivityLogAlertsImpl implements ActivityLogAlerts { + @JsonIgnore private 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).getValue(); + } + + 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..8ee2fe8ab3927 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogsClientImpl.java @@ -0,0 +1,438 @@ +// Copyright (c) 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.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.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 { + private final ClientLogger logger = new ClientLogger(ActivityLogsClientImpl.class); + + /** 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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..ca46accc27aaa --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ActivityLogsImpl.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.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ActivityLogsImpl implements ActivityLogs { + @JsonIgnore private 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..d7510bdebc270 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRuleIncidentsClientImpl.java @@ -0,0 +1,423 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.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.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.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 { + private final ClientLogger logger = new ClientLogger(AlertRuleIncidentsClientImpl.class); + + /** 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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @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. + */ + @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. + * @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. + */ + @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. + * @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. + */ + @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. + * @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. + */ + @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. + * @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. + */ + @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. + * @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. + */ + @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..bb1eaa0589af5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRuleIncidentsImpl.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AlertRuleIncidentsImpl implements AlertRuleIncidents { + @JsonIgnore private 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..1d7743278ec21 --- /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) { + this.innerModel().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; + } + + public AlertRuleResourceImpl withIsEnabled(Boolean isEnabled) { + this.updateAlertRulesResource.withIsEnabled(isEnabled); + 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..95f7e5755e894 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRulesClientImpl.java @@ -0,0 +1,1058 @@ +// Copyright (c) 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.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.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 { + private final ClientLogger logger = new ClientLogger(AlertRulesClientImpl.class); + + /** 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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @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 completion. + */ + @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. + * @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 completion. + */ + @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. + * @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 completion. + */ + @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. + * @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. + * @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 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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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.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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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.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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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.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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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.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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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..a560ad314fed3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AlertRulesImpl.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.AlertRulesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.AlertRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AlertRuleResource; +import com.azure.resourcemanager.monitor.generated.models.AlertRules; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AlertRulesImpl implements AlertRules { + @JsonIgnore private 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).getValue(); + } + + 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..15de4508a5207 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AutoscaleSettingsClientImpl.java @@ -0,0 +1,1278 @@ +// Copyright (c) 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.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.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 { + private final ClientLogger logger = new ClientLogger(AutoscaleSettingsClientImpl.class); + + /** 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @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 completion. + */ + @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. + * @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 completion. + */ + @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. + * @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 completion. + */ + @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. + * @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. + * @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 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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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..657ee43cc86c7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/AutoscaleSettingsImpl.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.AutoscaleSettingsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.AutoscaleSettingResourceInner; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleSettingResource; +import com.azure.resourcemanager.monitor.generated.models.AutoscaleSettings; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AutoscaleSettingsImpl implements AutoscaleSettings { + @JsonIgnore private 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).getValue(); + } + + 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..fabd060a95528 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/BaselinesClientImpl.java @@ -0,0 +1,461 @@ +// Copyright (c) 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.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.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 { + private final ClientLogger logger = new ClientLogger(BaselinesClientImpl.class); + + /** 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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..5ff7a11c97d3e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/BaselinesImpl.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.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 com.fasterxml.jackson.annotation.JsonIgnore; +import java.time.Duration; + +public final class BaselinesImpl implements Baselines { + @JsonIgnore private 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..3bc8348ec9fee --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointResourceImpl.java @@ -0,0 +1,252 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionEndpointResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointConfigurationAccess; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointLogsIngestion; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointNetworkAcls; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionEndpointResource; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionEndpointProvisioningState; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionEndpointResourceKind; +import com.azure.resourcemanager.monitor.generated.models.ResourceForUpdate; +import java.util.Collections; +import java.util.Map; + +public final class DataCollectionEndpointResourceImpl + implements DataCollectionEndpointResource, + DataCollectionEndpointResource.Definition, + DataCollectionEndpointResource.Update { + private DataCollectionEndpointResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public KnownDataCollectionEndpointResourceKind kind() { + return this.innerModel().kind(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String description() { + return this.innerModel().description(); + } + + public String immutableId() { + return this.innerModel().immutableId(); + } + + public DataCollectionEndpointConfigurationAccess configurationAccess() { + return this.innerModel().configurationAccess(); + } + + public DataCollectionEndpointLogsIngestion logsIngestion() { + return this.innerModel().logsIngestion(); + } + + public DataCollectionEndpointNetworkAcls networkAcls() { + return this.innerModel().networkAcls(); + } + + public KnownDataCollectionEndpointProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DataCollectionEndpointResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String dataCollectionEndpointName; + + private ResourceForUpdate updateBody; + + public DataCollectionEndpointResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public DataCollectionEndpointResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionEndpoints() + .createWithResponse(resourceGroupName, dataCollectionEndpointName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DataCollectionEndpointResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionEndpoints() + .createWithResponse(resourceGroupName, dataCollectionEndpointName, this.innerModel(), context) + .getValue(); + return this; + } + + DataCollectionEndpointResourceImpl( + String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new DataCollectionEndpointResourceInner(); + this.serviceManager = serviceManager; + this.dataCollectionEndpointName = name; + } + + public DataCollectionEndpointResourceImpl update() { + this.updateBody = new ResourceForUpdate(); + return this; + } + + public DataCollectionEndpointResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionEndpoints() + .updateWithResponse(resourceGroupName, dataCollectionEndpointName, updateBody, Context.NONE) + .getValue(); + return this; + } + + public DataCollectionEndpointResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionEndpoints() + .updateWithResponse(resourceGroupName, dataCollectionEndpointName, updateBody, context) + .getValue(); + return this; + } + + DataCollectionEndpointResourceImpl( + DataCollectionEndpointResourceInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.dataCollectionEndpointName = Utils.getValueFromIdByName(innerObject.id(), "dataCollectionEndpoints"); + } + + public DataCollectionEndpointResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionEndpoints() + .getByResourceGroupWithResponse(resourceGroupName, dataCollectionEndpointName, Context.NONE) + .getValue(); + return this; + } + + public DataCollectionEndpointResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionEndpoints() + .getByResourceGroupWithResponse(resourceGroupName, dataCollectionEndpointName, context) + .getValue(); + return this; + } + + public DataCollectionEndpointResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DataCollectionEndpointResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DataCollectionEndpointResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public DataCollectionEndpointResourceImpl withKind(KnownDataCollectionEndpointResourceKind kind) { + this.innerModel().withKind(kind); + return this; + } + + public DataCollectionEndpointResourceImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public DataCollectionEndpointResourceImpl withImmutableId(String immutableId) { + this.innerModel().withImmutableId(immutableId); + return this; + } + + public DataCollectionEndpointResourceImpl withConfigurationAccess( + DataCollectionEndpointConfigurationAccess configurationAccess) { + this.innerModel().withConfigurationAccess(configurationAccess); + return this; + } + + public DataCollectionEndpointResourceImpl withLogsIngestion(DataCollectionEndpointLogsIngestion logsIngestion) { + this.innerModel().withLogsIngestion(logsIngestion); + return this; + } + + public DataCollectionEndpointResourceImpl withNetworkAcls(DataCollectionEndpointNetworkAcls networkAcls) { + this.innerModel().withNetworkAcls(networkAcls); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointsClientImpl.java new file mode 100644 index 0000000000000..6aa6a7475ef56 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointsClientImpl.java @@ -0,0 +1,1329 @@ +// Copyright (c) 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.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.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 { + private final ClientLogger logger = new ClientLogger(DataCollectionEndpointsClientImpl.class); + + /** 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. + */ + @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-04-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())); + } + + /** + * 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. + */ + @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-04-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)); + } + + /** + * 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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-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(), + 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. + */ + @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-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(), + 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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-04-01"; + 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. + */ + @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-04-01"; + 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. + */ + @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. + */ + @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. + */ + @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-04-01"; + 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. + */ + @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-04-01"; + 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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-04-01"; + 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. + */ + @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-04-01"; + 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. + */ + @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. + */ + @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. + */ + @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 completion. + */ + @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-04-01"; + 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 completion. + */ + @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-04-01"; + 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 the completion. + */ + @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 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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..c090c402fac17 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionEndpointsImpl.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.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DataCollectionEndpointsImpl implements DataCollectionEndpoints { + @JsonIgnore private 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).getValue(); + } + + 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..4059b95342c12 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationProxyOnlyResourceImpl.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.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; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionRuleAssociationProvisioningState; + +public final class DataCollectionRuleAssociationProxyOnlyResourceImpl + implements DataCollectionRuleAssociationProxyOnlyResource, + DataCollectionRuleAssociationProxyOnlyResource.Definition { + private DataCollectionRuleAssociationProxyOnlyResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + DataCollectionRuleAssociationProxyOnlyResourceImpl( + DataCollectionRuleAssociationProxyOnlyResourceInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String description() { + return this.innerModel().description(); + } + + public String dataCollectionRuleId() { + return this.innerModel().dataCollectionRuleId(); + } + + public String dataCollectionEndpointId() { + return this.innerModel().dataCollectionEndpointId(); + } + + public KnownDataCollectionRuleAssociationProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public DataCollectionRuleAssociationProxyOnlyResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String resourceUri; + + private String associationName; + + public DataCollectionRuleAssociationProxyOnlyResourceImpl withExistingResourceUri(String resourceUri) { + this.resourceUri = resourceUri; + return this; + } + + public DataCollectionRuleAssociationProxyOnlyResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRuleAssociations() + .createWithResponse(resourceUri, associationName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DataCollectionRuleAssociationProxyOnlyResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRuleAssociations() + .createWithResponse(resourceUri, associationName, this.innerModel(), context) + .getValue(); + return this; + } + + DataCollectionRuleAssociationProxyOnlyResourceImpl( + String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new DataCollectionRuleAssociationProxyOnlyResourceInner(); + this.serviceManager = serviceManager; + this.associationName = name; + } + + public DataCollectionRuleAssociationProxyOnlyResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRuleAssociations() + .getWithResponse(resourceUri, associationName, Context.NONE) + .getValue(); + return this; + } + + public DataCollectionRuleAssociationProxyOnlyResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRuleAssociations() + .getWithResponse(resourceUri, associationName, context) + .getValue(); + return this; + } + + public DataCollectionRuleAssociationProxyOnlyResourceImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public DataCollectionRuleAssociationProxyOnlyResourceImpl withDataCollectionRuleId(String dataCollectionRuleId) { + this.innerModel().withDataCollectionRuleId(dataCollectionRuleId); + return this; + } + + public DataCollectionRuleAssociationProxyOnlyResourceImpl withDataCollectionEndpointId( + String dataCollectionEndpointId) { + this.innerModel().withDataCollectionEndpointId(dataCollectionEndpointId); + return this; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationsClientImpl.java new file mode 100644 index 0000000000000..bda01a82eb107 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationsClientImpl.java @@ -0,0 +1,1030 @@ +// Copyright (c) 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.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.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 { + private final ClientLogger logger = new ClientLogger(DataCollectionRuleAssociationsClientImpl.class); + + /** 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("/{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); + } + + /** + * 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. + */ + @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-04-01"; + 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. + */ + @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-04-01"; + 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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-04-01"; + 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. + */ + @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-04-01"; + 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. + */ + @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. + */ + @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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByRule( + String resourceGroupName, String dataCollectionRuleName, Context context) { + return new PagedIterable<>(listByRuleAsync(resourceGroupName, dataCollectionRuleName, 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. + */ + @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-04-01"; + 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. + */ + @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-04-01"; + 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. + */ + @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. + */ + @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. + */ + @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-04-01"; + 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. + */ + @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-04-01"; + 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. + */ + @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. + */ + @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. + */ + @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 completion. + */ + @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-04-01"; + 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 completion. + */ + @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-04-01"; + 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 the completion. + */ + @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 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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)); + } +} 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..e8438031871e7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleAssociationsImpl.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.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DataCollectionRuleAssociationsImpl implements DataCollectionRuleAssociations { + @JsonIgnore private 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 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).getValue(); + } + + 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..6fcee7f9cf4d3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRuleResourceImpl.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.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleDataSources; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleDestinations; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleResource; +import com.azure.resourcemanager.monitor.generated.models.DataFlow; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionRuleProvisioningState; +import com.azure.resourcemanager.monitor.generated.models.KnownDataCollectionRuleResourceKind; +import com.azure.resourcemanager.monitor.generated.models.ResourceForUpdate; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class DataCollectionRuleResourceImpl + implements DataCollectionRuleResource, DataCollectionRuleResource.Definition, DataCollectionRuleResource.Update { + private DataCollectionRuleResourceInner innerObject; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String location() { + return this.innerModel().location(); + } + + public Map tags() { + Map inner = this.innerModel().tags(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public KnownDataCollectionRuleResourceKind kind() { + return this.innerModel().kind(); + } + + public String etag() { + return this.innerModel().etag(); + } + + public SystemData systemData() { + return this.innerModel().systemData(); + } + + public String description() { + return this.innerModel().description(); + } + + public String immutableId() { + return this.innerModel().immutableId(); + } + + public DataCollectionRuleDataSources dataSources() { + return this.innerModel().dataSources(); + } + + public DataCollectionRuleDestinations destinations() { + return this.innerModel().destinations(); + } + + public List dataFlows() { + List inner = this.innerModel().dataFlows(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public KnownDataCollectionRuleProvisioningState provisioningState() { + return this.innerModel().provisioningState(); + } + + public Region region() { + return Region.fromName(this.regionName()); + } + + public String regionName() { + return this.location(); + } + + public DataCollectionRuleResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.monitor.generated.MonitorManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String dataCollectionRuleName; + + private ResourceForUpdate updateBody; + + public DataCollectionRuleResourceImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public DataCollectionRuleResource create() { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRules() + .createWithResponse(resourceGroupName, dataCollectionRuleName, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DataCollectionRuleResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRules() + .createWithResponse(resourceGroupName, dataCollectionRuleName, this.innerModel(), context) + .getValue(); + return this; + } + + DataCollectionRuleResourceImpl( + String name, com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = new DataCollectionRuleResourceInner(); + this.serviceManager = serviceManager; + this.dataCollectionRuleName = name; + } + + public DataCollectionRuleResourceImpl update() { + this.updateBody = new ResourceForUpdate(); + return this; + } + + public DataCollectionRuleResource apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRules() + .updateWithResponse(resourceGroupName, dataCollectionRuleName, updateBody, Context.NONE) + .getValue(); + return this; + } + + public DataCollectionRuleResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRules() + .updateWithResponse(resourceGroupName, dataCollectionRuleName, updateBody, context) + .getValue(); + return this; + } + + DataCollectionRuleResourceImpl( + DataCollectionRuleResourceInner innerObject, + com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.dataCollectionRuleName = Utils.getValueFromIdByName(innerObject.id(), "dataCollectionRules"); + } + + public DataCollectionRuleResource refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRules() + .getByResourceGroupWithResponse(resourceGroupName, dataCollectionRuleName, Context.NONE) + .getValue(); + return this; + } + + public DataCollectionRuleResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDataCollectionRules() + .getByResourceGroupWithResponse(resourceGroupName, dataCollectionRuleName, context) + .getValue(); + return this; + } + + public DataCollectionRuleResourceImpl withRegion(Region location) { + this.innerModel().withLocation(location.toString()); + return this; + } + + public DataCollectionRuleResourceImpl withRegion(String location) { + this.innerModel().withLocation(location); + return this; + } + + public DataCollectionRuleResourceImpl withTags(Map tags) { + if (isInCreateMode()) { + this.innerModel().withTags(tags); + return this; + } else { + this.updateBody.withTags(tags); + return this; + } + } + + public DataCollectionRuleResourceImpl withKind(KnownDataCollectionRuleResourceKind kind) { + this.innerModel().withKind(kind); + return this; + } + + public DataCollectionRuleResourceImpl withDescription(String description) { + this.innerModel().withDescription(description); + return this; + } + + public DataCollectionRuleResourceImpl withDataSources(DataCollectionRuleDataSources dataSources) { + this.innerModel().withDataSources(dataSources); + return this; + } + + public DataCollectionRuleResourceImpl withDestinations(DataCollectionRuleDestinations destinations) { + this.innerModel().withDestinations(destinations); + return this; + } + + public DataCollectionRuleResourceImpl withDataFlows(List dataFlows) { + this.innerModel().withDataFlows(dataFlows); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRulesClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRulesClientImpl.java new file mode 100644 index 0000000000000..c5303d7e673de --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRulesClientImpl.java @@ -0,0 +1,1316 @@ +// Copyright (c) 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.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.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 { + private final ClientLogger logger = new ClientLogger(DataCollectionRulesClientImpl.class); + + /** 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. + */ + @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-04-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())); + } + + /** + * 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. + */ + @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-04-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)); + } + + /** + * 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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-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(), + 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. + */ + @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-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(), + 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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-04-01"; + 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. + */ + @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-04-01"; + 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. + */ + @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. + */ + @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. + */ + @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-04-01"; + 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. + */ + @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-04-01"; + 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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-04-01"; + 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. + */ + @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-04-01"; + 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. + */ + @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. + */ + @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. + */ + @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 completion. + */ + @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-04-01"; + 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 completion. + */ + @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-04-01"; + 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 the completion. + */ + @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 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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..fc23adf1da82b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DataCollectionRulesImpl.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.DataCollectionRulesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRuleResource; +import com.azure.resourcemanager.monitor.generated.models.DataCollectionRules; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DataCollectionRulesImpl implements DataCollectionRules { + @JsonIgnore private 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).getValue(); + } + + 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..188ac2cd6c1a1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoriesClientImpl.java @@ -0,0 +1,311 @@ +// Copyright (c) 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.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 reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in DiagnosticSettingsCategoriesClient. */ +public final class DiagnosticSettingsCategoriesClientImpl implements DiagnosticSettingsCategoriesClient { + private final ClientLogger logger = new ClientLogger(DiagnosticSettingsCategoriesClientImpl.class); + + /** 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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..3405fe94621e5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsCategoriesImpl.java @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DiagnosticSettingsCategoriesImpl implements DiagnosticSettingsCategories { + @JsonIgnore private 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/DiagnosticSettingsClientImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsClientImpl.java new file mode 100644 index 0000000000000..c08267a621a21 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsClientImpl.java @@ -0,0 +1,582 @@ +// Copyright (c) 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.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.DiagnosticSettingsClient; +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 DiagnosticSettingsClient. */ +public final class DiagnosticSettingsClientImpl implements DiagnosticSettingsClient { + private final ClientLogger logger = new ClientLogger(DiagnosticSettingsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DiagnosticSettingsService service; + + /** The service client containing this operation class. */ + private final MonitorClientImpl client; + + /** + * Initializes an instance of DiagnosticSettingsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DiagnosticSettingsClientImpl(MonitorClientImpl client) { + this.service = + RestProxy.create(DiagnosticSettingsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MonitorClientDiagnosticSettings to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MonitorClientDiagnos") + private interface DiagnosticSettingsService { + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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 completion. + */ + @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 completion. + */ + @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 the completion. + */ + @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 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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/DiagnosticSettingsImpl.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsImpl.java new file mode 100644 index 0000000000000..b2b8f9b247029 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/DiagnosticSettingsImpl.java @@ -0,0 +1,202 @@ +// Copyright (c) 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.DiagnosticSettingsClient; +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.DiagnosticSettings; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsResource; +import com.azure.resourcemanager.monitor.generated.models.DiagnosticSettingsResourceCollection; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DiagnosticSettingsImpl implements DiagnosticSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DiagnosticSettingsImpl.class); + + private final DiagnosticSettingsClient innerClient; + + private final com.azure.resourcemanager.monitor.generated.MonitorManager serviceManager; + + public DiagnosticSettingsImpl( + DiagnosticSettingsClient 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).getValue(); + } + + 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 DiagnosticSettingsClient 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..c77d9f5db28fd --- /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() + .getDiagnosticSettings() + .createOrUpdateWithResponse(resourceUri, name, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DiagnosticSettingsResource create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDiagnosticSettings() + .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() + .getDiagnosticSettings() + .createOrUpdateWithResponse(resourceUri, name, this.innerModel(), Context.NONE) + .getValue(); + return this; + } + + public DiagnosticSettingsResource apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDiagnosticSettings() + .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() + .getDiagnosticSettings() + .getWithResponse(resourceUri, name, Context.NONE) + .getValue(); + return this; + } + + public DiagnosticSettingsResource refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDiagnosticSettings() + .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..1cae5b07d2081 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/EventCategoriesClientImpl.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.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.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.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 { + private final ClientLogger logger = new ClientLogger(EventCategoriesClientImpl.class); + + /** 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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..8d7632eda4e2e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/EventCategoriesImpl.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.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class EventCategoriesImpl implements EventCategories { + @JsonIgnore private 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..4cae3c22954cc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LogProfilesClientImpl.java @@ -0,0 +1,806 @@ +// Copyright (c) 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.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.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 { + private final ClientLogger logger = new ClientLogger(LogProfilesClientImpl.class); + + /** 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 completion. + */ + @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 completion. + */ + @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 the completion. + */ + @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 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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..1304844b70e24 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/LogProfilesImpl.java @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LogProfilesImpl implements LogProfiles { + @JsonIgnore private 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).getValue(); + } + + 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..f45ed9a95f6d8 --- /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 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 String kind() { + return this.innerModel().kind(); + } + + public String etag() { + return this.innerModel().etag(); + } + + 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..73b0401ca1162 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsClientImpl.java @@ -0,0 +1,1056 @@ +// Copyright (c) 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.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.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 { + private final ClientLogger logger = new ClientLogger(MetricAlertsClientImpl.class); + + /** 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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.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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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.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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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.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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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.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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @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 completion. + */ + @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. + * @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 completion. + */ + @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. + * @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 completion. + */ + @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. + * @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. + * @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 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..81a5c0014a125 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsImpl.java @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.MetricAlertsClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricAlertResourceInner; +import com.azure.resourcemanager.monitor.generated.models.MetricAlertResource; +import com.azure.resourcemanager.monitor.generated.models.MetricAlerts; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class MetricAlertsImpl implements MetricAlerts { + @JsonIgnore private 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).getValue(); + } + + 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..50d1db9280ed7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsStatusClientImpl.java @@ -0,0 +1,404 @@ +// Copyright (c) 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.core.util.logging.ClientLogger; +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 { + private final ClientLogger logger = new ClientLogger(MetricAlertsStatusClientImpl.class); + + /** 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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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..60334ca28c551 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricAlertsStatusImpl.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.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class MetricAlertsStatusImpl implements MetricAlertsStatus { + @JsonIgnore private 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..e516c2841edd0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricDefinitionsClientImpl.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.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.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.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 { + private final ClientLogger logger = new ClientLogger(MetricDefinitionsClientImpl.class); + + /** 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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..5f3fc7ad569cc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricDefinitionsImpl.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.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class MetricDefinitionsImpl implements MetricDefinitions { + @JsonIgnore private 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..a58b54bb980ff --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricNamespacesClientImpl.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.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.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 { + private final ClientLogger logger = new ClientLogger(MetricNamespacesClientImpl.class); + + /** 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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..506fb34221dc5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricNamespacesImpl.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.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class MetricNamespacesImpl implements MetricNamespaces { + @JsonIgnore private 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..bde5bb21b6729 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricsClientImpl.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.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.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.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 { + private final ClientLogger logger = new ClientLogger(MetricsClientImpl.class); + + /** 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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..077e530b21a45 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/MetricsImpl.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.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 com.fasterxml.jackson.annotation.JsonIgnore; +import java.time.Duration; + +public final class MetricsImpl implements Metrics { + @JsonIgnore private 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..a3f6b5e5aa6a5 --- /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.DiagnosticSettingsClient; +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 { + private final ClientLogger logger = new ClientLogger(MonitorClientImpl.class); + + /** 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 DiagnosticSettingsClient object to access its operations. */ + private final DiagnosticSettingsClient diagnosticSettings; + + /** + * Gets the DiagnosticSettingsClient object to access its operations. + * + * @return the DiagnosticSettingsClient object. + */ + public DiagnosticSettingsClient getDiagnosticSettings() { + return this.diagnosticSettings; + } + + /** 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.diagnosticSettings = new DiagnosticSettingsClientImpl(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)); + } + } +} 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..90eb256f7bc8f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationsClientImpl.java @@ -0,0 +1,157 @@ +// Copyright (c) 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.core.util.logging.ClientLogger; +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 { + private final ClientLogger logger = new ClientLogger(OperationsClientImpl.class); + + /** 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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..f8c1e174ef283 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/OperationsImpl.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.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class OperationsImpl implements Operations { + @JsonIgnore private 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..61e72b3c017d3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1172 @@ +// Copyright (c) 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.logging.ClientLogger; +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 { + private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionsClientImpl.class); + + /** 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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @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) + 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. + * @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) + 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. + * @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) + 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, + Context.NONE); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. + * @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) + 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. + * @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 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. + * @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 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. + * @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) + 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. + * @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) + 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. + * @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. + * @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. + * @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 completion. + */ + @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. + * @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 completion. + */ + @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. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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, Context.NONE); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @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 completion. + */ + @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. + * @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 completion. + */ + @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. + * @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. + * @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. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @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. + */ + @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. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope. + */ + @ServiceMethod(returns = ReturnType.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. + * @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. + */ + @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. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope. + */ + @ServiceMethod(returns = ReturnType.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. + * @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. + */ + @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. + */ + @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. + */ + @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..5d75db46393c5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateEndpointConnectionsImpl.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.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + @JsonIgnore private 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..e73018a326b8c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,524 @@ +// Copyright (c) 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.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.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 { + private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesClientImpl.class); + + /** 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. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @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. + */ + @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. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + */ + @ServiceMethod(returns = ReturnType.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. + * @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. + */ + @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. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the private link resources that need to be created for a Azure Monitor PrivateLinkScope. + */ + @ServiceMethod(returns = ReturnType.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. + * @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. + */ + @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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + */ + @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. + */ + @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..84d1429fefacb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkResourcesImpl.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.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + @JsonIgnore private 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..07acc570ebcc6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopeOperationStatusClientImpl.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.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.core.util.logging.ClientLogger; +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 { + private final ClientLogger logger = new ClientLogger(PrivateLinkScopeOperationStatusClientImpl.class); + + /** 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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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..eed4d231428ab --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopeOperationStatusImpl.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PrivateLinkScopeOperationStatusImpl implements PrivateLinkScopeOperationStatus { + @JsonIgnore private 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..f033f848bf13f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopedResourcesClientImpl.java @@ -0,0 +1,1097 @@ +// Copyright (c) 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.logging.ClientLogger; +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 { + private final ClientLogger logger = new ClientLogger(PrivateLinkScopedResourcesClientImpl.class); + + /** 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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @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) + 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. + * @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) + 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. + * @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) + 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, + Context.NONE); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. + * @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) + 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. + * @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 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. + * @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 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. + * @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) + 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. + * @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) + 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. + * @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. + * @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. + * @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 completion. + */ + @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. + * @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 completion. + */ + @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. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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, Context.NONE); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @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 completion. + */ + @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. + * @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 completion. + */ + @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. + * @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. + * @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. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @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. + */ + @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. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope. + */ + @ServiceMethod(returns = ReturnType.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. + * @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. + */ + @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. + * @param scopeName The name of the Azure Monitor PrivateLinkScope resource. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a private link scope. + */ + @ServiceMethod(returns = ReturnType.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. + * @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. + */ + @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. + */ + @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. + */ + @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..3f38c78f23fba --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopedResourcesImpl.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.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PrivateLinkScopedResourcesImpl implements PrivateLinkScopedResources { + @JsonIgnore private 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..549e13a08a42b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopesClientImpl.java @@ -0,0 +1,1371 @@ +// Copyright (c) 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.logging.ClientLogger; +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 { + private final ClientLogger logger = new ClientLogger(PrivateLinkScopesClientImpl.class); + + /** 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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. + * @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 completion. + */ + @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. + * @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 completion. + */ + @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. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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, Context.NONE); + } + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @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 completion. + */ + @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. + * @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 completion. + */ + @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. + * @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. + * @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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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..8523d54c27db6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/PrivateLinkScopesImpl.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.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PrivateLinkScopesImpl implements PrivateLinkScopes { + @JsonIgnore private 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..563ead887f3bd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScheduledQueryRulesClientImpl.java @@ -0,0 +1,1121 @@ +// Copyright (c) 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.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.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 { + private final ClientLogger logger = new ClientLogger(ScheduledQueryRulesClientImpl.class); + + /** 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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @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) + 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. + * @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. + */ + @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. + * @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) + 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. + * @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. + * @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. + */ + @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. + * @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 completion. + */ + @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. + * @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 completion. + */ + @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. + * @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 completion. + */ + @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. + * @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. + * @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 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + * @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. + */ + @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. + * @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. + */ + @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. + * @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. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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. + * @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. + */ + @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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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. + */ + @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. + * @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. + */ + @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..3149402cc6ce9 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/ScheduledQueryRulesImpl.java @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.ScheduledQueryRulesClient; +import com.azure.resourcemanager.monitor.generated.fluent.models.LogSearchRuleResourceInner; +import com.azure.resourcemanager.monitor.generated.models.LogSearchRuleResource; +import com.azure.resourcemanager.monitor.generated.models.ScheduledQueryRules; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ScheduledQueryRulesImpl implements ScheduledQueryRules { + @JsonIgnore private 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).getValue(); + } + + 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..6ad31b989622e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActivityLogsClientImpl.java @@ -0,0 +1,404 @@ +// Copyright (c) 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.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.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 { + private final ClientLogger logger = new ClientLogger(TenantActivityLogsClientImpl.class); + + /** 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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. + */ + @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..ec0d40d7c9451 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/TenantActivityLogsImpl.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.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TenantActivityLogsImpl implements TenantActivityLogs { + @JsonIgnore private 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/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..c124e9abb5fc1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/VMInsightsClientImpl.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.implementation; + +import com.azure.core.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.core.util.logging.ClientLogger; +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 { + private final ClientLogger logger = new ClientLogger(VMInsightsClientImpl.class); + + /** 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. + */ + @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. + */ + @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. + */ + @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. + */ + @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..7e4e34873caa8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/implementation/VMInsightsImpl.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.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; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VMInsightsImpl implements VMInsights { + @JsonIgnore private 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..65c34e25cdfb6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Action.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.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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) +}) +@JsonFlatten +@Immutable +public class Action { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Action.class); + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupList.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupList.java new file mode 100644 index 0000000000000..6a2ca5604680e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.ActionGroupResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of action groups. */ +@Fluent +public final class ActionGroupList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ActionGroupList.class); + + /* + * 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..73a11e23bbe76 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupPatchBody.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.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An action group object for the body of patch operations. */ +@JsonFlatten +@Fluent +public class ActionGroupPatchBody { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ActionGroupPatchBody.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Indicates whether this action group is enabled. If an action group is + * not enabled, then none of its actions will be activated. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * 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 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 ActionGroupPatchBody object itself. + */ + public ActionGroupPatchBody 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/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..de775d6eedcfd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroupResource.java @@ -0,0 +1,476 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 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. + * @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 { + /** + * 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); + } + } + /** + * 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 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..c063b099bcc76 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActionGroups.java @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.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. + * @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. + * @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. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String actionGroupName, Context context); + + /** + * Delete an action group. + * + * @param resourceGroupName The name of the resource group. + * @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. + * @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 response. + */ + Response deleteWithResponse(String resourceGroupName, String actionGroupName, 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. + */ + 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. + */ + PagedIterable list(Context context); + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource 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 a list of all action groups in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get a list of all action groups in a resource group. + * + * @param resourceGroupName The name of the resource 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 a list of all action groups in a resource group. + */ + 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. + * @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. + * @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 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. + */ + 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. + */ + 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 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/ActivityLogAlertActionGroup.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertActionGroup.java new file mode 100644 index 0000000000000..ae6795d61a0d0 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertActionGroup.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** A pointer to an Azure Action Group. */ +@Fluent +public final class ActivityLogAlertActionGroup { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ActivityLogAlertActionGroup.class); + + /* + * The resourceId 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") + private Map webhookProperties; + + /** + * Get the actionGroupId property: The resourceId 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 resourceId of the action group. This cannot be null or empty. + * + * @param actionGroupId the actionGroupId value to set. + * @return the ActivityLogAlertActionGroup object itself. + */ + public ActivityLogAlertActionGroup withActionGroupId(String actionGroupId) { + this.actionGroupId = actionGroupId; + return this; + } + + /** + * Get the webhookProperties property: the dictionary of custom properties to include with the post operation. These + * data are appended to the webhook payload. + * + * @return the webhookProperties value. + */ + public Map webhookProperties() { + return this.webhookProperties; + } + + /** + * Set the webhookProperties property: the dictionary of custom properties to include with the post operation. These + * data are appended to the webhook payload. + * + * @param webhookProperties the webhookProperties value to set. + * @return the ActivityLogAlertActionGroup object itself. + */ + public ActivityLogAlertActionGroup withWebhookProperties(Map webhookProperties) { + this.webhookProperties = webhookProperties; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (actionGroupId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property actionGroupId in model ActivityLogAlertActionGroup")); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertActionList.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertActionList.java new file mode 100644 index 0000000000000..041b934f49c36 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertActionList.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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of activity log alert actions. */ +@Fluent +public final class ActivityLogAlertActionList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ActivityLogAlertActionList.class); + + /* + * The list of activity log alerts. + */ + @JsonProperty(value = "actionGroups") + private List actionGroups; + + /** + * Get the actionGroups property: The list of activity log alerts. + * + * @return the actionGroups value. + */ + public List actionGroups() { + return this.actionGroups; + } + + /** + * Set the actionGroups property: The list of activity log alerts. + * + * @param actionGroups the actionGroups value to set. + * @return the ActivityLogAlertActionList object itself. + */ + public ActivityLogAlertActionList 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/ActivityLogAlertAllOfCondition.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertAllOfCondition.java new file mode 100644 index 0000000000000..43d662500f139 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertAllOfCondition.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.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** An Activity Log alert condition that is met when all its member conditions are met. */ +@Fluent +public final class ActivityLogAlertAllOfCondition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ActivityLogAlertAllOfCondition.class); + + /* + * The list of activity log alert conditions. + */ + @JsonProperty(value = "allOf", required = true) + private List allOf; + + /** + * Get the allOf property: The list of activity log alert conditions. + * + * @return the allOf value. + */ + public List allOf() { + return this.allOf; + } + + /** + * Set the allOf property: The list of activity log alert conditions. + * + * @param allOf the allOf value to set. + * @return the ActivityLogAlertAllOfCondition object itself. + */ + public ActivityLogAlertAllOfCondition withAllOf(List allOf) { + this.allOf = allOf; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (allOf() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property allOf in model ActivityLogAlertAllOfCondition")); + } else { + allOf().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertLeafCondition.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertLeafCondition.java new file mode 100644 index 0000000000000..43368f277cad1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertLeafCondition.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Activity Log alert condition that is met by comparing an activity log field and value. */ +@Fluent +public final class ActivityLogAlertLeafCondition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ActivityLogAlertLeafCondition.class); + + /* + * The name of the field that this condition will examine. The possible + * values for this field are (case-insensitive): 'resourceId', 'category', + * 'caller', 'level', 'operationName', 'resourceGroup', 'resourceProvider', + * 'status', 'subStatus', 'resourceType', or anything beginning with + * 'properties.'. + */ + @JsonProperty(value = "field", required = true) + private String field; + + /* + * The field value will be compared to this value (case-insensitive) to + * determine if the condition is met. + */ + @JsonProperty(value = "equals", required = true) + private String equals; + + /** + * Get the field property: The name of the field that this condition will examine. The possible values for this + * field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', + * 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'. + * + * @return the field value. + */ + public String field() { + return this.field; + } + + /** + * Set the field property: The name of the field that this condition will examine. The possible values for this + * field are (case-insensitive): 'resourceId', 'category', 'caller', 'level', 'operationName', 'resourceGroup', + * 'resourceProvider', 'status', 'subStatus', 'resourceType', or anything beginning with 'properties.'. + * + * @param field the field value to set. + * @return the ActivityLogAlertLeafCondition object itself. + */ + public ActivityLogAlertLeafCondition withField(String field) { + this.field = field; + return this; + } + + /** + * Get the equals property: The field value 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 field value will be compared to this value (case-insensitive) to determine if the + * condition is met. + * + * @param equals the equals value to set. + * @return the ActivityLogAlertLeafCondition object itself. + */ + public ActivityLogAlertLeafCondition withEquals(String equals) { + this.equals = equals; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (field() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property field in model ActivityLogAlertLeafCondition")); + } + if (equals() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property equals in model ActivityLogAlertLeafCondition")); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertList.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertList.java new file mode 100644 index 0000000000000..d4c37e2d467e2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertList.java @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.ActivityLogAlertResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of activity log alerts. */ +@Fluent +public final class ActivityLogAlertList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ActivityLogAlertList.class); + + /* + * The list of activity log alerts. + */ + @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 alerts. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of activity log alerts. + * + * @param value the value value to set. + * @return the ActivityLogAlertList object itself. + */ + public ActivityLogAlertList 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 ActivityLogAlertList object itself. + */ + public ActivityLogAlertList 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/ActivityLogAlertPatchBody.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertPatchBody.java new file mode 100644 index 0000000000000..e2dbb46684f51 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertPatchBody.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.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An activity log alert object for the body of patch operations. */ +@JsonFlatten +@Fluent +public class ActivityLogAlertPatchBody { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ActivityLogAlertPatchBody.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Indicates whether this activity log alert is enabled. If an activity log + * alert is not enabled, then none of its actions will be activated. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /** + * 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 ActivityLogAlertPatchBody object itself. + */ + public ActivityLogAlertPatchBody withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the enabled property: Indicates whether this activity log alert is enabled. If an activity log alert 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 is enabled. If an activity log alert is not + * enabled, then none of its actions will be activated. + * + * @param enabled the enabled value to set. + * @return the ActivityLogAlertPatchBody object itself. + */ + public ActivityLogAlertPatchBody 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/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..7fd0e7e8d0a58 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlertResource.java @@ -0,0 +1,304 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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 resourceIds that will be used as prefixes. The alert will only apply to + * activityLogs with resourceIds that fall under one of these prefixes. This list must include at least one item. + * + * @return the scopes value. + */ + List scopes(); + + /** + * Gets the enabled property: Indicates whether this activity log alert is enabled. If an activity log alert is not + * enabled, then none of its actions will be activated. + * + * @return the enabled value. + */ + Boolean enabled(); + + /** + * Gets the condition property: The condition that will cause this alert to activate. + * + * @return the condition value. + */ + ActivityLogAlertAllOfCondition condition(); + + /** + * Gets the actions property: The actions that will activate when the condition is met. + * + * @return the actions value. + */ + ActivityLogAlertActionList actions(); + + /** + * Gets the description property: A description of this activity log alert. + * + * @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. + * @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.WithEnabled, + DefinitionStages.WithCondition, + DefinitionStages.WithActions, + 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 resourceIds that will be used as prefixes. The alert will only + * apply to activityLogs with resourceIds that fall under one of these prefixes. This list must include at + * least one item.. + * + * @param scopes A list of resourceIds that will be used as prefixes. The alert will only apply to + * activityLogs with resourceIds that fall under one of these prefixes. This list must include at least + * one item. + * @return the next definition stage. + */ + WithCreate withScopes(List scopes); + } + /** The stage of the ActivityLogAlertResource definition allowing to specify enabled. */ + interface WithEnabled { + /** + * Specifies the enabled property: Indicates whether this activity log alert is enabled. If an activity log + * alert is not enabled, then none of its actions will be activated.. + * + * @param enabled Indicates whether this activity log alert is enabled. If an activity log alert is not + * enabled, then none of its actions will be activated. + * @return the next definition stage. + */ + WithCreate withEnabled(Boolean enabled); + } + /** The stage of the ActivityLogAlertResource definition allowing to specify condition. */ + interface WithCondition { + /** + * Specifies the condition property: The condition that will cause this alert to activate.. + * + * @param condition The condition that will cause this alert to activate. + * @return the next definition stage. + */ + WithCreate withCondition(ActivityLogAlertAllOfCondition condition); + } + /** The stage of the ActivityLogAlertResource definition allowing to specify actions. */ + interface WithActions { + /** + * Specifies the actions property: The actions that will activate when the condition is met.. + * + * @param actions The actions that will activate when the condition is met. + * @return the next definition stage. + */ + WithCreate withActions(ActivityLogAlertActionList actions); + } + /** The stage of the ActivityLogAlertResource definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: A description of this activity log alert.. + * + * @param description A description of this activity log alert. + * @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: Resource tags. + * + * @param tags 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 is enabled. If an activity log + * alert is not enabled, then none of its actions will be activated.. + * + * @param enabled Indicates whether this activity log alert is enabled. If an activity log alert is not + * enabled, then none of its actions will be activated. + * @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..91f85856da798 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ActivityLogAlerts.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 ActivityLogAlerts. */ +public interface ActivityLogAlerts { + /** + * Get an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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. + */ + ActivityLogAlertResource getByResourceGroup(String resourceGroupName, String activityLogAlertName); + + /** + * Get an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String activityLogAlertName, Context context); + + /** + * Delete an activity log alert. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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. + * + * @param resourceGroupName The name of the resource group. + * @param activityLogAlertName The name of the activity log alert. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + Response deleteWithResponse(String resourceGroupName, String activityLogAlertName, Context context); + + /** + * Get a list of all activity log alerts 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 alerts in a subscription. + */ + PagedIterable list(); + + /** + * Get a list of all activity log alerts 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 alerts in a subscription. + */ + PagedIterable list(Context context); + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource 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 a list of all activity log alerts in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Get a list of all activity log alerts in a resource group. + * + * @param resourceGroupName The name of the resource 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 a list of all activity log alerts in a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Get an activity log alert. + * + * @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. + */ + ActivityLogAlertResource getById(String id); + + /** + * Get an activity log alert. + * + * @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. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Delete an activity log alert. + * + * @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. + * + * @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 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..0681a435af189 --- /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. + */ + 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. + */ + 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/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..dddb5d9b11c00 --- /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. + * @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. + * @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. + */ + 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. + * @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. + */ + PagedIterable listByAlertRule(String resourceGroupName, String ruleName); + + /** + * Gets a list of incidents associated to an alert rule. + * + * @param resourceGroupName The name of the resource group. + * @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. + */ + 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/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..576289a70bc95 --- /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. + * @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..f2f7afe8ed9ef --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleResourceCollection.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.AlertRuleResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of alert rule resources. */ +@Fluent +public final class AlertRuleResourceCollection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AlertRuleResourceCollection.class); + + /* + * 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..619bad508bb59 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertRuleResourcePatch.java @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT 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.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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. */ +@JsonFlatten +@Fluent +public class AlertRuleResourcePatch { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AlertRuleResourcePatch.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * the name of the alert rule. + */ + @JsonProperty(value = "properties.name") + private String name; + + /* + * the description of the alert rule that will be included in the alert + * email. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * the provisioning state. + */ + @JsonProperty(value = "properties.provisioningState") + private String provisioningState; + + /* + * the flag that indicates whether the alert rule is enabled. + */ + @JsonProperty(value = "properties.isEnabled") + private Boolean isEnabled; + + /* + * the condition that results in the alert rule being activated. + */ + @JsonProperty(value = "properties.condition") + private RuleCondition condition; + + /* + * action that is performed when the alert rule becomes active, and when an + * alert condition is resolved. + */ + @JsonProperty(value = "properties.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 = "properties.actions") + private List actions; + + /* + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdatedTime; + + /** + * 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 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 AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch 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 AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch 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 AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch 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 AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch 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 AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch 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 AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch 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 AlertRuleResourcePatch object itself. + */ + public AlertRuleResourcePatch 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 (condition() != null) { + condition().validate(); + } + if (action() != null) { + action().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/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..0fc181fe6f0f9 --- /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. + * @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. + * @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 response. + */ + Response deleteWithResponse(String resourceGroupName, String ruleName, Context context); + + /** + * Gets a classic metric alert rule. + * + * @param resourceGroupName The name of the resource group. + * @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. + * @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. + */ + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List the classic metric alert rules within a resource group. + * + * @param resourceGroupName The name of the resource 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 represents a collection of alert rule resources. + */ + 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. + */ + 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. + */ + 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. + */ + 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. + */ + 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 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..2ff38034b5bff --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AlertingAction.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.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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") +@JsonFlatten +@Fluent +public class AlertingAction extends Action { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AlertingAction.class); + + /* + * 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(); + } + } +} 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..7b9aa3030caec --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ArmRoleReceiver.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An arm role receiver. */ +@Fluent +public final class ArmRoleReceiver { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ArmRoleReceiver.class); + + /* + * 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")); + } + } +} 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..f0e5fcde7aef2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutomationRunbookReceiver.java @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Azure Automation Runbook notification receiver. */ +@Fluent +public final class AutomationRunbookReceiver { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutomationRunbookReceiver.class); + + /* + * 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")); + } + } +} 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..6f0a69798af0e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleNotification.java @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Autoscale notification. */ +@Fluent +public final class AutoscaleNotification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoscaleNotification.class); + + /* + * the operation associated with the notification and its value must be + * "scale" + */ + @JsonProperty(value = "operation", required = true) + private String operation; + + /* + * 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..819372efb49f2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleProfile.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Autoscale profile. */ +@Fluent +public final class AutoscaleProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoscaleProfile.class); + + /* + * 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(); + } + } +} 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..3f645999a0b44 --- /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. + * @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..00d7ef78d3347 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettingResourceCollection.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.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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of autoscale setting resources. */ +@Fluent +public final class AutoscaleSettingResourceCollection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoscaleSettingResourceCollection.class); + + /* + * 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()); + } + } +} 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..86da955c45abf --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AutoscaleSettingResourcePatch.java @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The autoscale setting object for patch operations. */ +@JsonFlatten +@Fluent +public class AutoscaleSettingResourcePatch { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AutoscaleSettingResourcePatch.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * 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 = "properties.profiles") + private List profiles; + + /* + * the collection of notifications. + */ + @JsonProperty(value = "properties.notifications") + private List notifications; + + /* + * the enabled flag. Specifies whether automatic scaling is enabled for the + * resource. The default value is 'true'. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /* + * the name of the autoscale setting. + */ + @JsonProperty(value = "properties.name") + private String name; + + /* + * the resource identifier of the resource that the autoscale setting + * should be added to. + */ + @JsonProperty(value = "properties.targetResourceUri") + private String targetResourceUri; + + /* + * the location of the resource that the autoscale setting should be added + * to. + */ + @JsonProperty(value = "properties.targetResourceLocation") + private String targetResourceLocation; + + /** + * 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 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 AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch 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 AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch 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 AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch 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 AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch 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 AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch 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 AutoscaleSettingResourcePatch object itself. + */ + public AutoscaleSettingResourcePatch 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) { + profiles().forEach(e -> e.validate()); + } + if (notifications() != null) { + notifications().forEach(e -> e.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..3f910b5e4b37f --- /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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Lists the autoscale settings for a resource group. + * + * @param resourceGroupName The name of the resource 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 represents a collection of autoscale setting resources. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Deletes and autoscale setting. + * + * @param resourceGroupName The name of the resource group. + * @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. + * @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 response. + */ + Response deleteWithResponse(String resourceGroupName, String autoscaleSettingName, Context context); + + /** + * Gets an autoscale setting. + * + * @param resourceGroupName The name of the resource group. + * @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. + * @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. + */ + 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. + */ + 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. + */ + 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. + */ + 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. + */ + 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 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..7757602488abe --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzNsActionGroup.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Azure action group. */ +@Fluent +public final class AzNsActionGroup { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzNsActionGroup.class); + + /* + * 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..7090a6838c00d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureAppPushReceiver.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Azure mobile App push notification receiver. */ +@Fluent +public final class AzureAppPushReceiver { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureAppPushReceiver.class); + + /* + * 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")); + } + } +} 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..391e50dbca7dc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureFunctionReceiver.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An azure function receiver. */ +@Fluent +public final class AzureFunctionReceiver { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureFunctionReceiver.class); + + /* + * 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")); + } + } +} 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..4753e7169011e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorMetricsDestination.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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Azure Monitor Metrics destination. */ +@Fluent +public class AzureMonitorMetricsDestination { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureMonitorMetricsDestination.class); + + /* + * 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..e4538ce1bc8de --- /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. + * @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..0b9623e55ab54 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureMonitorPrivateLinkScopeListResult.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.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.AzureMonitorPrivateLinkScopeInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Describes the list of Azure Monitor PrivateLinkScope resources. */ +@Fluent +public final class AzureMonitorPrivateLinkScopeListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureMonitorPrivateLinkScopeListResult.class); + + /* + * 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()); + } + } +} 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..810020bf16b1c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/AzureResource.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An azure resource object. */ +@Fluent +public class AzureResource extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AzureResource.class); + + /* + * 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/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..90eb97b3d1c2c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/BaselineMetadata.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents a baseline metadata value. */ +@Fluent +public final class BaselineMetadata { + @JsonIgnore private final ClientLogger logger = new ClientLogger(BaselineMetadata.class); + + /* + * 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")); + } + } +} 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..c268f9fd20363 --- /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. + */ + 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. + */ + 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/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..c8246d89d9fab --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ConfigurationAccessEndpointSpec.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Definition of the endpoint used for accessing configuration. */ +@Immutable +public class ConfigurationAccessEndpointSpec { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigurationAccessEndpointSpec.class); + + /* + * 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/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..010580ddec9e8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Criteria.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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specifies the criteria for converting log to metric. */ +@Fluent +public final class Criteria { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Criteria.class); + + /* + * 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()); + } + } +} 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..bf7a2957f0fab --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpoint.java @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Definition of data collection endpoint. */ +@Fluent +public class DataCollectionEndpoint { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataCollectionEndpoint.class); + + /* + * 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 agents 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 agents to access their configuration. + * + * @return the configurationAccess value. + */ + public DataCollectionEndpointConfigurationAccess configurationAccess() { + return this.configurationAccess; + } + + /** + * Set the configurationAccess property: The endpoint used by agents 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..cbc596c532e1c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointConfigurationAccess.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The endpoint used by agents to access their configuration. */ +@Immutable +public final class DataCollectionEndpointConfigurationAccess extends ConfigurationAccessEndpointSpec { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataCollectionEndpointConfigurationAccess.class); + + /** + * 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..6528a69ca9eb2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointLogsIngestion.java @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** The endpoint used by clients to ingest logs. */ +@Immutable +public final class DataCollectionEndpointLogsIngestion extends LogsIngestionEndpointSpec { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataCollectionEndpointLogsIngestion.class); + + /** + * 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..41a1667b02308 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointNetworkAcls.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Network access control rules for the endpoints. */ +@Fluent +public final class DataCollectionEndpointNetworkAcls extends NetworkRuleSet { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataCollectionEndpointNetworkAcls.class); + + /** {@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..5cf562595e7ac --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointResource.java @@ -0,0 +1,327 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionEndpointResourceInner; +import java.util.Map; + +/** An immutable client-side representation of DataCollectionEndpointResource. */ +public interface DataCollectionEndpointResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the kind property: The kind of the resource. + * + * @return the kind value. + */ + KnownDataCollectionEndpointResourceKind kind(); + + /** + * Gets the etag property: Resource entity tag (ETag). + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the description property: Description of the data collection endpoint. + * + * @return the description value. + */ + String description(); + + /** + * Gets the immutableId property: The immutable ID of this data collection endpoint resource. This property is + * READ-ONLY. + * + * @return the immutableId value. + */ + String immutableId(); + + /** + * Gets the configurationAccess property: The endpoint used by agents to access their configuration. + * + * @return the configurationAccess value. + */ + DataCollectionEndpointConfigurationAccess configurationAccess(); + + /** + * Gets the logsIngestion property: The endpoint used by clients to ingest logs. + * + * @return the logsIngestion value. + */ + DataCollectionEndpointLogsIngestion logsIngestion(); + + /** + * Gets the networkAcls property: Network access control rules for the endpoints. + * + * @return the networkAcls value. + */ + DataCollectionEndpointNetworkAcls networkAcls(); + + /** + * Gets the provisioningState property: The resource provisioning state. This property is READ-ONLY. + * + * @return the provisioningState value. + */ + KnownDataCollectionEndpointProvisioningState provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionEndpointResourceInner + * object. + * + * @return the inner object. + */ + DataCollectionEndpointResourceInner innerModel(); + + /** The entirety of the DataCollectionEndpointResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The DataCollectionEndpointResource definition stages. */ + interface DefinitionStages { + /** The first stage of the DataCollectionEndpointResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the DataCollectionEndpointResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the DataCollectionEndpointResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the DataCollectionEndpointResource definition which contains all the minimum required properties + * for the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithKind, + DefinitionStages.WithDescription, + DefinitionStages.WithImmutableId, + DefinitionStages.WithConfigurationAccess, + DefinitionStages.WithLogsIngestion, + DefinitionStages.WithNetworkAcls { + /** + * Executes the create request. + * + * @return the created resource. + */ + DataCollectionEndpointResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DataCollectionEndpointResource create(Context context); + } + /** The stage of the DataCollectionEndpointResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the DataCollectionEndpointResource definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: The kind of the resource.. + * + * @param kind The kind of the resource. + * @return the next definition stage. + */ + WithCreate withKind(KnownDataCollectionEndpointResourceKind kind); + } + /** The stage of the DataCollectionEndpointResource definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of the data collection endpoint.. + * + * @param description Description of the data collection endpoint. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the DataCollectionEndpointResource definition allowing to specify immutableId. */ + interface WithImmutableId { + /** + * Specifies the immutableId property: The immutable ID of this data collection endpoint resource. This + * property is READ-ONLY.. + * + * @param immutableId The immutable ID of this data collection endpoint resource. This property is + * READ-ONLY. + * @return the next definition stage. + */ + WithCreate withImmutableId(String immutableId); + } + /** The stage of the DataCollectionEndpointResource definition allowing to specify configurationAccess. */ + interface WithConfigurationAccess { + /** + * Specifies the configurationAccess property: The endpoint used by agents to access their configuration.. + * + * @param configurationAccess The endpoint used by agents to access their configuration. + * @return the next definition stage. + */ + WithCreate withConfigurationAccess(DataCollectionEndpointConfigurationAccess configurationAccess); + } + /** The stage of the DataCollectionEndpointResource definition allowing to specify logsIngestion. */ + interface WithLogsIngestion { + /** + * Specifies the logsIngestion property: The endpoint used by clients to ingest logs.. + * + * @param logsIngestion The endpoint used by clients to ingest logs. + * @return the next definition stage. + */ + WithCreate withLogsIngestion(DataCollectionEndpointLogsIngestion logsIngestion); + } + /** The stage of the DataCollectionEndpointResource definition allowing to specify networkAcls. */ + interface WithNetworkAcls { + /** + * Specifies the networkAcls property: Network access control rules for the endpoints.. + * + * @param networkAcls Network access control rules for the endpoints. + * @return the next definition stage. + */ + WithCreate withNetworkAcls(DataCollectionEndpointNetworkAcls networkAcls); + } + } + /** + * Begins update for the DataCollectionEndpointResource resource. + * + * @return the stage of resource update. + */ + DataCollectionEndpointResource.Update update(); + + /** The template for DataCollectionEndpointResource update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DataCollectionEndpointResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DataCollectionEndpointResource apply(Context context); + } + /** The DataCollectionEndpointResource update stages. */ + interface UpdateStages { + /** The stage of the DataCollectionEndpointResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DataCollectionEndpointResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DataCollectionEndpointResource refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointResourceListResult.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointResourceListResult.java new file mode 100644 index 0000000000000..0710724d900c1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointResourceListResult.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.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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A pageable list of resources. */ +@Fluent +public final class DataCollectionEndpointResourceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataCollectionEndpointResourceListResult.class); + + /* + * 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()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointResourceProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionEndpointResourceProperties.java new file mode 100644 index 0000000000000..711b0d467ae2a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Resource properties. */ +@Fluent +public final class DataCollectionEndpointResourceProperties extends DataCollectionEndpoint { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataCollectionEndpointResourceProperties.class); + + /** {@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/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..5e77203f60c95 --- /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. + */ + 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. + */ + 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. + */ + 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. + */ + 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. + */ + 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 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. + */ + 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. + */ + 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 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..ed93074ea7563 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRule.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Definition of what monitoring data to collect and where that data should be sent. */ +@Fluent +public class DataCollectionRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataCollectionRule.class); + + /* + * 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 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 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 (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..5636fc093f1ac --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociation.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Definition of association of a data collection rule with a monitored Azure resource. */ +@Fluent +public class DataCollectionRuleAssociation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataCollectionRuleAssociation.class); + + /* + * 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; + + /** + * 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; + } + + /** + * 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/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..26afa30dd3786 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationProxyOnlyResource.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.models; + +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleAssociationProxyOnlyResourceInner; + +/** An immutable client-side representation of DataCollectionRuleAssociationProxyOnlyResource. */ +public interface DataCollectionRuleAssociationProxyOnlyResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the etag property: Resource entity tag (ETag). + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the description property: Description of the association. + * + * @return the description value. + */ + String description(); + + /** + * Gets the dataCollectionRuleId property: The resource ID of the data collection rule that is to be associated. + * + * @return the dataCollectionRuleId value. + */ + String dataCollectionRuleId(); + + /** + * Gets the dataCollectionEndpointId property: The resource ID of the data collection endpoint that is to be + * associated. + * + * @return the dataCollectionEndpointId value. + */ + String dataCollectionEndpointId(); + + /** + * Gets the provisioningState property: The resource provisioning state. + * + * @return the provisioningState value. + */ + KnownDataCollectionRuleAssociationProvisioningState provisioningState(); + + /** + * Gets the inner + * com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleAssociationProxyOnlyResourceInner + * object. + * + * @return the inner object. + */ + DataCollectionRuleAssociationProxyOnlyResourceInner innerModel(); + + /** The entirety of the DataCollectionRuleAssociationProxyOnlyResource definition. */ + interface Definition extends DefinitionStages.Blank, DefinitionStages.WithScope, DefinitionStages.WithCreate { + } + /** The DataCollectionRuleAssociationProxyOnlyResource definition stages. */ + interface DefinitionStages { + /** The first stage of the DataCollectionRuleAssociationProxyOnlyResource definition. */ + interface Blank extends WithScope { + } + /** + * The stage of the DataCollectionRuleAssociationProxyOnlyResource definition allowing to specify parent + * resource. + */ + interface WithScope { + /** + * Specifies resourceUri. + * + * @param resourceUri The identifier of the resource. + * @return the next definition stage. + */ + WithCreate withExistingResourceUri(String resourceUri); + } + /** + * The stage of the DataCollectionRuleAssociationProxyOnlyResource definition which contains all the minimum + * required properties for the resource to be created, but also allows for any other optional properties to be + * specified. + */ + interface WithCreate + extends DefinitionStages.WithDescription, + DefinitionStages.WithDataCollectionRuleId, + DefinitionStages.WithDataCollectionEndpointId { + /** + * Executes the create request. + * + * @return the created resource. + */ + DataCollectionRuleAssociationProxyOnlyResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DataCollectionRuleAssociationProxyOnlyResource create(Context context); + } + /** + * The stage of the DataCollectionRuleAssociationProxyOnlyResource definition allowing to specify description. + */ + interface WithDescription { + /** + * Specifies the description property: Description of the association.. + * + * @param description Description of the association. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** + * The stage of the DataCollectionRuleAssociationProxyOnlyResource definition allowing to specify + * dataCollectionRuleId. + */ + interface WithDataCollectionRuleId { + /** + * Specifies the dataCollectionRuleId property: The resource ID of the data collection rule that is to be + * associated.. + * + * @param dataCollectionRuleId The resource ID of the data collection rule that is to be associated. + * @return the next definition stage. + */ + WithCreate withDataCollectionRuleId(String dataCollectionRuleId); + } + /** + * The stage of the DataCollectionRuleAssociationProxyOnlyResource definition allowing to specify + * dataCollectionEndpointId. + */ + interface WithDataCollectionEndpointId { + /** + * Specifies the dataCollectionEndpointId property: The resource ID of the data collection endpoint that is + * to be associated.. + * + * @param dataCollectionEndpointId The resource ID of the data collection endpoint that is to be associated. + * @return the next definition stage. + */ + WithCreate withDataCollectionEndpointId(String dataCollectionEndpointId); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DataCollectionRuleAssociationProxyOnlyResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DataCollectionRuleAssociationProxyOnlyResource refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationProxyOnlyResourceListResult.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationProxyOnlyResourceListResult.java new file mode 100644 index 0000000000000..759d65d8a4800 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationProxyOnlyResourceListResult.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.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleAssociationProxyOnlyResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A pageable list of resources. */ +@Fluent +public final class DataCollectionRuleAssociationProxyOnlyResourceListResult { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(DataCollectionRuleAssociationProxyOnlyResourceListResult.class); + + /* + * 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()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationProxyOnlyResourceProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationProxyOnlyResourceProperties.java new file mode 100644 index 0000000000000..296b4199640b2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociationProxyOnlyResourceProperties.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Resource properties. */ +@Fluent +public final class DataCollectionRuleAssociationProxyOnlyResourceProperties extends DataCollectionRuleAssociation { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(DataCollectionRuleAssociationProxyOnlyResourceProperties.class); + + /** {@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/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..a1a408cf83dcb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleAssociations.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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. + */ + 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. + */ + 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. + */ + 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. + */ + PagedIterable listByRule( + String resourceGroupName, String dataCollectionRuleName, 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. + */ + 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 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. + */ + 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. + */ + 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 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..2c129f25ddcda --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleDataSources.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.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataCollectionRuleDataSources.class); + + /** {@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; + } + + /** + * 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..ddc8f6f719c4a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleDestinations.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.List; + +/** The specification of destinations. */ +@Fluent +public final class DataCollectionRuleDestinations extends DestinationsSpec { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataCollectionRuleDestinations.class); + + /** {@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/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..40425d4c29a13 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleResource.java @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.management.Region; +import com.azure.core.management.SystemData; +import com.azure.core.util.Context; +import com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleResourceInner; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of DataCollectionRuleResource. */ +public interface DataCollectionRuleResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the location property: The geo-location where the resource lives. + * + * @return the location value. + */ + String location(); + + /** + * Gets the tags property: Resource tags. + * + * @return the tags value. + */ + Map tags(); + + /** + * Gets the kind property: The kind of the resource. + * + * @return the kind value. + */ + KnownDataCollectionRuleResourceKind kind(); + + /** + * Gets the etag property: Resource entity tag (ETag). + * + * @return the etag value. + */ + String etag(); + + /** + * Gets the systemData property: Metadata pertaining to creation and last modification of the resource. + * + * @return the systemData value. + */ + SystemData systemData(); + + /** + * Gets the description property: Description of the data collection rule. + * + * @return the description value. + */ + String description(); + + /** + * Gets the immutableId property: The immutable ID of this data collection rule. This property is READ-ONLY. + * + * @return the immutableId value. + */ + String immutableId(); + + /** + * Gets the dataSources property: The specification of data sources. This property is optional and can be omitted if + * the rule is meant to be used via direct calls to the provisioned endpoint. + * + * @return the dataSources value. + */ + DataCollectionRuleDataSources dataSources(); + + /** + * Gets the destinations property: The specification of destinations. + * + * @return the destinations value. + */ + DataCollectionRuleDestinations destinations(); + + /** + * Gets the dataFlows property: The specification of data flows. + * + * @return the dataFlows value. + */ + List dataFlows(); + + /** + * Gets the provisioningState property: The resource provisioning state. + * + * @return the provisioningState value. + */ + KnownDataCollectionRuleProvisioningState provisioningState(); + + /** + * Gets the region of the resource. + * + * @return the region of the resource. + */ + Region region(); + + /** + * Gets the name of the resource region. + * + * @return the name of the resource region. + */ + String regionName(); + + /** + * Gets the inner com.azure.resourcemanager.monitor.generated.fluent.models.DataCollectionRuleResourceInner object. + * + * @return the inner object. + */ + DataCollectionRuleResourceInner innerModel(); + + /** The entirety of the DataCollectionRuleResource definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithCreate { + } + /** The DataCollectionRuleResource definition stages. */ + interface DefinitionStages { + /** The first stage of the DataCollectionRuleResource definition. */ + interface Blank extends WithLocation { + } + /** The stage of the DataCollectionRuleResource definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The geo-location where the resource lives. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the DataCollectionRuleResource definition allowing to specify parent resource. */ + interface WithResourceGroup { + /** + * Specifies resourceGroupName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @return the next definition stage. + */ + WithCreate withExistingResourceGroup(String resourceGroupName); + } + /** + * The stage of the DataCollectionRuleResource definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithTags, + DefinitionStages.WithKind, + DefinitionStages.WithDescription, + DefinitionStages.WithDataSources, + DefinitionStages.WithDestinations, + DefinitionStages.WithDataFlows { + /** + * Executes the create request. + * + * @return the created resource. + */ + DataCollectionRuleResource create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + DataCollectionRuleResource create(Context context); + } + /** The stage of the DataCollectionRuleResource definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the DataCollectionRuleResource definition allowing to specify kind. */ + interface WithKind { + /** + * Specifies the kind property: The kind of the resource.. + * + * @param kind The kind of the resource. + * @return the next definition stage. + */ + WithCreate withKind(KnownDataCollectionRuleResourceKind kind); + } + /** The stage of the DataCollectionRuleResource definition allowing to specify description. */ + interface WithDescription { + /** + * Specifies the description property: Description of the data collection rule.. + * + * @param description Description of the data collection rule. + * @return the next definition stage. + */ + WithCreate withDescription(String description); + } + /** The stage of the DataCollectionRuleResource definition allowing to specify dataSources. */ + interface WithDataSources { + /** + * Specifies the dataSources property: The specification of data sources. This property is optional and can + * be omitted if the rule is meant to be used via direct calls to the provisioned endpoint.. + * + * @param dataSources The specification of data sources. This property is optional and can be omitted if the + * rule is meant to be used via direct calls to the provisioned endpoint. + * @return the next definition stage. + */ + WithCreate withDataSources(DataCollectionRuleDataSources dataSources); + } + /** The stage of the DataCollectionRuleResource definition allowing to specify destinations. */ + interface WithDestinations { + /** + * Specifies the destinations property: The specification of destinations.. + * + * @param destinations The specification of destinations. + * @return the next definition stage. + */ + WithCreate withDestinations(DataCollectionRuleDestinations destinations); + } + /** The stage of the DataCollectionRuleResource definition allowing to specify dataFlows. */ + interface WithDataFlows { + /** + * Specifies the dataFlows property: The specification of data flows.. + * + * @param dataFlows The specification of data flows. + * @return the next definition stage. + */ + WithCreate withDataFlows(List dataFlows); + } + } + /** + * Begins update for the DataCollectionRuleResource resource. + * + * @return the stage of resource update. + */ + DataCollectionRuleResource.Update update(); + + /** The template for DataCollectionRuleResource update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + DataCollectionRuleResource apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + DataCollectionRuleResource apply(Context context); + } + /** The DataCollectionRuleResource update stages. */ + interface UpdateStages { + /** The stage of the DataCollectionRuleResource update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + DataCollectionRuleResource refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + DataCollectionRuleResource refresh(Context context); +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleResourceListResult.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleResourceListResult.java new file mode 100644 index 0000000000000..2e03a29d2ce2a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleResourceListResult.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.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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A pageable list of resources. */ +@Fluent +public final class DataCollectionRuleResourceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataCollectionRuleResourceListResult.class); + + /* + * 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()); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleResourceProperties.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleResourceProperties.java new file mode 100644 index 0000000000000..67d3ae72d0687 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataCollectionRuleResourceProperties.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.JsonIgnore; +import java.util.List; + +/** Resource properties. */ +@Fluent +public final class DataCollectionRuleResourceProperties extends DataCollectionRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataCollectionRuleResourceProperties.class); + + /** {@inheritDoc} */ + @Override + public DataCollectionRuleResourceProperties withDescription(String description) { + super.withDescription(description); + 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/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..883d537de070e --- /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. + */ + 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. + */ + 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. + */ + 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. + */ + 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. + */ + 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 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. + */ + 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. + */ + 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 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..18b7fa964279a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataContainer.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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about a container with data for a given resource. */ +@Fluent +public final class DataContainer { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataContainer.class); + + /* + * 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(); + } + } +} 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..acc9f541c981b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataFlow.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.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Definition of which streams are sent to which destinations. */ +@Fluent +public final class DataFlow { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataFlow.class); + + /* + * 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; + + /** + * 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; + } + + /** + * 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..067e7988f2caa --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DataSourcesSpec.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specification of data sources that will be collected. */ +@Fluent +public class DataSourcesSpec { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DataSourcesSpec.class); + + /* + * 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; + + /** + * 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; + } + + /** + * 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()); + } + } +} 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..1747401764d52 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DestinationsSpec.java @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specification of destinations that can be used in data flows. */ +@Fluent +public class DestinationsSpec { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DestinationsSpec.class); + + /* + * 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..50a81f3db3e56 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DestinationsSpecAzureMonitorMetrics.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** Azure Monitor Metrics destination. */ +@Fluent +public final class DestinationsSpecAzureMonitorMetrics extends AzureMonitorMetricsDestination { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DestinationsSpecAzureMonitorMetrics.class); + + /** {@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/DiagnosticSettings.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettings.java new file mode 100644 index 0000000000000..cb4f4d3ff5c02 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DiagnosticSettings.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 DiagnosticSettings. */ +public interface DiagnosticSettings { + /** + * 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. + */ + 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 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. + */ + 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. + */ + 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. + */ + 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 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/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..74b84e06429b7 --- /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. + */ + 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. + */ + 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/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..4749a8a32c666 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Dimension.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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specifies the criteria for converting log to metric. */ +@Fluent +public final class Dimension { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Dimension.class); + + /* + * 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")); + } + } +} 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..e477f8f7ccc2b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicMetricCriteria.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DynamicMetricCriteria.class); + + /* + * 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(); + } + } +} 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..05d78915bf78c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/DynamicThresholdFailingPeriods.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.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DynamicThresholdFailingPeriods.class); + + /* + * 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..a1eba78d36bcf --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EmailNotification.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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Email notification of an autoscale event. */ +@Fluent +public final class EmailNotification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EmailNotification.class); + + /* + * 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..d5d7d06b135e4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EmailReceiver.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.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An email receiver. */ +@Fluent +public final class EmailReceiver { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EmailReceiver.class); + + /* + * 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")); + } + } +} 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..c20d956f2d11f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EnableRequest.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Describes a receiver that should be resubscribed. */ +@Fluent +public final class EnableRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EnableRequest.class); + + /* + * 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")); + } + } +} 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..a255aac905378 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ErrorResponseCommon.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.annotation.Immutable; +import com.azure.core.management.exception.ManagementError; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The resource management error response. */ +@Immutable +public final class ErrorResponseCommon extends ManagementError { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ErrorResponseCommon.class); + + /* + * 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..f96d305d233c4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventCategories.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of 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. + */ + 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. + */ + 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..2d793e76113fd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventCategoryCollection.java @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.LocalizableStringInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EventCategoryCollection.class); + + /* + * 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()); + } + } +} 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..eb633c58bf872 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/EventDataCollection.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.EventDataInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents collection of events. */ +@Fluent +public final class EventDataCollection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(EventDataCollection.class); + + /* + * 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()); + } + } +} 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..1bc9727e479d5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ExtensionDataSource.java @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ExtensionDataSource.class); + + /* + * 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")); + } + } +} 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..bff57d25b0f89 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/HttpRequestInfo.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The Http request info. */ +@Fluent +public final class HttpRequestInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(HttpRequestInfo.class); + + /* + * 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/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..046641fafd33e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/IncidentListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.IncidentInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The List incidents operation response. */ +@Fluent +public final class IncidentListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(IncidentListResult.class); + + /* + * 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..4df22bd692e7e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ItsmReceiver.java @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An Itsm receiver. */ +@Fluent +public final class ItsmReceiver { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ItsmReceiver.class); + + /* + * 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")); + } + } +} 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/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..d1f6b86efbd48 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LocationThresholdRuleCondition.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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") +@JsonFlatten +@Fluent +public class LocationThresholdRuleCondition extends RuleCondition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LocationThresholdRuleCondition.class); + + /* + * 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..2c53caef41b7d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogAnalyticsDestination.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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Log Analytics destination. */ +@Fluent +public final class LogAnalyticsDestination { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogAnalyticsDestination.class); + + /* + * 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/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..ea6ffe5b86126 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogMetricTrigger.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A log metrics trigger descriptor. */ +@Fluent +public final class LogMetricTrigger { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogMetricTrigger.class); + + /* + * 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..50807e3219d11 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfileCollection.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.LogProfileResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of log profiles. */ +@Fluent +public final class LogProfileCollection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogProfileCollection.class); + + /* + * 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()); + } + } +} 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..961162d7a0589 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogProfileResourcePatch.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.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** The log profile resource for patch operations. */ +@JsonFlatten +@Fluent +public class LogProfileResourcePatch { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogProfileResourcePatch.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * the resource id of the storage account to which you would like to send + * the Activity Log. + */ + @JsonProperty(value = "properties.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 = "properties.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 = "properties.locations") + 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 = "properties.categories") + private List categories; + + /* + * the retention policy for the events in the log. + */ + @JsonProperty(value = "properties.retentionPolicy") + private RetentionPolicy retentionPolicy; + + /** + * 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 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 LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch 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 LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch 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 LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch 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 LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch 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 LogProfileResourcePatch object itself. + */ + public LogProfileResourcePatch 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/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..e10324a89d0fc --- /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 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. + */ + 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. + */ + 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. + */ + 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. + */ + 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. + */ + 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 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..58cdb072217c5 --- /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 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 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 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. + * @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..b2756e6b947ec --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogSearchRuleResourceCollection.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.LogSearchRuleResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of Log Search rule resources. */ +@Fluent +public final class LogSearchRuleResourceCollection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogSearchRuleResourceCollection.class); + + /* + * 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..fe48b47542bdf --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogSearchRuleResourcePatch.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.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** The log search rule resource for patch operations. */ +@JsonFlatten +@Fluent +public class LogSearchRuleResourcePatch { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogSearchRuleResourcePatch.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * The flag which indicates whether the Log Search rule is enabled. Value + * should be true or false + */ + @JsonProperty(value = "properties.enabled") + private Enabled enabled; + + /** + * 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 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 LogSearchRuleResourcePatch object itself. + */ + public LogSearchRuleResourcePatch 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/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..cab9d580bf61d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogSettings.java @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Part of MultiTenantDiagnosticSettings. Specifies the settings for a particular log. */ +@Fluent +public final class LogSettings { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogSettings.class); + + /* + * 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..28c21ac47f087 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogToMetricAction.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.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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") +@JsonFlatten +@Fluent +public class LogToMetricAction extends Action { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogToMetricAction.class); + + /* + * 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()); + } + } +} 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..b1f0e7d119ef8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogicAppReceiver.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A logic app receiver. */ +@Fluent +public final class LogicAppReceiver { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogicAppReceiver.class); + + /* + * 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")); + } + } +} 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..f2b94af487e92 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/LogsIngestionEndpointSpec.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Definition of the endpoint used for ingesting logs. */ +@Immutable +public class LogsIngestionEndpointSpec { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogsIngestionEndpointSpec.class); + + /* + * 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..86e03299fd349 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ManagementEventAggregationCondition.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementEventAggregationCondition.class); + + /* + * 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..ef997dcd0099d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ManagementEventRuleCondition.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.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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") +@JsonFlatten +@Fluent +public class ManagementEventRuleCondition extends RuleCondition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ManagementEventRuleCondition.class); + + /* + * 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/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..9d229668919af --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertAction.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** An alert action. */ +@Fluent +public final class MetricAlertAction { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricAlertAction.class); + + /* + * 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") + 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..94e12ee4a8134 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertCriteria.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.core.annotation.JsonFlatten; +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.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) +}) +@JsonFlatten +@Fluent +public class MetricAlertCriteria { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricAlertCriteria.class); + + /* + * 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.replace("\\.", "."), 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..2a7767a23e0b3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertMultipleResourceMultipleMetricCriteria.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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") +@JsonFlatten +@Fluent +public class MetricAlertMultipleResourceMultipleMetricCriteria extends MetricAlertCriteria { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(MetricAlertMultipleResourceMultipleMetricCriteria.class); + + /* + * 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..84c3daa740d95 --- /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. + * @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..facbb2593da74 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertResourceCollection.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricAlertResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents a collection of alert rule resources. */ +@Fluent +public final class MetricAlertResourceCollection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricAlertResourceCollection.class); + + /* + * 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..347755e538452 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertResourcePatch.java @@ -0,0 +1,397 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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. */ +@JsonFlatten +@Fluent +public class MetricAlertResourcePatch { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricAlertResourcePatch.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * the description of the metric alert that will be included in the alert + * email. + */ + @JsonProperty(value = "properties.description") + private String description; + + /* + * Alert severity {0, 1, 2, 3, 4} + */ + @JsonProperty(value = "properties.severity") + private Integer severity; + + /* + * the flag that indicates whether the metric alert is enabled. + */ + @JsonProperty(value = "properties.enabled") + private Boolean enabled; + + /* + * the list of resource id's that this metric alert is scoped to. + */ + @JsonProperty(value = "properties.scopes") + private List scopes; + + /* + * how often the metric alert is evaluated represented in ISO 8601 duration + * format. + */ + @JsonProperty(value = "properties.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 = "properties.windowSize") + private Duration windowSize; + + /* + * the resource type of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + */ + @JsonProperty(value = "properties.targetResourceType") + private String targetResourceType; + + /* + * the region of the target resource(s) on which the alert is + * created/updated. Mandatory for MultipleResourceMultipleMetricCriteria. + */ + @JsonProperty(value = "properties.targetResourceRegion") + private String targetResourceRegion; + + /* + * defines the specific alert criteria information. + */ + @JsonProperty(value = "properties.criteria") + private MetricAlertCriteria criteria; + + /* + * the flag that indicates whether the alert should be auto resolved or + * not. The default is true. + */ + @JsonProperty(value = "properties.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 = "properties.actions") + private List actions; + + /* + * Last time the rule was updated in ISO8601 format. + */ + @JsonProperty(value = "properties.lastUpdatedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastUpdatedTime; + + /* + * the value indicating whether this alert rule is migrated. + */ + @JsonProperty(value = "properties.isMigrated", access = JsonProperty.Access.WRITE_ONLY) + private Boolean isMigrated; + + /** + * 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 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 MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch 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 MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch 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 MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch 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 MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch 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 MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch 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 MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch 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 MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch 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 MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch 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 MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch 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 MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch 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 MetricAlertResourcePatch object itself. + */ + public MetricAlertResourcePatch 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/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..bdb86b8ac6cfd --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertSingleResourceMultipleMetricCriteria.java @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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") +@JsonFlatten +@Fluent +public class MetricAlertSingleResourceMultipleMetricCriteria extends MetricAlertCriteria { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(MetricAlertSingleResourceMultipleMetricCriteria.class); + + /* + * 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..24b47a936e275 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertStatus.java @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An alert status. */ +@Fluent +public final class MetricAlertStatus { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricAlertStatus.class); + + /* + * 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..3ec8ae7b79b6b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAlertStatusProperties.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An alert status properties. */ +@Fluent +public final class MetricAlertStatusProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricAlertStatusProperties.class); + + /* + * An object describing the type of the dimensions. + */ + @JsonProperty(value = "dimensions") + 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..d3561995bc168 --- /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. + */ + 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. + */ + PagedIterable list(Context context); + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource 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 represents a collection of alert rule resources. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Retrieve alert rule definitions in a resource group. + * + * @param resourceGroupName The name of the resource 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 represents a collection of alert rule resources. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Retrieve an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @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. + * @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. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context); + + /** + * Delete an alert rule definition. + * + * @param resourceGroupName The name of the resource group. + * @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. + * @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 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. + */ + 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. + */ + 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 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..c2ad013fd0131 --- /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. + * @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. + * @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. + */ + Response listWithResponse(String resourceGroupName, String ruleName, Context context); + + /** + * Retrieve an alert rule status. + * + * @param resourceGroupName The name of the resource group. + * @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. + * @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. + */ + 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..663703e92ed6b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricAvailability.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricAvailability.class); + + /* + * 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..f2211226ceccc --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricBaselinesResponse.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.SingleMetricBaselineInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of metric baselines. */ +@Fluent +public final class MetricBaselinesResponse { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricBaselinesResponse.class); + + /* + * 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..ef53f10e08615 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricCriteria.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.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricCriteria.class); + + /* + * 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")); + } + } +} 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..849a4cd40dbb7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDefinitionCollection.java @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetricDefinitionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents collection of metric definitions. */ +@Fluent +public final class MetricDefinitionCollection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricDefinitionCollection.class); + + /* + * 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()); + } + } +} 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..0fd8cd6aabeb3 --- /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. + */ + 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. + */ + 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..d4df029cd0d64 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricDimension.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specifies a metric dimension. */ +@Fluent +public final class MetricDimension { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricDimension.class); + + /* + * 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")); + } + } +} 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..2abd86f082467 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespaceCollection.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.MetricNamespaceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Represents collection of metric namespaces. */ +@Fluent +public final class MetricNamespaceCollection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricNamespaceCollection.class); + + /* + * 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()); + } + } +} 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..cf415e2ccf56b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricNamespaceName.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The fully qualified metric namespace name. */ +@Fluent +public final class MetricNamespaceName { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricNamespaceName.class); + + /* + * 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..ccaafa1545382 --- /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. + */ + 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. + */ + 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..2267a1b8b7c0e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricSettings.java @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricSettings.class); + + /* + * 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..a5031d1829beb --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricSingleDimension.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The metric dimension name and value. */ +@Fluent +public final class MetricSingleDimension { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricSingleDimension.class); + + /* + * 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")); + } + } +} 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..11961df17b471 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricTrigger.java @@ -0,0 +1,396 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricTrigger.class); + + /* + * 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()); + } + } +} 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..2bca324b1bc32 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/MetricValue.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents a metric value. */ +@Fluent +public final class MetricValue { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MetricValue.class); + + /* + * 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")); + } + } +} 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..5b33860b81b59 --- /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. + */ + 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..0334fdcdf0b74 --- /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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(MultiMetricCriteria.class); + + /* + * 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()); + } + } +} 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..864bb1e8272e4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/NetworkRuleSet.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Definition of the network rules. */ +@Fluent +public class NetworkRuleSet { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NetworkRuleSet.class); + + /* + * 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/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..a172cf9cc10e7 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Operation.java @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Microsoft Insights API operation definition. */ +@Fluent +public final class Operation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Operation.class); + + /* + * 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..a8be48a7d892d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/OperationDisplay.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Display metadata associated with the operation. */ +@Fluent +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * 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..6c1371fc39f6f --- /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. + */ + 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. + */ + 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..f188e91b55cf4 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Operator.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 Operator. */ +public final class Operator extends ExpandableStringEnum { + /** Static value Equals for Operator. */ + public static final Operator EQUALS = fromString("Equals"); + + /** Static value NotEquals for Operator. */ + public static final Operator NOT_EQUALS = fromString("NotEquals"); + + /** 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..9266f1047c893 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PerfCounterDataSource.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PerfCounterDataSource.class); + + /* + * 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..2311e98f4efba --- /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. + * @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..bcdd18ba46b4f --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnectionListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private endpoint connections. */ +@Immutable +public final class PrivateEndpointConnectionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionListResult.class); + + /* + * 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..e9e5360a39d4a --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointConnections.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 PrivateEndpointConnections. */ +public interface PrivateEndpointConnections { + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. + * @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. + * @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. + */ + 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. + * @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. + * @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. + * @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. + */ + PagedIterable listByPrivateLinkScope(String resourceGroupName, String scopeName); + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. + * @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. + */ + 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. + */ + 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. + */ + 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..d1357a3cae465 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateEndpointProperty.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Private endpoint which the connection belongs to. */ +@Fluent +public final class PrivateEndpointProperty { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointProperty.class); + + /* + * 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..de8c6d819449d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkResourceListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.PrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Immutable +public final class PrivateLinkResourceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceListResult.class); + + /* + * 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..42275c878dced --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkResources.java @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.http.rest.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. + * @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. + */ + 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. + * @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. + */ + 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. + * @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. + * @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. + */ + 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..6fdd6d14422e5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkScopeOperationStatus.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.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. + * @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. + * @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. + */ + 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..92831ead0b863 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkScopedResources.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// 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. + * @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. + * @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. + */ + 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. + * @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. + * @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. + * @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. + */ + PagedIterable listByPrivateLinkScope(String resourceGroupName, String scopeName); + + /** + * Gets all private endpoint connections on a private link scope. + * + * @param resourceGroupName The name of the resource group. + * @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. + */ + 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. + */ + 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. + */ + 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..fbb337365cb9c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkScopes.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.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. + */ + 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. + */ + PagedIterable list(Context context); + + /** + * Gets a list of Azure Monitor PrivateLinkScopes within a resource group. + * + * @param resourceGroupName The name of the resource 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 a list of Azure Monitor PrivateLinkScopes within a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * Gets a list of Azure Monitor PrivateLinkScopes within a resource group. + * + * @param resourceGroupName The name of the resource 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 a list of Azure Monitor PrivateLinkScopes within a resource group. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * Deletes a Azure Monitor PrivateLinkScope. + * + * @param resourceGroupName The name of the resource group. + * @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. + * @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. + * @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. + * @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. + */ + 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. + */ + 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. + */ + 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..8a94cd149efa2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkScopesResource.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** An azure resource object. */ +@Fluent +public class PrivateLinkScopesResource extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkScopesResource.class); + + /** {@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..d1092f3175094 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/PrivateLinkServiceConnectionStateProperty.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** State of the private endpoint connection. */ +@Fluent +public final class PrivateLinkServiceConnectionStateProperty { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkServiceConnectionStateProperty.class); + + /* + * 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")); + } + } +} 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..662f39cd45319 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ProxyOnlyResource.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; + +/** A proxy only azure resource object. */ +@Immutable +public class ProxyOnlyResource extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ProxyOnlyResource.class); + + /** + * 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..a5aa306d76522 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Recurrence.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Recurrence.class); + + /* + * 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(); + } + } +} 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..75d71e94a5412 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RecurrentSchedule.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The scheduling constraints for when the profile begins. */ +@Fluent +public final class RecurrentSchedule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecurrentSchedule.class); + + /* + * 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")); + } + } +} diff --git a/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResourceAutoGenerated2.java b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResourceAutoGenerated2.java new file mode 100644 index 0000000000000..d382a38902016 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResourceAutoGenerated2.java @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.management.Resource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.Map; + +/** An azure resource object. */ +@Fluent +public class ResourceAutoGenerated2 extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceAutoGenerated2.class); + + /** {@inheritDoc} */ + @Override + public ResourceAutoGenerated2 withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ResourceAutoGenerated2 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/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..c2dfd5ec00e4d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ResourceForUpdate.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.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceForUpdate.class); + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + 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..6a6a3723bbd30 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RetentionPolicy.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Specifies the retention policy for the log. */ +@Fluent +public final class RetentionPolicy { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RetentionPolicy.class); + + /* + * 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..5f9a79a875486 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleAction.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.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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) +}) +@JsonFlatten +@Immutable +public class RuleAction { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RuleAction.class); + + /** + * 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..faa12c96b19a3 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleCondition.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.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +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; + +/** 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) +}) +@JsonFlatten +@Fluent +public class RuleCondition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RuleCondition.class); + + /* + * 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..4e34d9eff096e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleDataSource.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.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +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; + +/** 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) +}) +@JsonFlatten +@Fluent +public class RuleDataSource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RuleDataSource.class); + + /* + * 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..6ad78ad15e680 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleEmailAction.java @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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") +@JsonFlatten +@Fluent +public class RuleEmailAction extends RuleAction { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RuleEmailAction.class); + + /* + * 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..84d36c4ffda80 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleManagementEventClaimsDataSource.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The claims for a rule management event data source. */ +@Fluent +public final class RuleManagementEventClaimsDataSource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RuleManagementEventClaimsDataSource.class); + + /* + * 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..555053546c433 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleManagementEventDataSource.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.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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") +@JsonFlatten +@Fluent +public class RuleManagementEventDataSource extends RuleDataSource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RuleManagementEventDataSource.class); + + /* + * 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..1da46edd61398 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleMetricDataSource.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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") +@JsonFlatten +@Fluent +public class RuleMetricDataSource extends RuleDataSource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RuleMetricDataSource.class); + + /* + * 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..a40abc2ad4dd2 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/RuleWebhookAction.java @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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") +@JsonFlatten +@Fluent +public class RuleWebhookAction extends RuleAction { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RuleWebhookAction.class); + + /* + * 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") + 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..2c59a2e39fd06 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleAction.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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; + +/** The parameters for the scaling action. */ +@Fluent +public final class ScaleAction { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScaleAction.class); + + /* + * 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")); + } + } +} 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..21dd3a4d8ee65 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleCapacity.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The number of instances that can be used during this profile. */ +@Fluent +public final class ScaleCapacity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScaleCapacity.class); + + /* + * 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")); + } + } +} 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..531ffadc365ad --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleRule.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A rule that provide the triggers and parameters for the scaling action. */ +@Fluent +public final class ScaleRule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScaleRule.class); + + /* + * 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(); + } + } +} 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..bfef4659e8844 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScaleRuleMetricDimension.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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specifies an auto scale rule metric dimension. */ +@Fluent +public final class ScaleRuleMetricDimension { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScaleRuleMetricDimension.class); + + /* + * 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")); + } + } +} 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..d2b697fa49f12 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Schedule.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.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Defines how often to run the search and the time interval. */ +@Fluent +public final class Schedule { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Schedule.class); + + /* + * 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..cddaffe7bcdc2 --- /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. + * @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. + * @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. + */ + Response getByResourceGroupWithResponse( + String resourceGroupName, String ruleName, Context context); + + /** + * Deletes a Log Search rule. + * + * @param resourceGroupName The name of the resource group. + * @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. + * @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 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. + */ + 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. + */ + PagedIterable list(String filter, Context context); + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource 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 represents a collection of Log Search rule resources. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List the Log Search rules within a resource group. + * + * @param resourceGroupName The name of the resource 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. + */ + 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. + */ + 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. + */ + 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 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..1515c577d8e71 --- /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. + * @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..457b8900f65ae --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ScopedResourceListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.ScopedResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ScopedResourceListResult.class); + + /* + * 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..077a22f06652e --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SenderAuthorization.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SenderAuthorization.class); + + /* + * 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..a86b03e6aaff6 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SingleBaseline.java @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT 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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The baseline values for a single sensitivity value. */ +@Fluent +public final class SingleBaseline { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SingleBaseline.class); + + /* + * 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")); + } + } +} 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..b4a0310890d4d --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SmsReceiver.java @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An SMS receiver. */ +@Fluent +public final class SmsReceiver { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SmsReceiver.class); + + /* + * 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")); + } + } +} 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..39be08652b0c8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/Source.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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Specifies the log search query. */ +@Fluent +public final class Source { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Source.class); + + /* + * 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")); + } + } +} 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..ed3369eee78d5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/SyslogDataSource.java @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(SyslogDataSource.class); + + /* + * 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..b5191bb1cde71 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TagsResource.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.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TagsResource.class); + + /* + * Resource tags + */ + @JsonProperty(value = "tags") + 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..2e29b5d0895f1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TenantActivityLogs.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.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. + */ + 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. + */ + 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/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..2d3f149d02103 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/ThresholdRuleCondition.java @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT 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.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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") +@JsonFlatten +@Fluent +public class ThresholdRuleCondition extends RuleCondition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ThresholdRuleCondition.class); + + /* + * 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")); + } + } +} 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..6da4fad13acd5 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeSeriesBaseline.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.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TimeSeriesBaseline.class); + + /* + * 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()); + } + } +} 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..b24bb07cbe32b --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeSeriesElement.java @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.monitor.generated.fluent.models.MetadataValueInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TimeSeriesElement.class); + + /* + * 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..e2b075a329d7c --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TimeWindow.java @@ -0,0 +1,198 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A specific date-time for the profile. */ +@Fluent +public final class TimeWindow { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TimeWindow.class); + + /* + * 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")); + } + } +} 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..e77d557b27a93 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/TriggerCondition.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.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The condition that results in the Log Search rule. */ +@Fluent +public final class TriggerCondition { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TriggerCondition.class); + + /* + * 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(); + } + } +} 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..5fa36b5c299a0 --- /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. + */ + 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..0d7b305e336ed --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/VoiceReceiver.java @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A voice receiver. */ +@Fluent +public final class VoiceReceiver { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VoiceReceiver.class); + + /* + * 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")); + } + } +} 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..cd38a181be2a1 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebhookNotification.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.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Webhook notification of an autoscale event. */ +@Fluent +public final class WebhookNotification { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WebhookNotification.class); + + /* + * 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") + 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..3875691b01557 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebhookReceiver.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.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A webhook receiver. */ +@Fluent +public final class WebhookReceiver { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WebhookReceiver.class); + + /* + * 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")); + } + } +} 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..9bc9503dcefef --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WebtestLocationAvailabilityCriteria.java @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.monitor.generated.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +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") +@JsonFlatten +@Fluent +public class WebtestLocationAvailabilityCriteria extends MetricAlertCriteria { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WebtestLocationAvailabilityCriteria.class); + + /* + * 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")); + } + } +} 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..34777a4009cb8 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WindowsEventLogDataSource.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.JsonIgnore; +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 { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WindowsEventLogDataSource.class); + + /* + * 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..02fa331921158 --- /dev/null +++ b/sdk/monitor/azure-resourcemanager-monitor-generated/src/main/java/com/azure/resourcemanager/monitor/generated/models/WorkspaceInfo.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.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Information about a Log Analytics Workspace. */ +@JsonFlatten +@Fluent +public class WorkspaceInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WorkspaceInfo.class); + + /* + * 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; + + /* + * Log Analytics workspace identifier. + */ + @JsonProperty(value = "properties.customerId", required = true) + private String customerId; + + /** + * 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 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 WorkspaceInfo object itself. + */ + public WorkspaceInfo withCustomerId(String customerId) { + this.customerId = 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 (customerId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property customerId in model WorkspaceInfo")); + } + } +} 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/ci.yml b/sdk/monitor/ci.yml index 81a2e21329558..a970731f1a9dc 100644 --- a/sdk/monitor/ci.yml +++ b/sdk/monitor/ci.yml @@ -54,3 +54,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 1226c0fd83771..e24b835087996 100644 --- a/sdk/monitor/pom.xml +++ b/sdk/monitor/pom.xml @@ -60,6 +60,7 @@ azure-monitor-opentelemetry-exporter azure-monitor-query + azure-resourcemanager-monitor-generated