From 090e1a488fdf4e072d275e596966eeeb85b75ba5 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 4 Jan 2021 23:29:19 +0000 Subject: [PATCH] CodeGen from PR 12279 in Azure/azure-rest-api-specs Merge 80662746f4a34efe7b4a74df869c649914614e50 into bda39d9be69b9e838eb41e5b71964a567a627cbc --- eng/versioning/version_client.txt | 1 + pom.xml | 1 + .../CHANGELOG.md | 5 + .../azure-resourcemanager-mariadb/README.md | 83 + .../azure-resourcemanager-mariadb/pom.xml | 62 + .../mariadb/MariaDBManager.java | 490 ++++ .../mariadb/fluent/AdvisorsClient.java | 72 + .../fluent/CheckNameAvailabilitiesClient.java | 41 + .../mariadb/fluent/ConfigurationsClient.java | 148 ++ .../mariadb/fluent/DatabasesClient.java | 197 ++ .../mariadb/fluent/FirewallRulesClient.java | 206 ++ .../LocationBasedPerformanceTiersClient.java | 39 + ...edActionSessionsOperationStatusClient.java | 45 + ...ecommendedActionSessionsResultsClient.java | 44 + .../mariadb/fluent/LogFilesClient.java | 41 + .../fluent/MariaDBManagementClient.java | 208 ++ .../mariadb/fluent/OperationsClient.java | 36 + .../PrivateEndpointConnectionsClient.java | 289 +++ .../fluent/PrivateLinkResourcesClient.java | 72 + .../mariadb/fluent/QueryTextsClient.java | 76 + .../fluent/RecommendedActionsClient.java | 80 + .../fluent/RecoverableServersClient.java | 42 + .../mariadb/fluent/ReplicasClient.java | 41 + .../fluent/ResourceProvidersClient.java | 109 + .../ServerBasedPerformanceTiersClient.java | 41 + .../fluent/ServerParametersClient.java | 77 + .../ServerSecurityAlertPoliciesClient.java | 128 + .../mariadb/fluent/ServersClient.java | 425 ++++ .../fluent/TopQueryStatisticsClient.java | 77 + .../fluent/VirtualNetworkRulesClient.java | 206 ++ .../mariadb/fluent/WaitStatisticsClient.java | 77 + .../mariadb/fluent/models/AdvisorInner.java | 51 + .../fluent/models/ConfigurationInner.java | 139 ++ .../models/ConfigurationListResultInner.java | 54 + .../mariadb/fluent/models/DatabaseInner.java | 79 + .../fluent/models/FirewallRuleInner.java | 90 + .../mariadb/fluent/models/LogFileInner.java | 125 + .../fluent/models/NameAvailabilityInner.java | 102 + .../models/OperationListResultInner.java | 55 + .../PerformanceTierPropertiesInner.java | 238 ++ .../PrivateEndpointConnectionInner.java | 103 + .../models/PrivateLinkResourceInner.java | 44 + ...erformanceInsightResetDataResultInner.java | 77 + .../fluent/models/QueryStatisticInner.java | 289 +++ .../mariadb/fluent/models/QueryTextInner.java | 79 + .../models/RecommendationActionInner.java | 237 ++ ...dedActionSessionsOperationStatusInner.java | 104 + .../RecoverableServerResourceInner.java | 117 + .../mariadb/fluent/models/ServerInner.java | 393 ++++ .../ServerSecurityAlertPolicyInner.java | 221 ++ .../models/VirtualNetworkRuleInner.java | 98 + .../fluent/models/WaitStatisticInner.java | 262 +++ .../mariadb/fluent/models/package-info.java | 10 + .../mariadb/fluent/package-info.java | 10 + .../mariadb/implementation/AdvisorImpl.java | 44 + .../implementation/AdvisorsClientImpl.java | 516 ++++ .../mariadb/implementation/AdvisorsImpl.java | 72 + .../CheckNameAvailabilitiesClientImpl.java | 216 ++ .../CheckNameAvailabilitiesImpl.java | 62 + .../implementation/ConfigurationImpl.java | 156 ++ .../ConfigurationListResultImpl.java | 47 + .../ConfigurationsClientImpl.java | 757 ++++++ .../implementation/ConfigurationsImpl.java | 131 ++ .../mariadb/implementation/DatabaseImpl.java | 140 ++ .../implementation/DatabasesClientImpl.java | 1000 ++++++++ .../mariadb/implementation/DatabasesImpl.java | 188 ++ .../implementation/FirewallRuleImpl.java | 140 ++ .../FirewallRulesClientImpl.java | 1029 ++++++++ .../implementation/FirewallRulesImpl.java | 189 ++ ...cationBasedPerformanceTiersClientImpl.java | 223 ++ .../LocationBasedPerformanceTiersImpl.java | 47 + ...tionSessionsOperationStatusClientImpl.java | 231 ++ ...ndedActionSessionsOperationStatusImpl.java | 65 + ...mendedActionSessionsResultsClientImpl.java | 343 +++ ...dRecommendedActionSessionsResultsImpl.java | 49 + .../mariadb/implementation/LogFileImpl.java | 61 + .../implementation/LogFilesClientImpl.java | 241 ++ .../mariadb/implementation/LogFilesImpl.java | 46 + .../MariaDBManagementClientBuilder.java | 146 ++ .../MariaDBManagementClientImpl.java | 606 +++++ .../implementation/NameAvailabilityImpl.java | 40 + .../OperationListResultImpl.java | 40 + .../implementation/OperationsClientImpl.java | 157 ++ .../implementation/OperationsImpl.java | 59 + .../PerformanceTierPropertiesImpl.java | 68 + .../PrivateEndpointConnectionImpl.java | 161 ++ .../PrivateEndpointConnectionsClientImpl.java | 1513 ++++++++++++ .../PrivateEndpointConnectionsImpl.java | 208 ++ .../PrivateLinkResourceImpl.java | 45 + .../PrivateLinkResourcesClientImpl.java | 522 +++++ .../PrivateLinkResourcesImpl.java | 75 + ...PerformanceInsightResetDataResultImpl.java | 38 + .../implementation/QueryStatisticImpl.java | 88 + .../mariadb/implementation/QueryTextImpl.java | 48 + .../implementation/QueryTextsClientImpl.java | 544 +++++ .../implementation/QueryTextsImpl.java | 76 + .../RecommendationActionImpl.java | 80 + ...ndedActionSessionsOperationStatusImpl.java | 42 + .../RecommendedActionsClientImpl.java | 593 +++++ .../RecommendedActionsImpl.java | 84 + .../RecoverableServerResourceImpl.java | 64 + .../RecoverableServersClientImpl.java | 223 ++ .../RecoverableServersImpl.java | 61 + .../implementation/ReplicasClientImpl.java | 241 ++ .../mariadb/implementation/ReplicasImpl.java | 46 + .../ResourceProvidersClientImpl.java | 523 +++++ .../implementation/ResourceProvidersImpl.java | 75 + ...ServerBasedPerformanceTiersClientImpl.java | 247 ++ .../ServerBasedPerformanceTiersImpl.java | 48 + .../mariadb/implementation/ServerImpl.java | 286 +++ .../ServerParametersClientImpl.java | 355 +++ .../implementation/ServerParametersImpl.java | 57 + ...ServerSecurityAlertPoliciesClientImpl.java | 605 +++++ .../ServerSecurityAlertPoliciesImpl.java | 129 + .../ServerSecurityAlertPolicyImpl.java | 203 ++ .../implementation/ServersClientImpl.java | 2073 +++++++++++++++++ .../mariadb/implementation/ServersImpl.java | 194 ++ .../TopQueryStatisticsClientImpl.java | 545 +++++ .../TopQueryStatisticsImpl.java | 77 + .../mariadb/implementation/Utils.java | 67 + .../VirtualNetworkRuleImpl.java | 146 ++ .../VirtualNetworkRulesClientImpl.java | 1152 +++++++++ .../VirtualNetworkRulesImpl.java | 198 ++ .../implementation/WaitStatisticImpl.java | 77 + .../WaitStatisticsClientImpl.java | 545 +++++ .../implementation/WaitStatisticsImpl.java | 77 + .../mariadb/implementation/package-info.java | 10 + .../mariadb/models/Advisor.java | 45 + .../mariadb/models/Advisors.java | 64 + .../mariadb/models/AdvisorsResultList.java | 59 + .../models/CheckNameAvailabilities.java | 34 + .../mariadb/models/Configuration.java | 204 ++ .../models/ConfigurationListResult.java | 25 + .../mariadb/models/Configurations.java | 96 + .../mariadb/models/CreateMode.java | 40 + .../mariadb/models/Database.java | 176 ++ .../mariadb/models/DatabaseListResult.java | 55 + .../mariadb/models/Databases.java | 142 ++ .../mariadb/models/ErrorAdditionalInfo.java | 54 + .../mariadb/models/FirewallRule.java | 184 ++ .../models/FirewallRuleListResult.java | 55 + .../mariadb/models/FirewallRules.java | 142 ++ .../mariadb/models/GeoRedundantBackup.java | 34 + .../models/LocationBasedPerformanceTiers.java | 34 + ...ommendedActionSessionsOperationStatus.java | 37 + ...BasedRecommendedActionSessionsResults.java | 36 + .../mariadb/models/LogFile.java | 74 + .../mariadb/models/LogFileListResult.java | 55 + .../mariadb/models/LogFiles.java | 36 + .../mariadb/models/NameAvailability.java | 38 + .../models/NameAvailabilityRequest.java | 81 + .../mariadb/models/Operation.java | 89 + .../mariadb/models/OperationDisplay.java | 84 + .../mariadb/models/OperationListResult.java | 25 + .../mariadb/models/OperationOrigin.java | 37 + .../mariadb/models/Operations.java | 31 + .../models/PerformanceTierListResult.java | 55 + .../models/PerformanceTierProperties.java | 74 + ...PerformanceTierServiceLevelObjectives.java | 232 ++ .../models/PrivateEndpointConnection.java | 179 ++ .../PrivateEndpointConnectionListResult.java | 59 + .../models/PrivateEndpointConnections.java | 142 ++ .../models/PrivateEndpointProperty.java | 50 + .../PrivateEndpointProvisioningState.java | 43 + .../mariadb/models/PrivateLinkResource.java | 45 + .../models/PrivateLinkResourceListResult.java | 59 + .../models/PrivateLinkResourceProperties.java | 55 + .../mariadb/models/PrivateLinkResources.java | 65 + ...kServiceConnectionStateActionsRequire.java | 32 + ...ateLinkServiceConnectionStateProperty.java | 103 + ...ivateLinkServiceConnectionStateStatus.java | 41 + .../models/PublicNetworkAccessEnum.java | 34 + ...ueryPerformanceInsightResetDataResult.java | 32 + ...erformanceInsightResetDataResultState.java | 35 + .../mariadb/models/QueryStatistic.java | 110 + .../mariadb/models/QueryText.java | 52 + .../mariadb/models/QueryTexts.java | 68 + .../mariadb/models/QueryTextsResultList.java | 59 + .../mariadb/models/RecommendationAction.java | 96 + .../RecommendationActionsResultList.java | 59 + ...ommendedActionSessionsOperationStatus.java | 40 + .../mariadb/models/RecommendedActions.java | 72 + .../models/RecoverableServerResource.java | 80 + .../mariadb/models/RecoverableServers.java | 36 + .../mariadb/models/Replicas.java | 36 + .../mariadb/models/ResourceProviders.java | 67 + .../models/SecurityAlertPolicyName.java | 31 + .../mariadb/models/Server.java | 388 +++ .../models/ServerBasedPerformanceTiers.java | 36 + .../mariadb/models/ServerForCreate.java | 144 ++ .../mariadb/models/ServerListResult.java | 55 + .../mariadb/models/ServerParameters.java | 40 + .../ServerPrivateEndpointConnection.java | 57 + ...erPrivateEndpointConnectionProperties.java | 98 + ...ateLinkServiceConnectionStateProperty.java | 105 + .../models/ServerPropertiesForCreate.java | 149 ++ .../ServerPropertiesForDefaultCreate.java | 126 + .../models/ServerPropertiesForGeoRestore.java | 90 + .../models/ServerPropertiesForReplica.java | 90 + .../models/ServerPropertiesForRestore.java | 126 + .../models/ServerSecurityAlertPolicies.java | 71 + .../models/ServerSecurityAlertPolicy.java | 349 +++ .../ServerSecurityAlertPolicyState.java | 47 + .../mariadb/models/ServerState.java | 37 + .../models/ServerUpdateParameters.java | 244 ++ .../mariadb/models/ServerVersion.java | 34 + .../mariadb/models/Servers.java | 224 ++ .../resourcemanager/mariadb/models/Sku.java | 159 ++ .../mariadb/models/SkuTier.java | 37 + .../mariadb/models/SslEnforcementEnum.java | 47 + .../mariadb/models/StorageAutogrow.java | 34 + .../mariadb/models/StorageProfile.java | 128 + .../mariadb/models/TagsObject.java | 51 + .../mariadb/models/TopQueryStatistics.java | 69 + .../models/TopQueryStatisticsInput.java | 213 ++ .../models/TopQueryStatisticsResultList.java | 59 + .../mariadb/models/VirtualNetworkRule.java | 190 ++ .../models/VirtualNetworkRuleListResult.java | 59 + .../models/VirtualNetworkRuleState.java | 43 + .../mariadb/models/VirtualNetworkRules.java | 142 ++ .../mariadb/models/WaitStatistic.java | 102 + .../mariadb/models/WaitStatistics.java | 69 + .../mariadb/models/WaitStatisticsInput.java | 123 + .../models/WaitStatisticsResultList.java | 59 + .../mariadb/models/package-info.java | 10 + .../resourcemanager/mariadb/package-info.java | 10 + .../src/main/java/module-info.java | 19 + sdk/mariadb/ci.yml | 31 + sdk/mariadb/pom.xml | 14 + 229 files changed, 34371 insertions(+) create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/CHANGELOG.md create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/README.md create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/pom.xml create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/MariaDBManager.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/AdvisorsClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/CheckNameAvailabilitiesClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ConfigurationsClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/DatabasesClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/FirewallRulesClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/LocationBasedPerformanceTiersClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/LocationBasedRecommendedActionSessionsOperationStatusClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/LocationBasedRecommendedActionSessionsResultsClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/LogFilesClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/MariaDBManagementClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/OperationsClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/PrivateEndpointConnectionsClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/PrivateLinkResourcesClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/QueryTextsClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/RecommendedActionsClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/RecoverableServersClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ReplicasClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ResourceProvidersClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ServerBasedPerformanceTiersClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ServerParametersClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ServerSecurityAlertPoliciesClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ServersClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/TopQueryStatisticsClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/VirtualNetworkRulesClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/WaitStatisticsClient.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/AdvisorInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/ConfigurationInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/ConfigurationListResultInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/DatabaseInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/FirewallRuleInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/LogFileInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/NameAvailabilityInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/OperationListResultInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/PerformanceTierPropertiesInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/PrivateEndpointConnectionInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/PrivateLinkResourceInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/QueryPerformanceInsightResetDataResultInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/QueryStatisticInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/QueryTextInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/RecommendationActionInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/RecommendedActionSessionsOperationStatusInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/RecoverableServerResourceInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/ServerInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/ServerSecurityAlertPolicyInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/VirtualNetworkRuleInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/WaitStatisticInner.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/package-info.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/package-info.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/AdvisorImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/AdvisorsClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/AdvisorsImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/CheckNameAvailabilitiesClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/CheckNameAvailabilitiesImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ConfigurationImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ConfigurationListResultImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ConfigurationsClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ConfigurationsImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/DatabaseImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/DatabasesClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/DatabasesImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/FirewallRuleImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/FirewallRulesClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/FirewallRulesImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedPerformanceTiersClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedPerformanceTiersImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedRecommendedActionSessionsOperationStatusClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedRecommendedActionSessionsOperationStatusImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedRecommendedActionSessionsResultsClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedRecommendedActionSessionsResultsImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LogFileImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LogFilesClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LogFilesImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/MariaDBManagementClientBuilder.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/MariaDBManagementClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/NameAvailabilityImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/OperationListResultImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/OperationsClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/OperationsImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PerformanceTierPropertiesImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateEndpointConnectionImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateEndpointConnectionsClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateEndpointConnectionsImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateLinkResourceImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateLinkResourcesClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateLinkResourcesImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryPerformanceInsightResetDataResultImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryStatisticImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryTextImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryTextsClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryTextsImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecommendationActionImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecommendedActionSessionsOperationStatusImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecommendedActionsClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecommendedActionsImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecoverableServerResourceImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecoverableServersClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecoverableServersImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ReplicasClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ReplicasImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ResourceProvidersClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ResourceProvidersImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerBasedPerformanceTiersClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerBasedPerformanceTiersImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerParametersClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerParametersImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerSecurityAlertPoliciesClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerSecurityAlertPoliciesImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerSecurityAlertPolicyImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServersClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServersImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/TopQueryStatisticsClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/TopQueryStatisticsImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/Utils.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/VirtualNetworkRuleImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/VirtualNetworkRulesClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/VirtualNetworkRulesImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/WaitStatisticImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/WaitStatisticsClientImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/WaitStatisticsImpl.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/package-info.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Advisor.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Advisors.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/AdvisorsResultList.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/CheckNameAvailabilities.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Configuration.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ConfigurationListResult.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Configurations.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/CreateMode.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Database.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/DatabaseListResult.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Databases.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ErrorAdditionalInfo.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/FirewallRule.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/FirewallRuleListResult.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/FirewallRules.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/GeoRedundantBackup.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LocationBasedPerformanceTiers.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LocationBasedRecommendedActionSessionsOperationStatus.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LocationBasedRecommendedActionSessionsResults.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LogFile.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LogFileListResult.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LogFiles.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/NameAvailability.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/NameAvailabilityRequest.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Operation.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/OperationDisplay.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/OperationListResult.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/OperationOrigin.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Operations.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PerformanceTierListResult.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PerformanceTierProperties.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PerformanceTierServiceLevelObjectives.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateEndpointConnection.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateEndpointConnectionListResult.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateEndpointConnections.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateEndpointProperty.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateEndpointProvisioningState.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkResource.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkResourceListResult.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkResourceProperties.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkResources.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkServiceConnectionStateActionsRequire.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkServiceConnectionStateProperty.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkServiceConnectionStateStatus.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PublicNetworkAccessEnum.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryPerformanceInsightResetDataResult.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryPerformanceInsightResetDataResultState.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryStatistic.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryText.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryTexts.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryTextsResultList.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecommendationAction.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecommendationActionsResultList.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecommendedActionSessionsOperationStatus.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecommendedActions.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecoverableServerResource.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecoverableServers.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Replicas.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ResourceProviders.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/SecurityAlertPolicyName.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Server.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerBasedPerformanceTiers.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerForCreate.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerListResult.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerParameters.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPrivateEndpointConnection.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPrivateEndpointConnectionProperties.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPrivateLinkServiceConnectionStateProperty.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForCreate.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForDefaultCreate.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForGeoRestore.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForReplica.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForRestore.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerSecurityAlertPolicies.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerSecurityAlertPolicy.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerSecurityAlertPolicyState.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerState.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerUpdateParameters.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerVersion.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Servers.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Sku.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/SkuTier.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/SslEnforcementEnum.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/StorageAutogrow.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/StorageProfile.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/TagsObject.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/TopQueryStatistics.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/TopQueryStatisticsInput.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/TopQueryStatisticsResultList.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/VirtualNetworkRule.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/VirtualNetworkRuleListResult.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/VirtualNetworkRuleState.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/VirtualNetworkRules.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/WaitStatistic.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/WaitStatistics.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/WaitStatisticsInput.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/WaitStatisticsResultList.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/package-info.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/package-info.java create mode 100644 sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/module-info.java create mode 100644 sdk/mariadb/ci.yml create mode 100644 sdk/mariadb/pom.xml diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index efc0ee0b6dde..be00323b9b30 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -187,6 +187,7 @@ com.azure.resourcemanager:azure-resourcemanager-recoveryservices;1.0.0-beta.1;1. com.azure.resourcemanager:azure-resourcemanager-kusto;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-loganalytics;1.0.0-beta.1;1.0.0-beta.2 com.azure.resourcemanager:azure-resourcemanager-eventgrid;1.0.0-beta.1;1.0.0-beta.2 +com.azure.resourcemanager:azure-resourcemanager-mariadb;1.0.0-beta.1;1.0.0-beta.1 com.microsoft:microsoft-opentelemetry-exporter-azuremonitor;1.0.0-beta.1;1.0.0-beta.2 diff --git a/pom.xml b/pom.xml index b80dac967d8f..9ff7cad2c4a7 100644 --- a/pom.xml +++ b/pom.xml @@ -30,6 +30,7 @@ sdk/keyvault sdk/kusto sdk/loganalytics + sdk/mariadb sdk/mediaservices sdk/metricsadvisor sdk/monitor diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/CHANGELOG.md b/sdk/mariadb/azure-resourcemanager-mariadb/CHANGELOG.md new file mode 100644 index 000000000000..cde45af3b456 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0-beta.1 (2021-01-04) + +- Azure Resource Manager MariaDB client library for Java. This package contains Microsoft Azure SDK for MariaDB Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and configurations with new business model. Package tag package-2020-01-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). \ No newline at end of file diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/README.md b/sdk/mariadb/azure-resourcemanager-mariadb/README.md new file mode 100644 index 000000000000..aabd18dad721 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/README.md @@ -0,0 +1,83 @@ +# Azure Resource Manager MariaDB client library for Java + +Azure Resource Manager MariaDB client library for Java. + +This package contains Microsoft Azure SDK for MariaDB Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and configurations with new business model. Package tag package-2020-01-01. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). + +## 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-mariadb;current}) +```xml + + com.azure.resourcemanager + azure-resourcemanager-mariadb + 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(); +MariaDBManager manager = MariaDBManager + .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/master/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 + + +[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/master/sdk/identity/azure-identity +[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core-http-netty +[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/AUTH.md +[design]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/resourcemanager/docs/DESIGN.md diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/pom.xml b/sdk/mariadb/azure-resourcemanager-mariadb/pom.xml new file mode 100644 index 000000000000..54407d5747e1 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/pom.xml @@ -0,0 +1,62 @@ + + 4.0.0 + + com.azure + azure-client-sdk-parent + 1.7.0 + ../../parents/azure-client-sdk-parent + + + com.azure.resourcemanager + azure-resourcemanager-mariadb + 1.0.0-beta.1 + jar + + Microsoft Azure SDK for MariaDB Management + This package contains Microsoft Azure SDK for MariaDB Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and configurations with new business model. Package tag package-2020-01-01. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt + 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-management + 1.0.0 + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.5 + + true + + + + + diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/MariaDBManager.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/MariaDBManager.java new file mode 100644 index 000000000000..79cf19ccc47a --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/MariaDBManager.java @@ -0,0 +1,490 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb; + +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.BearerTokenAuthenticationPolicy; +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.profile.AzureProfile; +import com.azure.core.util.Configuration; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.fluent.MariaDBManagementClient; +import com.azure.resourcemanager.mariadb.implementation.AdvisorsImpl; +import com.azure.resourcemanager.mariadb.implementation.CheckNameAvailabilitiesImpl; +import com.azure.resourcemanager.mariadb.implementation.ConfigurationsImpl; +import com.azure.resourcemanager.mariadb.implementation.DatabasesImpl; +import com.azure.resourcemanager.mariadb.implementation.FirewallRulesImpl; +import com.azure.resourcemanager.mariadb.implementation.LocationBasedPerformanceTiersImpl; +import com.azure.resourcemanager.mariadb.implementation.LocationBasedRecommendedActionSessionsOperationStatusImpl; +import com.azure.resourcemanager.mariadb.implementation.LocationBasedRecommendedActionSessionsResultsImpl; +import com.azure.resourcemanager.mariadb.implementation.LogFilesImpl; +import com.azure.resourcemanager.mariadb.implementation.MariaDBManagementClientBuilder; +import com.azure.resourcemanager.mariadb.implementation.OperationsImpl; +import com.azure.resourcemanager.mariadb.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.mariadb.implementation.PrivateLinkResourcesImpl; +import com.azure.resourcemanager.mariadb.implementation.QueryTextsImpl; +import com.azure.resourcemanager.mariadb.implementation.RecommendedActionsImpl; +import com.azure.resourcemanager.mariadb.implementation.RecoverableServersImpl; +import com.azure.resourcemanager.mariadb.implementation.ReplicasImpl; +import com.azure.resourcemanager.mariadb.implementation.ResourceProvidersImpl; +import com.azure.resourcemanager.mariadb.implementation.ServerBasedPerformanceTiersImpl; +import com.azure.resourcemanager.mariadb.implementation.ServerParametersImpl; +import com.azure.resourcemanager.mariadb.implementation.ServerSecurityAlertPoliciesImpl; +import com.azure.resourcemanager.mariadb.implementation.ServersImpl; +import com.azure.resourcemanager.mariadb.implementation.TopQueryStatisticsImpl; +import com.azure.resourcemanager.mariadb.implementation.VirtualNetworkRulesImpl; +import com.azure.resourcemanager.mariadb.implementation.WaitStatisticsImpl; +import com.azure.resourcemanager.mariadb.models.Advisors; +import com.azure.resourcemanager.mariadb.models.CheckNameAvailabilities; +import com.azure.resourcemanager.mariadb.models.Configurations; +import com.azure.resourcemanager.mariadb.models.Databases; +import com.azure.resourcemanager.mariadb.models.FirewallRules; +import com.azure.resourcemanager.mariadb.models.LocationBasedPerformanceTiers; +import com.azure.resourcemanager.mariadb.models.LocationBasedRecommendedActionSessionsOperationStatus; +import com.azure.resourcemanager.mariadb.models.LocationBasedRecommendedActionSessionsResults; +import com.azure.resourcemanager.mariadb.models.LogFiles; +import com.azure.resourcemanager.mariadb.models.Operations; +import com.azure.resourcemanager.mariadb.models.PrivateEndpointConnections; +import com.azure.resourcemanager.mariadb.models.PrivateLinkResources; +import com.azure.resourcemanager.mariadb.models.QueryTexts; +import com.azure.resourcemanager.mariadb.models.RecommendedActions; +import com.azure.resourcemanager.mariadb.models.RecoverableServers; +import com.azure.resourcemanager.mariadb.models.Replicas; +import com.azure.resourcemanager.mariadb.models.ResourceProviders; +import com.azure.resourcemanager.mariadb.models.ServerBasedPerformanceTiers; +import com.azure.resourcemanager.mariadb.models.ServerParameters; +import com.azure.resourcemanager.mariadb.models.ServerSecurityAlertPolicies; +import com.azure.resourcemanager.mariadb.models.Servers; +import com.azure.resourcemanager.mariadb.models.TopQueryStatistics; +import com.azure.resourcemanager.mariadb.models.VirtualNetworkRules; +import com.azure.resourcemanager.mariadb.models.WaitStatistics; +import java.time.Duration; +import java.time.temporal.ChronoUnit; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * Entry point to MariaDBManager. The Microsoft Azure management API provides create, read, update, and delete + * functionality for Azure MariaDB resources including servers, databases, firewall rules, VNET rules, log files and + * configurations with new business model. + */ +public final class MariaDBManager { + private Servers servers; + + private Replicas replicas; + + private FirewallRules firewallRules; + + private VirtualNetworkRules virtualNetworkRules; + + private Databases databases; + + private Configurations configurations; + + private ServerParameters serverParameters; + + private LogFiles logFiles; + + private RecoverableServers recoverableServers; + + private ServerBasedPerformanceTiers serverBasedPerformanceTiers; + + private LocationBasedPerformanceTiers locationBasedPerformanceTiers; + + private CheckNameAvailabilities checkNameAvailabilities; + + private Operations operations; + + private QueryTexts queryTexts; + + private TopQueryStatistics topQueryStatistics; + + private WaitStatistics waitStatistics; + + private ResourceProviders resourceProviders; + + private Advisors advisors; + + private RecommendedActions recommendedActions; + + private LocationBasedRecommendedActionSessionsOperationStatus locationBasedRecommendedActionSessionsOperationStatus; + + private LocationBasedRecommendedActionSessionsResults locationBasedRecommendedActionSessionsResults; + + private PrivateEndpointConnections privateEndpointConnections; + + private PrivateLinkResources privateLinkResources; + + private ServerSecurityAlertPolicies serverSecurityAlertPolicies; + + private final MariaDBManagementClient clientObject; + + private MariaDBManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + this.clientObject = + new MariaDBManagementClientBuilder() + .pipeline(httpPipeline) + .endpoint(profile.getEnvironment().getResourceManagerEndpoint()) + .subscriptionId(profile.getSubscriptionId()) + .defaultPollInterval(defaultPollInterval) + .buildClient(); + } + + /** + * Creates an instance of MariaDB service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the MariaDB service API instance. + */ + public static MariaDBManager 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 MariaDBManager with optional configuration. + * + * @return the Configurable instance allowing configurations. + */ + public static Configurable configure() { + return new MariaDBManager.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 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; + } + + /** + * 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 MariaDB service API entry point. + * + * @param credential the credential to use. + * @param profile the Azure profile for client. + * @return the MariaDB service API instance. + */ + public MariaDBManager authenticate(TokenCredential credential, AzureProfile profile) { + Objects.requireNonNull(credential, "'credential' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + + if (retryPolicy == null) { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } + List policies = new ArrayList<>(); + policies + .add( + new UserAgentPolicy( + null, + "com.azure.resourcemanager.mariadb", + "1.0.0-beta.1", + Configuration.getGlobalConfiguration())); + policies.add(new RequestIdPolicy()); + HttpPolicyProviders.addBeforeRetryPolicies(policies); + policies.add(retryPolicy); + policies.add(new AddDatePolicy()); + policies + .add( + new BearerTokenAuthenticationPolicy( + credential, profile.getEnvironment().getManagementEndpoint() + "/.default")); + HttpPolicyProviders.addAfterRetryPolicies(policies); + policies.add(new HttpLoggingPolicy(httpLogOptions)); + HttpPipeline httpPipeline = + new HttpPipelineBuilder() + .httpClient(httpClient) + .policies(policies.toArray(new HttpPipelinePolicy[0])) + .build(); + return new MariaDBManager(httpPipeline, profile, defaultPollInterval); + } + } + + /** @return Resource collection API of Servers. */ + public Servers servers() { + if (this.servers == null) { + this.servers = new ServersImpl(clientObject.getServers(), this); + } + return servers; + } + + /** @return Resource collection API of Replicas. */ + public Replicas replicas() { + if (this.replicas == null) { + this.replicas = new ReplicasImpl(clientObject.getReplicas(), this); + } + return replicas; + } + + /** @return Resource collection API of FirewallRules. */ + public FirewallRules firewallRules() { + if (this.firewallRules == null) { + this.firewallRules = new FirewallRulesImpl(clientObject.getFirewallRules(), this); + } + return firewallRules; + } + + /** @return Resource collection API of VirtualNetworkRules. */ + public VirtualNetworkRules virtualNetworkRules() { + if (this.virtualNetworkRules == null) { + this.virtualNetworkRules = new VirtualNetworkRulesImpl(clientObject.getVirtualNetworkRules(), this); + } + return virtualNetworkRules; + } + + /** @return Resource collection API of Databases. */ + public Databases databases() { + if (this.databases == null) { + this.databases = new DatabasesImpl(clientObject.getDatabases(), this); + } + return databases; + } + + /** @return Resource collection API of Configurations. */ + public Configurations configurations() { + if (this.configurations == null) { + this.configurations = new ConfigurationsImpl(clientObject.getConfigurations(), this); + } + return configurations; + } + + /** @return Resource collection API of ServerParameters. */ + public ServerParameters serverParameters() { + if (this.serverParameters == null) { + this.serverParameters = new ServerParametersImpl(clientObject.getServerParameters(), this); + } + return serverParameters; + } + + /** @return Resource collection API of LogFiles. */ + public LogFiles logFiles() { + if (this.logFiles == null) { + this.logFiles = new LogFilesImpl(clientObject.getLogFiles(), this); + } + return logFiles; + } + + /** @return Resource collection API of RecoverableServers. */ + public RecoverableServers recoverableServers() { + if (this.recoverableServers == null) { + this.recoverableServers = new RecoverableServersImpl(clientObject.getRecoverableServers(), this); + } + return recoverableServers; + } + + /** @return Resource collection API of ServerBasedPerformanceTiers. */ + public ServerBasedPerformanceTiers serverBasedPerformanceTiers() { + if (this.serverBasedPerformanceTiers == null) { + this.serverBasedPerformanceTiers = + new ServerBasedPerformanceTiersImpl(clientObject.getServerBasedPerformanceTiers(), this); + } + return serverBasedPerformanceTiers; + } + + /** @return Resource collection API of LocationBasedPerformanceTiers. */ + public LocationBasedPerformanceTiers locationBasedPerformanceTiers() { + if (this.locationBasedPerformanceTiers == null) { + this.locationBasedPerformanceTiers = + new LocationBasedPerformanceTiersImpl(clientObject.getLocationBasedPerformanceTiers(), this); + } + return locationBasedPerformanceTiers; + } + + /** @return Resource collection API of CheckNameAvailabilities. */ + public CheckNameAvailabilities checkNameAvailabilities() { + if (this.checkNameAvailabilities == null) { + this.checkNameAvailabilities = + new CheckNameAvailabilitiesImpl(clientObject.getCheckNameAvailabilities(), this); + } + return checkNameAvailabilities; + } + + /** @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 QueryTexts. */ + public QueryTexts queryTexts() { + if (this.queryTexts == null) { + this.queryTexts = new QueryTextsImpl(clientObject.getQueryTexts(), this); + } + return queryTexts; + } + + /** @return Resource collection API of TopQueryStatistics. */ + public TopQueryStatistics topQueryStatistics() { + if (this.topQueryStatistics == null) { + this.topQueryStatistics = new TopQueryStatisticsImpl(clientObject.getTopQueryStatistics(), this); + } + return topQueryStatistics; + } + + /** @return Resource collection API of WaitStatistics. */ + public WaitStatistics waitStatistics() { + if (this.waitStatistics == null) { + this.waitStatistics = new WaitStatisticsImpl(clientObject.getWaitStatistics(), this); + } + return waitStatistics; + } + + /** @return Resource collection API of ResourceProviders. */ + public ResourceProviders resourceProviders() { + if (this.resourceProviders == null) { + this.resourceProviders = new ResourceProvidersImpl(clientObject.getResourceProviders(), this); + } + return resourceProviders; + } + + /** @return Resource collection API of Advisors. */ + public Advisors advisors() { + if (this.advisors == null) { + this.advisors = new AdvisorsImpl(clientObject.getAdvisors(), this); + } + return advisors; + } + + /** @return Resource collection API of RecommendedActions. */ + public RecommendedActions recommendedActions() { + if (this.recommendedActions == null) { + this.recommendedActions = new RecommendedActionsImpl(clientObject.getRecommendedActions(), this); + } + return recommendedActions; + } + + /** @return Resource collection API of LocationBasedRecommendedActionSessionsOperationStatus. */ + public LocationBasedRecommendedActionSessionsOperationStatus + locationBasedRecommendedActionSessionsOperationStatus() { + if (this.locationBasedRecommendedActionSessionsOperationStatus == null) { + this.locationBasedRecommendedActionSessionsOperationStatus = + new LocationBasedRecommendedActionSessionsOperationStatusImpl( + clientObject.getLocationBasedRecommendedActionSessionsOperationStatus(), this); + } + return locationBasedRecommendedActionSessionsOperationStatus; + } + + /** @return Resource collection API of LocationBasedRecommendedActionSessionsResults. */ + public LocationBasedRecommendedActionSessionsResults locationBasedRecommendedActionSessionsResults() { + if (this.locationBasedRecommendedActionSessionsResults == null) { + this.locationBasedRecommendedActionSessionsResults = + new LocationBasedRecommendedActionSessionsResultsImpl( + clientObject.getLocationBasedRecommendedActionSessionsResults(), this); + } + return locationBasedRecommendedActionSessionsResults; + } + + /** @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 PrivateLinkResources. */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); + } + return privateLinkResources; + } + + /** @return Resource collection API of ServerSecurityAlertPolicies. */ + public ServerSecurityAlertPolicies serverSecurityAlertPolicies() { + if (this.serverSecurityAlertPolicies == null) { + this.serverSecurityAlertPolicies = + new ServerSecurityAlertPoliciesImpl(clientObject.getServerSecurityAlertPolicies(), this); + } + return serverSecurityAlertPolicies; + } + + /** + * @return Wrapped service client MariaDBManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + */ + public MariaDBManagementClient serviceClient() { + return this.clientObject; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/AdvisorsClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/AdvisorsClient.java new file mode 100644 index 000000000000..1093dae306ab --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/AdvisorsClient.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.mariadb.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.mariadb.fluent.models.AdvisorInner; + +/** An instance of this class provides access to all the operations defined in AdvisorsClient. */ +public interface AdvisorsClient { + /** + * Get a recommendation action advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recommendation action advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + AdvisorInner get(String resourceGroupName, String serverName, String advisorName); + + /** + * Get a recommendation action advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recommendation action advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String advisorName, Context context); + + /** + * List recommendation action advisors. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List recommendation action advisors. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/CheckNameAvailabilitiesClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/CheckNameAvailabilitiesClient.java new file mode 100644 index 000000000000..0c7d979a5a56 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/CheckNameAvailabilitiesClient.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.mariadb.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.mariadb.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.mariadb.models.NameAvailabilityRequest; + +/** An instance of this class provides access to all the operations defined in CheckNameAvailabilitiesClient. */ +public interface CheckNameAvailabilitiesClient { + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + NameAvailabilityInner execute(NameAvailabilityRequest nameAvailabilityRequest); + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response executeWithResponse( + NameAvailabilityRequest nameAvailabilityRequest, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ConfigurationsClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ConfigurationsClient.java new file mode 100644 index 000000000000..9856aebab4fa --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ConfigurationsClient.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.fluent.models.ConfigurationInner; + +/** An instance of this class provides access to all the operations defined in ConfigurationsClient. */ +public interface ConfigurationsClient { + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ConfigurationInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters); + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ConfigurationInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationInner parameters, + Context context); + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfigurationInner createOrUpdate( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters); + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfigurationInner createOrUpdate( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationInner parameters, + Context context); + + /** + * Gets information about a configuration of server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a configuration of server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfigurationInner get(String resourceGroupName, String serverName, String configurationName); + + /** + * Gets information about a configuration of server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a configuration of server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String configurationName, Context context); + + /** + * List all the configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/DatabasesClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/DatabasesClient.java new file mode 100644 index 000000000000..517a87f63cb4 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/DatabasesClient.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.fluent.models.DatabaseInner; + +/** An instance of this class provides access to all the operations defined in DatabasesClient. */ +public interface DatabasesClient { + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DatabaseInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters); + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The required parameters for creating or updating a database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, DatabaseInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context); + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters); + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The required parameters for creating or updating a database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context); + + /** + * Deletes a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 serverName, String databaseName); + + /** + * Deletes a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 serverName, String databaseName, Context context); + + /** + * Deletes a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverName, String databaseName); + + /** + * Deletes a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverName, String databaseName, Context context); + + /** + * Gets information about a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + DatabaseInner get(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets information about a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * List all the databases in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the databases in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/FirewallRulesClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/FirewallRulesClient.java new file mode 100644 index 000000000000..43d28326ca3b --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/FirewallRulesClient.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.mariadb.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.mariadb.fluent.models.FirewallRuleInner; + +/** An instance of this class provides access to all the operations defined in FirewallRulesClient. */ +public interface FirewallRulesClient { + /** + * Creates a new firewall rule or updates an existing firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall rule. + * @param parameters The required parameters for creating or updating a firewall 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 server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, FirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters); + + /** + * Creates a new firewall rule or updates an existing firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall rule. + * @param parameters The required parameters for creating or updating a firewall 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 server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, FirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context); + + /** + * Creates a new firewall rule or updates an existing firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall rule. + * @param parameters The required parameters for creating or updating a firewall 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 server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner createOrUpdate( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters); + + /** + * Creates a new firewall rule or updates an existing firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall rule. + * @param parameters The required parameters for creating or updating a firewall 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 server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context); + + /** + * Deletes a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String firewallRuleName); + + /** + * Deletes a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * Deletes a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 serverName, String firewallRuleName); + + /** + * Deletes a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * Gets information about a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 information about a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * Gets information about a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 information about a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * List all the firewall rules in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the firewall rules in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/LocationBasedPerformanceTiersClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/LocationBasedPerformanceTiersClient.java new file mode 100644 index 000000000000..825a53701966 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/LocationBasedPerformanceTiersClient.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.mariadb.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.mariadb.fluent.models.PerformanceTierPropertiesInner; + +/** An instance of this class provides access to all the operations defined in LocationBasedPerformanceTiersClient. */ +public interface LocationBasedPerformanceTiersClient { + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String locationName); + + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String locationName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/LocationBasedRecommendedActionSessionsOperationStatusClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/LocationBasedRecommendedActionSessionsOperationStatusClient.java new file mode 100644 index 000000000000..433c045661ee --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/LocationBasedRecommendedActionSessionsOperationStatusClient.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.mariadb.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.mariadb.fluent.models.RecommendedActionSessionsOperationStatusInner; + +/** + * An instance of this class provides access to all the operations defined in + * LocationBasedRecommendedActionSessionsOperationStatusClient. + */ +public interface LocationBasedRecommendedActionSessionsOperationStatusClient { + /** + * Recommendation action session operation status. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return recommendation action session operation status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RecommendedActionSessionsOperationStatusInner get(String locationName, String operationId); + + /** + * Recommendation action session operation status. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return recommendation action session operation status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String locationName, String operationId, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/LocationBasedRecommendedActionSessionsResultsClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/LocationBasedRecommendedActionSessionsResultsClient.java new file mode 100644 index 000000000000..5ea2d2774633 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/LocationBasedRecommendedActionSessionsResultsClient.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.mariadb.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.mariadb.fluent.models.RecommendationActionInner; + +/** + * An instance of this class provides access to all the operations defined in + * LocationBasedRecommendedActionSessionsResultsClient. + */ +public interface LocationBasedRecommendedActionSessionsResultsClient { + /** + * Recommendation action session operation result. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String locationName, String operationId); + + /** + * Recommendation action session operation result. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String locationName, String operationId, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/LogFilesClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/LogFilesClient.java new file mode 100644 index 000000000000..367dfb6185b4 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/LogFilesClient.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.mariadb.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.mariadb.fluent.models.LogFileInner; + +/** An instance of this class provides access to all the operations defined in LogFilesClient. */ +public interface LogFilesClient { + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/MariaDBManagementClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/MariaDBManagementClient.java new file mode 100644 index 000000000000..5147bbe202d9 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/MariaDBManagementClient.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.fluent; + +import com.azure.core.http.HttpPipeline; +import java.time.Duration; + +/** The interface for MariaDBManagementClient class. */ +public interface MariaDBManagementClient { + /** + * 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 ServersClient object to access its operations. + * + * @return the ServersClient object. + */ + ServersClient getServers(); + + /** + * Gets the ReplicasClient object to access its operations. + * + * @return the ReplicasClient object. + */ + ReplicasClient getReplicas(); + + /** + * Gets the FirewallRulesClient object to access its operations. + * + * @return the FirewallRulesClient object. + */ + FirewallRulesClient getFirewallRules(); + + /** + * Gets the VirtualNetworkRulesClient object to access its operations. + * + * @return the VirtualNetworkRulesClient object. + */ + VirtualNetworkRulesClient getVirtualNetworkRules(); + + /** + * Gets the DatabasesClient object to access its operations. + * + * @return the DatabasesClient object. + */ + DatabasesClient getDatabases(); + + /** + * Gets the ConfigurationsClient object to access its operations. + * + * @return the ConfigurationsClient object. + */ + ConfigurationsClient getConfigurations(); + + /** + * Gets the ServerParametersClient object to access its operations. + * + * @return the ServerParametersClient object. + */ + ServerParametersClient getServerParameters(); + + /** + * Gets the LogFilesClient object to access its operations. + * + * @return the LogFilesClient object. + */ + LogFilesClient getLogFiles(); + + /** + * Gets the RecoverableServersClient object to access its operations. + * + * @return the RecoverableServersClient object. + */ + RecoverableServersClient getRecoverableServers(); + + /** + * Gets the ServerBasedPerformanceTiersClient object to access its operations. + * + * @return the ServerBasedPerformanceTiersClient object. + */ + ServerBasedPerformanceTiersClient getServerBasedPerformanceTiers(); + + /** + * Gets the LocationBasedPerformanceTiersClient object to access its operations. + * + * @return the LocationBasedPerformanceTiersClient object. + */ + LocationBasedPerformanceTiersClient getLocationBasedPerformanceTiers(); + + /** + * Gets the CheckNameAvailabilitiesClient object to access its operations. + * + * @return the CheckNameAvailabilitiesClient object. + */ + CheckNameAvailabilitiesClient getCheckNameAvailabilities(); + + /** + * Gets the OperationsClient object to access its operations. + * + * @return the OperationsClient object. + */ + OperationsClient getOperations(); + + /** + * Gets the QueryTextsClient object to access its operations. + * + * @return the QueryTextsClient object. + */ + QueryTextsClient getQueryTexts(); + + /** + * Gets the TopQueryStatisticsClient object to access its operations. + * + * @return the TopQueryStatisticsClient object. + */ + TopQueryStatisticsClient getTopQueryStatistics(); + + /** + * Gets the WaitStatisticsClient object to access its operations. + * + * @return the WaitStatisticsClient object. + */ + WaitStatisticsClient getWaitStatistics(); + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + ResourceProvidersClient getResourceProviders(); + + /** + * Gets the AdvisorsClient object to access its operations. + * + * @return the AdvisorsClient object. + */ + AdvisorsClient getAdvisors(); + + /** + * Gets the RecommendedActionsClient object to access its operations. + * + * @return the RecommendedActionsClient object. + */ + RecommendedActionsClient getRecommendedActions(); + + /** + * Gets the LocationBasedRecommendedActionSessionsOperationStatusClient object to access its operations. + * + * @return the LocationBasedRecommendedActionSessionsOperationStatusClient object. + */ + LocationBasedRecommendedActionSessionsOperationStatusClient + getLocationBasedRecommendedActionSessionsOperationStatus(); + + /** + * Gets the LocationBasedRecommendedActionSessionsResultsClient object to access its operations. + * + * @return the LocationBasedRecommendedActionSessionsResultsClient object. + */ + LocationBasedRecommendedActionSessionsResultsClient getLocationBasedRecommendedActionSessionsResults(); + + /** + * Gets the PrivateEndpointConnectionsClient object to access its operations. + * + * @return the PrivateEndpointConnectionsClient object. + */ + PrivateEndpointConnectionsClient getPrivateEndpointConnections(); + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + PrivateLinkResourcesClient getPrivateLinkResources(); + + /** + * Gets the ServerSecurityAlertPoliciesClient object to access its operations. + * + * @return the ServerSecurityAlertPoliciesClient object. + */ + ServerSecurityAlertPoliciesClient getServerSecurityAlertPolicies(); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/OperationsClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/OperationsClient.java new file mode 100644 index 000000000000..6f08ab233906 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/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.mariadb.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.mariadb.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 REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + OperationListResultInner list(); + + /** + * Lists all of the available REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response listWithResponse(Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/PrivateEndpointConnectionsClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 000000000000..70f6cec419a4 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.mariadb.models.TagsObject; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public interface PrivateEndpointConnectionsClient { + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 serverName, String privateEndpointConnectionName); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 serverName, String privateEndpointConnectionName, Context context); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @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 serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @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 serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @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 serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @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 serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 serverName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 serverName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverName, String privateEndpointConnectionName, Context context); + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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> beginUpdateTags( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters); + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> beginUpdateTags( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context); + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 updateTags( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters); + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner updateTags( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/PrivateLinkResourcesClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/PrivateLinkResourcesClient.java new file mode 100644 index 000000000000..bd47e7fd131d --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/PrivateLinkResourcesClient.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.mariadb.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.mariadb.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 for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 for MariaDB server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets the private link resources for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 for MariaDB server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a private link resource for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 a private link resource for MariaDB server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner get(String resourceGroupName, String serverName, String groupName); + + /** + * Gets a private link resource for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 a private link resource for MariaDB server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/QueryTextsClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/QueryTextsClient.java new file mode 100644 index 000000000000..aa583343c951 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/QueryTextsClient.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.mariadb.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.mariadb.fluent.models.QueryTextInner; +import java.util.List; + +/** An instance of this class provides access to all the operations defined in QueryTextsClient. */ +public interface QueryTextsClient { + /** + * Retrieve the Query-Store query texts for the queryId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryId The Query-Store query identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Query Text. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + QueryTextInner get(String resourceGroupName, String serverName, String queryId); + + /** + * Retrieve the Query-Store query texts for the queryId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryId The Query-Store query identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Query Text. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String queryId, Context context); + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query texts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, List queryIds); + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query texts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, List queryIds, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/RecommendedActionsClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/RecommendedActionsClient.java new file mode 100644 index 000000000000..5b1b89ba3206 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/RecommendedActionsClient.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.mariadb.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.mariadb.fluent.models.RecommendationActionInner; + +/** An instance of this class provides access to all the operations defined in RecommendedActionsClient. */ +public interface RecommendedActionsClient { + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param recommendedActionName The recommended action 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 represents a Recommendation Action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RecommendationActionInner get( + String resourceGroupName, String serverName, String advisorName, String recommendedActionName); + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param recommendedActionName The recommended action 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 represents a Recommendation Action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String advisorName, String recommendedActionName, Context context); + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, String advisorName); + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param sessionId The recommendation action session identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, String advisorName, String sessionId, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/RecoverableServersClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/RecoverableServersClient.java new file mode 100644 index 000000000000..e7387f5929a4 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/RecoverableServersClient.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.mariadb.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.mariadb.fluent.models.RecoverableServerResourceInner; + +/** An instance of this class provides access to all the operations defined in RecoverableServersClient. */ +public interface RecoverableServersClient { + /** + * Gets a recoverable MariaDB Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable MariaDB Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RecoverableServerResourceInner get(String resourceGroupName, String serverName); + + /** + * Gets a recoverable MariaDB Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable MariaDB Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ReplicasClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ReplicasClient.java new file mode 100644 index 000000000000..e1a4f828bffd --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ReplicasClient.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.mariadb.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.mariadb.fluent.models.ServerInner; + +/** An instance of this class provides access to all the operations defined in ReplicasClient. */ +public interface ReplicasClient { + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ResourceProvidersClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ResourceProvidersClient.java new file mode 100644 index 000000000000..badc0650866c --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ResourceProvidersClient.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.mariadb.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mariadb.fluent.models.QueryPerformanceInsightResetDataResultInner; + +/** An instance of this class provides access to all the operations defined in ResourceProvidersClient. */ +public interface ResourceProvidersClient { + /** + * Reset data for Query Performance Insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Query Performance Insight data reset. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + QueryPerformanceInsightResetDataResultInner resetQueryPerformanceInsightData( + String resourceGroupName, String serverName); + + /** + * Reset data for Query Performance Insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Query Performance Insight data reset. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response resetQueryPerformanceInsightDataWithResponse( + String resourceGroupName, String serverName, Context context); + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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> beginCreateRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName); + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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> beginCreateRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName, Context context); + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 createRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName); + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 createRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ServerBasedPerformanceTiersClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ServerBasedPerformanceTiersClient.java new file mode 100644 index 000000000000..28a938066b90 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ServerBasedPerformanceTiersClient.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.mariadb.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.mariadb.fluent.models.PerformanceTierPropertiesInner; + +/** An instance of this class provides access to all the operations defined in ServerBasedPerformanceTiersClient. */ +public interface ServerBasedPerformanceTiersClient { + /** + * List all the performance tiers for a MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serverName); + + /** + * List all the performance tiers for a MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ServerParametersClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ServerParametersClient.java new file mode 100644 index 000000000000..e8993687377a --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ServerParametersClient.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.mariadb.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mariadb.fluent.models.ConfigurationListResultInner; + +/** An instance of this class provides access to all the operations defined in ServerParametersClient. */ +public interface ServerParametersClient { + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ConfigurationListResultInner> beginListUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value); + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ConfigurationListResultInner> beginListUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context); + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfigurationListResultInner listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value); + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfigurationListResultInner listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ServerSecurityAlertPoliciesClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ServerSecurityAlertPoliciesClient.java new file mode 100644 index 000000000000..b1eb6cdfed64 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ServerSecurityAlertPoliciesClient.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.mariadb.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mariadb.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.mariadb.models.SecurityAlertPolicyName; + +/** An instance of this class provides access to all the operations defined in ServerSecurityAlertPoliciesClient. */ +public interface ServerSecurityAlertPoliciesClient { + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerSecurityAlertPolicyInner get( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName); + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert 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 a server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert 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 a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert 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 a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ServersClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ServersClient.java new file mode 100644 index 000000000000..69cba03c1aaa --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/ServersClient.java @@ -0,0 +1,425 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.fluent.models.ServerInner; +import com.azure.resourcemanager.mariadb.models.ServerForCreate; +import com.azure.resourcemanager.mariadb.models.ServerUpdateParameters; + +/** An instance of this class provides access to all the operations defined in ServersClient. */ +public interface ServersClient { + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerInner> beginCreate( + String resourceGroupName, String serverName, ServerForCreate parameters); + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerInner> beginCreate( + String resourceGroupName, String serverName, ServerForCreate parameters, Context context); + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner create(String resourceGroupName, String serverName, ServerForCreate parameters); + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner create(String resourceGroupName, String serverName, ServerForCreate parameters, Context context); + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerInner> beginUpdate( + String resourceGroupName, String serverName, ServerUpdateParameters parameters); + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerInner> beginUpdate( + String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context); + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner update(String resourceGroupName, String serverName, ServerUpdateParameters parameters); + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner update(String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context); + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 serverName); + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 serverName, Context context); + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverName); + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverName, Context context); + + /** + * Gets information about a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerInner getByResourceGroup(String resourceGroupName, String serverName); + + /** + * Gets information about a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getByResourceGroupWithResponse(String resourceGroupName, String serverName, Context context); + + /** + * List all the servers in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all the servers in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List all the servers in a given 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 servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(); + + /** + * List all the servers in a given 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 servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(Context context); + + /** + * Restarts a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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> beginRestart(String resourceGroupName, String serverName); + + /** + * Restarts a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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> beginRestart(String resourceGroupName, String serverName, Context context); + + /** + * Restarts a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 restart(String resourceGroupName, String serverName); + + /** + * Restarts a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 restart(String resourceGroupName, String serverName, Context context); + + /** + * Starts a stopped server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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> beginStart(String resourceGroupName, String serverName); + + /** + * Starts a stopped server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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> beginStart(String resourceGroupName, String serverName, Context context); + + /** + * Starts a stopped server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 start(String resourceGroupName, String serverName); + + /** + * Starts a stopped server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 start(String resourceGroupName, String serverName, Context context); + + /** + * Stops a running server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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> beginStop(String resourceGroupName, String serverName); + + /** + * Stops a running server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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> beginStop(String resourceGroupName, String serverName, Context context); + + /** + * Stops a running server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 stop(String resourceGroupName, String serverName); + + /** + * Stops a running server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 stop(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/TopQueryStatisticsClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/TopQueryStatisticsClient.java new file mode 100644 index 000000000000..7f3b90aa0674 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/TopQueryStatisticsClient.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.mariadb.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.mariadb.fluent.models.QueryStatisticInner; +import com.azure.resourcemanager.mariadb.models.TopQueryStatisticsInput; + +/** An instance of this class provides access to all the operations defined in TopQueryStatisticsClient. */ +public interface TopQueryStatisticsClient { + /** + * Retrieve the query statistic for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryStatisticId The Query Statistic identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Query Statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + QueryStatisticInner get(String resourceGroupName, String serverName, String queryStatisticId); + + /** + * Retrieve the query statistic for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryStatisticId The Query Statistic identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Query Statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String queryStatisticId, Context context); + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters); + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/VirtualNetworkRulesClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/VirtualNetworkRulesClient.java new file mode 100644 index 000000000000..12246f47698b --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/VirtualNetworkRulesClient.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.mariadb.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.mariadb.fluent.models.VirtualNetworkRuleInner; + +/** An instance of this class provides access to all the operations defined in VirtualNetworkRulesClient. */ +public interface VirtualNetworkRulesClient { + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkRuleInner get(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters); + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context); + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters); + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 serverName, String virtualNetworkRuleName); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/WaitStatisticsClient.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/WaitStatisticsClient.java new file mode 100644 index 000000000000..8e964679696e --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/WaitStatisticsClient.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.mariadb.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.mariadb.fluent.models.WaitStatisticInner; +import com.azure.resourcemanager.mariadb.models.WaitStatisticsInput; + +/** An instance of this class provides access to all the operations defined in WaitStatisticsClient. */ +public interface WaitStatisticsClient { + /** + * Retrieve wait statistics for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param waitStatisticsId The Wait Statistic identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Wait Statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + WaitStatisticInner get(String resourceGroupName, String serverName, String waitStatisticsId); + + /** + * Retrieve wait statistics for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param waitStatisticsId The Wait Statistic identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Wait Statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String waitStatisticsId, Context context); + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of wait statistics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, WaitStatisticsInput parameters); + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of wait statistics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, WaitStatisticsInput parameters, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/AdvisorInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/AdvisorInner.java new file mode 100644 index 000000000000..0d2fcda31f4b --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/AdvisorInner.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.mariadb.fluent.models; + +import com.azure.core.annotation.Fluent; +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; + +/** Represents a recommendation action advisor. */ +@Fluent +public final class AdvisorInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdvisorInner.class); + + /* + * The properties of a recommendation action advisor. + */ + @JsonProperty(value = "properties") + private Object properties; + + /** + * Get the properties property: The properties of a recommendation action advisor. + * + * @return the properties value. + */ + public Object properties() { + return this.properties; + } + + /** + * Set the properties property: The properties of a recommendation action advisor. + * + * @param properties the properties value to set. + * @return the AdvisorInner object itself. + */ + public AdvisorInner withProperties(Object 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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/ConfigurationInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/ConfigurationInner.java new file mode 100644 index 000000000000..4bfe0f597718 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/ConfigurationInner.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.mariadb.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; + +/** Represents a Configuration. */ +@JsonFlatten +@Fluent +public class ConfigurationInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigurationInner.class); + + /* + * Value of the configuration. + */ + @JsonProperty(value = "properties.value") + private String value; + + /* + * Description of the configuration. + */ + @JsonProperty(value = "properties.description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /* + * Default value of the configuration. + */ + @JsonProperty(value = "properties.defaultValue", access = JsonProperty.Access.WRITE_ONLY) + private String defaultValue; + + /* + * Data type of the configuration. + */ + @JsonProperty(value = "properties.dataType", access = JsonProperty.Access.WRITE_ONLY) + private String dataType; + + /* + * Allowed values of the configuration. + */ + @JsonProperty(value = "properties.allowedValues", access = JsonProperty.Access.WRITE_ONLY) + private String allowedValues; + + /* + * Source of the configuration. + */ + @JsonProperty(value = "properties.source") + private String source; + + /** + * Get the value property: Value of the configuration. + * + * @return the value value. + */ + public String value() { + return this.value; + } + + /** + * Set the value property: Value of the configuration. + * + * @param value the value value to set. + * @return the ConfigurationInner object itself. + */ + public ConfigurationInner withValue(String value) { + this.value = value; + return this; + } + + /** + * Get the description property: Description of the configuration. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Get the defaultValue property: Default value of the configuration. + * + * @return the defaultValue value. + */ + public String defaultValue() { + return this.defaultValue; + } + + /** + * Get the dataType property: Data type of the configuration. + * + * @return the dataType value. + */ + public String dataType() { + return this.dataType; + } + + /** + * Get the allowedValues property: Allowed values of the configuration. + * + * @return the allowedValues value. + */ + public String allowedValues() { + return this.allowedValues; + } + + /** + * Get the source property: Source of the configuration. + * + * @return the source value. + */ + public String source() { + return this.source; + } + + /** + * Set the source property: Source of the configuration. + * + * @param source the source value to set. + * @return the ConfigurationInner object itself. + */ + public ConfigurationInner withSource(String source) { + this.source = source; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/ConfigurationListResultInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/ConfigurationListResultInner.java new file mode 100644 index 000000000000..44434a1ff53b --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/ConfigurationListResultInner.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.mariadb.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; + +/** A list of server configurations. */ +@Fluent +public final class ConfigurationListResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigurationListResultInner.class); + + /* + * The list of server configurations. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of server configurations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of server configurations. + * + * @param value the value value to set. + * @return the ConfigurationListResultInner object itself. + */ + public ConfigurationListResultInner 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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/DatabaseInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/DatabaseInner.java new file mode 100644 index 000000000000..af70d9b6c363 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/DatabaseInner.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.mariadb.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; + +/** Represents a Database. */ +@JsonFlatten +@Fluent +public class DatabaseInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseInner.class); + + /* + * The charset of the database. + */ + @JsonProperty(value = "properties.charset") + private String charset; + + /* + * The collation of the database. + */ + @JsonProperty(value = "properties.collation") + private String collation; + + /** + * Get the charset property: The charset of the database. + * + * @return the charset value. + */ + public String charset() { + return this.charset; + } + + /** + * Set the charset property: The charset of the database. + * + * @param charset the charset value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCharset(String charset) { + this.charset = charset; + return this; + } + + /** + * Get the collation property: The collation of the database. + * + * @return the collation value. + */ + public String collation() { + return this.collation; + } + + /** + * Set the collation property: The collation of the database. + * + * @param collation the collation value to set. + * @return the DatabaseInner object itself. + */ + public DatabaseInner withCollation(String collation) { + this.collation = collation; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/FirewallRuleInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/FirewallRuleInner.java new file mode 100644 index 000000000000..56e68a42d7af --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/FirewallRuleInner.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.mariadb.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; + +/** Represents a server firewall rule. */ +@JsonFlatten +@Fluent +public class FirewallRuleInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FirewallRuleInner.class); + + /* + * The start IP address of the server firewall rule. Must be IPv4 format. + */ + @JsonProperty(value = "properties.startIpAddress", required = true) + private String startIpAddress; + + /* + * The end IP address of the server firewall rule. Must be IPv4 format. + */ + @JsonProperty(value = "properties.endIpAddress", required = true) + private String endIpAddress; + + /** + * Get the startIpAddress property: The start IP address of the server firewall rule. Must be IPv4 format. + * + * @return the startIpAddress value. + */ + public String startIpAddress() { + return this.startIpAddress; + } + + /** + * Set the startIpAddress property: The start IP address of the server firewall rule. Must be IPv4 format. + * + * @param startIpAddress the startIpAddress value to set. + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withStartIpAddress(String startIpAddress) { + this.startIpAddress = startIpAddress; + return this; + } + + /** + * Get the endIpAddress property: The end IP address of the server firewall rule. Must be IPv4 format. + * + * @return the endIpAddress value. + */ + public String endIpAddress() { + return this.endIpAddress; + } + + /** + * Set the endIpAddress property: The end IP address of the server firewall rule. Must be IPv4 format. + * + * @param endIpAddress the endIpAddress value to set. + * @return the FirewallRuleInner object itself. + */ + public FirewallRuleInner withEndIpAddress(String endIpAddress) { + this.endIpAddress = endIpAddress; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (startIpAddress() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property startIpAddress in model FirewallRuleInner")); + } + if (endIpAddress() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property endIpAddress in model FirewallRuleInner")); + } + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/LogFileInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/LogFileInner.java new file mode 100644 index 000000000000..804a63f60f13 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/LogFileInner.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.mariadb.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; +import java.time.OffsetDateTime; + +/** Represents a log file. */ +@JsonFlatten +@Fluent +public class LogFileInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogFileInner.class); + + /* + * Size of the log file. + */ + @JsonProperty(value = "properties.sizeInKB") + private Long sizeInKB; + + /* + * Creation timestamp of the log file. + */ + @JsonProperty(value = "properties.createdTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdTime; + + /* + * Last modified timestamp of the log file. + */ + @JsonProperty(value = "properties.lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastModifiedTime; + + /* + * Type of the log file. + */ + @JsonProperty(value = "properties.type") + private String typePropertiesType; + + /* + * The url to download the log file from. + */ + @JsonProperty(value = "properties.url", access = JsonProperty.Access.WRITE_ONLY) + private String url; + + /** + * Get the sizeInKB property: Size of the log file. + * + * @return the sizeInKB value. + */ + public Long sizeInKB() { + return this.sizeInKB; + } + + /** + * Set the sizeInKB property: Size of the log file. + * + * @param sizeInKB the sizeInKB value to set. + * @return the LogFileInner object itself. + */ + public LogFileInner withSizeInKB(Long sizeInKB) { + this.sizeInKB = sizeInKB; + return this; + } + + /** + * Get the createdTime property: Creation timestamp of the log file. + * + * @return the createdTime value. + */ + public OffsetDateTime createdTime() { + return this.createdTime; + } + + /** + * Get the lastModifiedTime property: Last modified timestamp of the log file. + * + * @return the lastModifiedTime value. + */ + public OffsetDateTime lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Get the typePropertiesType property: Type of the log file. + * + * @return the typePropertiesType value. + */ + public String typePropertiesType() { + return this.typePropertiesType; + } + + /** + * Set the typePropertiesType property: Type of the log file. + * + * @param typePropertiesType the typePropertiesType value to set. + * @return the LogFileInner object itself. + */ + public LogFileInner withTypePropertiesType(String typePropertiesType) { + this.typePropertiesType = typePropertiesType; + return this; + } + + /** + * Get the url property: The url to download the log file from. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/NameAvailabilityInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/NameAvailabilityInner.java new file mode 100644 index 000000000000..3096e7c39705 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/NameAvailabilityInner.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.mariadb.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 resource name availability. */ +@Fluent +public final class NameAvailabilityInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NameAvailabilityInner.class); + + /* + * Error Message. + */ + @JsonProperty(value = "message") + private String message; + + /* + * Indicates whether the resource name is available. + */ + @JsonProperty(value = "nameAvailable") + private Boolean nameAvailable; + + /* + * Reason for name being unavailable. + */ + @JsonProperty(value = "reason") + private String reason; + + /** + * Get the message property: Error Message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: Error Message. + * + * @param message the message value to set. + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Get the nameAvailable property: Indicates whether the resource name is available. + * + * @return the nameAvailable value. + */ + public Boolean nameAvailable() { + return this.nameAvailable; + } + + /** + * Set the nameAvailable property: Indicates whether the resource name is available. + * + * @param nameAvailable the nameAvailable value to set. + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withNameAvailable(Boolean nameAvailable) { + this.nameAvailable = nameAvailable; + return this; + } + + /** + * Get the reason property: Reason for name being unavailable. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: Reason for name being unavailable. + * + * @param reason the reason value to set. + * @return the NameAvailabilityInner object itself. + */ + public NameAvailabilityInner withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/OperationListResultInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/OperationListResultInner.java new file mode 100644 index 000000000000..0b1b737342ea --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/OperationListResultInner.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.mariadb.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.models.Operation; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of resource provider operations. */ +@Fluent +public final class OperationListResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResultInner.class); + + /* + * The list of resource provider operations. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of resource provider operations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of resource provider operations. + * + * @param value the value value to set. + * @return the OperationListResultInner object itself. + */ + public OperationListResultInner 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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/PerformanceTierPropertiesInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/PerformanceTierPropertiesInner.java new file mode 100644 index 000000000000..8c399e47344c --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/PerformanceTierPropertiesInner.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.models.PerformanceTierServiceLevelObjectives; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Performance tier properties. */ +@Fluent +public final class PerformanceTierPropertiesInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PerformanceTierPropertiesInner.class); + + /* + * ID of the performance tier. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Maximum Backup retention in days for the performance tier edition + */ + @JsonProperty(value = "maxBackupRetentionDays") + private Integer maxBackupRetentionDays; + + /* + * Minimum Backup retention in days for the performance tier edition + */ + @JsonProperty(value = "minBackupRetentionDays") + private Integer minBackupRetentionDays; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "maxStorageMB") + private Integer maxStorageMB; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "minLargeStorageMB") + private Integer minLargeStorageMB; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "maxLargeStorageMB") + private Integer maxLargeStorageMB; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "minStorageMB") + private Integer minStorageMB; + + /* + * Service level objectives associated with the performance tier + */ + @JsonProperty(value = "serviceLevelObjectives") + private List serviceLevelObjectives; + + /** + * Get the id property: ID of the performance tier. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: ID of the performance tier. + * + * @param id the id value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the maxBackupRetentionDays property: Maximum Backup retention in days for the performance tier edition. + * + * @return the maxBackupRetentionDays value. + */ + public Integer maxBackupRetentionDays() { + return this.maxBackupRetentionDays; + } + + /** + * Set the maxBackupRetentionDays property: Maximum Backup retention in days for the performance tier edition. + * + * @param maxBackupRetentionDays the maxBackupRetentionDays value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withMaxBackupRetentionDays(Integer maxBackupRetentionDays) { + this.maxBackupRetentionDays = maxBackupRetentionDays; + return this; + } + + /** + * Get the minBackupRetentionDays property: Minimum Backup retention in days for the performance tier edition. + * + * @return the minBackupRetentionDays value. + */ + public Integer minBackupRetentionDays() { + return this.minBackupRetentionDays; + } + + /** + * Set the minBackupRetentionDays property: Minimum Backup retention in days for the performance tier edition. + * + * @param minBackupRetentionDays the minBackupRetentionDays value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withMinBackupRetentionDays(Integer minBackupRetentionDays) { + this.minBackupRetentionDays = minBackupRetentionDays; + return this; + } + + /** + * Get the maxStorageMB property: Max storage allowed for a server. + * + * @return the maxStorageMB value. + */ + public Integer maxStorageMB() { + return this.maxStorageMB; + } + + /** + * Set the maxStorageMB property: Max storage allowed for a server. + * + * @param maxStorageMB the maxStorageMB value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withMaxStorageMB(Integer maxStorageMB) { + this.maxStorageMB = maxStorageMB; + return this; + } + + /** + * Get the minLargeStorageMB property: Max storage allowed for a server. + * + * @return the minLargeStorageMB value. + */ + public Integer minLargeStorageMB() { + return this.minLargeStorageMB; + } + + /** + * Set the minLargeStorageMB property: Max storage allowed for a server. + * + * @param minLargeStorageMB the minLargeStorageMB value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withMinLargeStorageMB(Integer minLargeStorageMB) { + this.minLargeStorageMB = minLargeStorageMB; + return this; + } + + /** + * Get the maxLargeStorageMB property: Max storage allowed for a server. + * + * @return the maxLargeStorageMB value. + */ + public Integer maxLargeStorageMB() { + return this.maxLargeStorageMB; + } + + /** + * Set the maxLargeStorageMB property: Max storage allowed for a server. + * + * @param maxLargeStorageMB the maxLargeStorageMB value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withMaxLargeStorageMB(Integer maxLargeStorageMB) { + this.maxLargeStorageMB = maxLargeStorageMB; + return this; + } + + /** + * Get the minStorageMB property: Max storage allowed for a server. + * + * @return the minStorageMB value. + */ + public Integer minStorageMB() { + return this.minStorageMB; + } + + /** + * Set the minStorageMB property: Max storage allowed for a server. + * + * @param minStorageMB the minStorageMB value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withMinStorageMB(Integer minStorageMB) { + this.minStorageMB = minStorageMB; + return this; + } + + /** + * Get the serviceLevelObjectives property: Service level objectives associated with the performance tier. + * + * @return the serviceLevelObjectives value. + */ + public List serviceLevelObjectives() { + return this.serviceLevelObjectives; + } + + /** + * Set the serviceLevelObjectives property: Service level objectives associated with the performance tier. + * + * @param serviceLevelObjectives the serviceLevelObjectives value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withServiceLevelObjectives( + List serviceLevelObjectives) { + this.serviceLevelObjectives = serviceLevelObjectives; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serviceLevelObjectives() != null) { + serviceLevelObjectives().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/PrivateEndpointConnectionInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 000000000000..6e908201b18f --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/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.mariadb.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.mariadb.models.PrivateEndpointProperty; +import com.azure.resourcemanager.mariadb.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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/PrivateLinkResourceInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/PrivateLinkResourceInner.java new file mode 100644 index 000000000000..c5ca68c7ec38 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/PrivateLinkResourceInner.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.mariadb.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.models.PrivateLinkResourceProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private link resource. */ +@Immutable +public final class PrivateLinkResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceInner.class); + + /* + * The private link resource group id. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private PrivateLinkResourceProperties properties; + + /** + * Get the properties property: The private link resource group id. + * + * @return the properties value. + */ + public PrivateLinkResourceProperties properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/QueryPerformanceInsightResetDataResultInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/QueryPerformanceInsightResetDataResultInner.java new file mode 100644 index 000000000000..9c19716c3494 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/QueryPerformanceInsightResetDataResultInner.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.mariadb.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.models.QueryPerformanceInsightResetDataResultState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Result of Query Performance Insight data reset. */ +@Fluent +public final class QueryPerformanceInsightResetDataResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(QueryPerformanceInsightResetDataResultInner.class); + + /* + * Indicates result of the operation. + */ + @JsonProperty(value = "status") + private QueryPerformanceInsightResetDataResultState status; + + /* + * operation message. + */ + @JsonProperty(value = "message") + private String message; + + /** + * Get the status property: Indicates result of the operation. + * + * @return the status value. + */ + public QueryPerformanceInsightResetDataResultState status() { + return this.status; + } + + /** + * Set the status property: Indicates result of the operation. + * + * @param status the status value to set. + * @return the QueryPerformanceInsightResetDataResultInner object itself. + */ + public QueryPerformanceInsightResetDataResultInner withStatus(QueryPerformanceInsightResetDataResultState status) { + this.status = status; + return this; + } + + /** + * Get the message property: operation message. + * + * @return the message value. + */ + public String message() { + return this.message; + } + + /** + * Set the message property: operation message. + * + * @param message the message value to set. + * @return the QueryPerformanceInsightResetDataResultInner object itself. + */ + public QueryPerformanceInsightResetDataResultInner withMessage(String message) { + this.message = message; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/QueryStatisticInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/QueryStatisticInner.java new file mode 100644 index 000000000000..0898f2f39b47 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/QueryStatisticInner.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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; +import java.time.OffsetDateTime; +import java.util.List; + +/** Represents a Query Statistic. */ +@JsonFlatten +@Fluent +public class QueryStatisticInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(QueryStatisticInner.class); + + /* + * Database query identifier. + */ + @JsonProperty(value = "properties.queryId") + private String queryId; + + /* + * Observation start time. + */ + @JsonProperty(value = "properties.startTime") + private OffsetDateTime startTime; + + /* + * Observation end time. + */ + @JsonProperty(value = "properties.endTime") + private OffsetDateTime endTime; + + /* + * Aggregation function name. + */ + @JsonProperty(value = "properties.aggregationFunction") + private String aggregationFunction; + + /* + * The list of database names. + */ + @JsonProperty(value = "properties.databaseNames") + private List databaseNames; + + /* + * Number of query executions in this time interval. + */ + @JsonProperty(value = "properties.queryExecutionCount") + private Long queryExecutionCount; + + /* + * Metric name. + */ + @JsonProperty(value = "properties.metricName") + private String metricName; + + /* + * Metric display name. + */ + @JsonProperty(value = "properties.metricDisplayName") + private String metricDisplayName; + + /* + * Metric value. + */ + @JsonProperty(value = "properties.metricValue") + private Double metricValue; + + /* + * Metric value unit. + */ + @JsonProperty(value = "properties.metricValueUnit") + private String metricValueUnit; + + /** + * Get the queryId property: Database query identifier. + * + * @return the queryId value. + */ + public String queryId() { + return this.queryId; + } + + /** + * Set the queryId property: Database query identifier. + * + * @param queryId the queryId value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withQueryId(String queryId) { + this.queryId = queryId; + return this; + } + + /** + * Get the startTime property: Observation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Observation start time. + * + * @param startTime the startTime value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: Observation end time. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: Observation end time. + * + * @param endTime the endTime value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the aggregationFunction property: Aggregation function name. + * + * @return the aggregationFunction value. + */ + public String aggregationFunction() { + return this.aggregationFunction; + } + + /** + * Set the aggregationFunction property: Aggregation function name. + * + * @param aggregationFunction the aggregationFunction value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withAggregationFunction(String aggregationFunction) { + this.aggregationFunction = aggregationFunction; + return this; + } + + /** + * Get the databaseNames property: The list of database names. + * + * @return the databaseNames value. + */ + public List databaseNames() { + return this.databaseNames; + } + + /** + * Set the databaseNames property: The list of database names. + * + * @param databaseNames the databaseNames value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withDatabaseNames(List databaseNames) { + this.databaseNames = databaseNames; + return this; + } + + /** + * Get the queryExecutionCount property: Number of query executions in this time interval. + * + * @return the queryExecutionCount value. + */ + public Long queryExecutionCount() { + return this.queryExecutionCount; + } + + /** + * Set the queryExecutionCount property: Number of query executions in this time interval. + * + * @param queryExecutionCount the queryExecutionCount value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withQueryExecutionCount(Long queryExecutionCount) { + this.queryExecutionCount = queryExecutionCount; + return this; + } + + /** + * Get the metricName property: Metric name. + * + * @return the metricName value. + */ + public String metricName() { + return this.metricName; + } + + /** + * Set the metricName property: Metric name. + * + * @param metricName the metricName value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withMetricName(String metricName) { + this.metricName = metricName; + return this; + } + + /** + * Get the metricDisplayName property: Metric display name. + * + * @return the metricDisplayName value. + */ + public String metricDisplayName() { + return this.metricDisplayName; + } + + /** + * Set the metricDisplayName property: Metric display name. + * + * @param metricDisplayName the metricDisplayName value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withMetricDisplayName(String metricDisplayName) { + this.metricDisplayName = metricDisplayName; + return this; + } + + /** + * Get the metricValue property: Metric value. + * + * @return the metricValue value. + */ + public Double metricValue() { + return this.metricValue; + } + + /** + * Set the metricValue property: Metric value. + * + * @param metricValue the metricValue value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withMetricValue(Double metricValue) { + this.metricValue = metricValue; + return this; + } + + /** + * Get the metricValueUnit property: Metric value unit. + * + * @return the metricValueUnit value. + */ + public String metricValueUnit() { + return this.metricValueUnit; + } + + /** + * Set the metricValueUnit property: Metric value unit. + * + * @param metricValueUnit the metricValueUnit value to set. + * @return the QueryStatisticInner object itself. + */ + public QueryStatisticInner withMetricValueUnit(String metricValueUnit) { + this.metricValueUnit = metricValueUnit; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/QueryTextInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/QueryTextInner.java new file mode 100644 index 000000000000..ec8383391676 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/QueryTextInner.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.mariadb.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; + +/** Represents a Query Text. */ +@JsonFlatten +@Fluent +public class QueryTextInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(QueryTextInner.class); + + /* + * Query identifier unique to the server. + */ + @JsonProperty(value = "properties.queryId") + private String queryId; + + /* + * Query text. + */ + @JsonProperty(value = "properties.queryText") + private String queryText; + + /** + * Get the queryId property: Query identifier unique to the server. + * + * @return the queryId value. + */ + public String queryId() { + return this.queryId; + } + + /** + * Set the queryId property: Query identifier unique to the server. + * + * @param queryId the queryId value to set. + * @return the QueryTextInner object itself. + */ + public QueryTextInner withQueryId(String queryId) { + this.queryId = queryId; + return this; + } + + /** + * Get the queryText property: Query text. + * + * @return the queryText value. + */ + public String queryText() { + return this.queryText; + } + + /** + * Set the queryText property: Query text. + * + * @param queryText the queryText value to set. + * @return the QueryTextInner object itself. + */ + public QueryTextInner withQueryText(String queryText) { + this.queryText = queryText; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/RecommendationActionInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/RecommendationActionInner.java new file mode 100644 index 000000000000..5896f4072a3d --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/RecommendationActionInner.java @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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; +import java.time.OffsetDateTime; +import java.util.Map; + +/** Represents a Recommendation Action. */ +@JsonFlatten +@Fluent +public class RecommendationActionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecommendationActionInner.class); + + /* + * Advisor name. + */ + @JsonProperty(value = "properties.advisorName") + private String advisorName; + + /* + * Recommendation action session identifier. + */ + @JsonProperty(value = "properties.sessionId") + private String sessionId; + + /* + * Recommendation action identifier. + */ + @JsonProperty(value = "properties.actionId") + private Integer actionId; + + /* + * Recommendation action creation time. + */ + @JsonProperty(value = "properties.createdTime") + private OffsetDateTime createdTime; + + /* + * Recommendation action expiration time. + */ + @JsonProperty(value = "properties.expirationTime") + private OffsetDateTime expirationTime; + + /* + * Recommendation action reason. + */ + @JsonProperty(value = "properties.reason") + private String reason; + + /* + * Recommendation action type. + */ + @JsonProperty(value = "properties.recommendationType") + private String recommendationType; + + /* + * Recommendation action details. + */ + @JsonProperty(value = "properties.details") + private Map details; + + /** + * Get the advisorName property: Advisor name. + * + * @return the advisorName value. + */ + public String advisorName() { + return this.advisorName; + } + + /** + * Set the advisorName property: Advisor name. + * + * @param advisorName the advisorName value to set. + * @return the RecommendationActionInner object itself. + */ + public RecommendationActionInner withAdvisorName(String advisorName) { + this.advisorName = advisorName; + return this; + } + + /** + * Get the sessionId property: Recommendation action session identifier. + * + * @return the sessionId value. + */ + public String sessionId() { + return this.sessionId; + } + + /** + * Set the sessionId property: Recommendation action session identifier. + * + * @param sessionId the sessionId value to set. + * @return the RecommendationActionInner object itself. + */ + public RecommendationActionInner withSessionId(String sessionId) { + this.sessionId = sessionId; + return this; + } + + /** + * Get the actionId property: Recommendation action identifier. + * + * @return the actionId value. + */ + public Integer actionId() { + return this.actionId; + } + + /** + * Set the actionId property: Recommendation action identifier. + * + * @param actionId the actionId value to set. + * @return the RecommendationActionInner object itself. + */ + public RecommendationActionInner withActionId(Integer actionId) { + this.actionId = actionId; + return this; + } + + /** + * Get the createdTime property: Recommendation action creation time. + * + * @return the createdTime value. + */ + public OffsetDateTime createdTime() { + return this.createdTime; + } + + /** + * Set the createdTime property: Recommendation action creation time. + * + * @param createdTime the createdTime value to set. + * @return the RecommendationActionInner object itself. + */ + public RecommendationActionInner withCreatedTime(OffsetDateTime createdTime) { + this.createdTime = createdTime; + return this; + } + + /** + * Get the expirationTime property: Recommendation action expiration time. + * + * @return the expirationTime value. + */ + public OffsetDateTime expirationTime() { + return this.expirationTime; + } + + /** + * Set the expirationTime property: Recommendation action expiration time. + * + * @param expirationTime the expirationTime value to set. + * @return the RecommendationActionInner object itself. + */ + public RecommendationActionInner withExpirationTime(OffsetDateTime expirationTime) { + this.expirationTime = expirationTime; + return this; + } + + /** + * Get the reason property: Recommendation action reason. + * + * @return the reason value. + */ + public String reason() { + return this.reason; + } + + /** + * Set the reason property: Recommendation action reason. + * + * @param reason the reason value to set. + * @return the RecommendationActionInner object itself. + */ + public RecommendationActionInner withReason(String reason) { + this.reason = reason; + return this; + } + + /** + * Get the recommendationType property: Recommendation action type. + * + * @return the recommendationType value. + */ + public String recommendationType() { + return this.recommendationType; + } + + /** + * Set the recommendationType property: Recommendation action type. + * + * @param recommendationType the recommendationType value to set. + * @return the RecommendationActionInner object itself. + */ + public RecommendationActionInner withRecommendationType(String recommendationType) { + this.recommendationType = recommendationType; + return this; + } + + /** + * Get the details property: Recommendation action details. + * + * @return the details value. + */ + public Map details() { + return this.details; + } + + /** + * Set the details property: Recommendation action details. + * + * @param details the details value to set. + * @return the RecommendationActionInner object itself. + */ + public RecommendationActionInner withDetails(Map details) { + this.details = details; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/RecommendedActionSessionsOperationStatusInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/RecommendedActionSessionsOperationStatusInner.java new file mode 100644 index 000000000000..4b2b9ec737ae --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/RecommendedActionSessionsOperationStatusInner.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.mariadb.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.OffsetDateTime; + +/** Recommendation action session operation status. */ +@Fluent +public final class RecommendedActionSessionsOperationStatusInner { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(RecommendedActionSessionsOperationStatusInner.class); + + /* + * Operation identifier. + */ + @JsonProperty(value = "name") + private String name; + + /* + * Operation start time. + */ + @JsonProperty(value = "startTime") + private OffsetDateTime startTime; + + /* + * Operation status. + */ + @JsonProperty(value = "status") + private String status; + + /** + * Get the name property: Operation identifier. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Operation identifier. + * + * @param name the name value to set. + * @return the RecommendedActionSessionsOperationStatusInner object itself. + */ + public RecommendedActionSessionsOperationStatusInner withName(String name) { + this.name = name; + return this; + } + + /** + * Get the startTime property: Operation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Operation start time. + * + * @param startTime the startTime value to set. + * @return the RecommendedActionSessionsOperationStatusInner object itself. + */ + public RecommendedActionSessionsOperationStatusInner withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the status property: Operation status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: Operation status. + * + * @param status the status value to set. + * @return the RecommendedActionSessionsOperationStatusInner object itself. + */ + public RecommendedActionSessionsOperationStatusInner withStatus(String status) { + this.status = status; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/RecoverableServerResourceInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/RecoverableServerResourceInner.java new file mode 100644 index 000000000000..e8b6dffa0737 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/RecoverableServerResourceInner.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.mariadb.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; + +/** A recoverable server resource. */ +@JsonFlatten +@Immutable +public class RecoverableServerResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecoverableServerResourceInner.class); + + /* + * The last available backup date time. + */ + @JsonProperty(value = "properties.lastAvailableBackupDateTime", access = JsonProperty.Access.WRITE_ONLY) + private String lastAvailableBackupDateTime; + + /* + * The service level objective + */ + @JsonProperty(value = "properties.serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String serviceLevelObjective; + + /* + * Edition of the performance tier. + */ + @JsonProperty(value = "properties.edition", access = JsonProperty.Access.WRITE_ONLY) + private String edition; + + /* + * vCore associated with the service level objective + */ + @JsonProperty(value = "properties.vCore", access = JsonProperty.Access.WRITE_ONLY) + private Integer vCore; + + /* + * Hardware generation associated with the service level objective + */ + @JsonProperty(value = "properties.hardwareGeneration", access = JsonProperty.Access.WRITE_ONLY) + private String hardwareGeneration; + + /* + * The MariaDB version + */ + @JsonProperty(value = "properties.version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** + * Get the lastAvailableBackupDateTime property: The last available backup date time. + * + * @return the lastAvailableBackupDateTime value. + */ + public String lastAvailableBackupDateTime() { + return this.lastAvailableBackupDateTime; + } + + /** + * Get the serviceLevelObjective property: The service level objective. + * + * @return the serviceLevelObjective value. + */ + public String serviceLevelObjective() { + return this.serviceLevelObjective; + } + + /** + * Get the edition property: Edition of the performance tier. + * + * @return the edition value. + */ + public String edition() { + return this.edition; + } + + /** + * Get the vCore property: vCore associated with the service level objective. + * + * @return the vCore value. + */ + public Integer vCore() { + return this.vCore; + } + + /** + * Get the hardwareGeneration property: Hardware generation associated with the service level objective. + * + * @return the hardwareGeneration value. + */ + public String hardwareGeneration() { + return this.hardwareGeneration; + } + + /** + * Get the version property: The MariaDB version. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/ServerInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/ServerInner.java new file mode 100644 index 000000000000..4ed3e736918a --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/ServerInner.java @@ -0,0 +1,393 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.mariadb.models.ServerPrivateEndpointConnection; +import com.azure.resourcemanager.mariadb.models.ServerState; +import com.azure.resourcemanager.mariadb.models.ServerVersion; +import com.azure.resourcemanager.mariadb.models.Sku; +import com.azure.resourcemanager.mariadb.models.SslEnforcementEnum; +import com.azure.resourcemanager.mariadb.models.StorageProfile; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** Represents a server. */ +@JsonFlatten +@Fluent +public class ServerInner extends Resource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerInner.class); + + /* + * The SKU (pricing tier) of the server. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * The administrator's login name of a server. Can only be specified when + * the server is being created (and is required for creation). + */ + @JsonProperty(value = "properties.administratorLogin") + private String administratorLogin; + + /* + * Server version. + */ + @JsonProperty(value = "properties.version") + private ServerVersion version; + + /* + * Enable ssl enforcement or not when connect to server. + */ + @JsonProperty(value = "properties.sslEnforcement") + private SslEnforcementEnum sslEnforcement; + + /* + * A state of a server that is visible to user. + */ + @JsonProperty(value = "properties.userVisibleState") + private ServerState userVisibleState; + + /* + * The fully qualified domain name of a server. + */ + @JsonProperty(value = "properties.fullyQualifiedDomainName") + private String fullyQualifiedDomainName; + + /* + * Earliest restore point creation time (ISO8601 format) + */ + @JsonProperty(value = "properties.earliestRestoreDate") + private OffsetDateTime earliestRestoreDate; + + /* + * Storage profile of a server. + */ + @JsonProperty(value = "properties.storageProfile") + private StorageProfile storageProfile; + + /* + * The replication role of the server. + */ + @JsonProperty(value = "properties.replicationRole") + private String replicationRole; + + /* + * The master server id of a replica server. + */ + @JsonProperty(value = "properties.masterServerId") + private String masterServerId; + + /* + * The maximum number of replicas that a master server can have. + */ + @JsonProperty(value = "properties.replicaCapacity") + private Integer replicaCapacity; + + /* + * Whether or not public network access is allowed for this server. Value + * is optional but if passed in, must be 'Enabled' or 'Disabled' + */ + @JsonProperty(value = "properties.publicNetworkAccess") + private PublicNetworkAccessEnum publicNetworkAccess; + + /* + * List of private endpoint connections on a server + */ + @JsonProperty(value = "properties.privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; + + /** + * Get the sku property: The SKU (pricing tier) of the server. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU (pricing tier) of the server. + * + * @param sku the sku value to set. + * @return the ServerInner object itself. + */ + public ServerInner withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the administratorLogin property: The administrator's login name of a server. Can only be specified when the + * server is being created (and is required for creation). + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: The administrator's login name of a server. Can only be specified when the + * server is being created (and is required for creation). + * + * @param administratorLogin the administratorLogin value to set. + * @return the ServerInner object itself. + */ + public ServerInner withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the version property: Server version. + * + * @return the version value. + */ + public ServerVersion version() { + return this.version; + } + + /** + * Set the version property: Server version. + * + * @param version the version value to set. + * @return the ServerInner object itself. + */ + public ServerInner withVersion(ServerVersion version) { + this.version = version; + return this; + } + + /** + * Get the sslEnforcement property: Enable ssl enforcement or not when connect to server. + * + * @return the sslEnforcement value. + */ + public SslEnforcementEnum sslEnforcement() { + return this.sslEnforcement; + } + + /** + * Set the sslEnforcement property: Enable ssl enforcement or not when connect to server. + * + * @param sslEnforcement the sslEnforcement value to set. + * @return the ServerInner object itself. + */ + public ServerInner withSslEnforcement(SslEnforcementEnum sslEnforcement) { + this.sslEnforcement = sslEnforcement; + return this; + } + + /** + * Get the userVisibleState property: A state of a server that is visible to user. + * + * @return the userVisibleState value. + */ + public ServerState userVisibleState() { + return this.userVisibleState; + } + + /** + * Set the userVisibleState property: A state of a server that is visible to user. + * + * @param userVisibleState the userVisibleState value to set. + * @return the ServerInner object itself. + */ + public ServerInner withUserVisibleState(ServerState userVisibleState) { + this.userVisibleState = userVisibleState; + return this; + } + + /** + * Get the fullyQualifiedDomainName property: The fully qualified domain name of a server. + * + * @return the fullyQualifiedDomainName value. + */ + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; + } + + /** + * Set the fullyQualifiedDomainName property: The fully qualified domain name of a server. + * + * @param fullyQualifiedDomainName the fullyQualifiedDomainName value to set. + * @return the ServerInner object itself. + */ + public ServerInner withFullyQualifiedDomainName(String fullyQualifiedDomainName) { + this.fullyQualifiedDomainName = fullyQualifiedDomainName; + return this; + } + + /** + * Get the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + public OffsetDateTime earliestRestoreDate() { + return this.earliestRestoreDate; + } + + /** + * Set the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). + * + * @param earliestRestoreDate the earliestRestoreDate value to set. + * @return the ServerInner object itself. + */ + public ServerInner withEarliestRestoreDate(OffsetDateTime earliestRestoreDate) { + this.earliestRestoreDate = earliestRestoreDate; + return this; + } + + /** + * Get the storageProfile property: Storage profile of a server. + * + * @return the storageProfile value. + */ + public StorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: Storage profile of a server. + * + * @param storageProfile the storageProfile value to set. + * @return the ServerInner object itself. + */ + public ServerInner withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the replicationRole property: The replication role of the server. + * + * @return the replicationRole value. + */ + public String replicationRole() { + return this.replicationRole; + } + + /** + * Set the replicationRole property: The replication role of the server. + * + * @param replicationRole the replicationRole value to set. + * @return the ServerInner object itself. + */ + public ServerInner withReplicationRole(String replicationRole) { + this.replicationRole = replicationRole; + return this; + } + + /** + * Get the masterServerId property: The master server id of a replica server. + * + * @return the masterServerId value. + */ + public String masterServerId() { + return this.masterServerId; + } + + /** + * Set the masterServerId property: The master server id of a replica server. + * + * @param masterServerId the masterServerId value to set. + * @return the ServerInner object itself. + */ + public ServerInner withMasterServerId(String masterServerId) { + this.masterServerId = masterServerId; + return this; + } + + /** + * Get the replicaCapacity property: The maximum number of replicas that a master server can have. + * + * @return the replicaCapacity value. + */ + public Integer replicaCapacity() { + return this.replicaCapacity; + } + + /** + * Set the replicaCapacity property: The maximum number of replicas that a master server can have. + * + * @param replicaCapacity the replicaCapacity value to set. + * @return the ServerInner object itself. + */ + public ServerInner withReplicaCapacity(Integer replicaCapacity) { + this.replicaCapacity = replicaCapacity; + return this; + } + + /** + * Get the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccessEnum publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the ServerInner object itself. + */ + public ServerInner withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the privateEndpointConnections property: List of private endpoint connections on a server. + * + * @return the privateEndpointConnections value. + */ + public List privateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** {@inheritDoc} */ + @Override + public ServerInner withLocation(String location) { + super.withLocation(location); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerInner withTags(Map tags) { + super.withTags(tags); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (storageProfile() != null) { + storageProfile().validate(); + } + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/ServerSecurityAlertPolicyInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/ServerSecurityAlertPolicyInner.java new file mode 100644 index 000000000000..460392e8eeb6 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/ServerSecurityAlertPolicyInner.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.models.ServerSecurityAlertPolicyState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A server security alert policy. */ +@JsonFlatten +@Fluent +public class ServerSecurityAlertPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerSecurityAlertPolicyInner.class); + + /* + * Specifies the state of the policy, whether it is enabled or disabled. + */ + @JsonProperty(value = "properties.state") + private ServerSecurityAlertPolicyState state; + + /* + * Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly + */ + @JsonProperty(value = "properties.disabledAlerts") + private List disabledAlerts; + + /* + * Specifies an array of e-mail addresses to which the alert is sent. + */ + @JsonProperty(value = "properties.emailAddresses") + private List emailAddresses; + + /* + * Specifies that the alert is sent to the account administrators. + */ + @JsonProperty(value = "properties.emailAccountAdmins") + private Boolean emailAccountAdmins; + + /* + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold + * all Threat Detection audit logs. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the Threat Detection audit storage + * account. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the number of days to keep in the Threat Detection audit logs. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Get the state property: Specifies the state of the policy, whether it is enabled or disabled. + * + * @return the state value. + */ + public ServerSecurityAlertPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the policy, whether it is enabled or disabled. + * + * @param state the state value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withState(ServerSecurityAlertPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly. + * + * @return the disabledAlerts value. + */ + public List disabledAlerts() { + return this.disabledAlerts; + } + + /** + * Set the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + this.disabledAlerts = disabledAlerts; + return this; + } + + /** + * Get the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + public List emailAddresses() { + return this.emailAddresses; + } + + /** + * Set the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @param emailAddresses the emailAddresses value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withEmailAddresses(List emailAddresses) { + this.emailAddresses = emailAddresses; + return this; + } + + /** + * Get the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + public Boolean emailAccountAdmins() { + return this.emailAccountAdmins; + } + + /** + * Set the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @param emailAccountAdmins the emailAccountAdmins value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.emailAccountAdmins = emailAccountAdmins; + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @param retentionDays the retentionDays value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/VirtualNetworkRuleInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/VirtualNetworkRuleInner.java new file mode 100644 index 000000000000..0b14c0d3f222 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/VirtualNetworkRuleInner.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.models.VirtualNetworkRuleState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A virtual network rule. */ +@JsonFlatten +@Fluent +public class VirtualNetworkRuleInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkRuleInner.class); + + /* + * The ARM resource id of the virtual network subnet. + */ + @JsonProperty(value = "properties.virtualNetworkSubnetId") + private String virtualNetworkSubnetId; + + /* + * Create firewall rule before the virtual network has vnet service + * endpoint enabled. + */ + @JsonProperty(value = "properties.ignoreMissingVnetServiceEndpoint") + private Boolean ignoreMissingVnetServiceEndpoint; + + /* + * Virtual Network Rule State + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private VirtualNetworkRuleState state; + + /** + * Get the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @return the virtualNetworkSubnetId value. + */ + public String virtualNetworkSubnetId() { + return this.virtualNetworkSubnetId; + } + + /** + * Set the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @param virtualNetworkSubnetId the virtualNetworkSubnetId value to set. + * @return the VirtualNetworkRuleInner object itself. + */ + public VirtualNetworkRuleInner withVirtualNetworkSubnetId(String virtualNetworkSubnetId) { + this.virtualNetworkSubnetId = virtualNetworkSubnetId; + return this; + } + + /** + * Get the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @return the ignoreMissingVnetServiceEndpoint value. + */ + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.ignoreMissingVnetServiceEndpoint; + } + + /** + * Set the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @param ignoreMissingVnetServiceEndpoint the ignoreMissingVnetServiceEndpoint value to set. + * @return the VirtualNetworkRuleInner object itself. + */ + public VirtualNetworkRuleInner withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.ignoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; + return this; + } + + /** + * Get the state property: Virtual Network Rule State. + * + * @return the state value. + */ + public VirtualNetworkRuleState state() { + return this.state; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/WaitStatisticInner.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/WaitStatisticInner.java new file mode 100644 index 000000000000..976e3978502c --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/WaitStatisticInner.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.mariadb.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; +import java.time.OffsetDateTime; + +/** Represents a Wait Statistic. */ +@JsonFlatten +@Fluent +public class WaitStatisticInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WaitStatisticInner.class); + + /* + * Observation start time. + */ + @JsonProperty(value = "properties.startTime") + private OffsetDateTime startTime; + + /* + * Observation end time. + */ + @JsonProperty(value = "properties.endTime") + private OffsetDateTime endTime; + + /* + * Wait event name. + */ + @JsonProperty(value = "properties.eventName") + private String eventName; + + /* + * Wait event type name. + */ + @JsonProperty(value = "properties.eventTypeName") + private String eventTypeName; + + /* + * Database query identifier. + */ + @JsonProperty(value = "properties.queryId") + private Long queryId; + + /* + * Database Name. + */ + @JsonProperty(value = "properties.databaseName") + private String databaseName; + + /* + * Database user identifier. + */ + @JsonProperty(value = "properties.userId") + private Long userId; + + /* + * Wait event count observed in this time interval. + */ + @JsonProperty(value = "properties.count") + private Long count; + + /* + * Total time of wait in milliseconds in this time interval. + */ + @JsonProperty(value = "properties.totalTimeInMs") + private Double totalTimeInMs; + + /** + * Get the startTime property: Observation start time. + * + * @return the startTime value. + */ + public OffsetDateTime startTime() { + return this.startTime; + } + + /** + * Set the startTime property: Observation start time. + * + * @param startTime the startTime value to set. + * @return the WaitStatisticInner object itself. + */ + public WaitStatisticInner withStartTime(OffsetDateTime startTime) { + this.startTime = startTime; + return this; + } + + /** + * Get the endTime property: Observation end time. + * + * @return the endTime value. + */ + public OffsetDateTime endTime() { + return this.endTime; + } + + /** + * Set the endTime property: Observation end time. + * + * @param endTime the endTime value to set. + * @return the WaitStatisticInner object itself. + */ + public WaitStatisticInner withEndTime(OffsetDateTime endTime) { + this.endTime = endTime; + return this; + } + + /** + * Get the eventName property: Wait event name. + * + * @return the eventName value. + */ + public String eventName() { + return this.eventName; + } + + /** + * Set the eventName property: Wait event name. + * + * @param eventName the eventName value to set. + * @return the WaitStatisticInner object itself. + */ + public WaitStatisticInner withEventName(String eventName) { + this.eventName = eventName; + return this; + } + + /** + * Get the eventTypeName property: Wait event type name. + * + * @return the eventTypeName value. + */ + public String eventTypeName() { + return this.eventTypeName; + } + + /** + * Set the eventTypeName property: Wait event type name. + * + * @param eventTypeName the eventTypeName value to set. + * @return the WaitStatisticInner object itself. + */ + public WaitStatisticInner withEventTypeName(String eventTypeName) { + this.eventTypeName = eventTypeName; + return this; + } + + /** + * Get the queryId property: Database query identifier. + * + * @return the queryId value. + */ + public Long queryId() { + return this.queryId; + } + + /** + * Set the queryId property: Database query identifier. + * + * @param queryId the queryId value to set. + * @return the WaitStatisticInner object itself. + */ + public WaitStatisticInner withQueryId(Long queryId) { + this.queryId = queryId; + return this; + } + + /** + * Get the databaseName property: Database Name. + * + * @return the databaseName value. + */ + public String databaseName() { + return this.databaseName; + } + + /** + * Set the databaseName property: Database Name. + * + * @param databaseName the databaseName value to set. + * @return the WaitStatisticInner object itself. + */ + public WaitStatisticInner withDatabaseName(String databaseName) { + this.databaseName = databaseName; + return this; + } + + /** + * Get the userId property: Database user identifier. + * + * @return the userId value. + */ + public Long userId() { + return this.userId; + } + + /** + * Set the userId property: Database user identifier. + * + * @param userId the userId value to set. + * @return the WaitStatisticInner object itself. + */ + public WaitStatisticInner withUserId(Long userId) { + this.userId = userId; + return this; + } + + /** + * Get the count property: Wait event count observed in this time interval. + * + * @return the count value. + */ + public Long count() { + return this.count; + } + + /** + * Set the count property: Wait event count observed in this time interval. + * + * @param count the count value to set. + * @return the WaitStatisticInner object itself. + */ + public WaitStatisticInner withCount(Long count) { + this.count = count; + return this; + } + + /** + * Get the totalTimeInMs property: Total time of wait in milliseconds in this time interval. + * + * @return the totalTimeInMs value. + */ + public Double totalTimeInMs() { + return this.totalTimeInMs; + } + + /** + * Set the totalTimeInMs property: Total time of wait in milliseconds in this time interval. + * + * @param totalTimeInMs the totalTimeInMs value to set. + * @return the WaitStatisticInner object itself. + */ + public WaitStatisticInner withTotalTimeInMs(Double totalTimeInMs) { + this.totalTimeInMs = totalTimeInMs; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/package-info.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/package-info.java new file mode 100644 index 000000000000..99de6a281e02 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/models/package-info.java @@ -0,0 +1,10 @@ +// 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 MariaDBManagementClient. The Microsoft Azure management API provides + * create, read, update, and delete functionality for Azure MariaDB resources including servers, databases, firewall + * rules, VNET rules, log files and configurations with new business model. + */ +package com.azure.resourcemanager.mariadb.fluent.models; diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/package-info.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/package-info.java new file mode 100644 index 000000000000..b300df97280f --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/fluent/package-info.java @@ -0,0 +1,10 @@ +// 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 MariaDBManagementClient. The Microsoft Azure management API provides + * create, read, update, and delete functionality for Azure MariaDB resources including servers, databases, firewall + * rules, VNET rules, log files and configurations with new business model. + */ +package com.azure.resourcemanager.mariadb.fluent; diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/AdvisorImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/AdvisorImpl.java new file mode 100644 index 000000000000..78ac6f884821 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/AdvisorImpl.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.mariadb.implementation; + +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.AdvisorInner; +import com.azure.resourcemanager.mariadb.models.Advisor; + +public final class AdvisorImpl implements Advisor { + private AdvisorInner innerObject; + + private final MariaDBManager serviceManager; + + AdvisorImpl(AdvisorInner innerObject, MariaDBManager 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 Object properties() { + return this.innerModel().properties(); + } + + public AdvisorInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/AdvisorsClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/AdvisorsClientImpl.java new file mode 100644 index 000000000000..48445e961b59 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/AdvisorsClientImpl.java @@ -0,0 +1,516 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.fluent.AdvisorsClient; +import com.azure.resourcemanager.mariadb.fluent.models.AdvisorInner; +import com.azure.resourcemanager.mariadb.models.AdvisorsResultList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in AdvisorsClient. */ +public final class AdvisorsClientImpl implements AdvisorsClient { + private final ClientLogger logger = new ClientLogger(AdvisorsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final AdvisorsService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of AdvisorsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + AdvisorsClientImpl(MariaDBManagementClientImpl client) { + this.service = RestProxy.create(AdvisorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientAdvisors to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface AdvisorsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/advisors/{advisorName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("advisorName") String advisorName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/advisors") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a recommendation action advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recommendation action advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String advisorName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + advisorName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a recommendation action advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recommendation action advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String advisorName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + advisorName, + accept, + context); + } + + /** + * Get a recommendation action advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recommendation action advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String advisorName) { + return getWithResponseAsync(resourceGroupName, serverName, advisorName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a recommendation action advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recommendation action advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public AdvisorInner get(String resourceGroupName, String serverName, String advisorName) { + return getAsync(resourceGroupName, serverName, advisorName).block(); + } + + /** + * Get a recommendation action advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recommendation action advisor. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String advisorName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, advisorName, context).block(); + } + + /** + * List recommendation action advisors. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync(String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List recommendation action advisors. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * List recommendation action advisors. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * List recommendation action advisors. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * List recommendation action advisors. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * List recommendation action advisors. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, 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 query statistics. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 query statistics. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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 + .listByServerNext(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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/AdvisorsImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/AdvisorsImpl.java new file mode 100644 index 000000000000..edee401826c8 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/AdvisorsImpl.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.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.AdvisorsClient; +import com.azure.resourcemanager.mariadb.fluent.models.AdvisorInner; +import com.azure.resourcemanager.mariadb.models.Advisor; +import com.azure.resourcemanager.mariadb.models.Advisors; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class AdvisorsImpl implements Advisors { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdvisorsImpl.class); + + private final AdvisorsClient innerClient; + + private final MariaDBManager serviceManager; + + public AdvisorsImpl(AdvisorsClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Advisor get(String resourceGroupName, String serverName, String advisorName) { + AdvisorInner inner = this.serviceClient().get(resourceGroupName, serverName, advisorName); + if (inner != null) { + return new AdvisorImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String advisorName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, advisorName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new AdvisorImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return inner.mapPage(inner1 -> new AdvisorImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); + return inner.mapPage(inner1 -> new AdvisorImpl(inner1, this.manager())); + } + + private AdvisorsClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/CheckNameAvailabilitiesClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/CheckNameAvailabilitiesClientImpl.java new file mode 100644 index 000000000000..496275d0a6aa --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/CheckNameAvailabilitiesClientImpl.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.mariadb.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +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.mariadb.fluent.CheckNameAvailabilitiesClient; +import com.azure.resourcemanager.mariadb.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.mariadb.models.NameAvailabilityRequest; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in CheckNameAvailabilitiesClient. */ +public final class CheckNameAvailabilitiesClientImpl implements CheckNameAvailabilitiesClient { + private final ClientLogger logger = new ClientLogger(CheckNameAvailabilitiesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final CheckNameAvailabilitiesService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of CheckNameAvailabilitiesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + CheckNameAvailabilitiesClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy + .create(CheckNameAvailabilitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientCheckNameAvailabilities to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface CheckNameAvailabilitiesService { + @Headers({"Content-Type: application/json"}) + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.DBForMariaDB/checkNameAvailability") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> execute( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @BodyParam("application/json") NameAvailabilityRequest nameAvailabilityRequest, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> executeWithResponseAsync( + NameAvailabilityRequest nameAvailabilityRequest) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (nameAvailabilityRequest == null) { + return Mono + .error( + new IllegalArgumentException("Parameter nameAvailabilityRequest is required and cannot be null.")); + } else { + nameAvailabilityRequest.validate(); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .execute( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + nameAvailabilityRequest, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> executeWithResponseAsync( + NameAvailabilityRequest nameAvailabilityRequest, 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 (nameAvailabilityRequest == null) { + return Mono + .error( + new IllegalArgumentException("Parameter nameAvailabilityRequest is required and cannot be null.")); + } else { + nameAvailabilityRequest.validate(); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .execute( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + nameAvailabilityRequest, + accept, + context); + } + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono executeAsync(NameAvailabilityRequest nameAvailabilityRequest) { + return executeWithResponseAsync(nameAvailabilityRequest) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public NameAvailabilityInner execute(NameAvailabilityRequest nameAvailabilityRequest) { + return executeAsync(nameAvailabilityRequest).block(); + } + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response executeWithResponse( + NameAvailabilityRequest nameAvailabilityRequest, Context context) { + return executeWithResponseAsync(nameAvailabilityRequest, context).block(); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/CheckNameAvailabilitiesImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/CheckNameAvailabilitiesImpl.java new file mode 100644 index 000000000000..ca2a692cc9b3 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/CheckNameAvailabilitiesImpl.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.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.CheckNameAvailabilitiesClient; +import com.azure.resourcemanager.mariadb.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.mariadb.models.CheckNameAvailabilities; +import com.azure.resourcemanager.mariadb.models.NameAvailability; +import com.azure.resourcemanager.mariadb.models.NameAvailabilityRequest; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class CheckNameAvailabilitiesImpl implements CheckNameAvailabilities { + @JsonIgnore private final ClientLogger logger = new ClientLogger(CheckNameAvailabilitiesImpl.class); + + private final CheckNameAvailabilitiesClient innerClient; + + private final MariaDBManager serviceManager; + + public CheckNameAvailabilitiesImpl(CheckNameAvailabilitiesClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public NameAvailability execute(NameAvailabilityRequest nameAvailabilityRequest) { + NameAvailabilityInner inner = this.serviceClient().execute(nameAvailabilityRequest); + if (inner != null) { + return new NameAvailabilityImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response executeWithResponse( + NameAvailabilityRequest nameAvailabilityRequest, Context context) { + Response inner = + this.serviceClient().executeWithResponse(nameAvailabilityRequest, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new NameAvailabilityImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private CheckNameAvailabilitiesClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ConfigurationImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ConfigurationImpl.java new file mode 100644 index 000000000000..ff7dd0ad219e --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ConfigurationImpl.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.mariadb.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.mariadb.models.Configuration; + +public final class ConfigurationImpl implements Configuration, Configuration.Definition, Configuration.Update { + private ConfigurationInner innerObject; + + private final MariaDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String value() { + return this.innerModel().value(); + } + + public String description() { + return this.innerModel().description(); + } + + public String defaultValue() { + return this.innerModel().defaultValue(); + } + + public String dataType() { + return this.innerModel().dataType(); + } + + public String allowedValues() { + return this.innerModel().allowedValues(); + } + + public String source() { + return this.innerModel().source(); + } + + public ConfigurationInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String configurationName; + + public ConfigurationImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public Configuration create() { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurations() + .createOrUpdate(resourceGroupName, serverName, configurationName, this.innerModel(), Context.NONE); + return this; + } + + public Configuration create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurations() + .createOrUpdate(resourceGroupName, serverName, configurationName, this.innerModel(), context); + return this; + } + + ConfigurationImpl(String name, MariaDBManager serviceManager) { + this.innerObject = new ConfigurationInner(); + this.serviceManager = serviceManager; + this.configurationName = name; + } + + public ConfigurationImpl update() { + return this; + } + + public Configuration apply() { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurations() + .createOrUpdate(resourceGroupName, serverName, configurationName, this.innerModel(), Context.NONE); + return this; + } + + public Configuration apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurations() + .createOrUpdate(resourceGroupName, serverName, configurationName, this.innerModel(), context); + return this; + } + + ConfigurationImpl(ConfigurationInner innerObject, MariaDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.configurationName = Utils.getValueFromIdByName(innerObject.id(), "configurations"); + } + + public Configuration refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurations() + .getWithResponse(resourceGroupName, serverName, configurationName, Context.NONE) + .getValue(); + return this; + } + + public Configuration refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getConfigurations() + .getWithResponse(resourceGroupName, serverName, configurationName, context) + .getValue(); + return this; + } + + public ConfigurationImpl withValue(String value) { + this.innerModel().withValue(value); + return this; + } + + public ConfigurationImpl withSource(String source) { + this.innerModel().withSource(source); + return this; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ConfigurationListResultImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ConfigurationListResultImpl.java new file mode 100644 index 000000000000..de1a61c8f3f2 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ConfigurationListResultImpl.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.mariadb.implementation; + +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.mariadb.fluent.models.ConfigurationListResultInner; +import com.azure.resourcemanager.mariadb.models.Configuration; +import com.azure.resourcemanager.mariadb.models.ConfigurationListResult; +import java.util.Collections; +import java.util.List; +import java.util.stream.Collectors; + +public final class ConfigurationListResultImpl implements ConfigurationListResult { + private ConfigurationListResultInner innerObject; + + private final MariaDBManager serviceManager; + + ConfigurationListResultImpl(ConfigurationListResultInner innerObject, MariaDBManager 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 ConfigurationImpl(inner1, this.manager())) + .collect(Collectors.toList())); + } else { + return Collections.emptyList(); + } + } + + public ConfigurationListResultInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ConfigurationsClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ConfigurationsClientImpl.java new file mode 100644 index 000000000000..59c13b780716 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ConfigurationsClientImpl.java @@ -0,0 +1,757 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.implementation; + +import com.azure.core.annotation.BodyParam; +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.mariadb.fluent.ConfigurationsClient; +import com.azure.resourcemanager.mariadb.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.mariadb.fluent.models.ConfigurationListResultInner; +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 ConfigurationsClient. */ +public final class ConfigurationsClientImpl implements ConfigurationsClient { + private final ClientLogger logger = new ClientLogger(ConfigurationsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ConfigurationsService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of ConfigurationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ConfigurationsClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy.create(ConfigurationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientConfigurations to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface ConfigurationsService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/configurations/{configurationName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("configurationName") String configurationName, + @BodyParam("application/json") ConfigurationInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/configurations/{configurationName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("configurationName") String configurationName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/configurations") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName 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-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + configurationName, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName 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-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + configurationName, + parameters, + accept, + context); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ConfigurationInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, configurationName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ConfigurationInner.class, ConfigurationInner.class, Context.NONE); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ConfigurationInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, configurationName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ConfigurationInner.class, ConfigurationInner.class, context); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ConfigurationInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters).getSyncPoller(); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ConfigurationInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationInner createOrUpdate( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters).block(); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationInner createOrUpdate( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters, context).block(); + } + + /** + * Gets information about a configuration of server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a configuration of server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String configurationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + configurationName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets information about a configuration of server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a configuration of server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String configurationName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + configurationName, + accept, + context); + } + + /** + * Gets information about a configuration of server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a configuration of server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String configurationName) { + return getWithResponseAsync(resourceGroupName, serverName, configurationName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets information about a configuration of server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a configuration of server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationInner get(String resourceGroupName, String serverName, String configurationName) { + return getAsync(resourceGroupName, serverName, configurationName).block(); + } + + /** + * Gets information about a configuration of server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a configuration of server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String configurationName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, configurationName, context).block(); + } + + /** + * List all the configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all the configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all the configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * List all the configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * List all the configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * List all the configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ConfigurationsImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ConfigurationsImpl.java new file mode 100644 index 000000000000..43f07079c28e --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ConfigurationsImpl.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.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.ConfigurationsClient; +import com.azure.resourcemanager.mariadb.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.mariadb.models.Configuration; +import com.azure.resourcemanager.mariadb.models.Configurations; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ConfigurationsImpl implements Configurations { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigurationsImpl.class); + + private final ConfigurationsClient innerClient; + + private final MariaDBManager serviceManager; + + public ConfigurationsImpl(ConfigurationsClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public Configuration get(String resourceGroupName, String serverName, String configurationName) { + ConfigurationInner inner = this.serviceClient().get(resourceGroupName, serverName, configurationName); + if (inner != null) { + return new ConfigurationImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String configurationName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, configurationName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ConfigurationImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return inner.mapPage(inner1 -> new ConfigurationImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return inner.mapPage(inner1 -> new ConfigurationImpl(inner1, this.manager())); + } + + public Configuration 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String configurationName = Utils.getValueFromIdByName(id, "configurations"); + if (configurationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'configurations'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, configurationName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String configurationName = Utils.getValueFromIdByName(id, "configurations"); + if (configurationName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'configurations'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, configurationName, context); + } + + private ConfigurationsClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } + + public ConfigurationImpl define(String name) { + return new ConfigurationImpl(name, this.manager()); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/DatabaseImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/DatabaseImpl.java new file mode 100644 index 000000000000..b22001eefdb7 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/DatabaseImpl.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.DatabaseInner; +import com.azure.resourcemanager.mariadb.models.Database; + +public final class DatabaseImpl implements Database, Database.Definition, Database.Update { + private DatabaseInner innerObject; + + private final MariaDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String charset() { + return this.innerModel().charset(); + } + + public String collation() { + return this.innerModel().collation(); + } + + public DatabaseInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String databaseName; + + public DatabaseImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public Database create() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .createOrUpdate(resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE); + return this; + } + + public Database create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .createOrUpdate(resourceGroupName, serverName, databaseName, this.innerModel(), context); + return this; + } + + DatabaseImpl(String name, MariaDBManager serviceManager) { + this.innerObject = new DatabaseInner(); + this.serviceManager = serviceManager; + this.databaseName = name; + } + + public DatabaseImpl update() { + return this; + } + + public Database apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .createOrUpdate(resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE); + return this; + } + + public Database apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .createOrUpdate(resourceGroupName, serverName, databaseName, this.innerModel(), context); + return this; + } + + DatabaseImpl(DatabaseInner innerObject, MariaDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = Utils.getValueFromIdByName(innerObject.id(), "databases"); + } + + public Database refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE) + .getValue(); + return this; + } + + public Database refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .getWithResponse(resourceGroupName, serverName, databaseName, context) + .getValue(); + return this; + } + + public DatabaseImpl withCharset(String charset) { + this.innerModel().withCharset(charset); + return this; + } + + public DatabaseImpl withCollation(String collation) { + this.innerModel().withCollation(collation); + return this; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/DatabasesClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/DatabasesClientImpl.java new file mode 100644 index 000000000000..cf56d9a55b3f --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/DatabasesClientImpl.java @@ -0,0 +1,1000 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.fluent.DatabasesClient; +import com.azure.resourcemanager.mariadb.fluent.models.DatabaseInner; +import com.azure.resourcemanager.mariadb.models.DatabaseListResult; +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 DatabasesClient. */ +public final class DatabasesClientImpl implements DatabasesClient { + private final ClientLogger logger = new ClientLogger(DatabasesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final DatabasesService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of DatabasesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + DatabasesClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy.create(DatabasesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientDatabases to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface DatabasesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/databases/{databaseName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @BodyParam("application/json") DatabaseInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/databases/{databaseName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/databases/{databaseName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("databaseName") String databaseName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/databases") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The required parameters for creating or updating a database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName 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-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + parameters, + accept, + context); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DatabaseInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DatabaseInner.class, DatabaseInner.class, Context.NONE); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The required parameters for creating or updating a database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, DatabaseInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), DatabaseInner.class, DatabaseInner.class, context); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DatabaseInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The required parameters for creating or updating a database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, DatabaseInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The required parameters for creating or updating a database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The required parameters for creating or updating a database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).block(); + } + + /** + * Creates a new database or updates an existing database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param parameters The required parameters for creating or updating a database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + } + + /** + * Deletes a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context); + } + + /** + * Deletes a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 serverName, String databaseName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, databaseName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 serverName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, databaseName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 serverName, String databaseName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName).getSyncPoller(); + } + + /** + * Deletes a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 serverName, String databaseName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, context).getSyncPoller(); + } + + /** + * Deletes a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 serverName, String databaseName) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 serverName, String databaseName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, String databaseName) { + deleteAsync(resourceGroupName, serverName, databaseName).block(); + } + + /** + * Deletes a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, String databaseName, Context context) { + deleteAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * Gets information about a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets information about a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + databaseName, + accept, + context); + } + + /** + * Gets information about a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String databaseName) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets information about a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public DatabaseInner get(String resourceGroupName, String serverName, String databaseName) { + return getAsync(resourceGroupName, serverName, databaseName).block(); + } + + /** + * Gets information about a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a database. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, databaseName, context).block(); + } + + /** + * List all the databases in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all the databases in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of databases. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all the databases in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * List all the databases in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * List all the databases in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * List all the databases in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of databases. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/DatabasesImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/DatabasesImpl.java new file mode 100644 index 000000000000..4956780816a8 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/DatabasesImpl.java @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.DatabasesClient; +import com.azure.resourcemanager.mariadb.fluent.models.DatabaseInner; +import com.azure.resourcemanager.mariadb.models.Database; +import com.azure.resourcemanager.mariadb.models.Databases; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class DatabasesImpl implements Databases { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabasesImpl.class); + + private final DatabasesClient innerClient; + + private final MariaDBManager serviceManager; + + public DatabasesImpl(DatabasesClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String serverName, String databaseName) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName); + } + + public void delete(String resourceGroupName, String serverName, String databaseName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, databaseName, context); + } + + public Database get(String resourceGroupName, String serverName, String databaseName) { + DatabaseInner inner = this.serviceClient().get(resourceGroupName, serverName, databaseName); + if (inner != null) { + return new DatabaseImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, databaseName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new DatabaseImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return inner.mapPage(inner1 -> new DatabaseImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); + return inner.mapPage(inner1 -> new DatabaseImpl(inner1, this.manager())); + } + + public Database 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, databaseName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String databaseName = Utils.getValueFromIdByName(id, "databases"); + if (databaseName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'databases'.", id))); + } + this.delete(resourceGroupName, serverName, databaseName, context); + } + + private DatabasesClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } + + public DatabaseImpl define(String name) { + return new DatabaseImpl(name, this.manager()); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/FirewallRuleImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/FirewallRuleImpl.java new file mode 100644 index 000000000000..bc07dc3932ca --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/FirewallRuleImpl.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.mariadb.models.FirewallRule; + +public final class FirewallRuleImpl implements FirewallRule, FirewallRule.Definition, FirewallRule.Update { + private FirewallRuleInner innerObject; + + private final MariaDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String startIpAddress() { + return this.innerModel().startIpAddress(); + } + + public String endIpAddress() { + return this.innerModel().endIpAddress(); + } + + public FirewallRuleInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String firewallRuleName; + + public FirewallRuleImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public FirewallRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, serverName, firewallRuleName, this.innerModel(), Context.NONE); + return this; + } + + public FirewallRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, serverName, firewallRuleName, this.innerModel(), context); + return this; + } + + FirewallRuleImpl(String name, MariaDBManager serviceManager) { + this.innerObject = new FirewallRuleInner(); + this.serviceManager = serviceManager; + this.firewallRuleName = name; + } + + public FirewallRuleImpl update() { + return this; + } + + public FirewallRule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, serverName, firewallRuleName, this.innerModel(), Context.NONE); + return this; + } + + public FirewallRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .createOrUpdate(resourceGroupName, serverName, firewallRuleName, this.innerModel(), context); + return this; + } + + FirewallRuleImpl(FirewallRuleInner innerObject, MariaDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.firewallRuleName = Utils.getValueFromIdByName(innerObject.id(), "firewallRules"); + } + + public FirewallRule refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .getWithResponse(resourceGroupName, serverName, firewallRuleName, Context.NONE) + .getValue(); + return this; + } + + public FirewallRule refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getFirewallRules() + .getWithResponse(resourceGroupName, serverName, firewallRuleName, context) + .getValue(); + return this; + } + + public FirewallRuleImpl withStartIpAddress(String startIpAddress) { + this.innerModel().withStartIpAddress(startIpAddress); + return this; + } + + public FirewallRuleImpl withEndIpAddress(String endIpAddress) { + this.innerModel().withEndIpAddress(endIpAddress); + return this; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/FirewallRulesClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/FirewallRulesClientImpl.java new file mode 100644 index 000000000000..f734712e632c --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/FirewallRulesClientImpl.java @@ -0,0 +1,1029 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.fluent.FirewallRulesClient; +import com.azure.resourcemanager.mariadb.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.mariadb.models.FirewallRuleListResult; +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 FirewallRulesClient. */ +public final class FirewallRulesClientImpl implements FirewallRulesClient { + private final ClientLogger logger = new ClientLogger(FirewallRulesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final FirewallRulesService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of FirewallRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + FirewallRulesClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy.create(FirewallRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientFirewallRules to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface FirewallRulesService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + @BodyParam("application/json") FirewallRuleInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/firewallRules/{firewallRuleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("firewallRuleName") String firewallRuleName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/firewallRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall rule. + * @param parameters The required parameters for creating or updating a firewall 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 server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName 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-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + firewallRuleName, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall rule. + * @param parameters The required parameters for creating or updating a firewall 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 server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName 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-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + firewallRuleName, + parameters, + accept, + context); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall rule. + * @param parameters The required parameters for creating or updating a firewall 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 server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FirewallRuleInner.class, FirewallRuleInner.class, Context.NONE); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall rule. + * @param parameters The required parameters for creating or updating a firewall 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 server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), FirewallRuleInner.class, FirewallRuleInner.class, context); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall rule. + * @param parameters The required parameters for creating or updating a firewall 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 server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, FirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters).getSyncPoller(); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall rule. + * @param parameters The required parameters for creating or updating a firewall 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 server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, FirewallRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall rule. + * @param parameters The required parameters for creating or updating a firewall 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 server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall rule. + * @param parameters The required parameters for creating or updating a firewall 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 server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall rule. + * @param parameters The required parameters for creating or updating a firewall 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 server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner createOrUpdate( + String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters).block(); + } + + /** + * Creates a new firewall rule or updates an existing firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall rule. + * @param parameters The required parameters for creating or updating a firewall 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 server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String firewallRuleName, + FirewallRuleInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters, context).block(); + } + + /** + * Deletes a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 serverName, String firewallRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + firewallRuleName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 serverName, String firewallRuleName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + firewallRuleName, + accept, + context); + } + + /** + * Deletes a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String firewallRuleName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, firewallRuleName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, firewallRuleName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String firewallRuleName) { + return beginDeleteAsync(resourceGroupName, serverName, firewallRuleName).getSyncPoller(); + } + + /** + * Deletes a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, firewallRuleName, context).getSyncPoller(); + } + + /** + * Deletes a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 serverName, String firewallRuleName) { + return beginDeleteAsync(resourceGroupName, serverName, firewallRuleName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 deleteAsync( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, firewallRuleName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 serverName, String firewallRuleName) { + deleteAsync(resourceGroupName, serverName, firewallRuleName).block(); + } + + /** + * Deletes a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String firewallRuleName, Context context) { + deleteAsync(resourceGroupName, serverName, firewallRuleName, context).block(); + } + + /** + * Gets information about a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 information about a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + firewallRuleName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets information about a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 information about a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String firewallRuleName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (firewallRuleName == null) { + return Mono + .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + firewallRuleName, + accept, + context); + } + + /** + * Gets information about a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 information about a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String firewallRuleName) { + return getWithResponseAsync(resourceGroupName, serverName, firewallRuleName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets information about a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 information about a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName) { + return getAsync(resourceGroupName, serverName, firewallRuleName).block(); + } + + /** + * Gets information about a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 information about a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, firewallRuleName, context).block(); + } + + /** + * List all the firewall rules in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all the firewall rules in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all the firewall rules in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * List all the firewall rules in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * List all the firewall rules in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * List all the firewall rules in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/FirewallRulesImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/FirewallRulesImpl.java new file mode 100644 index 000000000000..33557dc80c82 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/FirewallRulesImpl.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.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.FirewallRulesClient; +import com.azure.resourcemanager.mariadb.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.mariadb.models.FirewallRule; +import com.azure.resourcemanager.mariadb.models.FirewallRules; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class FirewallRulesImpl implements FirewallRules { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FirewallRulesImpl.class); + + private final FirewallRulesClient innerClient; + + private final MariaDBManager serviceManager; + + public FirewallRulesImpl(FirewallRulesClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void delete(String resourceGroupName, String serverName, String firewallRuleName) { + this.serviceClient().delete(resourceGroupName, serverName, firewallRuleName); + } + + public void delete(String resourceGroupName, String serverName, String firewallRuleName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, firewallRuleName, context); + } + + public FirewallRule get(String resourceGroupName, String serverName, String firewallRuleName) { + FirewallRuleInner inner = this.serviceClient().get(resourceGroupName, serverName, firewallRuleName); + if (inner != null) { + return new FirewallRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, firewallRuleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new FirewallRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return inner.mapPage(inner1 -> new FirewallRuleImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return inner.mapPage(inner1 -> new FirewallRuleImpl(inner1, this.manager())); + } + + public FirewallRule 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, firewallRuleName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, firewallRuleName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + this.delete(resourceGroupName, serverName, firewallRuleName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); + if (firewallRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'firewallRules'.", id))); + } + this.delete(resourceGroupName, serverName, firewallRuleName, context); + } + + private FirewallRulesClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } + + public FirewallRuleImpl define(String name) { + return new FirewallRuleImpl(name, this.manager()); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedPerformanceTiersClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedPerformanceTiersClientImpl.java new file mode 100644 index 000000000000..7c40e5a054aa --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedPerformanceTiersClientImpl.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.fluent.LocationBasedPerformanceTiersClient; +import com.azure.resourcemanager.mariadb.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.mariadb.models.PerformanceTierListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LocationBasedPerformanceTiersClient. */ +public final class LocationBasedPerformanceTiersClientImpl implements LocationBasedPerformanceTiersClient { + private final ClientLogger logger = new ClientLogger(LocationBasedPerformanceTiersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LocationBasedPerformanceTiersService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of LocationBasedPerformanceTiersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LocationBasedPerformanceTiersClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy + .create( + LocationBasedPerformanceTiersService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientLocationBasedPerformanceTiers to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface LocationBasedPerformanceTiersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DBForMariaDB/locations/{locationName}" + + "/performanceTiers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationName") String locationName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String locationName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + locationName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String locationName, 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), locationName, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String locationName) { + return new PagedFlux<>(() -> listSinglePageAsync(locationName)); + } + + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String locationName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(locationName, context)); + } + + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String locationName) { + return new PagedIterable<>(listAsync(locationName)); + } + + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String locationName, Context context) { + return new PagedIterable<>(listAsync(locationName, context)); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedPerformanceTiersImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedPerformanceTiersImpl.java new file mode 100644 index 000000000000..6a12fed20e7b --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedPerformanceTiersImpl.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.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.LocationBasedPerformanceTiersClient; +import com.azure.resourcemanager.mariadb.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.mariadb.models.LocationBasedPerformanceTiers; +import com.azure.resourcemanager.mariadb.models.PerformanceTierProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LocationBasedPerformanceTiersImpl implements LocationBasedPerformanceTiers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LocationBasedPerformanceTiersImpl.class); + + private final LocationBasedPerformanceTiersClient innerClient; + + private final MariaDBManager serviceManager; + + public LocationBasedPerformanceTiersImpl( + LocationBasedPerformanceTiersClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String locationName) { + PagedIterable inner = this.serviceClient().list(locationName); + return inner.mapPage(inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable list(String locationName, Context context) { + PagedIterable inner = this.serviceClient().list(locationName, context); + return inner.mapPage(inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager())); + } + + private LocationBasedPerformanceTiersClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedRecommendedActionSessionsOperationStatusClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedRecommendedActionSessionsOperationStatusClientImpl.java new file mode 100644 index 000000000000..d06b829a7281 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedRecommendedActionSessionsOperationStatusClientImpl.java @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.fluent.LocationBasedRecommendedActionSessionsOperationStatusClient; +import com.azure.resourcemanager.mariadb.fluent.models.RecommendedActionSessionsOperationStatusInner; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * LocationBasedRecommendedActionSessionsOperationStatusClient. + */ +public final class LocationBasedRecommendedActionSessionsOperationStatusClientImpl + implements LocationBasedRecommendedActionSessionsOperationStatusClient { + private final ClientLogger logger = + new ClientLogger(LocationBasedRecommendedActionSessionsOperationStatusClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LocationBasedRecommendedActionSessionsOperationStatusService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of LocationBasedRecommendedActionSessionsOperationStatusClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LocationBasedRecommendedActionSessionsOperationStatusClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy + .create( + LocationBasedRecommendedActionSessionsOperationStatusService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for + * MariaDBManagementClientLocationBasedRecommendedActionSessionsOperationStatus to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface LocationBasedRecommendedActionSessionsOperationStatusService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMariaDB/locations/{locationName}" + + "/recommendedActionSessionsAzureAsyncOperation/{operationId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationName") String locationName, + @PathParam("operationId") String operationId, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Recommendation action session operation status. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return recommendation action session operation status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, String operationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + locationName, + operationId, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Recommendation action session operation status. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return recommendation action session operation status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String locationName, String operationId, 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + locationName, + operationId, + accept, + context); + } + + /** + * Recommendation action session operation status. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return recommendation action session operation status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String locationName, String operationId) { + return getWithResponseAsync(locationName, operationId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Recommendation action session operation status. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return recommendation action session operation status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecommendedActionSessionsOperationStatusInner get(String locationName, String operationId) { + return getAsync(locationName, operationId).block(); + } + + /** + * Recommendation action session operation status. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return recommendation action session operation status. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String locationName, String operationId, Context context) { + return getWithResponseAsync(locationName, operationId, context).block(); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedRecommendedActionSessionsOperationStatusImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedRecommendedActionSessionsOperationStatusImpl.java new file mode 100644 index 000000000000..97f50f5a35a6 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedRecommendedActionSessionsOperationStatusImpl.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.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.LocationBasedRecommendedActionSessionsOperationStatusClient; +import com.azure.resourcemanager.mariadb.fluent.models.RecommendedActionSessionsOperationStatusInner; +import com.azure.resourcemanager.mariadb.models.LocationBasedRecommendedActionSessionsOperationStatus; +import com.azure.resourcemanager.mariadb.models.RecommendedActionSessionsOperationStatus; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LocationBasedRecommendedActionSessionsOperationStatusImpl + implements LocationBasedRecommendedActionSessionsOperationStatus { + @JsonIgnore + private final ClientLogger logger = + new ClientLogger(LocationBasedRecommendedActionSessionsOperationStatusImpl.class); + + private final LocationBasedRecommendedActionSessionsOperationStatusClient innerClient; + + private final MariaDBManager serviceManager; + + public LocationBasedRecommendedActionSessionsOperationStatusImpl( + LocationBasedRecommendedActionSessionsOperationStatusClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public RecommendedActionSessionsOperationStatus get(String locationName, String operationId) { + RecommendedActionSessionsOperationStatusInner inner = this.serviceClient().get(locationName, operationId); + if (inner != null) { + return new RecommendedActionSessionsOperationStatusImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String locationName, String operationId, Context context) { + Response inner = + this.serviceClient().getWithResponse(locationName, operationId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RecommendedActionSessionsOperationStatusImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private LocationBasedRecommendedActionSessionsOperationStatusClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedRecommendedActionSessionsResultsClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedRecommendedActionSessionsResultsClientImpl.java new file mode 100644 index 000000000000..bd384721cae7 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedRecommendedActionSessionsResultsClientImpl.java @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.fluent.LocationBasedRecommendedActionSessionsResultsClient; +import com.azure.resourcemanager.mariadb.fluent.models.RecommendationActionInner; +import com.azure.resourcemanager.mariadb.models.RecommendationActionsResultList; +import reactor.core.publisher.Mono; + +/** + * An instance of this class provides access to all the operations defined in + * LocationBasedRecommendedActionSessionsResultsClient. + */ +public final class LocationBasedRecommendedActionSessionsResultsClientImpl + implements LocationBasedRecommendedActionSessionsResultsClient { + private final ClientLogger logger = new ClientLogger(LocationBasedRecommendedActionSessionsResultsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LocationBasedRecommendedActionSessionsResultsService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of LocationBasedRecommendedActionSessionsResultsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LocationBasedRecommendedActionSessionsResultsClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy + .create( + LocationBasedRecommendedActionSessionsResultsService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientLocationBasedRecommendedActionSessionsResults + * to be used by the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface LocationBasedRecommendedActionSessionsResultsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DBforMariaDB/locations/{locationName}" + + "/recommendedActionSessionsOperationResults/{operationId}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("locationName") String locationName, + @PathParam("operationId") String operationId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200, 201}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Recommendation action session operation result. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String locationName, String operationId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + locationName, + operationId, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Recommendation action session operation result. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String locationName, String operationId, 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 (locationName == null) { + return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); + } + if (operationId == null) { + return Mono.error(new IllegalArgumentException("Parameter operationId is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + locationName, + operationId, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Recommendation action session operation result. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String locationName, String operationId) { + return new PagedFlux<>( + () -> listSinglePageAsync(locationName, operationId), nextLink -> listNextSinglePageAsync(nextLink)); + } + + /** + * Recommendation action session operation result. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String locationName, String operationId, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(locationName, operationId, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * Recommendation action session operation result. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String locationName, String operationId) { + return new PagedIterable<>(listAsync(locationName, operationId)); + } + + /** + * Recommendation action session operation result. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String locationName, String operationId, Context context) { + return new PagedIterable<>(listAsync(locationName, operationId, 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 recommendation actions. + */ + @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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 recommendation actions. + */ + @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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedRecommendedActionSessionsResultsImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedRecommendedActionSessionsResultsImpl.java new file mode 100644 index 000000000000..575942a7affa --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LocationBasedRecommendedActionSessionsResultsImpl.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.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.LocationBasedRecommendedActionSessionsResultsClient; +import com.azure.resourcemanager.mariadb.fluent.models.RecommendationActionInner; +import com.azure.resourcemanager.mariadb.models.LocationBasedRecommendedActionSessionsResults; +import com.azure.resourcemanager.mariadb.models.RecommendationAction; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LocationBasedRecommendedActionSessionsResultsImpl + implements LocationBasedRecommendedActionSessionsResults { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(LocationBasedRecommendedActionSessionsResultsImpl.class); + + private final LocationBasedRecommendedActionSessionsResultsClient innerClient; + + private final MariaDBManager serviceManager; + + public LocationBasedRecommendedActionSessionsResultsImpl( + LocationBasedRecommendedActionSessionsResultsClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String locationName, String operationId) { + PagedIterable inner = this.serviceClient().list(locationName, operationId); + return inner.mapPage(inner1 -> new RecommendationActionImpl(inner1, this.manager())); + } + + public PagedIterable list(String locationName, String operationId, Context context) { + PagedIterable inner = this.serviceClient().list(locationName, operationId, context); + return inner.mapPage(inner1 -> new RecommendationActionImpl(inner1, this.manager())); + } + + private LocationBasedRecommendedActionSessionsResultsClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LogFileImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LogFileImpl.java new file mode 100644 index 000000000000..02b1385f3ab0 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LogFileImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.implementation; + +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.LogFileInner; +import com.azure.resourcemanager.mariadb.models.LogFile; +import java.time.OffsetDateTime; + +public final class LogFileImpl implements LogFile { + private LogFileInner innerObject; + + private final MariaDBManager serviceManager; + + LogFileImpl(LogFileInner innerObject, MariaDBManager 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 Long sizeInKB() { + return this.innerModel().sizeInKB(); + } + + public OffsetDateTime createdTime() { + return this.innerModel().createdTime(); + } + + public OffsetDateTime lastModifiedTime() { + return this.innerModel().lastModifiedTime(); + } + + public String typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public String url() { + return this.innerModel().url(); + } + + public LogFileInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LogFilesClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LogFilesClientImpl.java new file mode 100644 index 000000000000..737c33d43af0 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LogFilesClientImpl.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.mariadb.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.mariadb.fluent.LogFilesClient; +import com.azure.resourcemanager.mariadb.fluent.models.LogFileInner; +import com.azure.resourcemanager.mariadb.models.LogFileListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LogFilesClient. */ +public final class LogFilesClientImpl implements LogFilesClient { + private final ClientLogger logger = new ClientLogger(LogFilesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LogFilesService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of LogFilesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LogFilesClientImpl(MariaDBManagementClientImpl client) { + this.service = RestProxy.create(LogFilesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientLogFiles to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface LogFilesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/logFiles") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync(String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LogFilesImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LogFilesImpl.java new file mode 100644 index 000000000000..ef978efe8989 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/LogFilesImpl.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.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.LogFilesClient; +import com.azure.resourcemanager.mariadb.fluent.models.LogFileInner; +import com.azure.resourcemanager.mariadb.models.LogFile; +import com.azure.resourcemanager.mariadb.models.LogFiles; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LogFilesImpl implements LogFiles { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogFilesImpl.class); + + private final LogFilesClient innerClient; + + private final MariaDBManager serviceManager; + + public LogFilesImpl(LogFilesClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return inner.mapPage(inner1 -> new LogFileImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); + return inner.mapPage(inner1 -> new LogFileImpl(inner1, this.manager())); + } + + private LogFilesClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/MariaDBManagementClientBuilder.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/MariaDBManagementClientBuilder.java new file mode 100644 index 000000000000..90e605f3aaf2 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/MariaDBManagementClientBuilder.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.mariadb.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 MariaDBManagementClientImpl type. */ +@ServiceClientBuilder(serviceClients = {MariaDBManagementClientImpl.class}) +public final class MariaDBManagementClientBuilder { + /* + * The ID of the target subscription. + */ + private String subscriptionId; + + /** + * Sets The ID of the target subscription. + * + * @param subscriptionId the subscriptionId value. + * @return the MariaDBManagementClientBuilder. + */ + public MariaDBManagementClientBuilder subscriptionId(String subscriptionId) { + this.subscriptionId = subscriptionId; + return this; + } + + /* + * server parameter + */ + private String endpoint; + + /** + * Sets server parameter. + * + * @param endpoint the endpoint value. + * @return the MariaDBManagementClientBuilder. + */ + public MariaDBManagementClientBuilder 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 MariaDBManagementClientBuilder. + */ + public MariaDBManagementClientBuilder 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 MariaDBManagementClientBuilder. + */ + public MariaDBManagementClientBuilder 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 MariaDBManagementClientBuilder. + */ + public MariaDBManagementClientBuilder 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 MariaDBManagementClientBuilder. + */ + public MariaDBManagementClientBuilder serializerAdapter(SerializerAdapter serializerAdapter) { + this.serializerAdapter = serializerAdapter; + return this; + } + + /** + * Builds an instance of MariaDBManagementClientImpl with the provided parameters. + * + * @return an instance of MariaDBManagementClientImpl. + */ + public MariaDBManagementClientImpl 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(); + } + MariaDBManagementClientImpl client = + new MariaDBManagementClientImpl( + pipeline, serializerAdapter, defaultPollInterval, environment, subscriptionId, endpoint); + return client; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/MariaDBManagementClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/MariaDBManagementClientImpl.java new file mode 100644 index 000000000000..326a91f533dd --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/MariaDBManagementClientImpl.java @@ -0,0 +1,606 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.fluent.AdvisorsClient; +import com.azure.resourcemanager.mariadb.fluent.CheckNameAvailabilitiesClient; +import com.azure.resourcemanager.mariadb.fluent.ConfigurationsClient; +import com.azure.resourcemanager.mariadb.fluent.DatabasesClient; +import com.azure.resourcemanager.mariadb.fluent.FirewallRulesClient; +import com.azure.resourcemanager.mariadb.fluent.LocationBasedPerformanceTiersClient; +import com.azure.resourcemanager.mariadb.fluent.LocationBasedRecommendedActionSessionsOperationStatusClient; +import com.azure.resourcemanager.mariadb.fluent.LocationBasedRecommendedActionSessionsResultsClient; +import com.azure.resourcemanager.mariadb.fluent.LogFilesClient; +import com.azure.resourcemanager.mariadb.fluent.MariaDBManagementClient; +import com.azure.resourcemanager.mariadb.fluent.OperationsClient; +import com.azure.resourcemanager.mariadb.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.mariadb.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.mariadb.fluent.QueryTextsClient; +import com.azure.resourcemanager.mariadb.fluent.RecommendedActionsClient; +import com.azure.resourcemanager.mariadb.fluent.RecoverableServersClient; +import com.azure.resourcemanager.mariadb.fluent.ReplicasClient; +import com.azure.resourcemanager.mariadb.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.mariadb.fluent.ServerBasedPerformanceTiersClient; +import com.azure.resourcemanager.mariadb.fluent.ServerParametersClient; +import com.azure.resourcemanager.mariadb.fluent.ServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.mariadb.fluent.ServersClient; +import com.azure.resourcemanager.mariadb.fluent.TopQueryStatisticsClient; +import com.azure.resourcemanager.mariadb.fluent.VirtualNetworkRulesClient; +import com.azure.resourcemanager.mariadb.fluent.WaitStatisticsClient; +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 MariaDBManagementClientImpl type. */ +@ServiceClient(builder = MariaDBManagementClientBuilder.class) +public final class MariaDBManagementClientImpl implements MariaDBManagementClient { + private final ClientLogger logger = new ClientLogger(MariaDBManagementClientImpl.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 ServersClient object to access its operations. */ + private final ServersClient servers; + + /** + * Gets the ServersClient object to access its operations. + * + * @return the ServersClient object. + */ + public ServersClient getServers() { + return this.servers; + } + + /** The ReplicasClient object to access its operations. */ + private final ReplicasClient replicas; + + /** + * Gets the ReplicasClient object to access its operations. + * + * @return the ReplicasClient object. + */ + public ReplicasClient getReplicas() { + return this.replicas; + } + + /** The FirewallRulesClient object to access its operations. */ + private final FirewallRulesClient firewallRules; + + /** + * Gets the FirewallRulesClient object to access its operations. + * + * @return the FirewallRulesClient object. + */ + public FirewallRulesClient getFirewallRules() { + return this.firewallRules; + } + + /** The VirtualNetworkRulesClient object to access its operations. */ + private final VirtualNetworkRulesClient virtualNetworkRules; + + /** + * Gets the VirtualNetworkRulesClient object to access its operations. + * + * @return the VirtualNetworkRulesClient object. + */ + public VirtualNetworkRulesClient getVirtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** The DatabasesClient object to access its operations. */ + private final DatabasesClient databases; + + /** + * Gets the DatabasesClient object to access its operations. + * + * @return the DatabasesClient object. + */ + public DatabasesClient getDatabases() { + return this.databases; + } + + /** The ConfigurationsClient object to access its operations. */ + private final ConfigurationsClient configurations; + + /** + * Gets the ConfigurationsClient object to access its operations. + * + * @return the ConfigurationsClient object. + */ + public ConfigurationsClient getConfigurations() { + return this.configurations; + } + + /** The ServerParametersClient object to access its operations. */ + private final ServerParametersClient serverParameters; + + /** + * Gets the ServerParametersClient object to access its operations. + * + * @return the ServerParametersClient object. + */ + public ServerParametersClient getServerParameters() { + return this.serverParameters; + } + + /** The LogFilesClient object to access its operations. */ + private final LogFilesClient logFiles; + + /** + * Gets the LogFilesClient object to access its operations. + * + * @return the LogFilesClient object. + */ + public LogFilesClient getLogFiles() { + return this.logFiles; + } + + /** The RecoverableServersClient object to access its operations. */ + private final RecoverableServersClient recoverableServers; + + /** + * Gets the RecoverableServersClient object to access its operations. + * + * @return the RecoverableServersClient object. + */ + public RecoverableServersClient getRecoverableServers() { + return this.recoverableServers; + } + + /** The ServerBasedPerformanceTiersClient object to access its operations. */ + private final ServerBasedPerformanceTiersClient serverBasedPerformanceTiers; + + /** + * Gets the ServerBasedPerformanceTiersClient object to access its operations. + * + * @return the ServerBasedPerformanceTiersClient object. + */ + public ServerBasedPerformanceTiersClient getServerBasedPerformanceTiers() { + return this.serverBasedPerformanceTiers; + } + + /** The LocationBasedPerformanceTiersClient object to access its operations. */ + private final LocationBasedPerformanceTiersClient locationBasedPerformanceTiers; + + /** + * Gets the LocationBasedPerformanceTiersClient object to access its operations. + * + * @return the LocationBasedPerformanceTiersClient object. + */ + public LocationBasedPerformanceTiersClient getLocationBasedPerformanceTiers() { + return this.locationBasedPerformanceTiers; + } + + /** The CheckNameAvailabilitiesClient object to access its operations. */ + private final CheckNameAvailabilitiesClient checkNameAvailabilities; + + /** + * Gets the CheckNameAvailabilitiesClient object to access its operations. + * + * @return the CheckNameAvailabilitiesClient object. + */ + public CheckNameAvailabilitiesClient getCheckNameAvailabilities() { + return this.checkNameAvailabilities; + } + + /** 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 QueryTextsClient object to access its operations. */ + private final QueryTextsClient queryTexts; + + /** + * Gets the QueryTextsClient object to access its operations. + * + * @return the QueryTextsClient object. + */ + public QueryTextsClient getQueryTexts() { + return this.queryTexts; + } + + /** The TopQueryStatisticsClient object to access its operations. */ + private final TopQueryStatisticsClient topQueryStatistics; + + /** + * Gets the TopQueryStatisticsClient object to access its operations. + * + * @return the TopQueryStatisticsClient object. + */ + public TopQueryStatisticsClient getTopQueryStatistics() { + return this.topQueryStatistics; + } + + /** The WaitStatisticsClient object to access its operations. */ + private final WaitStatisticsClient waitStatistics; + + /** + * Gets the WaitStatisticsClient object to access its operations. + * + * @return the WaitStatisticsClient object. + */ + public WaitStatisticsClient getWaitStatistics() { + return this.waitStatistics; + } + + /** The ResourceProvidersClient object to access its operations. */ + private final ResourceProvidersClient resourceProviders; + + /** + * Gets the ResourceProvidersClient object to access its operations. + * + * @return the ResourceProvidersClient object. + */ + public ResourceProvidersClient getResourceProviders() { + return this.resourceProviders; + } + + /** The AdvisorsClient object to access its operations. */ + private final AdvisorsClient advisors; + + /** + * Gets the AdvisorsClient object to access its operations. + * + * @return the AdvisorsClient object. + */ + public AdvisorsClient getAdvisors() { + return this.advisors; + } + + /** The RecommendedActionsClient object to access its operations. */ + private final RecommendedActionsClient recommendedActions; + + /** + * Gets the RecommendedActionsClient object to access its operations. + * + * @return the RecommendedActionsClient object. + */ + public RecommendedActionsClient getRecommendedActions() { + return this.recommendedActions; + } + + /** The LocationBasedRecommendedActionSessionsOperationStatusClient object to access its operations. */ + private final LocationBasedRecommendedActionSessionsOperationStatusClient + locationBasedRecommendedActionSessionsOperationStatus; + + /** + * Gets the LocationBasedRecommendedActionSessionsOperationStatusClient object to access its operations. + * + * @return the LocationBasedRecommendedActionSessionsOperationStatusClient object. + */ + public LocationBasedRecommendedActionSessionsOperationStatusClient + getLocationBasedRecommendedActionSessionsOperationStatus() { + return this.locationBasedRecommendedActionSessionsOperationStatus; + } + + /** The LocationBasedRecommendedActionSessionsResultsClient object to access its operations. */ + private final LocationBasedRecommendedActionSessionsResultsClient locationBasedRecommendedActionSessionsResults; + + /** + * Gets the LocationBasedRecommendedActionSessionsResultsClient object to access its operations. + * + * @return the LocationBasedRecommendedActionSessionsResultsClient object. + */ + public LocationBasedRecommendedActionSessionsResultsClient getLocationBasedRecommendedActionSessionsResults() { + return this.locationBasedRecommendedActionSessionsResults; + } + + /** 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 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 ServerSecurityAlertPoliciesClient object to access its operations. */ + private final ServerSecurityAlertPoliciesClient serverSecurityAlertPolicies; + + /** + * Gets the ServerSecurityAlertPoliciesClient object to access its operations. + * + * @return the ServerSecurityAlertPoliciesClient object. + */ + public ServerSecurityAlertPoliciesClient getServerSecurityAlertPolicies() { + return this.serverSecurityAlertPolicies; + } + + /** + * Initializes an instance of MariaDBManagementClient 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. + */ + MariaDBManagementClientImpl( + 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.servers = new ServersClientImpl(this); + this.replicas = new ReplicasClientImpl(this); + this.firewallRules = new FirewallRulesClientImpl(this); + this.virtualNetworkRules = new VirtualNetworkRulesClientImpl(this); + this.databases = new DatabasesClientImpl(this); + this.configurations = new ConfigurationsClientImpl(this); + this.serverParameters = new ServerParametersClientImpl(this); + this.logFiles = new LogFilesClientImpl(this); + this.recoverableServers = new RecoverableServersClientImpl(this); + this.serverBasedPerformanceTiers = new ServerBasedPerformanceTiersClientImpl(this); + this.locationBasedPerformanceTiers = new LocationBasedPerformanceTiersClientImpl(this); + this.checkNameAvailabilities = new CheckNameAvailabilitiesClientImpl(this); + this.operations = new OperationsClientImpl(this); + this.queryTexts = new QueryTextsClientImpl(this); + this.topQueryStatistics = new TopQueryStatisticsClientImpl(this); + this.waitStatistics = new WaitStatisticsClientImpl(this); + this.resourceProviders = new ResourceProvidersClientImpl(this); + this.advisors = new AdvisorsClientImpl(this); + this.recommendedActions = new RecommendedActionsClientImpl(this); + this.locationBasedRecommendedActionSessionsOperationStatus = + new LocationBasedRecommendedActionSessionsOperationStatusClientImpl(this); + this.locationBasedRecommendedActionSessionsResults = + new LocationBasedRecommendedActionSessionsResultsClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); + this.serverSecurityAlertPolicies = new ServerSecurityAlertPoliciesClientImpl(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 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.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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/NameAvailabilityImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/NameAvailabilityImpl.java new file mode 100644 index 000000000000..e6645fc44251 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/NameAvailabilityImpl.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.mariadb.implementation; + +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.NameAvailabilityInner; +import com.azure.resourcemanager.mariadb.models.NameAvailability; + +public final class NameAvailabilityImpl implements NameAvailability { + private NameAvailabilityInner innerObject; + + private final MariaDBManager serviceManager; + + NameAvailabilityImpl(NameAvailabilityInner innerObject, MariaDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String message() { + return this.innerModel().message(); + } + + public Boolean nameAvailable() { + return this.innerModel().nameAvailable(); + } + + public String reason() { + return this.innerModel().reason(); + } + + public NameAvailabilityInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/OperationListResultImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/OperationListResultImpl.java new file mode 100644 index 000000000000..7703d4403c60 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/OperationListResultImpl.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.mariadb.implementation; + +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.OperationListResultInner; +import com.azure.resourcemanager.mariadb.models.Operation; +import com.azure.resourcemanager.mariadb.models.OperationListResult; +import java.util.Collections; +import java.util.List; + +public final class OperationListResultImpl implements OperationListResult { + private OperationListResultInner innerObject; + + private final MariaDBManager serviceManager; + + OperationListResultImpl(OperationListResultInner innerObject, MariaDBManager 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 OperationListResultInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/OperationsClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/OperationsClientImpl.java new file mode 100644 index 000000000000..c34944b58ddd --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/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.mariadb.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.mariadb.fluent.OperationsClient; +import com.azure.resourcemanager.mariadb.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 MariaDBManagementClientImpl client; + + /** + * Initializes an instance of OperationsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + OperationsClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy.create(OperationsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientOperations to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface OperationsService { + @Headers({"Content-Type: application/json"}) + @Get("/providers/Microsoft.DBForMariaDB/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 REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations. + */ + @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 = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Lists all of the available REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations. + */ + @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 = "2018-06-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 REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations. + */ + @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 REST API operations. + * + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public OperationListResultInner list() { + return listAsync().block(); + } + + /** + * Lists all of the available REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).block(); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/OperationsImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/OperationsImpl.java new file mode 100644 index 000000000000..2146fd3b1229 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/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.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.OperationsClient; +import com.azure.resourcemanager.mariadb.fluent.models.OperationListResultInner; +import com.azure.resourcemanager.mariadb.models.OperationListResult; +import com.azure.resourcemanager.mariadb.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 MariaDBManager serviceManager; + + public OperationsImpl(OperationsClient innerClient, MariaDBManager 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 MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PerformanceTierPropertiesImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PerformanceTierPropertiesImpl.java new file mode 100644 index 000000000000..7157a5820091 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PerformanceTierPropertiesImpl.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.mariadb.implementation; + +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.mariadb.models.PerformanceTierProperties; +import com.azure.resourcemanager.mariadb.models.PerformanceTierServiceLevelObjectives; +import java.util.Collections; +import java.util.List; + +public final class PerformanceTierPropertiesImpl implements PerformanceTierProperties { + private PerformanceTierPropertiesInner innerObject; + + private final MariaDBManager serviceManager; + + PerformanceTierPropertiesImpl(PerformanceTierPropertiesInner innerObject, MariaDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public Integer maxBackupRetentionDays() { + return this.innerModel().maxBackupRetentionDays(); + } + + public Integer minBackupRetentionDays() { + return this.innerModel().minBackupRetentionDays(); + } + + public Integer maxStorageMB() { + return this.innerModel().maxStorageMB(); + } + + public Integer minLargeStorageMB() { + return this.innerModel().minLargeStorageMB(); + } + + public Integer maxLargeStorageMB() { + return this.innerModel().maxLargeStorageMB(); + } + + public Integer minStorageMB() { + return this.innerModel().minStorageMB(); + } + + public List serviceLevelObjectives() { + List inner = this.innerModel().serviceLevelObjectives(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PerformanceTierPropertiesInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateEndpointConnectionImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 000000000000..cf39d3ceb790 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.mariadb.models.PrivateEndpointConnection; +import com.azure.resourcemanager.mariadb.models.PrivateEndpointProperty; +import com.azure.resourcemanager.mariadb.models.PrivateLinkServiceConnectionStateProperty; +import com.azure.resourcemanager.mariadb.models.TagsObject; +import java.util.Map; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { + private PrivateEndpointConnectionInner innerObject; + + private final MariaDBManager 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 MariaDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String privateEndpointConnectionName; + + private TagsObject updateParameters; + + public PrivateEndpointConnectionImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public PrivateEndpointConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, serverName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, serverName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl(String name, MariaDBManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnectionImpl update() { + this.updateParameters = new TagsObject(); + return this; + } + + public PrivateEndpointConnection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .updateTags( + resourceGroupName, serverName, privateEndpointConnectionName, updateParameters, Context.NONE); + return this; + } + + public PrivateEndpointConnection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .updateTags(resourceGroupName, serverName, privateEndpointConnectionName, updateParameters, context); + return this; + } + + PrivateEndpointConnectionImpl(PrivateEndpointConnectionInner innerObject, MariaDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.privateEndpointConnectionName = Utils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); + } + + public PrivateEndpointConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, serverName, 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; + } + + public PrivateEndpointConnectionImpl withTags(Map tags) { + this.updateParameters.withTags(tags); + return this; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 000000000000..2b5e6ee44a70 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1513 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.mariadb.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.mariadb.models.PrivateEndpointConnectionListResult; +import com.azure.resourcemanager.mariadb.models.TagsObject; +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 MariaDBManagementClientImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy + .create( + PrivateEndpointConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientPrivateEndpointConnections to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface PrivateEndpointConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PrivateEndpointConnectionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @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.DBforMariaDB" + + "/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateTags( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @BodyParam("application/json") TagsObject parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/privateEndpointConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 serverName, String privateEndpointConnectionName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required 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-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 serverName, 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required 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-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 serverName, String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 serverName, String privateEndpointConnectionName) { + return getAsync(resourceGroupName, serverName, privateEndpointConnectionName).block(); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 serverName, String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, context).block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @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 serverName, + 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and 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 = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @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 serverName, + 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and 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 = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @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 serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, 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. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @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 serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, privateEndpointConnectionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @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 serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @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 serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @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 serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @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 serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @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 serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters).block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @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 serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required 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-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required 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-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, 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. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName, context).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + deleteAsync(resourceGroupName, serverName, privateEndpointConnectionName).block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + deleteAsync(resourceGroupName, serverName, privateEndpointConnectionName, context).block(); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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>> updateTagsWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateTags( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateTagsWithResponseAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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 = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateTags( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + parameters, + accept, + context); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginUpdateTagsAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters) { + Mono>> mono = + updateTagsWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + Context.NONE); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> beginUpdateTagsAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateTagsWithResponseAsync( + resourceGroupName, serverName, privateEndpointConnectionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginUpdateTags( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters) { + return beginUpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) + .getSyncPoller(); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> beginUpdateTags( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context) { + return beginUpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 updateTagsAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters) { + return beginUpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateTagsAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context) { + return beginUpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 updateTags( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters) { + return updateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters).block(); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags 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 a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner updateTags( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context) { + return updateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .block(); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required 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-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required 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-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + 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 server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, 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> listByServerNextSinglePageAsync(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.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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> listByServerNextSinglePageAsync( + 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 + .listByServerNext(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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateEndpointConnectionsImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 000000000000..e8394c025cc8 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.mariadb.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.mariadb.models.PrivateEndpointConnection; +import com.azure.resourcemanager.mariadb.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 MariaDBManager serviceManager; + + public PrivateEndpointConnectionsImpl(PrivateEndpointConnectionsClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PrivateEndpointConnection get( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this.serviceClient().get(resourceGroupName, serverName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, 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 serverName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, serverName, privateEndpointConnectionName); + } + + public void delete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, privateEndpointConnectionName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return inner.mapPage(inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return inner.mapPage(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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", 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, serverName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", 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, serverName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", 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, serverName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", 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, serverName, privateEndpointConnectionName, context); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionImpl define(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateLinkResourceImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 000000000000..e9f9e6097956 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateLinkResourceImpl.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.mariadb.implementation; + +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.mariadb.models.PrivateLinkResource; +import com.azure.resourcemanager.mariadb.models.PrivateLinkResourceProperties; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final MariaDBManager serviceManager; + + PrivateLinkResourceImpl(PrivateLinkResourceInner innerObject, MariaDBManager 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 PrivateLinkResourceProperties properties() { + return this.innerModel().properties(); + } + + public PrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateLinkResourcesClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 000000000000..fee577a2b83a --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,522 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.mariadb.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.mariadb.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 MariaDBManagementClientImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy + .create(PrivateLinkResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientPrivateLinkResources to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface PrivateLinkResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/privateLinkResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @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.DBforMariaDB" + + "/servers/{serverName}/privateLinkResources/{groupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("groupName") String groupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the private link resources for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 for MariaDB server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required 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-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets the private link resources for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 for MariaDB server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required 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-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the private link resources for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 for MariaDB server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets the private link resources for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 for MariaDB server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the private link resources for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 for MariaDB server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets the private link resources for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 for MariaDB server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Gets a private link resource for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 a private link resource for MariaDB server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String groupName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required 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-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + groupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a private link resource for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 a private link resource for MariaDB server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, 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 (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required 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-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + groupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a private link resource for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 a private link resource for MariaDB server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String groupName) { + return getWithResponseAsync(resourceGroupName, serverName, groupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a private link resource for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 a private link resource for MariaDB server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateLinkResourceInner get(String resourceGroupName, String serverName, String groupName) { + return getAsync(resourceGroupName, serverName, groupName).block(); + } + + /** + * Gets a private link resource for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 a private link resource for MariaDB server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, 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> listByServerNextSinglePageAsync(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.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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> listByServerNextSinglePageAsync( + 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 + .listByServerNext(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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateLinkResourcesImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 000000000000..872335e63569 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/PrivateLinkResourcesImpl.java @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.mariadb.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.mariadb.models.PrivateLinkResource; +import com.azure.resourcemanager.mariadb.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 MariaDBManager serviceManager; + + public PrivateLinkResourcesImpl(PrivateLinkResourcesClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return inner.mapPage(inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return inner.mapPage(inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + } + + public PrivateLinkResource get(String resourceGroupName, String serverName, String groupName) { + PrivateLinkResourceInner inner = this.serviceClient().get(resourceGroupName, serverName, groupName); + if (inner != null) { + return new PrivateLinkResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, 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 MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryPerformanceInsightResetDataResultImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryPerformanceInsightResetDataResultImpl.java new file mode 100644 index 000000000000..35097b222c8f --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryPerformanceInsightResetDataResultImpl.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.mariadb.implementation; + +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.QueryPerformanceInsightResetDataResultInner; +import com.azure.resourcemanager.mariadb.models.QueryPerformanceInsightResetDataResult; +import com.azure.resourcemanager.mariadb.models.QueryPerformanceInsightResetDataResultState; + +public final class QueryPerformanceInsightResetDataResultImpl implements QueryPerformanceInsightResetDataResult { + private QueryPerformanceInsightResetDataResultInner innerObject; + + private final MariaDBManager serviceManager; + + QueryPerformanceInsightResetDataResultImpl( + QueryPerformanceInsightResetDataResultInner innerObject, MariaDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public QueryPerformanceInsightResetDataResultState status() { + return this.innerModel().status(); + } + + public String message() { + return this.innerModel().message(); + } + + public QueryPerformanceInsightResetDataResultInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryStatisticImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryStatisticImpl.java new file mode 100644 index 000000000000..e196dc5ce35b --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryStatisticImpl.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.mariadb.implementation; + +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.QueryStatisticInner; +import com.azure.resourcemanager.mariadb.models.QueryStatistic; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; + +public final class QueryStatisticImpl implements QueryStatistic { + private QueryStatisticInner innerObject; + + private final MariaDBManager serviceManager; + + QueryStatisticImpl(QueryStatisticInner innerObject, MariaDBManager 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 queryId() { + return this.innerModel().queryId(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public String aggregationFunction() { + return this.innerModel().aggregationFunction(); + } + + public List databaseNames() { + List inner = this.innerModel().databaseNames(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Long queryExecutionCount() { + return this.innerModel().queryExecutionCount(); + } + + public String metricName() { + return this.innerModel().metricName(); + } + + public String metricDisplayName() { + return this.innerModel().metricDisplayName(); + } + + public Double metricValue() { + return this.innerModel().metricValue(); + } + + public String metricValueUnit() { + return this.innerModel().metricValueUnit(); + } + + public QueryStatisticInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryTextImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryTextImpl.java new file mode 100644 index 000000000000..88d2eaab1e8b --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryTextImpl.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.mariadb.implementation; + +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.QueryTextInner; +import com.azure.resourcemanager.mariadb.models.QueryText; + +public final class QueryTextImpl implements QueryText { + private QueryTextInner innerObject; + + private final MariaDBManager serviceManager; + + QueryTextImpl(QueryTextInner innerObject, MariaDBManager 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 queryId() { + return this.innerModel().queryId(); + } + + public String queryText() { + return this.innerModel().queryText(); + } + + public QueryTextInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryTextsClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryTextsClientImpl.java new file mode 100644 index 000000000000..a4f43ae680a9 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryTextsClientImpl.java @@ -0,0 +1,544 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.core.util.serializer.CollectionFormat; +import com.azure.core.util.serializer.JacksonAdapter; +import com.azure.resourcemanager.mariadb.fluent.QueryTextsClient; +import com.azure.resourcemanager.mariadb.fluent.models.QueryTextInner; +import com.azure.resourcemanager.mariadb.models.QueryTextsResultList; +import java.util.List; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in QueryTextsClient. */ +public final class QueryTextsClientImpl implements QueryTextsClient { + private final ClientLogger logger = new ClientLogger(QueryTextsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final QueryTextsService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of QueryTextsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + QueryTextsClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy.create(QueryTextsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientQueryTexts to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface QueryTextsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/queryTexts/{queryId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("queryId") String queryId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/queryTexts") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @QueryParam("queryIds") String queryIds, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieve the Query-Store query texts for the queryId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryId The Query-Store query identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Query Text. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String queryId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (queryId == null) { + return Mono.error(new IllegalArgumentException("Parameter queryId is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + queryId, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Retrieve the Query-Store query texts for the queryId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryId The Query-Store query identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Query Text. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String queryId, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (queryId == null) { + return Mono.error(new IllegalArgumentException("Parameter queryId is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + queryId, + accept, + context); + } + + /** + * Retrieve the Query-Store query texts for the queryId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryId The Query-Store query identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Query Text. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String queryId) { + return getWithResponseAsync(resourceGroupName, serverName, queryId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieve the Query-Store query texts for the queryId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryId The Query-Store query identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Query Text. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public QueryTextInner get(String resourceGroupName, String serverName, String queryId) { + return getAsync(resourceGroupName, serverName, queryId).block(); + } + + /** + * Retrieve the Query-Store query texts for the queryId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryId The Query-Store query identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Query Text. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String queryId, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, queryId, context).block(); + } + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query texts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, List queryIds) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (queryIds == null) { + return Mono.error(new IllegalArgumentException("Parameter queryIds is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + String queryIdsConverted = + JacksonAdapter.createDefaultSerializerAdapter().serializeList(queryIds, CollectionFormat.CSV); + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + queryIdsConverted, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query texts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, List queryIds, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (queryIds == null) { + return Mono.error(new IllegalArgumentException("Parameter queryIds is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + String queryIdsConverted = + JacksonAdapter.createDefaultSerializerAdapter().serializeList(queryIds, CollectionFormat.CSV); + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + queryIdsConverted, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query texts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, List queryIds) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, queryIds), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query texts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, List queryIds, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, queryIds, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query texts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, List queryIds) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, queryIds)); + } + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query texts. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, List queryIds, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, queryIds, 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 query texts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 query texts. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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 + .listByServerNext(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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryTextsImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryTextsImpl.java new file mode 100644 index 000000000000..045072147a93 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/QueryTextsImpl.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.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.QueryTextsClient; +import com.azure.resourcemanager.mariadb.fluent.models.QueryTextInner; +import com.azure.resourcemanager.mariadb.models.QueryText; +import com.azure.resourcemanager.mariadb.models.QueryTexts; +import com.fasterxml.jackson.annotation.JsonIgnore; +import java.util.List; + +public final class QueryTextsImpl implements QueryTexts { + @JsonIgnore private final ClientLogger logger = new ClientLogger(QueryTextsImpl.class); + + private final QueryTextsClient innerClient; + + private final MariaDBManager serviceManager; + + public QueryTextsImpl(QueryTextsClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public QueryText get(String resourceGroupName, String serverName, String queryId) { + QueryTextInner inner = this.serviceClient().get(resourceGroupName, serverName, queryId); + if (inner != null) { + return new QueryTextImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String queryId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, queryId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new QueryTextImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, List queryIds) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, queryIds); + return inner.mapPage(inner1 -> new QueryTextImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, List queryIds, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, queryIds, context); + return inner.mapPage(inner1 -> new QueryTextImpl(inner1, this.manager())); + } + + private QueryTextsClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecommendationActionImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecommendationActionImpl.java new file mode 100644 index 000000000000..9b22f2f1b64f --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecommendationActionImpl.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.mariadb.implementation; + +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.RecommendationActionInner; +import com.azure.resourcemanager.mariadb.models.RecommendationAction; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.Map; + +public final class RecommendationActionImpl implements RecommendationAction { + private RecommendationActionInner innerObject; + + private final MariaDBManager serviceManager; + + RecommendationActionImpl(RecommendationActionInner innerObject, MariaDBManager 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 advisorName() { + return this.innerModel().advisorName(); + } + + public String sessionId() { + return this.innerModel().sessionId(); + } + + public Integer actionId() { + return this.innerModel().actionId(); + } + + public OffsetDateTime createdTime() { + return this.innerModel().createdTime(); + } + + public OffsetDateTime expirationTime() { + return this.innerModel().expirationTime(); + } + + public String reason() { + return this.innerModel().reason(); + } + + public String recommendationType() { + return this.innerModel().recommendationType(); + } + + public Map details() { + Map inner = this.innerModel().details(); + if (inner != null) { + return Collections.unmodifiableMap(inner); + } else { + return Collections.emptyMap(); + } + } + + public RecommendationActionInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecommendedActionSessionsOperationStatusImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecommendedActionSessionsOperationStatusImpl.java new file mode 100644 index 000000000000..3ede3f85db02 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecommendedActionSessionsOperationStatusImpl.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.mariadb.implementation; + +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.RecommendedActionSessionsOperationStatusInner; +import com.azure.resourcemanager.mariadb.models.RecommendedActionSessionsOperationStatus; +import java.time.OffsetDateTime; + +public final class RecommendedActionSessionsOperationStatusImpl implements RecommendedActionSessionsOperationStatus { + private RecommendedActionSessionsOperationStatusInner innerObject; + + private final MariaDBManager serviceManager; + + RecommendedActionSessionsOperationStatusImpl( + RecommendedActionSessionsOperationStatusInner innerObject, MariaDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String name() { + return this.innerModel().name(); + } + + public OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public String status() { + return this.innerModel().status(); + } + + public RecommendedActionSessionsOperationStatusInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecommendedActionsClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecommendedActionsClientImpl.java new file mode 100644 index 000000000000..8e51c2e0aa30 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecommendedActionsClientImpl.java @@ -0,0 +1,593 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.fluent.RecommendedActionsClient; +import com.azure.resourcemanager.mariadb.fluent.models.RecommendationActionInner; +import com.azure.resourcemanager.mariadb.models.RecommendationActionsResultList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RecommendedActionsClient. */ +public final class RecommendedActionsClientImpl implements RecommendedActionsClient { + private final ClientLogger logger = new ClientLogger(RecommendedActionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RecommendedActionsService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of RecommendedActionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RecommendedActionsClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy.create(RecommendedActionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientRecommendedActions to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface RecommendedActionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/advisors/{advisorName}/recommendedActions/{recommendedActionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("advisorName") String advisorName, + @PathParam("recommendedActionName") String recommendedActionName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/advisors/{advisorName}/recommendedActions") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("advisorName") String advisorName, + @QueryParam("sessionId") String sessionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param recommendedActionName The recommended action 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 represents a Recommendation Action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String advisorName, String recommendedActionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (recommendedActionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendedActionName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + advisorName, + recommendedActionName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param recommendedActionName The recommended action 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 represents a Recommendation Action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, + String serverName, + String advisorName, + String recommendedActionName, + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (recommendedActionName == null) { + return Mono + .error(new IllegalArgumentException("Parameter recommendedActionName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + advisorName, + recommendedActionName, + accept, + context); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param recommendedActionName The recommended action 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 represents a Recommendation Action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String advisorName, String recommendedActionName) { + return getWithResponseAsync(resourceGroupName, serverName, advisorName, recommendedActionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param recommendedActionName The recommended action 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 represents a Recommendation Action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecommendationActionInner get( + String resourceGroupName, String serverName, String advisorName, String recommendedActionName) { + return getAsync(resourceGroupName, serverName, advisorName, recommendedActionName).block(); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param recommendedActionName The recommended action 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 represents a Recommendation Action. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, + String serverName, + String advisorName, + String recommendedActionName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, advisorName, recommendedActionName, context).block(); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param sessionId The recommendation action session identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, String advisorName, String sessionId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + advisorName, + sessionId, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param sessionId The recommendation action session identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, String advisorName, String sessionId, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + advisorName, + sessionId, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param sessionId The recommendation action session identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, String advisorName, String sessionId) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, advisorName, sessionId), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, String advisorName) { + final String sessionId = null; + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, advisorName, sessionId), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param sessionId The recommendation action session identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, String advisorName, String sessionId, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, advisorName, sessionId, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, String advisorName) { + final String sessionId = null; + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, advisorName, sessionId)); + } + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param sessionId The recommendation action session identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, String advisorName, String sessionId, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, advisorName, sessionId, 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 recommendation actions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 recommendation actions. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + 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 + .listByServerNext(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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecommendedActionsImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecommendedActionsImpl.java new file mode 100644 index 000000000000..71d6d4ad40a5 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecommendedActionsImpl.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.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.RecommendedActionsClient; +import com.azure.resourcemanager.mariadb.fluent.models.RecommendationActionInner; +import com.azure.resourcemanager.mariadb.models.RecommendationAction; +import com.azure.resourcemanager.mariadb.models.RecommendedActions; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RecommendedActionsImpl implements RecommendedActions { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecommendedActionsImpl.class); + + private final RecommendedActionsClient innerClient; + + private final MariaDBManager serviceManager; + + public RecommendedActionsImpl(RecommendedActionsClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public RecommendationAction get( + String resourceGroupName, String serverName, String advisorName, String recommendedActionName) { + RecommendationActionInner inner = + this.serviceClient().get(resourceGroupName, serverName, advisorName, recommendedActionName); + if (inner != null) { + return new RecommendationActionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, + String serverName, + String advisorName, + String recommendedActionName, + Context context) { + Response inner = + this + .serviceClient() + .getWithResponse(resourceGroupName, serverName, advisorName, recommendedActionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RecommendationActionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, String advisorName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, advisorName); + return inner.mapPage(inner1 -> new RecommendationActionImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, String advisorName, String sessionId, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, advisorName, sessionId, context); + return inner.mapPage(inner1 -> new RecommendationActionImpl(inner1, this.manager())); + } + + private RecommendedActionsClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecoverableServerResourceImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecoverableServerResourceImpl.java new file mode 100644 index 000000000000..95344b37e5f2 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecoverableServerResourceImpl.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.mariadb.implementation; + +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.RecoverableServerResourceInner; +import com.azure.resourcemanager.mariadb.models.RecoverableServerResource; + +public final class RecoverableServerResourceImpl implements RecoverableServerResource { + private RecoverableServerResourceInner innerObject; + + private final MariaDBManager serviceManager; + + RecoverableServerResourceImpl(RecoverableServerResourceInner innerObject, MariaDBManager 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 lastAvailableBackupDateTime() { + return this.innerModel().lastAvailableBackupDateTime(); + } + + public String serviceLevelObjective() { + return this.innerModel().serviceLevelObjective(); + } + + public String edition() { + return this.innerModel().edition(); + } + + public Integer vCore() { + return this.innerModel().vCore(); + } + + public String hardwareGeneration() { + return this.innerModel().hardwareGeneration(); + } + + public String version() { + return this.innerModel().version(); + } + + public RecoverableServerResourceInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecoverableServersClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecoverableServersClientImpl.java new file mode 100644 index 000000000000..ceb845fec8e6 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecoverableServersClientImpl.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.fluent.RecoverableServersClient; +import com.azure.resourcemanager.mariadb.fluent.models.RecoverableServerResourceInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RecoverableServersClient. */ +public final class RecoverableServersClientImpl implements RecoverableServersClient { + private final ClientLogger logger = new ClientLogger(RecoverableServersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RecoverableServersService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of RecoverableServersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RecoverableServersClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy.create(RecoverableServersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientRecoverableServers to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface RecoverableServersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/recoverableServers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a recoverable MariaDB Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable MariaDB Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a recoverable MariaDB Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable MariaDB Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context); + } + + /** + * Gets a recoverable MariaDB Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable MariaDB Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName) { + return getWithResponseAsync(resourceGroupName, serverName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a recoverable MariaDB Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable MariaDB Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecoverableServerResourceInner get(String resourceGroupName, String serverName) { + return getAsync(resourceGroupName, serverName).block(); + } + + /** + * Gets a recoverable MariaDB Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable MariaDB Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, context).block(); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecoverableServersImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecoverableServersImpl.java new file mode 100644 index 000000000000..0ee4c589ee65 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/RecoverableServersImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.RecoverableServersClient; +import com.azure.resourcemanager.mariadb.fluent.models.RecoverableServerResourceInner; +import com.azure.resourcemanager.mariadb.models.RecoverableServerResource; +import com.azure.resourcemanager.mariadb.models.RecoverableServers; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class RecoverableServersImpl implements RecoverableServers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecoverableServersImpl.class); + + private final RecoverableServersClient innerClient; + + private final MariaDBManager serviceManager; + + public RecoverableServersImpl(RecoverableServersClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public RecoverableServerResource get(String resourceGroupName, String serverName) { + RecoverableServerResourceInner inner = this.serviceClient().get(resourceGroupName, serverName); + if (inner != null) { + return new RecoverableServerResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new RecoverableServerResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private RecoverableServersClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ReplicasClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ReplicasClientImpl.java new file mode 100644 index 000000000000..7b47a44d8946 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ReplicasClientImpl.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.mariadb.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.mariadb.fluent.ReplicasClient; +import com.azure.resourcemanager.mariadb.fluent.models.ServerInner; +import com.azure.resourcemanager.mariadb.models.ServerListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ReplicasClient. */ +public final class ReplicasClientImpl implements ReplicasClient { + private final ClientLogger logger = new ClientLogger(ReplicasClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ReplicasService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of ReplicasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReplicasClientImpl(MariaDBManagementClientImpl client) { + this.service = RestProxy.create(ReplicasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientReplicas to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface ReplicasService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/replicas") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync(String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ReplicasImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ReplicasImpl.java new file mode 100644 index 000000000000..6f4c4de4bae6 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ReplicasImpl.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.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.ReplicasClient; +import com.azure.resourcemanager.mariadb.fluent.models.ServerInner; +import com.azure.resourcemanager.mariadb.models.Replicas; +import com.azure.resourcemanager.mariadb.models.Server; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ReplicasImpl implements Replicas { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReplicasImpl.class); + + private final ReplicasClient innerClient; + + private final MariaDBManager serviceManager; + + public ReplicasImpl(ReplicasClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return inner.mapPage(inner1 -> new ServerImpl(inner1, this.manager())); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); + return inner.mapPage(inner1 -> new ServerImpl(inner1, this.manager())); + } + + private ReplicasClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ResourceProvidersClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ResourceProvidersClientImpl.java new file mode 100644 index 000000000000..d2cd206cb44f --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ResourceProvidersClientImpl.java @@ -0,0 +1,523 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.implementation; + +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mariadb.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.mariadb.fluent.models.QueryPerformanceInsightResetDataResultInner; +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 ResourceProvidersClient. */ +public final class ResourceProvidersClientImpl implements ResourceProvidersClient { + private final ClientLogger logger = new ClientLogger(ResourceProvidersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ResourceProvidersService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of ResourceProvidersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ResourceProvidersClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy.create(ResourceProvidersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientResourceProviders to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface ResourceProvidersService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/resetQueryPerformanceInsightData") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> resetQueryPerformanceInsightData( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/advisors/{advisorName}/createRecommendedActionSession") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createRecommendedActionSession( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("advisorName") String advisorName, + @QueryParam("databaseName") String databaseName, + Context context); + } + + /** + * Reset data for Query Performance Insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Query Performance Insight data reset. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + resetQueryPerformanceInsightDataWithResponseAsync(String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .resetQueryPerformanceInsightData( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Reset data for Query Performance Insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Query Performance Insight data reset. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> + resetQueryPerformanceInsightDataWithResponseAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .resetQueryPerformanceInsightData( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context); + } + + /** + * Reset data for Query Performance Insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Query Performance Insight data reset. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono resetQueryPerformanceInsightDataAsync( + String resourceGroupName, String serverName) { + return resetQueryPerformanceInsightDataWithResponseAsync(resourceGroupName, serverName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Reset data for Query Performance Insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Query Performance Insight data reset. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public QueryPerformanceInsightResetDataResultInner resetQueryPerformanceInsightData( + String resourceGroupName, String serverName) { + return resetQueryPerformanceInsightDataAsync(resourceGroupName, serverName).block(); + } + + /** + * Reset data for Query Performance Insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws 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 Query Performance Insight data reset. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response resetQueryPerformanceInsightDataWithResponse( + String resourceGroupName, String serverName, Context context) { + return resetQueryPerformanceInsightDataWithResponseAsync(resourceGroupName, serverName, context).block(); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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>> createRecommendedActionSessionWithResponseAsync( + String resourceGroupName, String serverName, String advisorName, String databaseName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + return FluxUtil + .withContext( + context -> + service + .createRecommendedActionSession( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + advisorName, + databaseName, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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>> createRecommendedActionSessionWithResponseAsync( + String resourceGroupName, String serverName, String advisorName, String databaseName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (advisorName == null) { + return Mono.error(new IllegalArgumentException("Parameter advisorName is required and cannot be null.")); + } + if (databaseName == null) { + return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + context = this.client.mergeContext(context); + return service + .createRecommendedActionSession( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + advisorName, + databaseName, + context); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginCreateRecommendedActionSessionAsync( + String resourceGroupName, String serverName, String advisorName, String databaseName) { + Mono>> mono = + createRecommendedActionSessionWithResponseAsync(resourceGroupName, serverName, advisorName, databaseName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginCreateRecommendedActionSessionAsync( + String resourceGroupName, String serverName, String advisorName, String databaseName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createRecommendedActionSessionWithResponseAsync( + resourceGroupName, serverName, advisorName, databaseName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginCreateRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName) { + return beginCreateRecommendedActionSessionAsync(resourceGroupName, serverName, advisorName, databaseName) + .getSyncPoller(); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginCreateRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName, Context context) { + return beginCreateRecommendedActionSessionAsync( + resourceGroupName, serverName, advisorName, databaseName, context) + .getSyncPoller(); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 createRecommendedActionSessionAsync( + String resourceGroupName, String serverName, String advisorName, String databaseName) { + return beginCreateRecommendedActionSessionAsync(resourceGroupName, serverName, advisorName, databaseName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 createRecommendedActionSessionAsync( + String resourceGroupName, String serverName, String advisorName, String databaseName, Context context) { + return beginCreateRecommendedActionSessionAsync( + resourceGroupName, serverName, advisorName, databaseName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 createRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName) { + createRecommendedActionSessionAsync(resourceGroupName, serverName, advisorName, databaseName).block(); + } + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 createRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName, Context context) { + createRecommendedActionSessionAsync(resourceGroupName, serverName, advisorName, databaseName, context).block(); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ResourceProvidersImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ResourceProvidersImpl.java new file mode 100644 index 000000000000..c14a84669bcf --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ResourceProvidersImpl.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.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.ResourceProvidersClient; +import com.azure.resourcemanager.mariadb.fluent.models.QueryPerformanceInsightResetDataResultInner; +import com.azure.resourcemanager.mariadb.models.QueryPerformanceInsightResetDataResult; +import com.azure.resourcemanager.mariadb.models.ResourceProviders; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ResourceProvidersImpl implements ResourceProviders { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceProvidersImpl.class); + + private final ResourceProvidersClient innerClient; + + private final MariaDBManager serviceManager; + + public ResourceProvidersImpl(ResourceProvidersClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public QueryPerformanceInsightResetDataResult resetQueryPerformanceInsightData( + String resourceGroupName, String serverName) { + QueryPerformanceInsightResetDataResultInner inner = + this.serviceClient().resetQueryPerformanceInsightData(resourceGroupName, serverName); + if (inner != null) { + return new QueryPerformanceInsightResetDataResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response resetQueryPerformanceInsightDataWithResponse( + String resourceGroupName, String serverName, Context context) { + Response inner = + this.serviceClient().resetQueryPerformanceInsightDataWithResponse(resourceGroupName, serverName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new QueryPerformanceInsightResetDataResultImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void createRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName) { + this.serviceClient().createRecommendedActionSession(resourceGroupName, serverName, advisorName, databaseName); + } + + public void createRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName, Context context) { + this + .serviceClient() + .createRecommendedActionSession(resourceGroupName, serverName, advisorName, databaseName, context); + } + + private ResourceProvidersClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerBasedPerformanceTiersClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerBasedPerformanceTiersClientImpl.java new file mode 100644 index 000000000000..63f7804ae13c --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerBasedPerformanceTiersClientImpl.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.fluent.ServerBasedPerformanceTiersClient; +import com.azure.resourcemanager.mariadb.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.mariadb.models.PerformanceTierListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerBasedPerformanceTiersClient. */ +public final class ServerBasedPerformanceTiersClientImpl implements ServerBasedPerformanceTiersClient { + private final ClientLogger logger = new ClientLogger(ServerBasedPerformanceTiersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerBasedPerformanceTiersService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of ServerBasedPerformanceTiersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerBasedPerformanceTiersClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerBasedPerformanceTiersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientServerBasedPerformanceTiers to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface ServerBasedPerformanceTiersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/performanceTiers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all the performance tiers for a MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all the performance tiers for a MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all the performance tiers for a MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * List all the performance tiers for a MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * List all the performance tiers for a MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serverName) { + return new PagedIterable<>(listAsync(resourceGroupName, serverName)); + } + + /** + * List all the performance tiers for a MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerBasedPerformanceTiersImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerBasedPerformanceTiersImpl.java new file mode 100644 index 000000000000..ec4252ef918e --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerBasedPerformanceTiersImpl.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.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.ServerBasedPerformanceTiersClient; +import com.azure.resourcemanager.mariadb.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.mariadb.models.PerformanceTierProperties; +import com.azure.resourcemanager.mariadb.models.ServerBasedPerformanceTiers; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerBasedPerformanceTiersImpl implements ServerBasedPerformanceTiers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerBasedPerformanceTiersImpl.class); + + private final ServerBasedPerformanceTiersClient innerClient; + + private final MariaDBManager serviceManager; + + public ServerBasedPerformanceTiersImpl( + ServerBasedPerformanceTiersClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, serverName); + return inner.mapPage(inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager())); + } + + public PagedIterable list(String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, serverName, context); + return inner.mapPage(inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager())); + } + + private ServerBasedPerformanceTiersClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerImpl.java new file mode 100644 index 000000000000..a6453a0c71a5 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerImpl.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.mariadb.implementation; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.ServerInner; +import com.azure.resourcemanager.mariadb.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.mariadb.models.Server; +import com.azure.resourcemanager.mariadb.models.ServerForCreate; +import com.azure.resourcemanager.mariadb.models.ServerPrivateEndpointConnection; +import com.azure.resourcemanager.mariadb.models.ServerPropertiesForCreate; +import com.azure.resourcemanager.mariadb.models.ServerState; +import com.azure.resourcemanager.mariadb.models.ServerUpdateParameters; +import com.azure.resourcemanager.mariadb.models.ServerVersion; +import com.azure.resourcemanager.mariadb.models.Sku; +import com.azure.resourcemanager.mariadb.models.SslEnforcementEnum; +import com.azure.resourcemanager.mariadb.models.StorageProfile; +import java.time.OffsetDateTime; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public final class ServerImpl implements Server, Server.Definition, Server.Update { + private ServerInner innerObject; + + private final MariaDBManager 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 Sku sku() { + return this.innerModel().sku(); + } + + public String administratorLogin() { + return this.innerModel().administratorLogin(); + } + + public ServerVersion version() { + return this.innerModel().version(); + } + + public SslEnforcementEnum sslEnforcement() { + return this.innerModel().sslEnforcement(); + } + + public ServerState userVisibleState() { + return this.innerModel().userVisibleState(); + } + + public String fullyQualifiedDomainName() { + return this.innerModel().fullyQualifiedDomainName(); + } + + public OffsetDateTime earliestRestoreDate() { + return this.innerModel().earliestRestoreDate(); + } + + public StorageProfile storageProfile() { + return this.innerModel().storageProfile(); + } + + public String replicationRole() { + return this.innerModel().replicationRole(); + } + + public String masterServerId() { + return this.innerModel().masterServerId(); + } + + public Integer replicaCapacity() { + return this.innerModel().replicaCapacity(); + } + + public PublicNetworkAccessEnum publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); + } + + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); + 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 ServerInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private ServerForCreate createParameters; + + private ServerUpdateParameters updateParameters; + + public ServerImpl withExistingResourceGroup(String resourceGroupName) { + this.resourceGroupName = resourceGroupName; + return this; + } + + public Server create() { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .create(resourceGroupName, serverName, createParameters, Context.NONE); + return this; + } + + public Server create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .create(resourceGroupName, serverName, createParameters, context); + return this; + } + + ServerImpl(String name, MariaDBManager serviceManager) { + this.innerObject = new ServerInner(); + this.serviceManager = serviceManager; + this.serverName = name; + this.createParameters = new ServerForCreate(); + } + + public ServerImpl update() { + this.updateParameters = new ServerUpdateParameters(); + return this; + } + + public Server apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .update(resourceGroupName, serverName, updateParameters, Context.NONE); + return this; + } + + public Server apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .update(resourceGroupName, serverName, updateParameters, context); + return this; + } + + ServerImpl(ServerInner innerObject, MariaDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + } + + public Server refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .getByResourceGroupWithResponse(resourceGroupName, serverName, Context.NONE) + .getValue(); + return this; + } + + public Server refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServers() + .getByResourceGroupWithResponse(resourceGroupName, serverName, context) + .getValue(); + return this; + } + + public ServerImpl withRegion(Region location) { + this.createParameters.withLocation(location.toString()); + return this; + } + + public ServerImpl withRegion(String location) { + this.createParameters.withLocation(location); + return this; + } + + public ServerImpl withProperties(ServerPropertiesForCreate properties) { + this.createParameters.withProperties(properties); + return this; + } + + public ServerImpl withTags(Map tags) { + if (isInCreateMode()) { + this.createParameters.withTags(tags); + return this; + } else { + this.updateParameters.withTags(tags); + return this; + } + } + + public ServerImpl withSku(Sku sku) { + if (isInCreateMode()) { + this.createParameters.withSku(sku); + return this; + } else { + this.updateParameters.withSku(sku); + return this; + } + } + + public ServerImpl withStorageProfile(StorageProfile storageProfile) { + this.updateParameters.withStorageProfile(storageProfile); + return this; + } + + public ServerImpl withAdministratorLoginPassword(String administratorLoginPassword) { + this.updateParameters.withAdministratorLoginPassword(administratorLoginPassword); + return this; + } + + public ServerImpl withVersion(ServerVersion version) { + this.updateParameters.withVersion(version); + return this; + } + + public ServerImpl withSslEnforcement(SslEnforcementEnum sslEnforcement) { + this.updateParameters.withSslEnforcement(sslEnforcement); + return this; + } + + public ServerImpl withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + this.updateParameters.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + public ServerImpl withReplicationRole(String replicationRole) { + this.updateParameters.withReplicationRole(replicationRole); + return this; + } + + private boolean isInCreateMode() { + return this.innerModel().id() == null; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerParametersClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerParametersClientImpl.java new file mode 100644 index 000000000000..3da7d69f2aba --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerParametersClientImpl.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +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.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mariadb.fluent.ServerParametersClient; +import com.azure.resourcemanager.mariadb.fluent.models.ConfigurationListResultInner; +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 ServerParametersClient. */ +public final class ServerParametersClientImpl implements ServerParametersClient { + private final ClientLogger logger = new ClientLogger(ServerParametersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerParametersService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of ServerParametersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerParametersClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy.create(ServerParametersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientServerParameters to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface ServerParametersService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/updateConfigurations") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> listUpdateConfigurations( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @BodyParam("application/json") ConfigurationListResultInner value, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listUpdateConfigurationsWithResponseAsync( + String resourceGroupName, String serverName, ConfigurationListResultInner value) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (value == null) { + return Mono.error(new IllegalArgumentException("Parameter value is required and cannot be null.")); + } else { + value.validate(); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listUpdateConfigurations( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + value, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listUpdateConfigurationsWithResponseAsync( + String resourceGroupName, String serverName, ConfigurationListResultInner value, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (value == null) { + return Mono.error(new IllegalArgumentException("Parameter value is required and cannot be null.")); + } else { + value.validate(); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listUpdateConfigurations( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + value, + accept, + context); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ConfigurationListResultInner> + beginListUpdateConfigurationsAsync( + String resourceGroupName, String serverName, ConfigurationListResultInner value) { + Mono>> mono = + listUpdateConfigurationsWithResponseAsync(resourceGroupName, serverName, value); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ConfigurationListResultInner.class, + ConfigurationListResultInner.class, + Context.NONE); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ConfigurationListResultInner> + beginListUpdateConfigurationsAsync( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + listUpdateConfigurationsWithResponseAsync(resourceGroupName, serverName, value, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ConfigurationListResultInner.class, + ConfigurationListResultInner.class, + context); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ConfigurationListResultInner> + beginListUpdateConfigurations(String resourceGroupName, String serverName, ConfigurationListResultInner value) { + return beginListUpdateConfigurationsAsync(resourceGroupName, serverName, value).getSyncPoller(); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ConfigurationListResultInner> + beginListUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context) { + return beginListUpdateConfigurationsAsync(resourceGroupName, serverName, value, context).getSyncPoller(); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listUpdateConfigurationsAsync( + String resourceGroupName, String serverName, ConfigurationListResultInner value) { + return beginListUpdateConfigurationsAsync(resourceGroupName, serverName, value) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listUpdateConfigurationsAsync( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context) { + return beginListUpdateConfigurationsAsync(resourceGroupName, serverName, value, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationListResultInner listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value) { + return listUpdateConfigurationsAsync(resourceGroupName, serverName, value).block(); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationListResultInner listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context) { + return listUpdateConfigurationsAsync(resourceGroupName, serverName, value, context).block(); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerParametersImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerParametersImpl.java new file mode 100644 index 000000000000..0366a565793c --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerParametersImpl.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.mariadb.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.ServerParametersClient; +import com.azure.resourcemanager.mariadb.fluent.models.ConfigurationListResultInner; +import com.azure.resourcemanager.mariadb.models.ConfigurationListResult; +import com.azure.resourcemanager.mariadb.models.ServerParameters; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerParametersImpl implements ServerParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerParametersImpl.class); + + private final ServerParametersClient innerClient; + + private final MariaDBManager serviceManager; + + public ServerParametersImpl(ServerParametersClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ConfigurationListResult listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value) { + ConfigurationListResultInner inner = + this.serviceClient().listUpdateConfigurations(resourceGroupName, serverName, value); + if (inner != null) { + return new ConfigurationListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public ConfigurationListResult listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context) { + ConfigurationListResultInner inner = + this.serviceClient().listUpdateConfigurations(resourceGroupName, serverName, value, context); + if (inner != null) { + return new ConfigurationListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private ServerParametersClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerSecurityAlertPoliciesClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerSecurityAlertPoliciesClientImpl.java new file mode 100644 index 000000000000..85dc86e2c03f --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerSecurityAlertPoliciesClientImpl.java @@ -0,0 +1,605 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mariadb.fluent.ServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.mariadb.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.mariadb.models.SecurityAlertPolicyName; +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 ServerSecurityAlertPoliciesClient. */ +public final class ServerSecurityAlertPoliciesClientImpl implements ServerSecurityAlertPoliciesClient { + private final ClientLogger logger = new ClientLogger(ServerSecurityAlertPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerSecurityAlertPoliciesService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of ServerSecurityAlertPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerSecurityAlertPoliciesClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerSecurityAlertPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientServerSecurityAlertPolicies to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface ServerSecurityAlertPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerSecurityAlertPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required 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-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert 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 a server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required 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-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName) { + return getWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerSecurityAlertPolicyInner get( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName) { + return getAsync(resourceGroupName, serverName, securityAlertPolicyName).block(); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert 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 a server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName, context).block(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and 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 = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert 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 a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and 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 = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerSecurityAlertPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerSecurityAlertPolicyInner.class, + ServerSecurityAlertPolicyInner.class, + Context.NONE); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert 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 a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerSecurityAlertPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, securityAlertPolicyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerSecurityAlertPolicyInner.class, + ServerSecurityAlertPolicyInner.class, + context); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert 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 a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert 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 a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters).block(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert 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 a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters, context).block(); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerSecurityAlertPoliciesImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerSecurityAlertPoliciesImpl.java new file mode 100644 index 000000000000..e617d73a4117 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerSecurityAlertPoliciesImpl.java @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.ServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.mariadb.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.mariadb.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.mariadb.models.ServerSecurityAlertPolicies; +import com.azure.resourcemanager.mariadb.models.ServerSecurityAlertPolicy; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerSecurityAlertPoliciesImpl implements ServerSecurityAlertPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerSecurityAlertPoliciesImpl.class); + + private final ServerSecurityAlertPoliciesClient innerClient; + + private final MariaDBManager serviceManager; + + public ServerSecurityAlertPoliciesImpl( + ServerSecurityAlertPoliciesClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServerSecurityAlertPolicy get( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName) { + ServerSecurityAlertPolicyInner inner = + this.serviceClient().get(resourceGroupName, serverName, securityAlertPolicyName); + if (inner != null) { + return new ServerSecurityAlertPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerSecurityAlertPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerSecurityAlertPolicy 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(Utils.getValueFromIdByName(id, "securityAlertPolicies")); + if (securityAlertPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(Utils.getValueFromIdByName(id, "securityAlertPolicies")); + if (securityAlertPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, context); + } + + private ServerSecurityAlertPoliciesClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } + + public ServerSecurityAlertPolicyImpl define(SecurityAlertPolicyName name) { + return new ServerSecurityAlertPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerSecurityAlertPolicyImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerSecurityAlertPolicyImpl.java new file mode 100644 index 000000000000..46d73363581a --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServerSecurityAlertPolicyImpl.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.mariadb.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.mariadb.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.mariadb.models.ServerSecurityAlertPolicy; +import com.azure.resourcemanager.mariadb.models.ServerSecurityAlertPolicyState; +import java.util.Collections; +import java.util.List; + +public final class ServerSecurityAlertPolicyImpl + implements ServerSecurityAlertPolicy, ServerSecurityAlertPolicy.Definition, ServerSecurityAlertPolicy.Update { + private ServerSecurityAlertPolicyInner innerObject; + + private final MariaDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ServerSecurityAlertPolicyState state() { + return this.innerModel().state(); + } + + public List disabledAlerts() { + List inner = this.innerModel().disabledAlerts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List emailAddresses() { + List inner = this.innerModel().emailAddresses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean emailAccountAdmins() { + return this.innerModel().emailAccountAdmins(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public ServerSecurityAlertPolicyInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private SecurityAlertPolicyName securityAlertPolicyName; + + public ServerSecurityAlertPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerSecurityAlertPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate( + resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public ServerSecurityAlertPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate(resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), context); + return this; + } + + ServerSecurityAlertPolicyImpl(SecurityAlertPolicyName name, MariaDBManager serviceManager) { + this.innerObject = new ServerSecurityAlertPolicyInner(); + this.serviceManager = serviceManager; + this.securityAlertPolicyName = name; + } + + public ServerSecurityAlertPolicyImpl update() { + return this; + } + + public ServerSecurityAlertPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate( + resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public ServerSecurityAlertPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate(resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), context); + return this; + } + + ServerSecurityAlertPolicyImpl(ServerSecurityAlertPolicyInner innerObject, MariaDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.securityAlertPolicyName = + SecurityAlertPolicyName.fromString(Utils.getValueFromIdByName(innerObject.id(), "securityAlertPolicies")); + } + + public ServerSecurityAlertPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, Context.NONE) + .getValue(); + return this; + } + + public ServerSecurityAlertPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, context) + .getValue(); + return this; + } + + public ServerSecurityAlertPolicyImpl withState(ServerSecurityAlertPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public ServerSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.innerModel().withDisabledAlerts(disabledAlerts); + return this; + } + + public ServerSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.innerModel().withEmailAddresses(emailAddresses); + return this; + } + + public ServerSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.innerModel().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + public ServerSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public ServerSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ServerSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServersClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServersClientImpl.java new file mode 100644 index 000000000000..6887b6206863 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServersClientImpl.java @@ -0,0 +1,2073 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.mariadb.fluent.ServersClient; +import com.azure.resourcemanager.mariadb.fluent.models.ServerInner; +import com.azure.resourcemanager.mariadb.models.ServerForCreate; +import com.azure.resourcemanager.mariadb.models.ServerListResult; +import com.azure.resourcemanager.mariadb.models.ServerUpdateParameters; +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 ServersClient. */ +public final class ServersClientImpl implements ServersClient { + private final ClientLogger logger = new ClientLogger(ServersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServersService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of ServersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServersClientImpl(MariaDBManagementClientImpl client) { + this.service = RestProxy.create(ServersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientServers to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface ServersService { + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> create( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @BodyParam("application/json") ServerForCreate parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> update( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @BodyParam("application/json") ServerUpdateParameters parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> getByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByResourceGroup( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DBForMariaDB/servers") + @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"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/restart") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> restart( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/start") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> start( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/stop") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> stop( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String serverName, ServerForCreate 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .create( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createWithResponseAsync( + String resourceGroupName, String serverName, ServerForCreate 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .create( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context); + } + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerInner> beginCreateAsync( + String resourceGroupName, String serverName, ServerForCreate parameters) { + Mono>> mono = createWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, Context.NONE); + } + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerInner> beginCreateAsync( + String resourceGroupName, String serverName, ServerForCreate parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createWithResponseAsync(resourceGroupName, serverName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, context); + } + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerInner> beginCreate( + String resourceGroupName, String serverName, ServerForCreate parameters) { + return beginCreateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + } + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerInner> beginCreate( + String resourceGroupName, String serverName, ServerForCreate parameters, Context context) { + return beginCreateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + } + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync(String resourceGroupName, String serverName, ServerForCreate parameters) { + return beginCreateAsync(resourceGroupName, serverName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createAsync( + String resourceGroupName, String serverName, ServerForCreate parameters, Context context) { + return beginCreateAsync(resourceGroupName, serverName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner create(String resourceGroupName, String serverName, ServerForCreate parameters) { + return createAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * Creates a new server or updates an existing server. The update action will overwrite the existing server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for creating or updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner create( + String resourceGroupName, String serverName, ServerForCreate parameters, Context context) { + return createAsync(resourceGroupName, serverName, parameters, context).block(); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, ServerUpdateParameters 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .update( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateWithResponseAsync( + String resourceGroupName, String serverName, ServerUpdateParameters 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .update( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerInner> beginUpdateAsync( + String resourceGroupName, String serverName, ServerUpdateParameters parameters) { + Mono>> mono = updateWithResponseAsync(resourceGroupName, serverName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, Context.NONE); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerInner> beginUpdateAsync( + String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateWithResponseAsync(resourceGroupName, serverName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerInner.class, ServerInner.class, context); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerInner> beginUpdate( + String resourceGroupName, String serverName, ServerUpdateParameters parameters) { + return beginUpdateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerInner> beginUpdate( + String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context) { + return beginUpdateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, ServerUpdateParameters parameters) { + return beginUpdateAsync(resourceGroupName, serverName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateAsync( + String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context) { + return beginUpdateAsync(resourceGroupName, serverName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner update(String resourceGroupName, String serverName, ServerUpdateParameters parameters) { + return updateAsync(resourceGroupName, serverName, parameters).block(); + } + + /** + * Updates an existing server. The request body can contain one to many of the properties present in the normal + * server definition. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for updating a server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner update( + String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context) { + return updateAsync(resourceGroupName, serverName, parameters, context).block(); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 serverName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 serverName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 serverName) { + return beginDeleteAsync(resourceGroupName, serverName).getSyncPoller(); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 serverName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, context).getSyncPoller(); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 serverName) { + return beginDeleteAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 serverName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName) { + deleteAsync(resourceGroupName, serverName).block(); + } + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 serverName, Context context) { + deleteAsync(resourceGroupName, serverName, context).block(); + } + + /** + * Gets information about a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .getByResourceGroup( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets information about a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getByResourceGroupWithResponseAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .getByResourceGroup( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context); + } + + /** + * Gets information about a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getByResourceGroupAsync(String resourceGroupName, String serverName) { + return getByResourceGroupWithResponseAsync(resourceGroupName, serverName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets information about a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerInner getByResourceGroup(String resourceGroupName, String serverName) { + return getByResourceGroupAsync(resourceGroupName, serverName).block(); + } + + /** + * Gets information about a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getByResourceGroupWithResponse( + String resourceGroupName, String serverName, Context context) { + return getByResourceGroupWithResponseAsync(resourceGroupName, serverName, context).block(); + } + + /** + * List all the servers in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @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-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByResourceGroup( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all the servers in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @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-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByResourceGroup( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all the servers in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName)); + } + + /** + * List all the servers in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context)); + } + + /** + * List all the servers in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName)); + } + + /** + * List all the servers in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + return new PagedIterable<>(listByResourceGroupAsync(resourceGroupName, context)); + } + + /** + * List all the servers in a given 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 servers. + */ + @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-06-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)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * List all the servers in a given 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 servers. + */ + @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-06-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 all the servers in a given 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 servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync() { + return new PagedFlux<>(() -> listSinglePageAsync()); + } + + /** + * List all the servers in a given 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 servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(context)); + } + + /** + * List all the servers in a given 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 servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list() { + return new PagedIterable<>(listAsync()); + } + + /** + * List all the servers in a given 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 servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(Context context) { + return new PagedIterable<>(listAsync(context)); + } + + /** + * Restarts a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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>> restartWithResponseAsync(String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .restart( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Restarts a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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>> restartWithResponseAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .restart( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context); + } + + /** + * Restarts a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginRestartAsync(String resourceGroupName, String serverName) { + Mono>> mono = restartWithResponseAsync(resourceGroupName, serverName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Restarts a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginRestartAsync( + String resourceGroupName, String serverName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = restartWithResponseAsync(resourceGroupName, serverName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Restarts a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginRestart(String resourceGroupName, String serverName) { + return beginRestartAsync(resourceGroupName, serverName).getSyncPoller(); + } + + /** + * Restarts a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginRestart( + String resourceGroupName, String serverName, Context context) { + return beginRestartAsync(resourceGroupName, serverName, context).getSyncPoller(); + } + + /** + * Restarts a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 restartAsync(String resourceGroupName, String serverName) { + return beginRestartAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restarts a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 restartAsync(String resourceGroupName, String serverName, Context context) { + return beginRestartAsync(resourceGroupName, serverName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Restarts a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 restart(String resourceGroupName, String serverName) { + restartAsync(resourceGroupName, serverName).block(); + } + + /** + * Restarts a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 restart(String resourceGroupName, String serverName, Context context) { + restartAsync(resourceGroupName, serverName, context).block(); + } + + /** + * Starts a stopped server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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>> startWithResponseAsync(String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .start( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Starts a stopped server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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>> startWithResponseAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .start( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context); + } + + /** + * Starts a stopped server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginStartAsync(String resourceGroupName, String serverName) { + Mono>> mono = startWithResponseAsync(resourceGroupName, serverName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Starts a stopped server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginStartAsync( + String resourceGroupName, String serverName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = startWithResponseAsync(resourceGroupName, serverName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Starts a stopped server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginStart(String resourceGroupName, String serverName) { + return beginStartAsync(resourceGroupName, serverName).getSyncPoller(); + } + + /** + * Starts a stopped server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginStart(String resourceGroupName, String serverName, Context context) { + return beginStartAsync(resourceGroupName, serverName, context).getSyncPoller(); + } + + /** + * Starts a stopped server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 startAsync(String resourceGroupName, String serverName) { + return beginStartAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts a stopped server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 startAsync(String resourceGroupName, String serverName, Context context) { + return beginStartAsync(resourceGroupName, serverName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Starts a stopped server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 start(String resourceGroupName, String serverName) { + startAsync(resourceGroupName, serverName).block(); + } + + /** + * Starts a stopped server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 start(String resourceGroupName, String serverName, Context context) { + startAsync(resourceGroupName, serverName, context).block(); + } + + /** + * Stops a running server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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>> stopWithResponseAsync(String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .stop( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Stops a running server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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>> stopWithResponseAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .stop( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context); + } + + /** + * Stops a running server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginStopAsync(String resourceGroupName, String serverName) { + Mono>> mono = stopWithResponseAsync(resourceGroupName, serverName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Stops a running server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginStopAsync( + String resourceGroupName, String serverName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = stopWithResponseAsync(resourceGroupName, serverName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Stops a running server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginStop(String resourceGroupName, String serverName) { + return beginStopAsync(resourceGroupName, serverName).getSyncPoller(); + } + + /** + * Stops a running server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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> beginStop(String resourceGroupName, String serverName, Context context) { + return beginStopAsync(resourceGroupName, serverName, context).getSyncPoller(); + } + + /** + * Stops a running server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 stopAsync(String resourceGroupName, String serverName) { + return beginStopAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Stops a running server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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 stopAsync(String resourceGroupName, String serverName, Context context) { + return beginStopAsync(resourceGroupName, serverName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Stops a running server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 stop(String resourceGroupName, String serverName) { + stopAsync(resourceGroupName, serverName).block(); + } + + /** + * Stops a running server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @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 stop(String resourceGroupName, String serverName, Context context) { + stopAsync(resourceGroupName, serverName, context).block(); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServersImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServersImpl.java new file mode 100644 index 000000000000..8e98b260870e --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/ServersImpl.java @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.ServersClient; +import com.azure.resourcemanager.mariadb.fluent.models.ServerInner; +import com.azure.resourcemanager.mariadb.models.Server; +import com.azure.resourcemanager.mariadb.models.Servers; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServersImpl implements Servers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServersImpl.class); + + private final ServersClient innerClient; + + private final MariaDBManager serviceManager; + + public ServersImpl(ServersClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public void deleteByResourceGroup(String resourceGroupName, String serverName) { + this.serviceClient().delete(resourceGroupName, serverName); + } + + public void delete(String resourceGroupName, String serverName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, context); + } + + public Server getByResourceGroup(String resourceGroupName, String serverName) { + ServerInner inner = this.serviceClient().getByResourceGroup(resourceGroupName, serverName); + if (inner != null) { + return new ServerImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getByResourceGroupWithResponse( + String resourceGroupName, String serverName, Context context) { + Response inner = + this.serviceClient().getByResourceGroupWithResponse(resourceGroupName, serverName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByResourceGroup(String resourceGroupName) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); + return inner.mapPage(inner1 -> new ServerImpl(inner1, this.manager())); + } + + public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { + PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); + return inner.mapPage(inner1 -> new ServerImpl(inner1, this.manager())); + } + + public PagedIterable list() { + PagedIterable inner = this.serviceClient().list(); + return inner.mapPage(inner1 -> new ServerImpl(inner1, this.manager())); + } + + public PagedIterable list(Context context) { + PagedIterable inner = this.serviceClient().list(context); + return inner.mapPage(inner1 -> new ServerImpl(inner1, this.manager())); + } + + public void restart(String resourceGroupName, String serverName) { + this.serviceClient().restart(resourceGroupName, serverName); + } + + public void restart(String resourceGroupName, String serverName, Context context) { + this.serviceClient().restart(resourceGroupName, serverName, context); + } + + public void start(String resourceGroupName, String serverName) { + this.serviceClient().start(resourceGroupName, serverName); + } + + public void start(String resourceGroupName, String serverName, Context context) { + this.serviceClient().start(resourceGroupName, serverName, context); + } + + public void stop(String resourceGroupName, String serverName) { + this.serviceClient().stop(resourceGroupName, serverName); + } + + public void stop(String resourceGroupName, String serverName, Context context) { + this.serviceClient().stop(resourceGroupName, serverName, context); + } + + public Server 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, serverName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + return this.getByResourceGroupWithResponse(resourceGroupName, serverName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + this.delete(resourceGroupName, serverName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + this.delete(resourceGroupName, serverName, context); + } + + private ServersClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } + + public ServerImpl define(String name) { + return new ServerImpl(name, this.manager()); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/TopQueryStatisticsClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/TopQueryStatisticsClientImpl.java new file mode 100644 index 000000000000..9a24592c08dc --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/TopQueryStatisticsClientImpl.java @@ -0,0 +1,545 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.implementation; + +import com.azure.core.annotation.BodyParam; +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.mariadb.fluent.TopQueryStatisticsClient; +import com.azure.resourcemanager.mariadb.fluent.models.QueryStatisticInner; +import com.azure.resourcemanager.mariadb.models.TopQueryStatisticsInput; +import com.azure.resourcemanager.mariadb.models.TopQueryStatisticsResultList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in TopQueryStatisticsClient. */ +public final class TopQueryStatisticsClientImpl implements TopQueryStatisticsClient { + private final ClientLogger logger = new ClientLogger(TopQueryStatisticsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final TopQueryStatisticsService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of TopQueryStatisticsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + TopQueryStatisticsClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy.create(TopQueryStatisticsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientTopQueryStatistics to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface TopQueryStatisticsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/topQueryStatistics/{queryStatisticId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("queryStatisticId") String queryStatisticId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/topQueryStatistics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @BodyParam("application/json") TopQueryStatisticsInput parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieve the query statistic for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryStatisticId The Query Statistic identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Query Statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String queryStatisticId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (queryStatisticId == null) { + return Mono + .error(new IllegalArgumentException("Parameter queryStatisticId is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + queryStatisticId, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Retrieve the query statistic for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryStatisticId The Query Statistic identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Query Statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String queryStatisticId, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (queryStatisticId == null) { + return Mono + .error(new IllegalArgumentException("Parameter queryStatisticId is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + queryStatisticId, + accept, + context); + } + + /** + * Retrieve the query statistic for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryStatisticId The Query Statistic identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Query Statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String queryStatisticId) { + return getWithResponseAsync(resourceGroupName, serverName, queryStatisticId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieve the query statistic for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryStatisticId The Query Statistic identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Query Statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public QueryStatisticInner get(String resourceGroupName, String serverName, String queryStatisticId) { + return getAsync(resourceGroupName, serverName, queryStatisticId).block(); + } + + /** + * Retrieve the query statistic for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryStatisticId The Query Statistic identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Query Statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String queryStatisticId, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, queryStatisticId, context).block(); + } + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, TopQueryStatisticsInput 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, TopQueryStatisticsInput 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, parameters), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, parameters, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, parameters)); + } + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, parameters, 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 query statistics. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 query statistics. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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 + .listByServerNext(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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/TopQueryStatisticsImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/TopQueryStatisticsImpl.java new file mode 100644 index 000000000000..f42da929a6fc --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/TopQueryStatisticsImpl.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.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.TopQueryStatisticsClient; +import com.azure.resourcemanager.mariadb.fluent.models.QueryStatisticInner; +import com.azure.resourcemanager.mariadb.models.QueryStatistic; +import com.azure.resourcemanager.mariadb.models.TopQueryStatistics; +import com.azure.resourcemanager.mariadb.models.TopQueryStatisticsInput; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class TopQueryStatisticsImpl implements TopQueryStatistics { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TopQueryStatisticsImpl.class); + + private final TopQueryStatisticsClient innerClient; + + private final MariaDBManager serviceManager; + + public TopQueryStatisticsImpl(TopQueryStatisticsClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public QueryStatistic get(String resourceGroupName, String serverName, String queryStatisticId) { + QueryStatisticInner inner = this.serviceClient().get(resourceGroupName, serverName, queryStatisticId); + if (inner != null) { + return new QueryStatisticImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String queryStatisticId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, queryStatisticId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new QueryStatisticImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, parameters); + return inner.mapPage(inner1 -> new QueryStatisticImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, parameters, context); + return inner.mapPage(inner1 -> new QueryStatisticImpl(inner1, this.manager())); + } + + private TopQueryStatisticsClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/Utils.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/Utils.java new file mode 100644 index 000000000000..ffa7b4a72c0a --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/Utils.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.mariadb.implementation; + +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; + +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; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/VirtualNetworkRuleImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/VirtualNetworkRuleImpl.java new file mode 100644 index 000000000000..16bc2c5a9efa --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/VirtualNetworkRuleImpl.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.mariadb.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.VirtualNetworkRuleInner; +import com.azure.resourcemanager.mariadb.models.VirtualNetworkRule; +import com.azure.resourcemanager.mariadb.models.VirtualNetworkRuleState; + +public final class VirtualNetworkRuleImpl + implements VirtualNetworkRule, VirtualNetworkRule.Definition, VirtualNetworkRule.Update { + private VirtualNetworkRuleInner innerObject; + + private final MariaDBManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String virtualNetworkSubnetId() { + return this.innerModel().virtualNetworkSubnetId(); + } + + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.innerModel().ignoreMissingVnetServiceEndpoint(); + } + + public VirtualNetworkRuleState state() { + return this.innerModel().state(); + } + + public VirtualNetworkRuleInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String virtualNetworkRuleName; + + public VirtualNetworkRuleImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public VirtualNetworkRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualNetworkRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), context); + return this; + } + + VirtualNetworkRuleImpl(String name, MariaDBManager serviceManager) { + this.innerObject = new VirtualNetworkRuleInner(); + this.serviceManager = serviceManager; + this.virtualNetworkRuleName = name; + } + + public VirtualNetworkRuleImpl update() { + return this; + } + + public VirtualNetworkRule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualNetworkRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), context); + return this; + } + + VirtualNetworkRuleImpl(VirtualNetworkRuleInner innerObject, MariaDBManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.virtualNetworkRuleName = Utils.getValueFromIdByName(innerObject.id(), "virtualNetworkRules"); + } + + public VirtualNetworkRule refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, Context.NONE) + .getValue(); + return this; + } + + public VirtualNetworkRule refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, context) + .getValue(); + return this; + } + + public VirtualNetworkRuleImpl withVirtualNetworkSubnetId(String virtualNetworkSubnetId) { + this.innerModel().withVirtualNetworkSubnetId(virtualNetworkSubnetId); + return this; + } + + public VirtualNetworkRuleImpl withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.innerModel().withIgnoreMissingVnetServiceEndpoint(ignoreMissingVnetServiceEndpoint); + return this; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/VirtualNetworkRulesClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/VirtualNetworkRulesClientImpl.java new file mode 100644 index 000000000000..3b85fb045f13 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/VirtualNetworkRulesClientImpl.java @@ -0,0 +1,1152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.mariadb.fluent.VirtualNetworkRulesClient; +import com.azure.resourcemanager.mariadb.fluent.models.VirtualNetworkRuleInner; +import com.azure.resourcemanager.mariadb.models.VirtualNetworkRuleListResult; +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 VirtualNetworkRulesClient. */ +public final class VirtualNetworkRulesClientImpl implements VirtualNetworkRulesClient { + private final ClientLogger logger = new ClientLogger(VirtualNetworkRulesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualNetworkRulesService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of VirtualNetworkRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualNetworkRulesClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy.create(VirtualNetworkRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientVirtualNetworkRules to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface VirtualNetworkRulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("virtualNetworkRuleName") String virtualNetworkRuleName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("virtualNetworkRuleName") String virtualNetworkRuleName, + @BodyParam("application/json") VirtualNetworkRuleInner 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.DBForMariaDB" + + "/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("virtualNetworkRuleName") String virtualNetworkRuleName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForMariaDB" + + "/servers/{serverName}/virtualNetworkRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + virtualNetworkRuleName, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + virtualNetworkRuleName, + accept, + context); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return getWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkRuleInner get(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return getAsync(resourceGroupName, serverName, virtualNetworkRuleName).block(); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, context).block(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName 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-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + virtualNetworkRuleName, + parameters, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName 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-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + virtualNetworkRuleName, + parameters, + accept, + context); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, VirtualNetworkRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualNetworkRuleInner.class, + VirtualNetworkRuleInner.class, + Context.NONE); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, VirtualNetworkRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualNetworkRuleInner.class, + VirtualNetworkRuleInner.class, + context); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).block(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context).block(); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 serverName, String virtualNetworkRuleName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required 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-06-01"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + virtualNetworkRuleName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 serverName, String virtualNetworkRuleName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required 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-06-01"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + virtualNetworkRuleName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName).getSyncPoller(); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName, context).getSyncPoller(); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 serverName, String virtualNetworkRuleName) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 deleteAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 serverName, String virtualNetworkRuleName) { + deleteAsync(resourceGroupName, serverName, virtualNetworkRuleName).block(); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + deleteAsync(resourceGroupName, serverName, virtualNetworkRuleName, context).block(); + } + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required 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-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required 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-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, 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 virtual network rules. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 virtual network rules. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + 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 + .listByServerNext(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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/VirtualNetworkRulesImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/VirtualNetworkRulesImpl.java new file mode 100644 index 000000000000..9360e40711db --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/VirtualNetworkRulesImpl.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.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.VirtualNetworkRulesClient; +import com.azure.resourcemanager.mariadb.fluent.models.VirtualNetworkRuleInner; +import com.azure.resourcemanager.mariadb.models.VirtualNetworkRule; +import com.azure.resourcemanager.mariadb.models.VirtualNetworkRules; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VirtualNetworkRulesImpl implements VirtualNetworkRules { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkRulesImpl.class); + + private final VirtualNetworkRulesClient innerClient; + + private final MariaDBManager serviceManager; + + public VirtualNetworkRulesImpl(VirtualNetworkRulesClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public VirtualNetworkRule get(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + VirtualNetworkRuleInner inner = this.serviceClient().get(resourceGroupName, serverName, virtualNetworkRuleName); + if (inner != null) { + return new VirtualNetworkRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualNetworkRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + this.serviceClient().delete(resourceGroupName, serverName, virtualNetworkRuleName); + } + + public void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, virtualNetworkRuleName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return inner.mapPage(inner1 -> new VirtualNetworkRuleImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, context); + return inner.mapPage(inner1 -> new VirtualNetworkRuleImpl(inner1, this.manager())); + } + + public VirtualNetworkRule 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + this.delete(resourceGroupName, serverName, virtualNetworkRuleName, 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 serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + this.delete(resourceGroupName, serverName, virtualNetworkRuleName, context); + } + + private VirtualNetworkRulesClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } + + public VirtualNetworkRuleImpl define(String name) { + return new VirtualNetworkRuleImpl(name, this.manager()); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/WaitStatisticImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/WaitStatisticImpl.java new file mode 100644 index 000000000000..85777aebd29a --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/WaitStatisticImpl.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.mariadb.implementation; + +import com.azure.resourcemanager.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.models.WaitStatisticInner; +import com.azure.resourcemanager.mariadb.models.WaitStatistic; +import java.time.OffsetDateTime; + +public final class WaitStatisticImpl implements WaitStatistic { + private WaitStatisticInner innerObject; + + private final MariaDBManager serviceManager; + + WaitStatisticImpl(WaitStatisticInner innerObject, MariaDBManager 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 OffsetDateTime startTime() { + return this.innerModel().startTime(); + } + + public OffsetDateTime endTime() { + return this.innerModel().endTime(); + } + + public String eventName() { + return this.innerModel().eventName(); + } + + public String eventTypeName() { + return this.innerModel().eventTypeName(); + } + + public Long queryId() { + return this.innerModel().queryId(); + } + + public String databaseName() { + return this.innerModel().databaseName(); + } + + public Long userId() { + return this.innerModel().userId(); + } + + public Long count() { + return this.innerModel().count(); + } + + public Double totalTimeInMs() { + return this.innerModel().totalTimeInMs(); + } + + public WaitStatisticInner innerModel() { + return this.innerObject; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/WaitStatisticsClientImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/WaitStatisticsClientImpl.java new file mode 100644 index 000000000000..c7932460f90f --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/WaitStatisticsClientImpl.java @@ -0,0 +1,545 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.implementation; + +import com.azure.core.annotation.BodyParam; +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.mariadb.fluent.WaitStatisticsClient; +import com.azure.resourcemanager.mariadb.fluent.models.WaitStatisticInner; +import com.azure.resourcemanager.mariadb.models.WaitStatisticsInput; +import com.azure.resourcemanager.mariadb.models.WaitStatisticsResultList; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in WaitStatisticsClient. */ +public final class WaitStatisticsClientImpl implements WaitStatisticsClient { + private final ClientLogger logger = new ClientLogger(WaitStatisticsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final WaitStatisticsService service; + + /** The service client containing this operation class. */ + private final MariaDBManagementClientImpl client; + + /** + * Initializes an instance of WaitStatisticsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + WaitStatisticsClientImpl(MariaDBManagementClientImpl client) { + this.service = + RestProxy.create(WaitStatisticsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for MariaDBManagementClientWaitStatistics to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "MariaDBManagementCli") + private interface WaitStatisticsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/waitStatistics/{waitStatisticsId}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("waitStatisticsId") String waitStatisticsId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforMariaDB" + + "/servers/{serverName}/waitStatistics") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @BodyParam("application/json") WaitStatisticsInput parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Retrieve wait statistics for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param waitStatisticsId The Wait Statistic identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Wait Statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String waitStatisticsId) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (waitStatisticsId == null) { + return Mono + .error(new IllegalArgumentException("Parameter waitStatisticsId is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + waitStatisticsId, + accept, + context)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Retrieve wait statistics for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param waitStatisticsId The Wait Statistic identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Wait Statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String waitStatisticsId, 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (waitStatisticsId == null) { + return Mono + .error(new IllegalArgumentException("Parameter waitStatisticsId is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + waitStatisticsId, + accept, + context); + } + + /** + * Retrieve wait statistics for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param waitStatisticsId The Wait Statistic identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Wait Statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName, String waitStatisticsId) { + return getWithResponseAsync(resourceGroupName, serverName, waitStatisticsId) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Retrieve wait statistics for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param waitStatisticsId The Wait Statistic identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Wait Statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public WaitStatisticInner get(String resourceGroupName, String serverName, String waitStatisticsId) { + return getAsync(resourceGroupName, serverName, waitStatisticsId).block(); + } + + /** + * Retrieve wait statistics for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param waitStatisticsId The Wait Statistic identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Wait Statistic. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String waitStatisticsId, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, waitStatisticsId, context).block(); + } + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of wait statistics. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, WaitStatisticsInput 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of wait statistics. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, WaitStatisticsInput 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 (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName 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-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + parameters, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of wait statistics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, WaitStatisticsInput parameters) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, parameters), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of wait statistics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, WaitStatisticsInput parameters, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, parameters, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of wait statistics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, WaitStatisticsInput parameters) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, parameters)); + } + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of wait statistics. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, WaitStatisticsInput parameters, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, parameters, 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 wait statistics. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + } + + /** + * 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 wait statistics. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(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 + .listByServerNext(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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/WaitStatisticsImpl.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/WaitStatisticsImpl.java new file mode 100644 index 000000000000..77c42c1cb29b --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/WaitStatisticsImpl.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.mariadb.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.mariadb.MariaDBManager; +import com.azure.resourcemanager.mariadb.fluent.WaitStatisticsClient; +import com.azure.resourcemanager.mariadb.fluent.models.WaitStatisticInner; +import com.azure.resourcemanager.mariadb.models.WaitStatistic; +import com.azure.resourcemanager.mariadb.models.WaitStatistics; +import com.azure.resourcemanager.mariadb.models.WaitStatisticsInput; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class WaitStatisticsImpl implements WaitStatistics { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WaitStatisticsImpl.class); + + private final WaitStatisticsClient innerClient; + + private final MariaDBManager serviceManager; + + public WaitStatisticsImpl(WaitStatisticsClient innerClient, MariaDBManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public WaitStatistic get(String resourceGroupName, String serverName, String waitStatisticsId) { + WaitStatisticInner inner = this.serviceClient().get(resourceGroupName, serverName, waitStatisticsId); + if (inner != null) { + return new WaitStatisticImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String waitStatisticsId, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, waitStatisticsId, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new WaitStatisticImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, WaitStatisticsInput parameters) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, parameters); + return inner.mapPage(inner1 -> new WaitStatisticImpl(inner1, this.manager())); + } + + public PagedIterable listByServer( + String resourceGroupName, String serverName, WaitStatisticsInput parameters, Context context) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName, parameters, context); + return inner.mapPage(inner1 -> new WaitStatisticImpl(inner1, this.manager())); + } + + private WaitStatisticsClient serviceClient() { + return this.innerClient; + } + + private MariaDBManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/package-info.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/package-info.java new file mode 100644 index 000000000000..156c07258ea6 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/implementation/package-info.java @@ -0,0 +1,10 @@ +// 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 MariaDBManagementClient. The Microsoft Azure management API provides + * create, read, update, and delete functionality for Azure MariaDB resources including servers, databases, firewall + * rules, VNET rules, log files and configurations with new business model. + */ +package com.azure.resourcemanager.mariadb.implementation; diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Advisor.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Advisor.java new file mode 100644 index 000000000000..60402d9ee828 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Advisor.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.mariadb.models; + +import com.azure.resourcemanager.mariadb.fluent.models.AdvisorInner; + +/** An immutable client-side representation of Advisor. */ +public interface Advisor { + /** + * 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 properties property: The properties of a recommendation action advisor. + * + * @return the properties value. + */ + Object properties(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.AdvisorInner object. + * + * @return the inner object. + */ + AdvisorInner innerModel(); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Advisors.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Advisors.java new file mode 100644 index 000000000000..2333d156a5ed --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Advisors.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.mariadb.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 Advisors. */ +public interface Advisors { + /** + * Get a recommendation action advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recommendation action advisor. + */ + Advisor get(String resourceGroupName, String serverName, String advisorName); + + /** + * Get a recommendation action advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recommendation action advisor. + */ + Response getWithResponse(String resourceGroupName, String serverName, String advisorName, Context context); + + /** + * List recommendation action advisors. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List recommendation action advisors. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/AdvisorsResultList.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/AdvisorsResultList.java new file mode 100644 index 000000000000..8b7b28db011f --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/AdvisorsResultList.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.mariadb.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.fluent.models.AdvisorInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of query statistics. */ +@Immutable +public final class AdvisorsResultList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(AdvisorsResultList.class); + + /* + * The list of recommendation action advisors. + */ + @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: The list of recommendation action advisors. + * + * @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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/CheckNameAvailabilities.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/CheckNameAvailabilities.java new file mode 100644 index 000000000000..39d85008f416 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/CheckNameAvailabilities.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.mariadb.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of CheckNameAvailabilities. */ +public interface CheckNameAvailabilities { + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + NameAvailability execute(NameAvailabilityRequest nameAvailabilityRequest); + + /** + * Check the availability of name for resource. + * + * @param nameAvailabilityRequest The required parameters for checking if resource name is available. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a resource name availability. + */ + Response executeWithResponse(NameAvailabilityRequest nameAvailabilityRequest, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Configuration.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Configuration.java new file mode 100644 index 000000000000..6d2831392237 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Configuration.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.mariadb.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mariadb.fluent.models.ConfigurationInner; + +/** An immutable client-side representation of Configuration. */ +public interface Configuration { + /** + * 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 value property: Value of the configuration. + * + * @return the value value. + */ + String value(); + + /** + * Gets the description property: Description of the configuration. + * + * @return the description value. + */ + String description(); + + /** + * Gets the defaultValue property: Default value of the configuration. + * + * @return the defaultValue value. + */ + String defaultValue(); + + /** + * Gets the dataType property: Data type of the configuration. + * + * @return the dataType value. + */ + String dataType(); + + /** + * Gets the allowedValues property: Allowed values of the configuration. + * + * @return the allowedValues value. + */ + String allowedValues(); + + /** + * Gets the source property: Source of the configuration. + * + * @return the source value. + */ + String source(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.ConfigurationInner object. + * + * @return the inner object. + */ + ConfigurationInner innerModel(); + + /** The entirety of the Configuration definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The Configuration definition stages. */ + interface DefinitionStages { + /** The first stage of the Configuration definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the Configuration definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the Configuration 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.WithValue, DefinitionStages.WithSource { + /** + * Executes the create request. + * + * @return the created resource. + */ + Configuration create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Configuration create(Context context); + } + /** The stage of the Configuration definition allowing to specify value. */ + interface WithValue { + /** + * Specifies the value property: Value of the configuration.. + * + * @param value Value of the configuration. + * @return the next definition stage. + */ + WithCreate withValue(String value); + } + /** The stage of the Configuration definition allowing to specify source. */ + interface WithSource { + /** + * Specifies the source property: Source of the configuration.. + * + * @param source Source of the configuration. + * @return the next definition stage. + */ + WithCreate withSource(String source); + } + } + /** + * Begins update for the Configuration resource. + * + * @return the stage of resource update. + */ + Configuration.Update update(); + + /** The template for Configuration update. */ + interface Update extends UpdateStages.WithValue, UpdateStages.WithSource { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Configuration apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Configuration apply(Context context); + } + /** The Configuration update stages. */ + interface UpdateStages { + /** The stage of the Configuration update allowing to specify value. */ + interface WithValue { + /** + * Specifies the value property: Value of the configuration.. + * + * @param value Value of the configuration. + * @return the next definition stage. + */ + Update withValue(String value); + } + /** The stage of the Configuration update allowing to specify source. */ + interface WithSource { + /** + * Specifies the source property: Source of the configuration.. + * + * @param source Source of the configuration. + * @return the next definition stage. + */ + Update withSource(String source); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Configuration refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Configuration refresh(Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ConfigurationListResult.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ConfigurationListResult.java new file mode 100644 index 000000000000..c171a878be3d --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ConfigurationListResult.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.mariadb.models; + +import com.azure.resourcemanager.mariadb.fluent.models.ConfigurationListResultInner; +import java.util.List; + +/** An immutable client-side representation of ConfigurationListResult. */ +public interface ConfigurationListResult { + /** + * Gets the value property: The list of server configurations. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.ConfigurationListResultInner object. + * + * @return the inner object. + */ + ConfigurationListResultInner innerModel(); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Configurations.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Configurations.java new file mode 100644 index 000000000000..a7f75366f503 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Configurations.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.mariadb.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 Configurations. */ +public interface Configurations { + /** + * Gets information about a configuration of server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a configuration of server. + */ + Configuration get(String resourceGroupName, String serverName, String configurationName); + + /** + * Gets information about a configuration of server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a configuration of server. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String configurationName, Context context); + + /** + * List all the configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets information about a configuration of server. + * + * @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 information about a configuration of server. + */ + Configuration getById(String id); + + /** + * Gets information about a configuration of server. + * + * @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 information about a configuration of server. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new Configuration resource. + * + * @param name resource name. + * @return the first stage of the new Configuration definition. + */ + Configuration.DefinitionStages.Blank define(String name); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/CreateMode.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/CreateMode.java new file mode 100644 index 000000000000..08605feda3d0 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/CreateMode.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.mariadb.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for CreateMode. */ +public final class CreateMode extends ExpandableStringEnum { + /** Static value Default for CreateMode. */ + public static final CreateMode DEFAULT = fromString("Default"); + + /** Static value PointInTimeRestore for CreateMode. */ + public static final CreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + + /** Static value GeoRestore for CreateMode. */ + public static final CreateMode GEO_RESTORE = fromString("GeoRestore"); + + /** Static value Replica for CreateMode. */ + public static final CreateMode REPLICA = fromString("Replica"); + + /** + * Creates or finds a CreateMode from its string representation. + * + * @param name a name to look for. + * @return the corresponding CreateMode. + */ + @JsonCreator + public static CreateMode fromString(String name) { + return fromString(name, CreateMode.class); + } + + /** @return known CreateMode values. */ + public static Collection values() { + return values(CreateMode.class); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Database.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Database.java new file mode 100644 index 000000000000..034e3e35e391 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Database.java @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mariadb.fluent.models.DatabaseInner; + +/** An immutable client-side representation of Database. */ +public interface Database { + /** + * 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 charset property: The charset of the database. + * + * @return the charset value. + */ + String charset(); + + /** + * Gets the collation property: The collation of the database. + * + * @return the collation value. + */ + String collation(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.DatabaseInner object. + * + * @return the inner object. + */ + DatabaseInner innerModel(); + + /** The entirety of the Database definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The Database definition stages. */ + interface DefinitionStages { + /** The first stage of the Database definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the Database definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the Database 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.WithCharset, DefinitionStages.WithCollation { + /** + * Executes the create request. + * + * @return the created resource. + */ + Database create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Database create(Context context); + } + /** The stage of the Database definition allowing to specify charset. */ + interface WithCharset { + /** + * Specifies the charset property: The charset of the database.. + * + * @param charset The charset of the database. + * @return the next definition stage. + */ + WithCreate withCharset(String charset); + } + /** The stage of the Database definition allowing to specify collation. */ + interface WithCollation { + /** + * Specifies the collation property: The collation of the database.. + * + * @param collation The collation of the database. + * @return the next definition stage. + */ + WithCreate withCollation(String collation); + } + } + /** + * Begins update for the Database resource. + * + * @return the stage of resource update. + */ + Database.Update update(); + + /** The template for Database update. */ + interface Update extends UpdateStages.WithCharset, UpdateStages.WithCollation { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Database apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Database apply(Context context); + } + /** The Database update stages. */ + interface UpdateStages { + /** The stage of the Database update allowing to specify charset. */ + interface WithCharset { + /** + * Specifies the charset property: The charset of the database.. + * + * @param charset The charset of the database. + * @return the next definition stage. + */ + Update withCharset(String charset); + } + /** The stage of the Database update allowing to specify collation. */ + interface WithCollation { + /** + * Specifies the collation property: The collation of the database.. + * + * @param collation The collation of the database. + * @return the next definition stage. + */ + Update withCollation(String collation); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Database refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Database refresh(Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/DatabaseListResult.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/DatabaseListResult.java new file mode 100644 index 000000000000..d774791b2a8b --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/DatabaseListResult.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.mariadb.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.fluent.models.DatabaseInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A List of databases. */ +@Fluent +public final class DatabaseListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseListResult.class); + + /* + * The list of databases housed in a server + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of databases housed in a server. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of databases housed in a server. + * + * @param value the value value to set. + * @return the DatabaseListResult object itself. + */ + public DatabaseListResult 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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Databases.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Databases.java new file mode 100644 index 000000000000..bd12e5a126ab --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Databases.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.mariadb.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 Databases. */ +public interface Databases { + /** + * Deletes a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverName, String databaseName); + + /** + * Deletes a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverName, String databaseName, Context context); + + /** + * Gets information about a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a database. + */ + Database get(String resourceGroupName, String serverName, String databaseName); + + /** + * Gets information about a database. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a database. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String databaseName, Context context); + + /** + * List all the databases in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of databases. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the databases in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a List of databases. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets information about a database. + * + * @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 information about a database. + */ + Database getById(String id); + + /** + * Gets information about a database. + * + * @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 information about a database. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a database. + * + * @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 database. + * + * @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 Database resource. + * + * @param name resource name. + * @return the first stage of the new Database definition. + */ + Database.DefinitionStages.Blank define(String name); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ErrorAdditionalInfo.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ErrorAdditionalInfo.java new file mode 100644 index 000000000000..6c88238e2bf5 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ErrorAdditionalInfo.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.mariadb.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; + +/** The resource management error additional info. */ +@Immutable +public final class ErrorAdditionalInfo { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ErrorAdditionalInfo.class); + + /* + * The additional info type. + */ + @JsonProperty(value = "type", access = JsonProperty.Access.WRITE_ONLY) + private String type; + + /* + * The additional info. + */ + @JsonProperty(value = "info", access = JsonProperty.Access.WRITE_ONLY) + private Object info; + + /** + * Get the type property: The additional info type. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Get the info property: The additional info. + * + * @return the info value. + */ + public Object info() { + return this.info; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/FirewallRule.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/FirewallRule.java new file mode 100644 index 000000000000..759beddf2163 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/FirewallRule.java @@ -0,0 +1,184 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mariadb.fluent.models.FirewallRuleInner; + +/** An immutable client-side representation of FirewallRule. */ +public interface FirewallRule { + /** + * 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 startIpAddress property: The start IP address of the server firewall rule. Must be IPv4 format. + * + * @return the startIpAddress value. + */ + String startIpAddress(); + + /** + * Gets the endIpAddress property: The end IP address of the server firewall rule. Must be IPv4 format. + * + * @return the endIpAddress value. + */ + String endIpAddress(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.FirewallRuleInner object. + * + * @return the inner object. + */ + FirewallRuleInner innerModel(); + + /** The entirety of the FirewallRule definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithParentResource, + DefinitionStages.WithStartIpAddress, + DefinitionStages.WithEndIpAddress, + DefinitionStages.WithCreate { + } + /** The FirewallRule definition stages. */ + interface DefinitionStages { + /** The first stage of the FirewallRule definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the FirewallRule definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithStartIpAddress withExistingServer(String resourceGroupName, String serverName); + } + /** The stage of the FirewallRule definition allowing to specify startIpAddress. */ + interface WithStartIpAddress { + /** + * Specifies the startIpAddress property: The start IP address of the server firewall rule. Must be IPv4 + * format.. + * + * @param startIpAddress The start IP address of the server firewall rule. Must be IPv4 format. + * @return the next definition stage. + */ + WithEndIpAddress withStartIpAddress(String startIpAddress); + } + /** The stage of the FirewallRule definition allowing to specify endIpAddress. */ + interface WithEndIpAddress { + /** + * Specifies the endIpAddress property: The end IP address of the server firewall rule. Must be IPv4 + * format.. + * + * @param endIpAddress The end IP address of the server firewall rule. Must be IPv4 format. + * @return the next definition stage. + */ + WithCreate withEndIpAddress(String endIpAddress); + } + /** + * The stage of the FirewallRule definition which contains all the minimum required properties for the resource + * to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate { + /** + * Executes the create request. + * + * @return the created resource. + */ + FirewallRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + FirewallRule create(Context context); + } + } + /** + * Begins update for the FirewallRule resource. + * + * @return the stage of resource update. + */ + FirewallRule.Update update(); + + /** The template for FirewallRule update. */ + interface Update extends UpdateStages.WithStartIpAddress, UpdateStages.WithEndIpAddress { + /** + * Executes the update request. + * + * @return the updated resource. + */ + FirewallRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + FirewallRule apply(Context context); + } + /** The FirewallRule update stages. */ + interface UpdateStages { + /** The stage of the FirewallRule update allowing to specify startIpAddress. */ + interface WithStartIpAddress { + /** + * Specifies the startIpAddress property: The start IP address of the server firewall rule. Must be IPv4 + * format.. + * + * @param startIpAddress The start IP address of the server firewall rule. Must be IPv4 format. + * @return the next definition stage. + */ + Update withStartIpAddress(String startIpAddress); + } + /** The stage of the FirewallRule update allowing to specify endIpAddress. */ + interface WithEndIpAddress { + /** + * Specifies the endIpAddress property: The end IP address of the server firewall rule. Must be IPv4 + * format.. + * + * @param endIpAddress The end IP address of the server firewall rule. Must be IPv4 format. + * @return the next definition stage. + */ + Update withEndIpAddress(String endIpAddress); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + FirewallRule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + FirewallRule refresh(Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/FirewallRuleListResult.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/FirewallRuleListResult.java new file mode 100644 index 000000000000..ab48ce181bee --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/FirewallRuleListResult.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.mariadb.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.fluent.models.FirewallRuleInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of firewall rules. */ +@Fluent +public final class FirewallRuleListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(FirewallRuleListResult.class); + + /* + * The list of firewall rules in a server. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of firewall rules in a server. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of firewall rules in a server. + * + * @param value the value value to set. + * @return the FirewallRuleListResult object itself. + */ + public FirewallRuleListResult 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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/FirewallRules.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/FirewallRules.java new file mode 100644 index 000000000000..0ecff692a3c0 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/FirewallRules.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.mariadb.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 FirewallRules. */ +public interface FirewallRules { + /** + * Deletes a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 delete(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * Deletes a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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. + */ + void delete(String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * Gets information about a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 information about a server firewall rule. + */ + FirewallRule get(String resourceGroupName, String serverName, String firewallRuleName); + + /** + * Gets information about a server firewall rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param firewallRuleName The name of the server firewall 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 information about a server firewall rule. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String firewallRuleName, Context context); + + /** + * List all the firewall rules in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the firewall rules in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of firewall rules. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets information about a server firewall 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 information about a server firewall rule. + */ + FirewallRule getById(String id); + + /** + * Gets information about a server firewall 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 information about a server firewall rule. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a server firewall 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 server firewall 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. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new FirewallRule resource. + * + * @param name resource name. + * @return the first stage of the new FirewallRule definition. + */ + FirewallRule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/GeoRedundantBackup.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/GeoRedundantBackup.java new file mode 100644 index 000000000000..4c0777592c4c --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/GeoRedundantBackup.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.mariadb.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for GeoRedundantBackup. */ +public final class GeoRedundantBackup extends ExpandableStringEnum { + /** Static value Enabled for GeoRedundantBackup. */ + public static final GeoRedundantBackup ENABLED = fromString("Enabled"); + + /** Static value Disabled for GeoRedundantBackup. */ + public static final GeoRedundantBackup DISABLED = fromString("Disabled"); + + /** + * Creates or finds a GeoRedundantBackup from its string representation. + * + * @param name a name to look for. + * @return the corresponding GeoRedundantBackup. + */ + @JsonCreator + public static GeoRedundantBackup fromString(String name) { + return fromString(name, GeoRedundantBackup.class); + } + + /** @return known GeoRedundantBackup values. */ + public static Collection values() { + return values(GeoRedundantBackup.class); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LocationBasedPerformanceTiers.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LocationBasedPerformanceTiers.java new file mode 100644 index 000000000000..d36db707093e --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LocationBasedPerformanceTiers.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.mariadb.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of LocationBasedPerformanceTiers. */ +public interface LocationBasedPerformanceTiers { + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + PagedIterable list(String locationName); + + /** + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + PagedIterable list(String locationName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LocationBasedRecommendedActionSessionsOperationStatus.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LocationBasedRecommendedActionSessionsOperationStatus.java new file mode 100644 index 000000000000..37c26a53d2f5 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LocationBasedRecommendedActionSessionsOperationStatus.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.mariadb.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of LocationBasedRecommendedActionSessionsOperationStatus. */ +public interface LocationBasedRecommendedActionSessionsOperationStatus { + /** + * Recommendation action session operation status. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return recommendation action session operation status. + */ + RecommendedActionSessionsOperationStatus get(String locationName, String operationId); + + /** + * Recommendation action session operation status. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return recommendation action session operation status. + */ + Response getWithResponse( + String locationName, String operationId, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LocationBasedRecommendedActionSessionsResults.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LocationBasedRecommendedActionSessionsResults.java new file mode 100644 index 000000000000..b74d074e1a18 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LocationBasedRecommendedActionSessionsResults.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.mariadb.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of LocationBasedRecommendedActionSessionsResults. */ +public interface LocationBasedRecommendedActionSessionsResults { + /** + * Recommendation action session operation result. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + PagedIterable list(String locationName, String operationId); + + /** + * Recommendation action session operation result. + * + * @param locationName The name of the location. + * @param operationId The operation identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + PagedIterable list(String locationName, String operationId, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LogFile.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LogFile.java new file mode 100644 index 000000000000..47c3959e28a1 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LogFile.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.mariadb.models; + +import com.azure.resourcemanager.mariadb.fluent.models.LogFileInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of LogFile. */ +public interface LogFile { + /** + * 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 sizeInKB property: Size of the log file. + * + * @return the sizeInKB value. + */ + Long sizeInKB(); + + /** + * Gets the createdTime property: Creation timestamp of the log file. + * + * @return the createdTime value. + */ + OffsetDateTime createdTime(); + + /** + * Gets the lastModifiedTime property: Last modified timestamp of the log file. + * + * @return the lastModifiedTime value. + */ + OffsetDateTime lastModifiedTime(); + + /** + * Gets the typePropertiesType property: Type of the log file. + * + * @return the typePropertiesType value. + */ + String typePropertiesType(); + + /** + * Gets the url property: The url to download the log file from. + * + * @return the url value. + */ + String url(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.LogFileInner object. + * + * @return the inner object. + */ + LogFileInner innerModel(); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LogFileListResult.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LogFileListResult.java new file mode 100644 index 000000000000..84ca1cd80bc7 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LogFileListResult.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.mariadb.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.fluent.models.LogFileInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of log files. */ +@Fluent +public final class LogFileListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogFileListResult.class); + + /* + * The list of log files. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of log files. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of log files. + * + * @param value the value value to set. + * @return the LogFileListResult object itself. + */ + public LogFileListResult 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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LogFiles.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LogFiles.java new file mode 100644 index 000000000000..890462833e5c --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/LogFiles.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.mariadb.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of LogFiles. */ +public interface LogFiles { + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/NameAvailability.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/NameAvailability.java new file mode 100644 index 000000000000..4c4936a3e070 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/NameAvailability.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.mariadb.models; + +import com.azure.resourcemanager.mariadb.fluent.models.NameAvailabilityInner; + +/** An immutable client-side representation of NameAvailability. */ +public interface NameAvailability { + /** + * Gets the message property: Error Message. + * + * @return the message value. + */ + String message(); + + /** + * Gets the nameAvailable property: Indicates whether the resource name is available. + * + * @return the nameAvailable value. + */ + Boolean nameAvailable(); + + /** + * Gets the reason property: Reason for name being unavailable. + * + * @return the reason value. + */ + String reason(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.NameAvailabilityInner object. + * + * @return the inner object. + */ + NameAvailabilityInner innerModel(); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/NameAvailabilityRequest.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/NameAvailabilityRequest.java new file mode 100644 index 000000000000..ae8de46914d9 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/NameAvailabilityRequest.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.mariadb.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; + +/** Request from client to check resource name availability. */ +@Fluent +public final class NameAvailabilityRequest { + @JsonIgnore private final ClientLogger logger = new ClientLogger(NameAvailabilityRequest.class); + + /* + * Resource name to verify. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * Resource type used for verification. + */ + @JsonProperty(value = "type") + private String type; + + /** + * Get the name property: Resource name to verify. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: Resource name to verify. + * + * @param name the name value to set. + * @return the NameAvailabilityRequest object itself. + */ + public NameAvailabilityRequest withName(String name) { + this.name = name; + return this; + } + + /** + * Get the type property: Resource type used for verification. + * + * @return the type value. + */ + public String type() { + return this.type; + } + + /** + * Set the type property: Resource type used for verification. + * + * @param type the type value to set. + * @return the NameAvailabilityRequest object itself. + */ + public NameAvailabilityRequest withType(String type) { + this.type = type; + 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 NameAvailabilityRequest")); + } + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Operation.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Operation.java new file mode 100644 index 000000000000..e7d9565700b5 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Operation.java @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.util.Map; + +/** REST API operation definition. */ +@Immutable +public final class Operation { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Operation.class); + + /* + * The name of the operation being performed on this particular object. + */ + @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) + private String name; + + /* + * The localized display information for this particular operation or + * action. + */ + @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) + private OperationDisplay display; + + /* + * The intended executor of the operation. + */ + @JsonProperty(value = "origin", access = JsonProperty.Access.WRITE_ONLY) + private OperationOrigin origin; + + /* + * Additional descriptions for the operation. + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private Map properties; + + /** + * Get the name property: The name of the operation being performed on this particular object. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Get the display property: The localized display information for this particular operation or action. + * + * @return the display value. + */ + public OperationDisplay display() { + return this.display; + } + + /** + * Get the origin property: The intended executor of the operation. + * + * @return the origin value. + */ + public OperationOrigin origin() { + return this.origin; + } + + /** + * Get the properties property: Additional descriptions for the operation. + * + * @return the properties value. + */ + public Map properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (display() != null) { + display().validate(); + } + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/OperationDisplay.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/OperationDisplay.java new file mode 100644 index 000000000000..8d86c22a5ffe --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/OperationDisplay.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.mariadb.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; + +/** Display metadata associated with the operation. */ +@Immutable +public final class OperationDisplay { + @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationDisplay.class); + + /* + * Operation resource provider name. + */ + @JsonProperty(value = "provider", access = JsonProperty.Access.WRITE_ONLY) + private String provider; + + /* + * Resource on which the operation is performed. + */ + @JsonProperty(value = "resource", access = JsonProperty.Access.WRITE_ONLY) + private String resource; + + /* + * Localized friendly name for the operation. + */ + @JsonProperty(value = "operation", access = JsonProperty.Access.WRITE_ONLY) + private String operation; + + /* + * Operation description. + */ + @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) + private String description; + + /** + * Get the provider property: Operation resource provider name. + * + * @return the provider value. + */ + public String provider() { + return this.provider; + } + + /** + * Get the resource property: Resource on which the operation is performed. + * + * @return the resource value. + */ + public String resource() { + return this.resource; + } + + /** + * Get the operation property: Localized friendly name for the operation. + * + * @return the operation value. + */ + public String operation() { + return this.operation; + } + + /** + * Get the description property: Operation description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/OperationListResult.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/OperationListResult.java new file mode 100644 index 000000000000..e3f34e5c7156 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/OperationListResult.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.mariadb.models; + +import com.azure.resourcemanager.mariadb.fluent.models.OperationListResultInner; +import java.util.List; + +/** An immutable client-side representation of OperationListResult. */ +public interface OperationListResult { + /** + * Gets the value property: The list of resource provider operations. + * + * @return the value value. + */ + List value(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.OperationListResultInner object. + * + * @return the inner object. + */ + OperationListResultInner innerModel(); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/OperationOrigin.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/OperationOrigin.java new file mode 100644 index 000000000000..96a2f62fceec --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/OperationOrigin.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.mariadb.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for OperationOrigin. */ +public final class OperationOrigin extends ExpandableStringEnum { + /** Static value NotSpecified for OperationOrigin. */ + public static final OperationOrigin NOT_SPECIFIED = fromString("NotSpecified"); + + /** Static value user for OperationOrigin. */ + public static final OperationOrigin USER = fromString("user"); + + /** Static value system for OperationOrigin. */ + public static final OperationOrigin SYSTEM = fromString("system"); + + /** + * Creates or finds a OperationOrigin from its string representation. + * + * @param name a name to look for. + * @return the corresponding OperationOrigin. + */ + @JsonCreator + public static OperationOrigin fromString(String name) { + return fromString(name, OperationOrigin.class); + } + + /** @return known OperationOrigin values. */ + public static Collection values() { + return values(OperationOrigin.class); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Operations.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Operations.java new file mode 100644 index 000000000000..1d2b12161447 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/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.mariadb.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 REST API operations. + * + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations. + */ + OperationListResult list(); + + /** + * Lists all of the available REST API operations. + * + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of resource provider operations. + */ + Response listWithResponse(Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PerformanceTierListResult.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PerformanceTierListResult.java new file mode 100644 index 000000000000..3f3eaac0ea33 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PerformanceTierListResult.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.mariadb.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.fluent.models.PerformanceTierPropertiesInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of performance tiers. */ +@Fluent +public final class PerformanceTierListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PerformanceTierListResult.class); + + /* + * The list of performance tiers + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of performance tiers. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of performance tiers. + * + * @param value the value value to set. + * @return the PerformanceTierListResult object itself. + */ + public PerformanceTierListResult 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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PerformanceTierProperties.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PerformanceTierProperties.java new file mode 100644 index 000000000000..d09c859f96d0 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PerformanceTierProperties.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.mariadb.models; + +import com.azure.resourcemanager.mariadb.fluent.models.PerformanceTierPropertiesInner; +import java.util.List; + +/** An immutable client-side representation of PerformanceTierProperties. */ +public interface PerformanceTierProperties { + /** + * Gets the id property: ID of the performance tier. + * + * @return the id value. + */ + String id(); + + /** + * Gets the maxBackupRetentionDays property: Maximum Backup retention in days for the performance tier edition. + * + * @return the maxBackupRetentionDays value. + */ + Integer maxBackupRetentionDays(); + + /** + * Gets the minBackupRetentionDays property: Minimum Backup retention in days for the performance tier edition. + * + * @return the minBackupRetentionDays value. + */ + Integer minBackupRetentionDays(); + + /** + * Gets the maxStorageMB property: Max storage allowed for a server. + * + * @return the maxStorageMB value. + */ + Integer maxStorageMB(); + + /** + * Gets the minLargeStorageMB property: Max storage allowed for a server. + * + * @return the minLargeStorageMB value. + */ + Integer minLargeStorageMB(); + + /** + * Gets the maxLargeStorageMB property: Max storage allowed for a server. + * + * @return the maxLargeStorageMB value. + */ + Integer maxLargeStorageMB(); + + /** + * Gets the minStorageMB property: Max storage allowed for a server. + * + * @return the minStorageMB value. + */ + Integer minStorageMB(); + + /** + * Gets the serviceLevelObjectives property: Service level objectives associated with the performance tier. + * + * @return the serviceLevelObjectives value. + */ + List serviceLevelObjectives(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.PerformanceTierPropertiesInner object. + * + * @return the inner object. + */ + PerformanceTierPropertiesInner innerModel(); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PerformanceTierServiceLevelObjectives.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PerformanceTierServiceLevelObjectives.java new file mode 100644 index 000000000000..9a827e222740 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PerformanceTierServiceLevelObjectives.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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; + +/** Service level objectives for performance tier. */ +@Fluent +public final class PerformanceTierServiceLevelObjectives { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PerformanceTierServiceLevelObjectives.class); + + /* + * ID for the service level objective. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Edition of the performance tier. + */ + @JsonProperty(value = "edition") + private String edition; + + /* + * vCore associated with the service level objective + */ + @JsonProperty(value = "vCore") + private Integer vCore; + + /* + * Hardware generation associated with the service level objective + */ + @JsonProperty(value = "hardwareGeneration") + private String hardwareGeneration; + + /* + * Maximum Backup retention in days for the performance tier edition + */ + @JsonProperty(value = "maxBackupRetentionDays") + private Integer maxBackupRetentionDays; + + /* + * Minimum Backup retention in days for the performance tier edition + */ + @JsonProperty(value = "minBackupRetentionDays") + private Integer minBackupRetentionDays; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "maxStorageMB") + private Integer maxStorageMB; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "minStorageMB") + private Integer minStorageMB; + + /** + * Get the id property: ID for the service level objective. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: ID for the service level objective. + * + * @param id the id value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withId(String id) { + this.id = id; + return this; + } + + /** + * Get the edition property: Edition of the performance tier. + * + * @return the edition value. + */ + public String edition() { + return this.edition; + } + + /** + * Set the edition property: Edition of the performance tier. + * + * @param edition the edition value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withEdition(String edition) { + this.edition = edition; + return this; + } + + /** + * Get the vCore property: vCore associated with the service level objective. + * + * @return the vCore value. + */ + public Integer vCore() { + return this.vCore; + } + + /** + * Set the vCore property: vCore associated with the service level objective. + * + * @param vCore the vCore value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withVCore(Integer vCore) { + this.vCore = vCore; + return this; + } + + /** + * Get the hardwareGeneration property: Hardware generation associated with the service level objective. + * + * @return the hardwareGeneration value. + */ + public String hardwareGeneration() { + return this.hardwareGeneration; + } + + /** + * Set the hardwareGeneration property: Hardware generation associated with the service level objective. + * + * @param hardwareGeneration the hardwareGeneration value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withHardwareGeneration(String hardwareGeneration) { + this.hardwareGeneration = hardwareGeneration; + return this; + } + + /** + * Get the maxBackupRetentionDays property: Maximum Backup retention in days for the performance tier edition. + * + * @return the maxBackupRetentionDays value. + */ + public Integer maxBackupRetentionDays() { + return this.maxBackupRetentionDays; + } + + /** + * Set the maxBackupRetentionDays property: Maximum Backup retention in days for the performance tier edition. + * + * @param maxBackupRetentionDays the maxBackupRetentionDays value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withMaxBackupRetentionDays(Integer maxBackupRetentionDays) { + this.maxBackupRetentionDays = maxBackupRetentionDays; + return this; + } + + /** + * Get the minBackupRetentionDays property: Minimum Backup retention in days for the performance tier edition. + * + * @return the minBackupRetentionDays value. + */ + public Integer minBackupRetentionDays() { + return this.minBackupRetentionDays; + } + + /** + * Set the minBackupRetentionDays property: Minimum Backup retention in days for the performance tier edition. + * + * @param minBackupRetentionDays the minBackupRetentionDays value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withMinBackupRetentionDays(Integer minBackupRetentionDays) { + this.minBackupRetentionDays = minBackupRetentionDays; + return this; + } + + /** + * Get the maxStorageMB property: Max storage allowed for a server. + * + * @return the maxStorageMB value. + */ + public Integer maxStorageMB() { + return this.maxStorageMB; + } + + /** + * Set the maxStorageMB property: Max storage allowed for a server. + * + * @param maxStorageMB the maxStorageMB value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withMaxStorageMB(Integer maxStorageMB) { + this.maxStorageMB = maxStorageMB; + return this; + } + + /** + * Get the minStorageMB property: Max storage allowed for a server. + * + * @return the minStorageMB value. + */ + public Integer minStorageMB() { + return this.minStorageMB; + } + + /** + * Set the minStorageMB property: Max storage allowed for a server. + * + * @param minStorageMB the minStorageMB value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withMinStorageMB(Integer minStorageMB) { + this.minStorageMB = minStorageMB; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateEndpointConnection.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateEndpointConnection.java new file mode 100644 index 000000000000..afd1e88a527b --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateEndpointConnection.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.mariadb.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mariadb.fluent.models.PrivateEndpointConnectionInner; +import java.util.Map; + +/** 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.mariadb.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, serverName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * 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.WithTags { + /** + * 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 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. + */ + 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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateEndpointConnectionListResult.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 000000000000..47363f893de6 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/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.mariadb.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateEndpointConnections.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateEndpointConnections.java new file mode 100644 index 000000000000..c5d64c04c25e --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateEndpointConnections.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateEndpointConnections. */ +public interface PrivateEndpointConnections { + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 serverName, String privateEndpointConnectionName); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 serverName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverName, String privateEndpointConnectionName, Context context); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, 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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateEndpointProperty.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateEndpointProperty.java new file mode 100644 index 000000000000..d4cdb4e2beaa --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/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.mariadb.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 PrivateEndpointProperty model. */ +@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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateEndpointProvisioningState.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateEndpointProvisioningState.java new file mode 100644 index 000000000000..aa011c5d2772 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateEndpointProvisioningState.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.mariadb.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateEndpointProvisioningState. */ +public final class PrivateEndpointProvisioningState extends ExpandableStringEnum { + /** Static value Approving for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState APPROVING = fromString("Approving"); + + /** Static value Ready for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState READY = fromString("Ready"); + + /** Static value Dropping for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState DROPPING = fromString("Dropping"); + + /** Static value Failed for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState FAILED = fromString("Failed"); + + /** Static value Rejecting for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState REJECTING = fromString("Rejecting"); + + /** + * Creates or finds a PrivateEndpointProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointProvisioningState. + */ + @JsonCreator + public static PrivateEndpointProvisioningState fromString(String name) { + return fromString(name, PrivateEndpointProvisioningState.class); + } + + /** @return known PrivateEndpointProvisioningState values. */ + public static Collection values() { + return values(PrivateEndpointProvisioningState.class); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkResource.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkResource.java new file mode 100644 index 000000000000..6a78c0b413ff --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkResource.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.mariadb.models; + +import com.azure.resourcemanager.mariadb.fluent.models.PrivateLinkResourceInner; + +/** 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 properties property: The private link resource group id. + * + * @return the properties value. + */ + PrivateLinkResourceProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkResourceListResult.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkResourceListResult.java new file mode 100644 index 000000000000..4469e07e1704 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/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.mariadb.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkResourceProperties.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkResourceProperties.java new file mode 100644 index 000000000000..a7fd0e923f1c --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkResourceProperties.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.mariadb.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.util.List; + +/** Properties of a private link resource. */ +@Immutable +public final class PrivateLinkResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceProperties.class); + + /* + * The private link resource group id. + */ + @JsonProperty(value = "groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The private link resource required member names. + */ + @JsonProperty(value = "requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkResources.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkResources.java new file mode 100644 index 000000000000..b6392c8e9e1b --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkResources.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.mariadb.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 for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 for MariaDB server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets the private link resources for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 for MariaDB server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a private link resource for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 a private link resource for MariaDB server. + */ + PrivateLinkResource get(String resourceGroupName, String serverName, String groupName); + + /** + * Gets a private link resource for MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @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 a private link resource for MariaDB server. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkServiceConnectionStateActionsRequire.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkServiceConnectionStateActionsRequire.java new file mode 100644 index 000000000000..549505e87f7c --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkServiceConnectionStateActionsRequire.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.mariadb.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateLinkServiceConnectionStateActionsRequire. */ +public final class PrivateLinkServiceConnectionStateActionsRequire + extends ExpandableStringEnum { + /** Static value None for PrivateLinkServiceConnectionStateActionsRequire. */ + public static final PrivateLinkServiceConnectionStateActionsRequire NONE = fromString("None"); + + /** + * Creates or finds a PrivateLinkServiceConnectionStateActionsRequire from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateLinkServiceConnectionStateActionsRequire. + */ + @JsonCreator + public static PrivateLinkServiceConnectionStateActionsRequire fromString(String name) { + return fromString(name, PrivateLinkServiceConnectionStateActionsRequire.class); + } + + /** @return known PrivateLinkServiceConnectionStateActionsRequire values. */ + public static Collection values() { + return values(PrivateLinkServiceConnectionStateActionsRequire.class); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkServiceConnectionStateProperty.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkServiceConnectionStateProperty.java new file mode 100644 index 000000000000..5f6c70039477 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/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.mariadb.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 PrivateLinkServiceConnectionStateProperty model. */ +@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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkServiceConnectionStateStatus.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkServiceConnectionStateStatus.java new file mode 100644 index 000000000000..6a1cc7aba934 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PrivateLinkServiceConnectionStateStatus.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.mariadb.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateLinkServiceConnectionStateStatus. */ +public final class PrivateLinkServiceConnectionStateStatus + extends ExpandableStringEnum { + /** Static value Approved for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus APPROVED = fromString("Approved"); + + /** Static value Pending for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus PENDING = fromString("Pending"); + + /** Static value Rejected for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus REJECTED = fromString("Rejected"); + + /** Static value Disconnected for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus DISCONNECTED = fromString("Disconnected"); + + /** + * Creates or finds a PrivateLinkServiceConnectionStateStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateLinkServiceConnectionStateStatus. + */ + @JsonCreator + public static PrivateLinkServiceConnectionStateStatus fromString(String name) { + return fromString(name, PrivateLinkServiceConnectionStateStatus.class); + } + + /** @return known PrivateLinkServiceConnectionStateStatus values. */ + public static Collection values() { + return values(PrivateLinkServiceConnectionStateStatus.class); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PublicNetworkAccessEnum.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PublicNetworkAccessEnum.java new file mode 100644 index 000000000000..0de3fd828e36 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/PublicNetworkAccessEnum.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.mariadb.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PublicNetworkAccessEnum. */ +public final class PublicNetworkAccessEnum extends ExpandableStringEnum { + /** Static value Enabled for PublicNetworkAccessEnum. */ + public static final PublicNetworkAccessEnum ENABLED = fromString("Enabled"); + + /** Static value Disabled for PublicNetworkAccessEnum. */ + public static final PublicNetworkAccessEnum DISABLED = fromString("Disabled"); + + /** + * Creates or finds a PublicNetworkAccessEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicNetworkAccessEnum. + */ + @JsonCreator + public static PublicNetworkAccessEnum fromString(String name) { + return fromString(name, PublicNetworkAccessEnum.class); + } + + /** @return known PublicNetworkAccessEnum values. */ + public static Collection values() { + return values(PublicNetworkAccessEnum.class); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryPerformanceInsightResetDataResult.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryPerformanceInsightResetDataResult.java new file mode 100644 index 000000000000..81b855ac473c --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryPerformanceInsightResetDataResult.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.mariadb.models; + +import com.azure.resourcemanager.mariadb.fluent.models.QueryPerformanceInsightResetDataResultInner; + +/** An immutable client-side representation of QueryPerformanceInsightResetDataResult. */ +public interface QueryPerformanceInsightResetDataResult { + /** + * Gets the status property: Indicates result of the operation. + * + * @return the status value. + */ + QueryPerformanceInsightResetDataResultState status(); + + /** + * Gets the message property: operation message. + * + * @return the message value. + */ + String message(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.QueryPerformanceInsightResetDataResultInner + * object. + * + * @return the inner object. + */ + QueryPerformanceInsightResetDataResultInner innerModel(); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryPerformanceInsightResetDataResultState.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryPerformanceInsightResetDataResultState.java new file mode 100644 index 000000000000..1bf6932089e6 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryPerformanceInsightResetDataResultState.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.mariadb.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for QueryPerformanceInsightResetDataResultState. */ +public final class QueryPerformanceInsightResetDataResultState + extends ExpandableStringEnum { + /** Static value Succeeded for QueryPerformanceInsightResetDataResultState. */ + public static final QueryPerformanceInsightResetDataResultState SUCCEEDED = fromString("Succeeded"); + + /** Static value Failed for QueryPerformanceInsightResetDataResultState. */ + public static final QueryPerformanceInsightResetDataResultState FAILED = fromString("Failed"); + + /** + * Creates or finds a QueryPerformanceInsightResetDataResultState from its string representation. + * + * @param name a name to look for. + * @return the corresponding QueryPerformanceInsightResetDataResultState. + */ + @JsonCreator + public static QueryPerformanceInsightResetDataResultState fromString(String name) { + return fromString(name, QueryPerformanceInsightResetDataResultState.class); + } + + /** @return known QueryPerformanceInsightResetDataResultState values. */ + public static Collection values() { + return values(QueryPerformanceInsightResetDataResultState.class); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryStatistic.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryStatistic.java new file mode 100644 index 000000000000..5a7e03dc0adb --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryStatistic.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.mariadb.models; + +import com.azure.resourcemanager.mariadb.fluent.models.QueryStatisticInner; +import java.time.OffsetDateTime; +import java.util.List; + +/** An immutable client-side representation of QueryStatistic. */ +public interface QueryStatistic { + /** + * 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 queryId property: Database query identifier. + * + * @return the queryId value. + */ + String queryId(); + + /** + * Gets the startTime property: Observation start time. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: Observation end time. + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the aggregationFunction property: Aggregation function name. + * + * @return the aggregationFunction value. + */ + String aggregationFunction(); + + /** + * Gets the databaseNames property: The list of database names. + * + * @return the databaseNames value. + */ + List databaseNames(); + + /** + * Gets the queryExecutionCount property: Number of query executions in this time interval. + * + * @return the queryExecutionCount value. + */ + Long queryExecutionCount(); + + /** + * Gets the metricName property: Metric name. + * + * @return the metricName value. + */ + String metricName(); + + /** + * Gets the metricDisplayName property: Metric display name. + * + * @return the metricDisplayName value. + */ + String metricDisplayName(); + + /** + * Gets the metricValue property: Metric value. + * + * @return the metricValue value. + */ + Double metricValue(); + + /** + * Gets the metricValueUnit property: Metric value unit. + * + * @return the metricValueUnit value. + */ + String metricValueUnit(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.QueryStatisticInner object. + * + * @return the inner object. + */ + QueryStatisticInner innerModel(); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryText.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryText.java new file mode 100644 index 000000000000..6758f565e725 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryText.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.mariadb.models; + +import com.azure.resourcemanager.mariadb.fluent.models.QueryTextInner; + +/** An immutable client-side representation of QueryText. */ +public interface QueryText { + /** + * 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 queryId property: Query identifier unique to the server. + * + * @return the queryId value. + */ + String queryId(); + + /** + * Gets the queryText property: Query text. + * + * @return the queryText value. + */ + String queryText(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.QueryTextInner object. + * + * @return the inner object. + */ + QueryTextInner innerModel(); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryTexts.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryTexts.java new file mode 100644 index 000000000000..812e23fefee9 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryTexts.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.mariadb.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import java.util.List; + +/** Resource collection API of QueryTexts. */ +public interface QueryTexts { + /** + * Retrieve the Query-Store query texts for the queryId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryId The Query-Store query identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Query Text. + */ + QueryText get(String resourceGroupName, String serverName, String queryId); + + /** + * Retrieve the Query-Store query texts for the queryId. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryId The Query-Store query identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Query Text. + */ + Response getWithResponse(String resourceGroupName, String serverName, String queryId, Context context); + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query texts. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, List queryIds); + + /** + * Retrieve the Query-Store query texts for specified queryIds. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryIds The query identifiers. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query texts. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, List queryIds, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryTextsResultList.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryTextsResultList.java new file mode 100644 index 000000000000..a856fe8359a7 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/QueryTextsResultList.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.mariadb.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.fluent.models.QueryTextInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of query texts. */ +@Immutable +public final class QueryTextsResultList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(QueryTextsResultList.class); + + /* + * The list of query texts. + */ + @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: The list of query texts. + * + * @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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecommendationAction.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecommendationAction.java new file mode 100644 index 000000000000..0eb641e96e0a --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecommendationAction.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.mariadb.models; + +import com.azure.resourcemanager.mariadb.fluent.models.RecommendationActionInner; +import java.time.OffsetDateTime; +import java.util.Map; + +/** An immutable client-side representation of RecommendationAction. */ +public interface RecommendationAction { + /** + * 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 advisorName property: Advisor name. + * + * @return the advisorName value. + */ + String advisorName(); + + /** + * Gets the sessionId property: Recommendation action session identifier. + * + * @return the sessionId value. + */ + String sessionId(); + + /** + * Gets the actionId property: Recommendation action identifier. + * + * @return the actionId value. + */ + Integer actionId(); + + /** + * Gets the createdTime property: Recommendation action creation time. + * + * @return the createdTime value. + */ + OffsetDateTime createdTime(); + + /** + * Gets the expirationTime property: Recommendation action expiration time. + * + * @return the expirationTime value. + */ + OffsetDateTime expirationTime(); + + /** + * Gets the reason property: Recommendation action reason. + * + * @return the reason value. + */ + String reason(); + + /** + * Gets the recommendationType property: Recommendation action type. + * + * @return the recommendationType value. + */ + String recommendationType(); + + /** + * Gets the details property: Recommendation action details. + * + * @return the details value. + */ + Map details(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.RecommendationActionInner object. + * + * @return the inner object. + */ + RecommendationActionInner innerModel(); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecommendationActionsResultList.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecommendationActionsResultList.java new file mode 100644 index 000000000000..f3028dfd460b --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecommendationActionsResultList.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.mariadb.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.fluent.models.RecommendationActionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of recommendation actions. */ +@Immutable +public final class RecommendationActionsResultList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecommendationActionsResultList.class); + + /* + * The list of recommendation action advisors. + */ + @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: The list of recommendation action advisors. + * + * @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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecommendedActionSessionsOperationStatus.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecommendedActionSessionsOperationStatus.java new file mode 100644 index 000000000000..c82832dc6eba --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecommendedActionSessionsOperationStatus.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.mariadb.models; + +import com.azure.resourcemanager.mariadb.fluent.models.RecommendedActionSessionsOperationStatusInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of RecommendedActionSessionsOperationStatus. */ +public interface RecommendedActionSessionsOperationStatus { + /** + * Gets the name property: Operation identifier. + * + * @return the name value. + */ + String name(); + + /** + * Gets the startTime property: Operation start time. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the status property: Operation status. + * + * @return the status value. + */ + String status(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.RecommendedActionSessionsOperationStatusInner + * object. + * + * @return the inner object. + */ + RecommendedActionSessionsOperationStatusInner innerModel(); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecommendedActions.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecommendedActions.java new file mode 100644 index 000000000000..6265b1ccb95f --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecommendedActions.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.mariadb.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 RecommendedActions. */ +public interface RecommendedActions { + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param recommendedActionName The recommended action 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 represents a Recommendation Action. + */ + RecommendationAction get( + String resourceGroupName, String serverName, String advisorName, String recommendedActionName); + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param recommendedActionName The recommended action 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 represents a Recommendation Action. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String advisorName, String recommendedActionName, Context context); + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, String advisorName); + + /** + * Retrieve recommended actions from the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param sessionId The recommendation action session identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of recommendation actions. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, String advisorName, String sessionId, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecoverableServerResource.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecoverableServerResource.java new file mode 100644 index 000000000000..422eecf7cbd7 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecoverableServerResource.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.mariadb.models; + +import com.azure.resourcemanager.mariadb.fluent.models.RecoverableServerResourceInner; + +/** An immutable client-side representation of RecoverableServerResource. */ +public interface RecoverableServerResource { + /** + * 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 lastAvailableBackupDateTime property: The last available backup date time. + * + * @return the lastAvailableBackupDateTime value. + */ + String lastAvailableBackupDateTime(); + + /** + * Gets the serviceLevelObjective property: The service level objective. + * + * @return the serviceLevelObjective value. + */ + String serviceLevelObjective(); + + /** + * Gets the edition property: Edition of the performance tier. + * + * @return the edition value. + */ + String edition(); + + /** + * Gets the vCore property: vCore associated with the service level objective. + * + * @return the vCore value. + */ + Integer vCore(); + + /** + * Gets the hardwareGeneration property: Hardware generation associated with the service level objective. + * + * @return the hardwareGeneration value. + */ + String hardwareGeneration(); + + /** + * Gets the version property: The MariaDB version. + * + * @return the version value. + */ + String version(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.RecoverableServerResourceInner object. + * + * @return the inner object. + */ + RecoverableServerResourceInner innerModel(); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecoverableServers.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecoverableServers.java new file mode 100644 index 000000000000..31c7a5184ae1 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/RecoverableServers.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.mariadb.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of RecoverableServers. */ +public interface RecoverableServers { + /** + * Gets a recoverable MariaDB Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable MariaDB Server. + */ + RecoverableServerResource get(String resourceGroupName, String serverName); + + /** + * Gets a recoverable MariaDB Server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a recoverable MariaDB Server. + */ + Response getWithResponse(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Replicas.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Replicas.java new file mode 100644 index 000000000000..0ee3891323d9 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Replicas.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.mariadb.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Replicas. */ +public interface Replicas { + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ResourceProviders.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ResourceProviders.java new file mode 100644 index 000000000000..bc7a4b904090 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ResourceProviders.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.mariadb.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ResourceProviders. */ +public interface ResourceProviders { + /** + * Reset data for Query Performance Insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Query Performance Insight data reset. + */ + QueryPerformanceInsightResetDataResult resetQueryPerformanceInsightData( + String resourceGroupName, String serverName); + + /** + * Reset data for Query Performance Insight. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 Query Performance Insight data reset. + */ + Response resetQueryPerformanceInsightDataWithResponse( + String resourceGroupName, String serverName, Context context); + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 createRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName); + + /** + * Create recommendation action session for the advisor. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param advisorName The advisor name for recommendation action. + * @param databaseName The name of the database. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 createRecommendedActionSession( + String resourceGroupName, String serverName, String advisorName, String databaseName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/SecurityAlertPolicyName.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/SecurityAlertPolicyName.java new file mode 100644 index 000000000000..e82be3cdf381 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/SecurityAlertPolicyName.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.mariadb.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SecurityAlertPolicyName. */ +public final class SecurityAlertPolicyName extends ExpandableStringEnum { + /** Static value Default for SecurityAlertPolicyName. */ + public static final SecurityAlertPolicyName DEFAULT = fromString("Default"); + + /** + * Creates or finds a SecurityAlertPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecurityAlertPolicyName. + */ + @JsonCreator + public static SecurityAlertPolicyName fromString(String name) { + return fromString(name, SecurityAlertPolicyName.class); + } + + /** @return known SecurityAlertPolicyName values. */ + public static Collection values() { + return values(SecurityAlertPolicyName.class); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Server.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Server.java new file mode 100644 index 000000000000..09f243bed3d3 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Server.java @@ -0,0 +1,388 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.models; + +import com.azure.core.management.Region; +import com.azure.core.util.Context; +import com.azure.resourcemanager.mariadb.fluent.models.ServerInner; +import java.time.OffsetDateTime; +import java.util.List; +import java.util.Map; + +/** An immutable client-side representation of Server. */ +public interface Server { + /** + * 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 sku property: The SKU (pricing tier) of the server. + * + * @return the sku value. + */ + Sku sku(); + + /** + * Gets the administratorLogin property: The administrator's login name of a server. Can only be specified when the + * server is being created (and is required for creation). + * + * @return the administratorLogin value. + */ + String administratorLogin(); + + /** + * Gets the version property: Server version. + * + * @return the version value. + */ + ServerVersion version(); + + /** + * Gets the sslEnforcement property: Enable ssl enforcement or not when connect to server. + * + * @return the sslEnforcement value. + */ + SslEnforcementEnum sslEnforcement(); + + /** + * Gets the userVisibleState property: A state of a server that is visible to user. + * + * @return the userVisibleState value. + */ + ServerState userVisibleState(); + + /** + * Gets the fullyQualifiedDomainName property: The fully qualified domain name of a server. + * + * @return the fullyQualifiedDomainName value. + */ + String fullyQualifiedDomainName(); + + /** + * Gets the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). + * + * @return the earliestRestoreDate value. + */ + OffsetDateTime earliestRestoreDate(); + + /** + * Gets the storageProfile property: Storage profile of a server. + * + * @return the storageProfile value. + */ + StorageProfile storageProfile(); + + /** + * Gets the replicationRole property: The replication role of the server. + * + * @return the replicationRole value. + */ + String replicationRole(); + + /** + * Gets the masterServerId property: The master server id of a replica server. + * + * @return the masterServerId value. + */ + String masterServerId(); + + /** + * Gets the replicaCapacity property: The maximum number of replicas that a master server can have. + * + * @return the replicaCapacity value. + */ + Integer replicaCapacity(); + + /** + * Gets the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the publicNetworkAccess value. + */ + PublicNetworkAccessEnum publicNetworkAccess(); + + /** + * Gets the privateEndpointConnections property: List of private endpoint connections on a server. + * + * @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.mariadb.fluent.models.ServerInner object. + * + * @return the inner object. + */ + ServerInner innerModel(); + + /** The entirety of the Server definition. */ + interface Definition + extends DefinitionStages.Blank, + DefinitionStages.WithLocation, + DefinitionStages.WithResourceGroup, + DefinitionStages.WithProperties, + DefinitionStages.WithCreate { + } + /** The Server definition stages. */ + interface DefinitionStages { + /** The first stage of the Server definition. */ + interface Blank extends WithLocation { + } + /** The stage of the Server definition allowing to specify location. */ + interface WithLocation { + /** + * Specifies the region for the resource. + * + * @param location The location the resource resides in. + * @return the next definition stage. + */ + WithResourceGroup withRegion(Region location); + + /** + * Specifies the region for the resource. + * + * @param location The location the resource resides in. + * @return the next definition stage. + */ + WithResourceGroup withRegion(String location); + } + /** The stage of the Server 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. + */ + WithProperties withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the Server definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties of the server.. + * + * @param properties Properties of the server. + * @return the next definition stage. + */ + WithCreate withProperties(ServerPropertiesForCreate properties); + } + /** + * The stage of the Server 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.WithSku { + /** + * Executes the create request. + * + * @return the created resource. + */ + Server create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + Server create(Context context); + } + /** The stage of the Server definition allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Application-specific metadata in the form of key-value pairs.. + * + * @param tags Application-specific metadata in the form of key-value pairs. + * @return the next definition stage. + */ + WithCreate withTags(Map tags); + } + /** The stage of the Server definition allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The SKU (pricing tier) of the server.. + * + * @param sku The SKU (pricing tier) of the server. + * @return the next definition stage. + */ + WithCreate withSku(Sku sku); + } + } + /** + * Begins update for the Server resource. + * + * @return the stage of resource update. + */ + Server.Update update(); + + /** The template for Server update. */ + interface Update + extends UpdateStages.WithTags, + UpdateStages.WithSku, + UpdateStages.WithStorageProfile, + UpdateStages.WithAdministratorLoginPassword, + UpdateStages.WithVersion, + UpdateStages.WithSslEnforcement, + UpdateStages.WithPublicNetworkAccess, + UpdateStages.WithReplicationRole { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Server apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Server apply(Context context); + } + /** The Server update stages. */ + interface UpdateStages { + /** The stage of the Server update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Application-specific metadata in the form of key-value pairs.. + * + * @param tags Application-specific metadata in the form of key-value pairs. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + /** The stage of the Server update allowing to specify sku. */ + interface WithSku { + /** + * Specifies the sku property: The SKU (pricing tier) of the server.. + * + * @param sku The SKU (pricing tier) of the server. + * @return the next definition stage. + */ + Update withSku(Sku sku); + } + /** The stage of the Server update allowing to specify storageProfile. */ + interface WithStorageProfile { + /** + * Specifies the storageProfile property: Storage profile of a server.. + * + * @param storageProfile Storage profile of a server. + * @return the next definition stage. + */ + Update withStorageProfile(StorageProfile storageProfile); + } + /** The stage of the Server update allowing to specify administratorLoginPassword. */ + interface WithAdministratorLoginPassword { + /** + * Specifies the administratorLoginPassword property: The password of the administrator login.. + * + * @param administratorLoginPassword The password of the administrator login. + * @return the next definition stage. + */ + Update withAdministratorLoginPassword(String administratorLoginPassword); + } + /** The stage of the Server update allowing to specify version. */ + interface WithVersion { + /** + * Specifies the version property: The version of a server.. + * + * @param version The version of a server. + * @return the next definition stage. + */ + Update withVersion(ServerVersion version); + } + /** The stage of the Server update allowing to specify sslEnforcement. */ + interface WithSslEnforcement { + /** + * Specifies the sslEnforcement property: Enable ssl enforcement or not when connect to server.. + * + * @param sslEnforcement Enable ssl enforcement or not when connect to server. + * @return the next definition stage. + */ + Update withSslEnforcement(SslEnforcementEnum sslEnforcement); + } + /** The stage of the Server update allowing to specify publicNetworkAccess. */ + interface WithPublicNetworkAccess { + /** + * Specifies the publicNetworkAccess property: Whether or not public network access is allowed for this + * server. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param publicNetworkAccess Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * @return the next definition stage. + */ + Update withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess); + } + /** The stage of the Server update allowing to specify replicationRole. */ + interface WithReplicationRole { + /** + * Specifies the replicationRole property: The replication role of the server.. + * + * @param replicationRole The replication role of the server. + * @return the next definition stage. + */ + Update withReplicationRole(String replicationRole); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + Server refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + Server refresh(Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerBasedPerformanceTiers.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerBasedPerformanceTiers.java new file mode 100644 index 000000000000..a0ce87d01869 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerBasedPerformanceTiers.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.mariadb.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ServerBasedPerformanceTiers. */ +public interface ServerBasedPerformanceTiers { + /** + * List all the performance tiers for a MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + PagedIterable list(String resourceGroupName, String serverName); + + /** + * List all the performance tiers for a MariaDB server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + PagedIterable list(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerForCreate.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerForCreate.java new file mode 100644 index 000000000000..7c654511e8af --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerForCreate.java @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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; + +/** Represents a server to be created. */ +@Fluent +public final class ServerForCreate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerForCreate.class); + + /* + * The SKU (pricing tier) of the server. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Properties of the server. + */ + @JsonProperty(value = "properties", required = true) + private ServerPropertiesForCreate properties; + + /* + * The location the resource resides in. + */ + @JsonProperty(value = "location", required = true) + private String location; + + /* + * Application-specific metadata in the form of key-value pairs. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the sku property: The SKU (pricing tier) of the server. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU (pricing tier) of the server. + * + * @param sku the sku value to set. + * @return the ServerForCreate object itself. + */ + public ServerForCreate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the properties property: Properties of the server. + * + * @return the properties value. + */ + public ServerPropertiesForCreate properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the server. + * + * @param properties the properties value to set. + * @return the ServerForCreate object itself. + */ + public ServerForCreate withProperties(ServerPropertiesForCreate properties) { + this.properties = properties; + return this; + } + + /** + * Get the location property: The location the resource resides in. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location the resource resides in. + * + * @param location the location value to set. + * @return the ServerForCreate object itself. + */ + public ServerForCreate withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: Application-specific metadata in the form of key-value pairs. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Application-specific metadata in the form of key-value pairs. + * + * @param tags the tags value to set. + * @return the ServerForCreate object itself. + */ + public ServerForCreate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (properties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property properties in model ServerForCreate")); + } else { + properties().validate(); + } + if (location() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property location in model ServerForCreate")); + } + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerListResult.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerListResult.java new file mode 100644 index 000000000000..274234484a65 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerListResult.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.mariadb.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.fluent.models.ServerInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of servers. */ +@Fluent +public final class ServerListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerListResult.class); + + /* + * The list of servers + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of servers. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of servers. + * + * @param value the value value to set. + * @return the ServerListResult object itself. + */ + public ServerListResult 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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerParameters.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerParameters.java new file mode 100644 index 000000000000..0158e68f4efc --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerParameters.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.mariadb.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mariadb.fluent.models.ConfigurationListResultInner; + +/** Resource collection API of ServerParameters. */ +public interface ServerParameters { + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + ConfigurationListResult listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value); + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + ConfigurationListResult listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPrivateEndpointConnection.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPrivateEndpointConnection.java new file mode 100644 index 000000000000..2f4a8666c39f --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPrivateEndpointConnection.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.mariadb.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; + +/** A private endpoint connection under a server. */ +@Immutable +public final class ServerPrivateEndpointConnection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerPrivateEndpointConnection.class); + + /* + * Resource Id of the private endpoint connection. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Private endpoint connection properties + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private ServerPrivateEndpointConnectionProperties properties; + + /** + * Get the id property: Resource Id of the private endpoint connection. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the properties property: Private endpoint connection properties. + * + * @return the properties value. + */ + public ServerPrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPrivateEndpointConnectionProperties.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPrivateEndpointConnectionProperties.java new file mode 100644 index 000000000000..9912937cceeb --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPrivateEndpointConnectionProperties.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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; + +/** Properties of a private endpoint connection. */ +@Fluent +public final class ServerPrivateEndpointConnectionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerPrivateEndpointConnectionProperties.class); + + /* + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpointProperty privateEndpoint; + + /* + * Connection state of the private endpoint connection. + */ + @JsonProperty(value = "privateLinkServiceConnectionState") + private ServerPrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /* + * State of the private endpoint connection. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private PrivateEndpointProvisioningState 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 ServerPrivateEndpointConnectionProperties object itself. + */ + public ServerPrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public ServerPrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the ServerPrivateEndpointConnectionProperties object itself. + */ + public ServerPrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + ServerPrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + public PrivateEndpointProvisioningState 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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPrivateLinkServiceConnectionStateProperty.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPrivateLinkServiceConnectionStateProperty.java new file mode 100644 index 000000000000..aef6a64f0a67 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPrivateLinkServiceConnectionStateProperty.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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 ServerPrivateLinkServiceConnectionStateProperty model. */ +@Fluent +public final class ServerPrivateLinkServiceConnectionStateProperty { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ServerPrivateLinkServiceConnectionStateProperty.class); + + /* + * The private link service connection status. + */ + @JsonProperty(value = "status", required = true) + private PrivateLinkServiceConnectionStateStatus 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 PrivateLinkServiceConnectionStateActionsRequire actionsRequired; + + /** + * Get the status property: The private link service connection status. + * + * @return the status value. + */ + public PrivateLinkServiceConnectionStateStatus status() { + return this.status; + } + + /** + * Set the status property: The private link service connection status. + * + * @param status the status value to set. + * @return the ServerPrivateLinkServiceConnectionStateProperty object itself. + */ + public ServerPrivateLinkServiceConnectionStateProperty withStatus(PrivateLinkServiceConnectionStateStatus 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 ServerPrivateLinkServiceConnectionStateProperty object itself. + */ + public ServerPrivateLinkServiceConnectionStateProperty 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 PrivateLinkServiceConnectionStateActionsRequire 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 ServerPrivateLinkServiceConnectionStateProperty")); + } + if (description() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property description in model" + + " ServerPrivateLinkServiceConnectionStateProperty")); + } + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForCreate.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForCreate.java new file mode 100644 index 000000000000..f4e6fc5fdf5e --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForCreate.java @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The properties used to create a new server. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "createMode", + defaultImpl = ServerPropertiesForCreate.class) +@JsonTypeName("ServerPropertiesForCreate") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Default", value = ServerPropertiesForDefaultCreate.class), + @JsonSubTypes.Type(name = "PointInTimeRestore", value = ServerPropertiesForRestore.class), + @JsonSubTypes.Type(name = "GeoRestore", value = ServerPropertiesForGeoRestore.class), + @JsonSubTypes.Type(name = "Replica", value = ServerPropertiesForReplica.class) +}) +@Fluent +public class ServerPropertiesForCreate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerPropertiesForCreate.class); + + /* + * Server version. + */ + @JsonProperty(value = "version") + private ServerVersion version; + + /* + * Enable ssl enforcement or not when connect to server. + */ + @JsonProperty(value = "sslEnforcement") + private SslEnforcementEnum sslEnforcement; + + /* + * Whether or not public network access is allowed for this server. Value + * is optional but if passed in, must be 'Enabled' or 'Disabled' + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccessEnum publicNetworkAccess; + + /* + * Storage profile of a server. + */ + @JsonProperty(value = "storageProfile") + private StorageProfile storageProfile; + + /** + * Get the version property: Server version. + * + * @return the version value. + */ + public ServerVersion version() { + return this.version; + } + + /** + * Set the version property: Server version. + * + * @param version the version value to set. + * @return the ServerPropertiesForCreate object itself. + */ + public ServerPropertiesForCreate withVersion(ServerVersion version) { + this.version = version; + return this; + } + + /** + * Get the sslEnforcement property: Enable ssl enforcement or not when connect to server. + * + * @return the sslEnforcement value. + */ + public SslEnforcementEnum sslEnforcement() { + return this.sslEnforcement; + } + + /** + * Set the sslEnforcement property: Enable ssl enforcement or not when connect to server. + * + * @param sslEnforcement the sslEnforcement value to set. + * @return the ServerPropertiesForCreate object itself. + */ + public ServerPropertiesForCreate withSslEnforcement(SslEnforcementEnum sslEnforcement) { + this.sslEnforcement = sslEnforcement; + return this; + } + + /** + * Get the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccessEnum publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the ServerPropertiesForCreate object itself. + */ + public ServerPropertiesForCreate withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the storageProfile property: Storage profile of a server. + * + * @return the storageProfile value. + */ + public StorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: Storage profile of a server. + * + * @param storageProfile the storageProfile value to set. + * @return the ServerPropertiesForCreate object itself. + */ + public ServerPropertiesForCreate withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageProfile() != null) { + storageProfile().validate(); + } + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForDefaultCreate.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForDefaultCreate.java new file mode 100644 index 000000000000..2acd622e3fce --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForDefaultCreate.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.mariadb.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; + +/** The properties used to create a new server. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "createMode") +@JsonTypeName("Default") +@Fluent +public final class ServerPropertiesForDefaultCreate extends ServerPropertiesForCreate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerPropertiesForDefaultCreate.class); + + /* + * The administrator's login name of a server. Can only be specified when + * the server is being created (and is required for creation). + */ + @JsonProperty(value = "administratorLogin", required = true) + private String administratorLogin; + + /* + * The password of the administrator login. + */ + @JsonProperty(value = "administratorLoginPassword", required = true) + private String administratorLoginPassword; + + /** + * Get the administratorLogin property: The administrator's login name of a server. Can only be specified when the + * server is being created (and is required for creation). + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: The administrator's login name of a server. Can only be specified when the + * server is being created (and is required for creation). + * + * @param administratorLogin the administratorLogin value to set. + * @return the ServerPropertiesForDefaultCreate object itself. + */ + public ServerPropertiesForDefaultCreate withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: The password of the administrator login. + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: The password of the administrator login. + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ServerPropertiesForDefaultCreate object itself. + */ + public ServerPropertiesForDefaultCreate withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForDefaultCreate withVersion(ServerVersion version) { + super.withVersion(version); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForDefaultCreate withSslEnforcement(SslEnforcementEnum sslEnforcement) { + super.withSslEnforcement(sslEnforcement); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForDefaultCreate withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + super.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForDefaultCreate withStorageProfile(StorageProfile storageProfile) { + super.withStorageProfile(storageProfile); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (administratorLogin() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorLogin in model ServerPropertiesForDefaultCreate")); + } + if (administratorLoginPassword() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorLoginPassword in model" + + " ServerPropertiesForDefaultCreate")); + } + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForGeoRestore.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForGeoRestore.java new file mode 100644 index 000000000000..88f94ff2a2d2 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForGeoRestore.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.mariadb.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; + +/** The properties used to create a new server by restoring to a different region from a geo replicated backup. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "createMode") +@JsonTypeName("GeoRestore") +@Fluent +public final class ServerPropertiesForGeoRestore extends ServerPropertiesForCreate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerPropertiesForGeoRestore.class); + + /* + * The source server id to restore from. + */ + @JsonProperty(value = "sourceServerId", required = true) + private String sourceServerId; + + /** + * Get the sourceServerId property: The source server id to restore from. + * + * @return the sourceServerId value. + */ + public String sourceServerId() { + return this.sourceServerId; + } + + /** + * Set the sourceServerId property: The source server id to restore from. + * + * @param sourceServerId the sourceServerId value to set. + * @return the ServerPropertiesForGeoRestore object itself. + */ + public ServerPropertiesForGeoRestore withSourceServerId(String sourceServerId) { + this.sourceServerId = sourceServerId; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForGeoRestore withVersion(ServerVersion version) { + super.withVersion(version); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForGeoRestore withSslEnforcement(SslEnforcementEnum sslEnforcement) { + super.withSslEnforcement(sslEnforcement); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForGeoRestore withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + super.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForGeoRestore withStorageProfile(StorageProfile storageProfile) { + super.withStorageProfile(storageProfile); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (sourceServerId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceServerId in model ServerPropertiesForGeoRestore")); + } + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForReplica.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForReplica.java new file mode 100644 index 000000000000..7fcbb7e7e320 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForReplica.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.mariadb.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; + +/** The properties to create a new replica. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "createMode") +@JsonTypeName("Replica") +@Fluent +public final class ServerPropertiesForReplica extends ServerPropertiesForCreate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerPropertiesForReplica.class); + + /* + * The master server id to create replica from. + */ + @JsonProperty(value = "sourceServerId", required = true) + private String sourceServerId; + + /** + * Get the sourceServerId property: The master server id to create replica from. + * + * @return the sourceServerId value. + */ + public String sourceServerId() { + return this.sourceServerId; + } + + /** + * Set the sourceServerId property: The master server id to create replica from. + * + * @param sourceServerId the sourceServerId value to set. + * @return the ServerPropertiesForReplica object itself. + */ + public ServerPropertiesForReplica withSourceServerId(String sourceServerId) { + this.sourceServerId = sourceServerId; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForReplica withVersion(ServerVersion version) { + super.withVersion(version); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForReplica withSslEnforcement(SslEnforcementEnum sslEnforcement) { + super.withSslEnforcement(sslEnforcement); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForReplica withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + super.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForReplica withStorageProfile(StorageProfile storageProfile) { + super.withStorageProfile(storageProfile); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (sourceServerId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceServerId in model ServerPropertiesForReplica")); + } + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForRestore.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForRestore.java new file mode 100644 index 000000000000..ff82daf58a0b --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerPropertiesForRestore.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.mariadb.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; + +/** The properties used to create a new server by restoring from a backup. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "createMode") +@JsonTypeName("PointInTimeRestore") +@Fluent +public final class ServerPropertiesForRestore extends ServerPropertiesForCreate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerPropertiesForRestore.class); + + /* + * The source server id to restore from. + */ + @JsonProperty(value = "sourceServerId", required = true) + private String sourceServerId; + + /* + * Restore point creation time (ISO8601 format), specifying the time to + * restore from. + */ + @JsonProperty(value = "restorePointInTime", required = true) + private OffsetDateTime restorePointInTime; + + /** + * Get the sourceServerId property: The source server id to restore from. + * + * @return the sourceServerId value. + */ + public String sourceServerId() { + return this.sourceServerId; + } + + /** + * Set the sourceServerId property: The source server id to restore from. + * + * @param sourceServerId the sourceServerId value to set. + * @return the ServerPropertiesForRestore object itself. + */ + public ServerPropertiesForRestore withSourceServerId(String sourceServerId) { + this.sourceServerId = sourceServerId; + return this; + } + + /** + * Get the restorePointInTime property: Restore point creation time (ISO8601 format), specifying the time to restore + * from. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime property: Restore point creation time (ISO8601 format), specifying the time to restore + * from. + * + * @param restorePointInTime the restorePointInTime value to set. + * @return the ServerPropertiesForRestore object itself. + */ + public ServerPropertiesForRestore withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForRestore withVersion(ServerVersion version) { + super.withVersion(version); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForRestore withSslEnforcement(SslEnforcementEnum sslEnforcement) { + super.withSslEnforcement(sslEnforcement); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForRestore withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + super.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForRestore withStorageProfile(StorageProfile storageProfile) { + super.withStorageProfile(storageProfile); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (sourceServerId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceServerId in model ServerPropertiesForRestore")); + } + if (restorePointInTime() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property restorePointInTime in model ServerPropertiesForRestore")); + } + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerSecurityAlertPolicies.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerSecurityAlertPolicies.java new file mode 100644 index 000000000000..5e40a917ad82 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerSecurityAlertPolicies.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.mariadb.models; + +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServerSecurityAlertPolicies. */ +public interface ServerSecurityAlertPolicies { + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + ServerSecurityAlertPolicy get( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName); + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert 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 a server's security alert policy. + */ + Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context); + + /** + * Get a server's security alert policy. + * + * @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 server's security alert policy. + */ + ServerSecurityAlertPolicy getById(String id); + + /** + * Get a server's security alert policy. + * + * @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 server's security alert policy. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerSecurityAlertPolicy resource. + * + * @param name resource name. + * @return the first stage of the new ServerSecurityAlertPolicy definition. + */ + ServerSecurityAlertPolicy.DefinitionStages.Blank define(SecurityAlertPolicyName name); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerSecurityAlertPolicy.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerSecurityAlertPolicy.java new file mode 100644 index 000000000000..066ccf70bd4c --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerSecurityAlertPolicy.java @@ -0,0 +1,349 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mariadb.fluent.models.ServerSecurityAlertPolicyInner; +import java.util.List; + +/** An immutable client-side representation of ServerSecurityAlertPolicy. */ +public interface ServerSecurityAlertPolicy { + /** + * 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 state property: Specifies the state of the policy, whether it is enabled or disabled. + * + * @return the state value. + */ + ServerSecurityAlertPolicyState state(); + + /** + * Gets the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly. + * + * @return the disabledAlerts value. + */ + List disabledAlerts(); + + /** + * Gets the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + List emailAddresses(); + + /** + * Gets the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + Boolean emailAccountAdmins(); + + /** + * Gets the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.ServerSecurityAlertPolicyInner object. + * + * @return the inner object. + */ + ServerSecurityAlertPolicyInner innerModel(); + + /** The entirety of the ServerSecurityAlertPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerSecurityAlertPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerSecurityAlertPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerSecurityAlertPolicy 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.WithState, + DefinitionStages.WithDisabledAlerts, + DefinitionStages.WithEmailAddresses, + DefinitionStages.WithEmailAccountAdmins, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRetentionDays { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerSecurityAlertPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerSecurityAlertPolicy create(Context context); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled. + * @return the next definition stage. + */ + WithCreate withState(ServerSecurityAlertPolicyState state); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly. + * @return the next definition stage. + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + WithCreate withEmailAddresses(List emailAddresses); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + } + /** + * Begins update for the ServerSecurityAlertPolicy resource. + * + * @return the stage of resource update. + */ + ServerSecurityAlertPolicy.Update update(); + + /** The template for ServerSecurityAlertPolicy update. */ + interface Update + extends UpdateStages.WithState, + UpdateStages.WithDisabledAlerts, + UpdateStages.WithEmailAddresses, + UpdateStages.WithEmailAccountAdmins, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRetentionDays { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerSecurityAlertPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerSecurityAlertPolicy apply(Context context); + } + /** The ServerSecurityAlertPolicy update stages. */ + interface UpdateStages { + /** The stage of the ServerSecurityAlertPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled. + * @return the next definition stage. + */ + Update withState(ServerSecurityAlertPolicyState state); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly. + * @return the next definition stage. + */ + Update withDisabledAlerts(List disabledAlerts); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + Update withEmailAddresses(List emailAddresses); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerSecurityAlertPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerSecurityAlertPolicy refresh(Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerSecurityAlertPolicyState.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerSecurityAlertPolicyState.java new file mode 100644 index 000000000000..15b662618210 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerSecurityAlertPolicyState.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.mariadb.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ServerSecurityAlertPolicyState. */ +public enum ServerSecurityAlertPolicyState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a ServerSecurityAlertPolicyState instance. */ + private final String value; + + ServerSecurityAlertPolicyState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ServerSecurityAlertPolicyState instance. + * + * @param value the serialized value to parse. + * @return the parsed ServerSecurityAlertPolicyState object, or null if unable to parse. + */ + @JsonCreator + public static ServerSecurityAlertPolicyState fromString(String value) { + ServerSecurityAlertPolicyState[] items = ServerSecurityAlertPolicyState.values(); + for (ServerSecurityAlertPolicyState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerState.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerState.java new file mode 100644 index 000000000000..298b7a9fe37e --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerState.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.mariadb.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServerState. */ +public final class ServerState extends ExpandableStringEnum { + /** Static value Ready for ServerState. */ + public static final ServerState READY = fromString("Ready"); + + /** Static value Dropping for ServerState. */ + public static final ServerState DROPPING = fromString("Dropping"); + + /** Static value Disabled for ServerState. */ + public static final ServerState DISABLED = fromString("Disabled"); + + /** + * Creates or finds a ServerState from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerState. + */ + @JsonCreator + public static ServerState fromString(String name) { + return fromString(name, ServerState.class); + } + + /** @return known ServerState values. */ + public static Collection values() { + return values(ServerState.class); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerUpdateParameters.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerUpdateParameters.java new file mode 100644 index 000000000000..1e0885e2acbd --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerUpdateParameters.java @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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; + +/** Parameters allowed to update for a server. */ +@JsonFlatten +@Fluent +public class ServerUpdateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerUpdateParameters.class); + + /* + * The SKU (pricing tier) of the server. + */ + @JsonProperty(value = "sku") + private Sku sku; + + /* + * Application-specific metadata in the form of key-value pairs. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Storage profile of a server. + */ + @JsonProperty(value = "properties.storageProfile") + private StorageProfile storageProfile; + + /* + * The password of the administrator login. + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /* + * The version of a server. + */ + @JsonProperty(value = "properties.version") + private ServerVersion version; + + /* + * Enable ssl enforcement or not when connect to server. + */ + @JsonProperty(value = "properties.sslEnforcement") + private SslEnforcementEnum sslEnforcement; + + /* + * Whether or not public network access is allowed for this server. Value + * is optional but if passed in, must be 'Enabled' or 'Disabled' + */ + @JsonProperty(value = "properties.publicNetworkAccess") + private PublicNetworkAccessEnum publicNetworkAccess; + + /* + * The replication role of the server. + */ + @JsonProperty(value = "properties.replicationRole") + private String replicationRole; + + /** + * Get the sku property: The SKU (pricing tier) of the server. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU (pricing tier) of the server. + * + * @param sku the sku value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the tags property: Application-specific metadata in the form of key-value pairs. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Application-specific metadata in the form of key-value pairs. + * + * @param tags the tags value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the storageProfile property: Storage profile of a server. + * + * @return the storageProfile value. + */ + public StorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: Storage profile of a server. + * + * @param storageProfile the storageProfile value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the administratorLoginPassword property: The password of the administrator login. + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: The password of the administrator login. + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the version property: The version of a server. + * + * @return the version value. + */ + public ServerVersion version() { + return this.version; + } + + /** + * Set the version property: The version of a server. + * + * @param version the version value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withVersion(ServerVersion version) { + this.version = version; + return this; + } + + /** + * Get the sslEnforcement property: Enable ssl enforcement or not when connect to server. + * + * @return the sslEnforcement value. + */ + public SslEnforcementEnum sslEnforcement() { + return this.sslEnforcement; + } + + /** + * Set the sslEnforcement property: Enable ssl enforcement or not when connect to server. + * + * @param sslEnforcement the sslEnforcement value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withSslEnforcement(SslEnforcementEnum sslEnforcement) { + this.sslEnforcement = sslEnforcement; + return this; + } + + /** + * Get the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccessEnum publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the replicationRole property: The replication role of the server. + * + * @return the replicationRole value. + */ + public String replicationRole() { + return this.replicationRole; + } + + /** + * Set the replicationRole property: The replication role of the server. + * + * @param replicationRole the replicationRole value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withReplicationRole(String replicationRole) { + this.replicationRole = replicationRole; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (sku() != null) { + sku().validate(); + } + if (storageProfile() != null) { + storageProfile().validate(); + } + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerVersion.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerVersion.java new file mode 100644 index 000000000000..efb53d149720 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/ServerVersion.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.mariadb.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServerVersion. */ +public final class ServerVersion extends ExpandableStringEnum { + /** Static value 5.6 for ServerVersion. */ + public static final ServerVersion FIVE_SIX = fromString("5.6"); + + /** Static value 5.7 for ServerVersion. */ + public static final ServerVersion FIVE_SEVEN = fromString("5.7"); + + /** + * Creates or finds a ServerVersion from its string representation. + * + * @param name a name to look for. + * @return the corresponding ServerVersion. + */ + @JsonCreator + public static ServerVersion fromString(String name) { + return fromString(name, ServerVersion.class); + } + + /** @return known ServerVersion values. */ + public static Collection values() { + return values(ServerVersion.class); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Servers.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Servers.java new file mode 100644 index 000000000000..96e1d36ed350 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Servers.java @@ -0,0 +1,224 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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 Servers. */ +public interface Servers { + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverName); + + /** + * Deletes a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 serverName, Context context); + + /** + * Gets information about a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a server. + */ + Server getByResourceGroup(String resourceGroupName, String serverName); + + /** + * Gets information about a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return information about a server. + */ + Response getByResourceGroupWithResponse(String resourceGroupName, String serverName, Context context); + + /** + * List all the servers in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + PagedIterable listByResourceGroup(String resourceGroupName); + + /** + * List all the servers in a given resource group. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + PagedIterable listByResourceGroup(String resourceGroupName, Context context); + + /** + * List all the servers in a given 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 servers. + */ + PagedIterable list(); + + /** + * List all the servers in a given 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 servers. + */ + PagedIterable list(Context context); + + /** + * Restarts a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 restart(String resourceGroupName, String serverName); + + /** + * Restarts a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 restart(String resourceGroupName, String serverName, Context context); + + /** + * Starts a stopped server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 start(String resourceGroupName, String serverName); + + /** + * Starts a stopped server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 start(String resourceGroupName, String serverName, Context context); + + /** + * Stops a running server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 stop(String resourceGroupName, String serverName); + + /** + * Stops a running server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.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 stop(String resourceGroupName, String serverName, Context context); + + /** + * Gets information about a server. + * + * @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 information about a server. + */ + Server getById(String id); + + /** + * Gets information about a server. + * + * @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 information about a server. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a server. + * + * @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 server. + * + * @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 Server resource. + * + * @param name resource name. + * @return the first stage of the new Server definition. + */ + Server.DefinitionStages.Blank define(String name); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Sku.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Sku.java new file mode 100644 index 000000000000..7903b4ff2e34 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/Sku.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.mariadb.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; + +/** Billing information related properties of a server. */ +@Fluent +public final class Sku { + @JsonIgnore private final ClientLogger logger = new ClientLogger(Sku.class); + + /* + * The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, + * GP_Gen5_8. + */ + @JsonProperty(value = "name", required = true) + private String name; + + /* + * The tier of the particular SKU, e.g. Basic. + */ + @JsonProperty(value = "tier") + private SkuTier tier; + + /* + * The scale up/out capacity, representing server's compute units. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /* + * The size code, to be interpreted by resource as appropriate. + */ + @JsonProperty(value = "size") + private String size; + + /* + * The family of hardware. + */ + @JsonProperty(value = "family") + private String family; + + /** + * Get the name property: The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8. + * + * @return the name value. + */ + public String name() { + return this.name; + } + + /** + * Set the name property: The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, GP_Gen5_8. + * + * @param name the name value to set. + * @return the Sku object itself. + */ + public Sku withName(String name) { + this.name = name; + return this; + } + + /** + * Get the tier property: The tier of the particular SKU, e.g. Basic. + * + * @return the tier value. + */ + public SkuTier tier() { + return this.tier; + } + + /** + * Set the tier property: The tier of the particular SKU, e.g. Basic. + * + * @param tier the tier value to set. + * @return the Sku object itself. + */ + public Sku withTier(SkuTier tier) { + this.tier = tier; + return this; + } + + /** + * Get the capacity property: The scale up/out capacity, representing server's compute units. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: The scale up/out capacity, representing server's compute units. + * + * @param capacity the capacity value to set. + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get the size property: The size code, to be interpreted by resource as appropriate. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: The size code, to be interpreted by resource as appropriate. + * + * @param size the size value to set. + * @return the Sku object itself. + */ + public Sku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the family property: The family of hardware. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: The family of hardware. + * + * @param family the family value to set. + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + 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 Sku")); + } + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/SkuTier.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/SkuTier.java new file mode 100644 index 000000000000..31591c2f70eb --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/SkuTier.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.mariadb.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SkuTier. */ +public final class SkuTier extends ExpandableStringEnum { + /** Static value Basic for SkuTier. */ + public static final SkuTier BASIC = fromString("Basic"); + + /** Static value GeneralPurpose for SkuTier. */ + public static final SkuTier GENERAL_PURPOSE = fromString("GeneralPurpose"); + + /** Static value MemoryOptimized for SkuTier. */ + public static final SkuTier MEMORY_OPTIMIZED = fromString("MemoryOptimized"); + + /** + * Creates or finds a SkuTier from its string representation. + * + * @param name a name to look for. + * @return the corresponding SkuTier. + */ + @JsonCreator + public static SkuTier fromString(String name) { + return fromString(name, SkuTier.class); + } + + /** @return known SkuTier values. */ + public static Collection values() { + return values(SkuTier.class); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/SslEnforcementEnum.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/SslEnforcementEnum.java new file mode 100644 index 000000000000..2d25998574bf --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/SslEnforcementEnum.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.mariadb.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for SslEnforcementEnum. */ +public enum SslEnforcementEnum { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a SslEnforcementEnum instance. */ + private final String value; + + SslEnforcementEnum(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SslEnforcementEnum instance. + * + * @param value the serialized value to parse. + * @return the parsed SslEnforcementEnum object, or null if unable to parse. + */ + @JsonCreator + public static SslEnforcementEnum fromString(String value) { + SslEnforcementEnum[] items = SslEnforcementEnum.values(); + for (SslEnforcementEnum item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/StorageAutogrow.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/StorageAutogrow.java new file mode 100644 index 000000000000..5d986e11ce3a --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/StorageAutogrow.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.mariadb.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StorageAutogrow. */ +public final class StorageAutogrow extends ExpandableStringEnum { + /** Static value Enabled for StorageAutogrow. */ + public static final StorageAutogrow ENABLED = fromString("Enabled"); + + /** Static value Disabled for StorageAutogrow. */ + public static final StorageAutogrow DISABLED = fromString("Disabled"); + + /** + * Creates or finds a StorageAutogrow from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageAutogrow. + */ + @JsonCreator + public static StorageAutogrow fromString(String name) { + return fromString(name, StorageAutogrow.class); + } + + /** @return known StorageAutogrow values. */ + public static Collection values() { + return values(StorageAutogrow.class); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/StorageProfile.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/StorageProfile.java new file mode 100644 index 000000000000..4123af8135f6 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/StorageProfile.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.mariadb.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; + +/** Storage Profile properties of a server. */ +@Fluent +public final class StorageProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageProfile.class); + + /* + * Backup retention days for the server. + */ + @JsonProperty(value = "backupRetentionDays") + private Integer backupRetentionDays; + + /* + * Enable Geo-redundant or not for server backup. + */ + @JsonProperty(value = "geoRedundantBackup") + private GeoRedundantBackup geoRedundantBackup; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "storageMB") + private Integer storageMB; + + /* + * Enable Storage Auto Grow. + */ + @JsonProperty(value = "storageAutogrow") + private StorageAutogrow storageAutogrow; + + /** + * Get the backupRetentionDays property: Backup retention days for the server. + * + * @return the backupRetentionDays value. + */ + public Integer backupRetentionDays() { + return this.backupRetentionDays; + } + + /** + * Set the backupRetentionDays property: Backup retention days for the server. + * + * @param backupRetentionDays the backupRetentionDays value to set. + * @return the StorageProfile object itself. + */ + public StorageProfile withBackupRetentionDays(Integer backupRetentionDays) { + this.backupRetentionDays = backupRetentionDays; + return this; + } + + /** + * Get the geoRedundantBackup property: Enable Geo-redundant or not for server backup. + * + * @return the geoRedundantBackup value. + */ + public GeoRedundantBackup geoRedundantBackup() { + return this.geoRedundantBackup; + } + + /** + * Set the geoRedundantBackup property: Enable Geo-redundant or not for server backup. + * + * @param geoRedundantBackup the geoRedundantBackup value to set. + * @return the StorageProfile object itself. + */ + public StorageProfile withGeoRedundantBackup(GeoRedundantBackup geoRedundantBackup) { + this.geoRedundantBackup = geoRedundantBackup; + return this; + } + + /** + * Get the storageMB property: Max storage allowed for a server. + * + * @return the storageMB value. + */ + public Integer storageMB() { + return this.storageMB; + } + + /** + * Set the storageMB property: Max storage allowed for a server. + * + * @param storageMB the storageMB value to set. + * @return the StorageProfile object itself. + */ + public StorageProfile withStorageMB(Integer storageMB) { + this.storageMB = storageMB; + return this; + } + + /** + * Get the storageAutogrow property: Enable Storage Auto Grow. + * + * @return the storageAutogrow value. + */ + public StorageAutogrow storageAutogrow() { + return this.storageAutogrow; + } + + /** + * Set the storageAutogrow property: Enable Storage Auto Grow. + * + * @param storageAutogrow the storageAutogrow value to set. + * @return the StorageProfile object itself. + */ + public StorageProfile withStorageAutogrow(StorageAutogrow storageAutogrow) { + this.storageAutogrow = storageAutogrow; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/TagsObject.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/TagsObject.java new file mode 100644 index 000000000000..0d92e6054752 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/TagsObject.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.mariadb.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; + +/** Tags object for patch operations. */ +@Fluent +public final class TagsObject { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TagsObject.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 TagsObject object itself. + */ + public TagsObject 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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/TopQueryStatistics.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/TopQueryStatistics.java new file mode 100644 index 000000000000..507b60a68eef --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/TopQueryStatistics.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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 TopQueryStatistics. */ +public interface TopQueryStatistics { + /** + * Retrieve the query statistic for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryStatisticId The Query Statistic identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Query Statistic. + */ + QueryStatistic get(String resourceGroupName, String serverName, String queryStatisticId); + + /** + * Retrieve the query statistic for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param queryStatisticId The Query Statistic identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Query Statistic. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String queryStatisticId, Context context); + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters); + + /** + * Retrieve the Query-Store top queries for specified metric and aggregation. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving top query statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of query statistics. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, TopQueryStatisticsInput parameters, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/TopQueryStatisticsInput.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/TopQueryStatisticsInput.java new file mode 100644 index 000000000000..cf6437b86f2b --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/TopQueryStatisticsInput.java @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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; + +/** Input to get top query statistics. */ +@JsonFlatten +@Fluent +public class TopQueryStatisticsInput { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TopQueryStatisticsInput.class); + + /* + * Max number of top queries to return. + */ + @JsonProperty(value = "properties.numberOfTopQueries", required = true) + private int numberOfTopQueries; + + /* + * Aggregation function name. + */ + @JsonProperty(value = "properties.aggregationFunction", required = true) + private String aggregationFunction; + + /* + * Observed metric name. + */ + @JsonProperty(value = "properties.observedMetric", required = true) + private String observedMetric; + + /* + * Observation start time. + */ + @JsonProperty(value = "properties.observationStartTime", required = true) + private OffsetDateTime observationStartTime; + + /* + * Observation end time. + */ + @JsonProperty(value = "properties.observationEndTime", required = true) + private OffsetDateTime observationEndTime; + + /* + * Aggregation interval type in ISO 8601 format. + */ + @JsonProperty(value = "properties.aggregationWindow", required = true) + private String aggregationWindow; + + /** + * Get the numberOfTopQueries property: Max number of top queries to return. + * + * @return the numberOfTopQueries value. + */ + public int numberOfTopQueries() { + return this.numberOfTopQueries; + } + + /** + * Set the numberOfTopQueries property: Max number of top queries to return. + * + * @param numberOfTopQueries the numberOfTopQueries value to set. + * @return the TopQueryStatisticsInput object itself. + */ + public TopQueryStatisticsInput withNumberOfTopQueries(int numberOfTopQueries) { + this.numberOfTopQueries = numberOfTopQueries; + return this; + } + + /** + * Get the aggregationFunction property: Aggregation function name. + * + * @return the aggregationFunction value. + */ + public String aggregationFunction() { + return this.aggregationFunction; + } + + /** + * Set the aggregationFunction property: Aggregation function name. + * + * @param aggregationFunction the aggregationFunction value to set. + * @return the TopQueryStatisticsInput object itself. + */ + public TopQueryStatisticsInput withAggregationFunction(String aggregationFunction) { + this.aggregationFunction = aggregationFunction; + return this; + } + + /** + * Get the observedMetric property: Observed metric name. + * + * @return the observedMetric value. + */ + public String observedMetric() { + return this.observedMetric; + } + + /** + * Set the observedMetric property: Observed metric name. + * + * @param observedMetric the observedMetric value to set. + * @return the TopQueryStatisticsInput object itself. + */ + public TopQueryStatisticsInput withObservedMetric(String observedMetric) { + this.observedMetric = observedMetric; + return this; + } + + /** + * Get the observationStartTime property: Observation start time. + * + * @return the observationStartTime value. + */ + public OffsetDateTime observationStartTime() { + return this.observationStartTime; + } + + /** + * Set the observationStartTime property: Observation start time. + * + * @param observationStartTime the observationStartTime value to set. + * @return the TopQueryStatisticsInput object itself. + */ + public TopQueryStatisticsInput withObservationStartTime(OffsetDateTime observationStartTime) { + this.observationStartTime = observationStartTime; + return this; + } + + /** + * Get the observationEndTime property: Observation end time. + * + * @return the observationEndTime value. + */ + public OffsetDateTime observationEndTime() { + return this.observationEndTime; + } + + /** + * Set the observationEndTime property: Observation end time. + * + * @param observationEndTime the observationEndTime value to set. + * @return the TopQueryStatisticsInput object itself. + */ + public TopQueryStatisticsInput withObservationEndTime(OffsetDateTime observationEndTime) { + this.observationEndTime = observationEndTime; + return this; + } + + /** + * Get the aggregationWindow property: Aggregation interval type in ISO 8601 format. + * + * @return the aggregationWindow value. + */ + public String aggregationWindow() { + return this.aggregationWindow; + } + + /** + * Set the aggregationWindow property: Aggregation interval type in ISO 8601 format. + * + * @param aggregationWindow the aggregationWindow value to set. + * @return the TopQueryStatisticsInput object itself. + */ + public TopQueryStatisticsInput withAggregationWindow(String aggregationWindow) { + this.aggregationWindow = aggregationWindow; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (aggregationFunction() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property aggregationFunction in model TopQueryStatisticsInput")); + } + if (observedMetric() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property observedMetric in model TopQueryStatisticsInput")); + } + if (observationStartTime() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property observationStartTime in model TopQueryStatisticsInput")); + } + if (observationEndTime() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property observationEndTime in model TopQueryStatisticsInput")); + } + if (aggregationWindow() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property aggregationWindow in model TopQueryStatisticsInput")); + } + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/TopQueryStatisticsResultList.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/TopQueryStatisticsResultList.java new file mode 100644 index 000000000000..34259725d838 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/TopQueryStatisticsResultList.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.mariadb.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.fluent.models.QueryStatisticInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of query statistics. */ +@Immutable +public final class TopQueryStatisticsResultList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TopQueryStatisticsResultList.class); + + /* + * The list of top query statistics. + */ + @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: The list of top query statistics. + * + * @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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/VirtualNetworkRule.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/VirtualNetworkRule.java new file mode 100644 index 000000000000..659f6d999945 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/VirtualNetworkRule.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.mariadb.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.mariadb.fluent.models.VirtualNetworkRuleInner; + +/** An immutable client-side representation of VirtualNetworkRule. */ +public interface VirtualNetworkRule { + /** + * 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 virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @return the virtualNetworkSubnetId value. + */ + String virtualNetworkSubnetId(); + + /** + * Gets the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @return the ignoreMissingVnetServiceEndpoint value. + */ + Boolean ignoreMissingVnetServiceEndpoint(); + + /** + * Gets the state property: Virtual Network Rule State. + * + * @return the state value. + */ + VirtualNetworkRuleState state(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.VirtualNetworkRuleInner object. + * + * @return the inner object. + */ + VirtualNetworkRuleInner innerModel(); + + /** The entirety of the VirtualNetworkRule definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The VirtualNetworkRule definition stages. */ + interface DefinitionStages { + /** The first stage of the VirtualNetworkRule definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the VirtualNetworkRule definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the VirtualNetworkRule 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.WithVirtualNetworkSubnetId, DefinitionStages.WithIgnoreMissingVnetServiceEndpoint { + /** + * Executes the create request. + * + * @return the created resource. + */ + VirtualNetworkRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VirtualNetworkRule create(Context context); + } + /** The stage of the VirtualNetworkRule definition allowing to specify virtualNetworkSubnetId. */ + interface WithVirtualNetworkSubnetId { + /** + * Specifies the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet.. + * + * @param virtualNetworkSubnetId The ARM resource id of the virtual network subnet. + * @return the next definition stage. + */ + WithCreate withVirtualNetworkSubnetId(String virtualNetworkSubnetId); + } + /** The stage of the VirtualNetworkRule definition allowing to specify ignoreMissingVnetServiceEndpoint. */ + interface WithIgnoreMissingVnetServiceEndpoint { + /** + * Specifies the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network + * has vnet service endpoint enabled.. + * + * @param ignoreMissingVnetServiceEndpoint Create firewall rule before the virtual network has vnet service + * endpoint enabled. + * @return the next definition stage. + */ + WithCreate withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint); + } + } + /** + * Begins update for the VirtualNetworkRule resource. + * + * @return the stage of resource update. + */ + VirtualNetworkRule.Update update(); + + /** The template for VirtualNetworkRule update. */ + interface Update + extends UpdateStages.WithVirtualNetworkSubnetId, UpdateStages.WithIgnoreMissingVnetServiceEndpoint { + /** + * Executes the update request. + * + * @return the updated resource. + */ + VirtualNetworkRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + VirtualNetworkRule apply(Context context); + } + /** The VirtualNetworkRule update stages. */ + interface UpdateStages { + /** The stage of the VirtualNetworkRule update allowing to specify virtualNetworkSubnetId. */ + interface WithVirtualNetworkSubnetId { + /** + * Specifies the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet.. + * + * @param virtualNetworkSubnetId The ARM resource id of the virtual network subnet. + * @return the next definition stage. + */ + Update withVirtualNetworkSubnetId(String virtualNetworkSubnetId); + } + /** The stage of the VirtualNetworkRule update allowing to specify ignoreMissingVnetServiceEndpoint. */ + interface WithIgnoreMissingVnetServiceEndpoint { + /** + * Specifies the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network + * has vnet service endpoint enabled.. + * + * @param ignoreMissingVnetServiceEndpoint Create firewall rule before the virtual network has vnet service + * endpoint enabled. + * @return the next definition stage. + */ + Update withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + VirtualNetworkRule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VirtualNetworkRule refresh(Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/VirtualNetworkRuleListResult.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/VirtualNetworkRuleListResult.java new file mode 100644 index 000000000000..295513846dc3 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/VirtualNetworkRuleListResult.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.mariadb.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.fluent.models.VirtualNetworkRuleInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of virtual network rules. */ +@Immutable +public final class VirtualNetworkRuleListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkRuleListResult.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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/VirtualNetworkRuleState.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/VirtualNetworkRuleState.java new file mode 100644 index 000000000000..f90722f19bcf --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/VirtualNetworkRuleState.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.mariadb.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VirtualNetworkRuleState. */ +public final class VirtualNetworkRuleState extends ExpandableStringEnum { + /** Static value Initializing for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState INITIALIZING = fromString("Initializing"); + + /** Static value InProgress for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState IN_PROGRESS = fromString("InProgress"); + + /** Static value Ready for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState READY = fromString("Ready"); + + /** Static value Deleting for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState DELETING = fromString("Deleting"); + + /** Static value Unknown for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState UNKNOWN = fromString("Unknown"); + + /** + * Creates or finds a VirtualNetworkRuleState from its string representation. + * + * @param name a name to look for. + * @return the corresponding VirtualNetworkRuleState. + */ + @JsonCreator + public static VirtualNetworkRuleState fromString(String name) { + return fromString(name, VirtualNetworkRuleState.class); + } + + /** @return known VirtualNetworkRuleState values. */ + public static Collection values() { + return values(VirtualNetworkRuleState.class); + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/VirtualNetworkRules.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/VirtualNetworkRules.java new file mode 100644 index 000000000000..cedb76d1fefa --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/VirtualNetworkRules.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.mariadb.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 VirtualNetworkRules. */ +public interface VirtualNetworkRules { + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 virtual network rule. + */ + VirtualNetworkRule get(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 virtual network rule. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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 delete(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network 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. + */ + void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a virtual network 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 virtual network rule. + */ + VirtualNetworkRule getById(String id); + + /** + * Gets a virtual network 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 virtual network rule. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the virtual network rule with the 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 the virtual network rule with the 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 VirtualNetworkRule resource. + * + * @param name resource name. + * @return the first stage of the new VirtualNetworkRule definition. + */ + VirtualNetworkRule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/WaitStatistic.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/WaitStatistic.java new file mode 100644 index 000000000000..d937ae0fa4e0 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/WaitStatistic.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.mariadb.models; + +import com.azure.resourcemanager.mariadb.fluent.models.WaitStatisticInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of WaitStatistic. */ +public interface WaitStatistic { + /** + * 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 startTime property: Observation start time. + * + * @return the startTime value. + */ + OffsetDateTime startTime(); + + /** + * Gets the endTime property: Observation end time. + * + * @return the endTime value. + */ + OffsetDateTime endTime(); + + /** + * Gets the eventName property: Wait event name. + * + * @return the eventName value. + */ + String eventName(); + + /** + * Gets the eventTypeName property: Wait event type name. + * + * @return the eventTypeName value. + */ + String eventTypeName(); + + /** + * Gets the queryId property: Database query identifier. + * + * @return the queryId value. + */ + Long queryId(); + + /** + * Gets the databaseName property: Database Name. + * + * @return the databaseName value. + */ + String databaseName(); + + /** + * Gets the userId property: Database user identifier. + * + * @return the userId value. + */ + Long userId(); + + /** + * Gets the count property: Wait event count observed in this time interval. + * + * @return the count value. + */ + Long count(); + + /** + * Gets the totalTimeInMs property: Total time of wait in milliseconds in this time interval. + * + * @return the totalTimeInMs value. + */ + Double totalTimeInMs(); + + /** + * Gets the inner com.azure.resourcemanager.mariadb.fluent.models.WaitStatisticInner object. + * + * @return the inner object. + */ + WaitStatisticInner innerModel(); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/WaitStatistics.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/WaitStatistics.java new file mode 100644 index 000000000000..9ba9927ec4a3 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/WaitStatistics.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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 WaitStatistics. */ +public interface WaitStatistics { + /** + * Retrieve wait statistics for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param waitStatisticsId The Wait Statistic identifier. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Wait Statistic. + */ + WaitStatistic get(String resourceGroupName, String serverName, String waitStatisticsId); + + /** + * Retrieve wait statistics for specified identifier. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param waitStatisticsId The Wait Statistic identifier. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Wait Statistic. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String waitStatisticsId, Context context); + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of wait statistics. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, WaitStatisticsInput parameters); + + /** + * Retrieve wait statistics for specified aggregation window. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param parameters The required parameters for retrieving wait statistics. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of wait statistics. + */ + PagedIterable listByServer( + String resourceGroupName, String serverName, WaitStatisticsInput parameters, Context context); +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/WaitStatisticsInput.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/WaitStatisticsInput.java new file mode 100644 index 000000000000..ca1dd3cc850c --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/WaitStatisticsInput.java @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.mariadb.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; + +/** Input to get wait statistics. */ +@JsonFlatten +@Fluent +public class WaitStatisticsInput { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WaitStatisticsInput.class); + + /* + * Observation start time. + */ + @JsonProperty(value = "properties.observationStartTime", required = true) + private OffsetDateTime observationStartTime; + + /* + * Observation end time. + */ + @JsonProperty(value = "properties.observationEndTime", required = true) + private OffsetDateTime observationEndTime; + + /* + * Aggregation interval type in ISO 8601 format. + */ + @JsonProperty(value = "properties.aggregationWindow", required = true) + private String aggregationWindow; + + /** + * Get the observationStartTime property: Observation start time. + * + * @return the observationStartTime value. + */ + public OffsetDateTime observationStartTime() { + return this.observationStartTime; + } + + /** + * Set the observationStartTime property: Observation start time. + * + * @param observationStartTime the observationStartTime value to set. + * @return the WaitStatisticsInput object itself. + */ + public WaitStatisticsInput withObservationStartTime(OffsetDateTime observationStartTime) { + this.observationStartTime = observationStartTime; + return this; + } + + /** + * Get the observationEndTime property: Observation end time. + * + * @return the observationEndTime value. + */ + public OffsetDateTime observationEndTime() { + return this.observationEndTime; + } + + /** + * Set the observationEndTime property: Observation end time. + * + * @param observationEndTime the observationEndTime value to set. + * @return the WaitStatisticsInput object itself. + */ + public WaitStatisticsInput withObservationEndTime(OffsetDateTime observationEndTime) { + this.observationEndTime = observationEndTime; + return this; + } + + /** + * Get the aggregationWindow property: Aggregation interval type in ISO 8601 format. + * + * @return the aggregationWindow value. + */ + public String aggregationWindow() { + return this.aggregationWindow; + } + + /** + * Set the aggregationWindow property: Aggregation interval type in ISO 8601 format. + * + * @param aggregationWindow the aggregationWindow value to set. + * @return the WaitStatisticsInput object itself. + */ + public WaitStatisticsInput withAggregationWindow(String aggregationWindow) { + this.aggregationWindow = aggregationWindow; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (observationStartTime() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property observationStartTime in model WaitStatisticsInput")); + } + if (observationEndTime() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property observationEndTime in model WaitStatisticsInput")); + } + if (aggregationWindow() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property aggregationWindow in model WaitStatisticsInput")); + } + } +} diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/WaitStatisticsResultList.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/WaitStatisticsResultList.java new file mode 100644 index 000000000000..e3a46a2ede10 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/WaitStatisticsResultList.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.mariadb.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.mariadb.fluent.models.WaitStatisticInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of wait statistics. */ +@Immutable +public final class WaitStatisticsResultList { + @JsonIgnore private final ClientLogger logger = new ClientLogger(WaitStatisticsResultList.class); + + /* + * The list of wait statistics. + */ + @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: The list of wait statistics. + * + * @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/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/package-info.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/package-info.java new file mode 100644 index 000000000000..3ce84f909629 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/models/package-info.java @@ -0,0 +1,10 @@ +// 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 MariaDBManagementClient. The Microsoft Azure management API provides create, + * read, update, and delete functionality for Azure MariaDB resources including servers, databases, firewall rules, VNET + * rules, log files and configurations with new business model. + */ +package com.azure.resourcemanager.mariadb.models; diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/package-info.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/package-info.java new file mode 100644 index 000000000000..de24dadf600f --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/com/azure/resourcemanager/mariadb/package-info.java @@ -0,0 +1,10 @@ +// 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 MariaDBManagementClient. The Microsoft Azure management API provides create, read, + * update, and delete functionality for Azure MariaDB resources including servers, databases, firewall rules, VNET + * rules, log files and configurations with new business model. + */ +package com.azure.resourcemanager.mariadb; diff --git a/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/module-info.java b/sdk/mariadb/azure-resourcemanager-mariadb/src/main/java/module-info.java new file mode 100644 index 000000000000..f5e18acc3fb6 --- /dev/null +++ b/sdk/mariadb/azure-resourcemanager-mariadb/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.mariadb { + requires transitive com.azure.core.management; + + exports com.azure.resourcemanager.mariadb; + exports com.azure.resourcemanager.mariadb.fluent; + exports com.azure.resourcemanager.mariadb.fluent.models; + exports com.azure.resourcemanager.mariadb.models; + + opens com.azure.resourcemanager.mariadb.fluent.models to + com.azure.core, + com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.mariadb.models to + com.azure.core, + com.fasterxml.jackson.databind; +} diff --git a/sdk/mariadb/ci.yml b/sdk/mariadb/ci.yml new file mode 100644 index 000000000000..6e2043d0bfa3 --- /dev/null +++ b/sdk/mariadb/ci.yml @@ -0,0 +1,31 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - master + - hotfix/* + - release/* + paths: + include: + - sdk/mariadb/ + +pr: + branches: + include: + - master + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/mariadb/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: mariadb + Artifacts: + - name: azure-resourcemanager-mariadb + groupId: com.azure.resourcemanager + safeName: azureresourcemanagermariadb diff --git a/sdk/mariadb/pom.xml b/sdk/mariadb/pom.xml new file mode 100644 index 000000000000..e97c8e6447c7 --- /dev/null +++ b/sdk/mariadb/pom.xml @@ -0,0 +1,14 @@ + + + 4.0.0 + com.azure + azure-mariadb-service + pom + 1.0.0 + + azure-resourcemanager-mariadb + +