From e1078aaa0211f1966c3204af4bfe156f6af23489 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Mon, 23 Dec 2024 00:00:25 -0800 Subject: [PATCH] [Automation] Generate Fluent Lite from Swagger postgresql#package-2020-01-01 (#43545) --- eng/versioning/version_client.txt | 2 +- .../CHANGELOG.md | 77 +- .../README.md | 56 +- .../SAMPLE.md | 843 ++++++++++-------- .../azure-resourcemanager-postgresql/pom.xml | 12 +- .../postgresql/PostgreSqlManager.java | 179 +++- .../fluent/CheckNameAvailabilitiesClient.java | 38 +- .../fluent/ConfigurationsClient.java | 125 ++- .../postgresql/fluent/DatabasesClient.java | 178 +++- .../fluent/FirewallRulesClient.java | 179 +++- .../LocationBasedPerformanceTiersClient.java | 25 +- .../postgresql/fluent/LogFilesClient.java | 26 +- .../postgresql/fluent/OperationsClient.java | 34 +- .../fluent/PostgreSqlManagementClient.java | 48 +- .../PrivateEndpointConnectionsClient.java | 260 +++++- .../fluent/PrivateLinkResourcesClient.java | 65 +- .../fluent/RecoverableServersClient.java | 39 +- .../postgresql/fluent/ReplicasClient.java | 26 +- .../fluent/ServerAdministratorsClient.java | 177 +++- .../ServerBasedPerformanceTiersClient.java | 26 +- .../postgresql/fluent/ServerKeysClient.java | 176 +++- .../fluent/ServerParametersClient.java | 63 +- .../ServerSecurityAlertPoliciesClient.java | 126 ++- .../postgresql/fluent/ServersClient.java | 289 +++++- .../fluent/VirtualNetworkRulesClient.java | 178 +++- .../fluent/models/ConfigurationInner.java | 129 ++- .../models/ConfigurationListResultInner.java | 67 +- .../models/ConfigurationProperties.java | 96 +- .../fluent/models/DatabaseInner.java | 121 ++- .../fluent/models/DatabaseProperties.java | 74 +- .../fluent/models/FirewallRuleInner.java | 127 ++- .../fluent/models/FirewallRuleProperties.java | 86 +- .../fluent/models/LogFileInner.java | 129 ++- .../fluent/models/LogFileProperties.java | 95 +- .../fluent/models/NameAvailabilityInner.java | 82 +- .../models/OperationListResultInner.java | 67 +- .../PerformanceTierPropertiesInner.java | 130 ++- .../PrivateEndpointConnectionInner.java | 125 ++- .../PrivateEndpointConnectionProperties.java | 83 +- .../models/PrivateLinkResourceInner.java | 112 ++- .../models/RecoverableServerProperties.java | 90 +- .../RecoverableServerResourceInner.java | 131 ++- .../models/SecurityAlertPolicyProperties.java | 138 ++- .../models/ServerAdministratorProperties.java | 118 ++- .../ServerAdministratorResourceInner.java | 131 ++- .../postgresql/fluent/models/ServerInner.java | 200 ++++- .../fluent/models/ServerKeyInner.java | 128 ++- .../fluent/models/ServerKeyProperties.java | 88 +- .../fluent/models/ServerProperties.java | 199 +++-- .../ServerSecurityAlertPolicyInner.java | 143 ++- .../ServerUpdateParametersProperties.java | 125 ++- .../models/VirtualNetworkRuleInner.java | 123 ++- .../models/VirtualNetworkRuleProperties.java | 91 +- .../fluent/models/package-info.java | 7 +- .../postgresql/fluent/package-info.java | 7 +- .../CheckNameAvailabilitiesClientImpl.java | 65 +- .../CheckNameAvailabilitiesImpl.java | 22 +- .../implementation/ConfigurationImpl.java | 10 +- .../ConfigurationsClientImpl.java | 141 ++- .../implementation/ConfigurationsImpl.java | 50 +- .../implementation/DatabaseImpl.java | 10 +- .../implementation/DatabasesClientImpl.java | 169 ++-- .../implementation/DatabasesImpl.java | 74 +- .../implementation/FirewallRuleImpl.java | 10 +- .../FirewallRulesClientImpl.java | 178 ++-- .../implementation/FirewallRulesImpl.java | 74 +- ...cationBasedPerformanceTiersClientImpl.java | 44 +- .../LocationBasedPerformanceTiersImpl.java | 8 +- .../implementation/LogFilesClientImpl.java | 44 +- .../implementation/LogFilesImpl.java | 8 +- .../implementation/OperationsClientImpl.java | 65 +- .../implementation/OperationsImpl.java | 18 +- .../PostgreSqlManagementClientBuilder.java | 74 +- .../PostgreSqlManagementClientImpl.java | 168 ++-- .../PrivateEndpointConnectionImpl.java | 11 +- .../PrivateEndpointConnectionsClientImpl.java | 273 +++--- .../PrivateEndpointConnectionsImpl.java | 82 +- .../PrivateLinkResourcesClientImpl.java | 109 ++- .../PrivateLinkResourcesImpl.java | 26 +- .../RecoverableServersClientImpl.java | 61 +- .../RecoverableServersImpl.java | 22 +- .../implementation/ReplicasClientImpl.java | 44 +- .../implementation/ReplicasImpl.java | 8 +- .../{Utils.java => ResourceManagerUtils.java} | 24 +- .../ServerAdministratorsClientImpl.java | 190 ++-- .../ServerAdministratorsImpl.java | 28 +- ...ServerBasedPerformanceTiersClientImpl.java | 44 +- .../ServerBasedPerformanceTiersImpl.java | 8 +- .../postgresql/implementation/ServerImpl.java | 8 +- .../implementation/ServerKeyImpl.java | 10 +- .../implementation/ServerKeysClientImpl.java | 185 ++-- .../implementation/ServerKeysImpl.java | 74 +- .../ServerParametersClientImpl.java | 62 +- .../implementation/ServerParametersImpl.java | 4 +- ...ServerSecurityAlertPoliciesClientImpl.java | 147 ++- .../ServerSecurityAlertPoliciesImpl.java | 64 +- .../ServerSecurityAlertPolicyImpl.java | 12 +- .../implementation/ServersClientImpl.java | 271 +++--- .../implementation/ServersImpl.java | 62 +- .../VirtualNetworkRuleImpl.java | 11 +- .../VirtualNetworkRulesClientImpl.java | 189 ++-- .../VirtualNetworkRulesImpl.java | 74 +- .../implementation/package-info.java | 7 +- .../postgresql/models/AdministratorType.java | 25 +- .../models/CheckNameAvailabilities.java | 18 +- .../postgresql/models/Configuration.java | 95 +- .../models/ConfigurationListResult.java | 8 +- .../postgresql/models/Configurations.java | 34 +- .../postgresql/models/CreateMode.java | 39 +- .../postgresql/models/Database.java | 87 +- .../postgresql/models/DatabaseListResult.java | 67 +- .../postgresql/models/Databases.java | 42 +- .../postgresql/models/FirewallRule.java | 87 +- .../models/FirewallRuleListResult.java | 67 +- .../postgresql/models/FirewallRules.java | 42 +- .../postgresql/models/GeoRedundantBackup.java | 31 +- .../postgresql/models/IdentityType.java | 28 +- .../models/InfrastructureEncryption.java | 32 +- .../models/LocationBasedPerformanceTiers.java | 12 +- .../postgresql/models/LogFile.java | 22 +- .../postgresql/models/LogFileListResult.java | 67 +- .../postgresql/models/LogFiles.java | 12 +- .../models/MinimalTlsVersionEnum.java | 39 +- .../postgresql/models/NameAvailability.java | 12 +- .../models/NameAvailabilityRequest.java | 80 +- .../postgresql/models/Operation.java | 84 +- .../postgresql/models/OperationDisplay.java | 78 +- .../models/OperationListResult.java | 8 +- .../postgresql/models/OperationOrigin.java | 35 +- .../postgresql/models/Operations.java | 20 +- .../models/PerformanceTierListResult.java | 68 +- .../models/PerformanceTierProperties.java | 22 +- ...PerformanceTierServiceLevelObjectives.java | 128 ++- .../models/PrivateEndpointConnection.java | 79 +- .../PrivateEndpointConnectionListResult.java | 72 +- .../models/PrivateEndpointConnections.java | 42 +- .../models/PrivateEndpointProperty.java | 66 +- .../PrivateEndpointProvisioningState.java | 43 +- .../models/PrivateLinkResource.java | 14 +- .../models/PrivateLinkResourceListResult.java | 71 +- .../models/PrivateLinkResourceProperties.java | 70 +- .../models/PrivateLinkResources.java | 28 +- ...kServiceConnectionStateActionsRequire.java | 27 +- ...ateLinkServiceConnectionStateProperty.java | 93 +- ...ivateLinkServiceConnectionStateStatus.java | 39 +- .../models/PublicNetworkAccessEnum.java | 32 +- .../models/RecoverableServerResource.java | 24 +- .../postgresql/models/RecoverableServers.java | 18 +- .../postgresql/models/Replicas.java | 12 +- .../postgresql/models/ResourceIdentity.java | 83 +- .../models/SecurityAlertPolicyName.java | 27 +- .../postgresql/models/Server.java | 199 +++-- .../models/ServerAdministratorResource.java | 20 +- ...ServerAdministratorResourceListResult.java | 70 +- .../models/ServerAdministrators.java | 36 +- .../models/ServerBasedPerformanceTiers.java | 12 +- .../postgresql/models/ServerForCreate.java | 111 ++- .../postgresql/models/ServerKey.java | 91 +- .../models/ServerKeyListResult.java | 69 +- .../postgresql/models/ServerKeyType.java | 27 +- .../postgresql/models/ServerKeys.java | 40 +- .../postgresql/models/ServerListResult.java | 67 +- .../postgresql/models/ServerParameters.java | 8 +- .../ServerPrivateEndpointConnection.java | 70 +- ...erPrivateEndpointConnectionProperties.java | 84 +- ...ateLinkServiceConnectionStateProperty.java | 95 +- .../models/ServerPropertiesForCreate.java | 180 +++- .../ServerPropertiesForDefaultCreate.java | 164 +++- .../models/ServerPropertiesForGeoRestore.java | 146 ++- .../models/ServerPropertiesForReplica.java | 145 ++- .../models/ServerPropertiesForRestore.java | 165 +++- .../models/ServerSecurityAlertPolicies.java | 36 +- .../models/ServerSecurityAlertPolicy.java | 171 ++-- .../ServerSecurityAlertPolicyListResult.java | 72 +- .../ServerSecurityAlertPolicyState.java | 29 +- .../postgresql/models/ServerState.java | 39 +- .../models/ServerUpdateParameters.java | 120 ++- .../postgresql/models/ServerVersion.java | 47 +- .../postgresql/models/Servers.java | 52 +- .../postgresql/models/Sku.java | 108 ++- .../postgresql/models/SkuTier.java | 35 +- .../postgresql/models/SslEnforcementEnum.java | 29 +- .../postgresql/models/StorageAutogrow.java | 31 +- .../postgresql/models/StorageProfile.java | 94 +- .../postgresql/models/TagsObject.java | 69 +- .../postgresql/models/VirtualNetworkRule.java | 93 +- .../models/VirtualNetworkRuleListResult.java | 70 +- .../models/VirtualNetworkRuleState.java | 43 +- .../models/VirtualNetworkRules.java | 42 +- .../postgresql/models/package-info.java | 7 +- .../postgresql/package-info.java | 7 +- .../src/main/java/module-info.java | 4 +- .../proxy-config.json | 1 + .../reflect-config.json | 1 + .../CheckNameAvailabilityExecuteSamples.java | 18 +- .../ConfigurationsCreateOrUpdateSamples.java | 13 +- .../generated/ConfigurationsGetSamples.java | 15 +- .../ConfigurationsListByServerSamples.java | 14 +- .../DatabasesCreateOrUpdateSamples.java | 13 +- .../generated/DatabasesDeleteSamples.java | 14 +- .../generated/DatabasesGetSamples.java | 13 +- .../DatabasesListByServerSamples.java | 14 +- .../FirewallRulesCreateOrUpdateSamples.java | 13 +- .../generated/FirewallRulesDeleteSamples.java | 14 +- .../generated/FirewallRulesGetSamples.java | 14 +- .../FirewallRulesListByServerSamples.java | 14 +- ...cationBasedPerformanceTierListSamples.java | 14 +- .../LogFilesListByServerSamples.java | 14 +- .../generated/OperationsListSamples.java | 13 +- ...pointConnectionsCreateOrUpdateSamples.java | 16 +- ...ivateEndpointConnectionsDeleteSamples.java | 17 +- .../PrivateEndpointConnectionsGetSamples.java | 18 +- ...ndpointConnectionsListByServerSamples.java | 18 +- ...eEndpointConnectionsUpdateTagsSamples.java | 30 +- .../PrivateLinkResourcesGetSamples.java | 18 +- ...ivateLinkResourcesListByServerSamples.java | 18 +- .../RecoverableServersGetSamples.java | 14 +- .../ReplicasListByServerSamples.java | 15 +- ...erAdministratorsCreateOrUpdateSamples.java | 23 +- .../ServerAdministratorsDeleteSamples.java | 14 +- .../ServerAdministratorsGetSamples.java | 14 +- .../ServerAdministratorsListSamples.java | 14 +- ...ServerBasedPerformanceTierListSamples.java | 14 +- .../ServerKeysCreateOrUpdateSamples.java | 17 +- .../generated/ServerKeysDeleteSamples.java | 18 +- .../generated/ServerKeysGetSamples.java | 18 +- .../generated/ServerKeysListSamples.java | 13 +- ...metersListUpdateConfigurationsSamples.java | 17 +- ...ityAlertPoliciesCreateOrUpdateSamples.java | 40 +- ...ServerSecurityAlertPoliciesGetSamples.java | 21 +- ...urityAlertPoliciesListByServerSamples.java | 19 +- .../generated/ServersCreateSamples.java | 82 +- .../generated/ServersDeleteSamples.java | 13 +- .../ServersGetByResourceGroupSamples.java | 13 +- .../ServersListByResourceGroupSamples.java | 14 +- .../generated/ServersListSamples.java | 13 +- .../generated/ServersRestartSamples.java | 13 +- .../generated/ServersUpdateSamples.java | 18 +- ...tualNetworkRulesCreateOrUpdateSamples.java | 17 +- .../VirtualNetworkRulesDeleteSamples.java | 15 +- .../VirtualNetworkRulesGetSamples.java | 15 +- ...irtualNetworkRulesListByServerSamples.java | 14 +- ...abilitiesExecuteWithResponseMockTests.java | 42 + .../generated/ConfigurationInnerTests.java | 28 + .../ConfigurationListResultInnerTests.java | 33 + .../ConfigurationPropertiesTests.java | 28 + ...ConfigurationsCreateOrUpdateMockTests.java | 43 + ...onfigurationsGetWithResponseMockTests.java | 40 + .../ConfigurationsListByServerMockTests.java | 40 + .../generated/DatabaseInnerTests.java | 28 + .../generated/DatabaseListResultTests.java | 34 + .../generated/DatabasePropertiesTests.java | 27 + .../DatabasesCreateOrUpdateMockTests.java | 43 + .../generated/DatabasesDeleteMockTests.java | 33 + .../DatabasesGetWithResponseMockTests.java | 40 + .../DatabasesListByServerMockTests.java | 40 + .../generated/FirewallRuleInnerTests.java | 29 + .../FirewallRuleListResultTests.java | 32 + .../FirewallRulePropertiesTests.java | 29 + .../FirewallRulesCreateOrUpdateMockTests.java | 43 + .../FirewallRulesDeleteMockTests.java | 33 + ...FirewallRulesGetWithResponseMockTests.java | 40 + .../FirewallRulesListByServerMockTests.java | 40 + ...ionBasedPerformanceTiersListMockTests.java | 55 ++ .../generated/LogFileInnerTests.java | 31 + .../generated/LogFileListResultTests.java | 40 + .../generated/LogFilePropertiesTests.java | 32 + .../LogFilesListByServerMockTests.java | 41 + .../generated/NameAvailabilityInnerTests.java | 31 + .../NameAvailabilityRequestTests.java | 27 + .../generated/OperationDisplayTests.java | 23 + .../OperationListResultInnerTests.java | 26 + .../postgresql/generated/OperationTests.java | 23 + .../OperationsListWithResponseMockTests.java | 36 + .../PerformanceTierListResultTests.java | 111 +++ .../PerformanceTierPropertiesInnerTests.java | 70 ++ ...rmanceTierServiceLevelObjectivesTests.java | 47 + .../PrivateEndpointConnectionInnerTests.java | 35 + ...vateEndpointConnectionListResultTests.java | 23 + ...vateEndpointConnectionPropertiesTests.java | 36 + ...intConnectionsCreateOrUpdateMockTests.java | 48 + ...ateEndpointConnectionsDeleteMockTests.java | 34 + ...ntConnectionsGetWithResponseMockTests.java | 41 + ...pointConnectionsListByServerMockTests.java | 42 + .../PrivateEndpointPropertyTests.java | 25 + .../PrivateLinkResourceInnerTests.java | 23 + .../PrivateLinkResourceListResultTests.java | 23 + .../PrivateLinkResourcePropertiesTests.java | 23 + ...LinkResourcesGetWithResponseMockTests.java | 37 + ...ateLinkResourcesListByServerMockTests.java | 37 + ...nkServiceConnectionStatePropertyTests.java | 29 + .../RecoverableServerPropertiesTests.java | 23 + .../RecoverableServerResourceInnerTests.java | 23 + ...erableServersGetWithResponseMockTests.java | 37 + .../ReplicasListByServerMockTests.java | 75 ++ .../generated/ResourceIdentityTests.java | 27 + .../ServerAdministratorPropertiesTests.java | 38 + ...ServerAdministratorResourceInnerTests.java | 38 + ...rAdministratorResourceListResultTests.java | 55 ++ ...AdministratorsCreateOrUpdateMockTests.java | 49 + .../ServerAdministratorsDeleteMockTests.java | 33 + ...dministratorsGetWithResponseMockTests.java | 44 + .../ServerAdministratorsListMockTests.java | 46 + ...verBasedPerformanceTiersListMockTests.java | 55 ++ .../generated/ServerForCreateTests.java | 102 +++ .../generated/ServerInnerTests.java | 123 +++ .../generated/ServerKeysDeleteMockTests.java | 33 + .../generated/ServerListResultTests.java | 157 ++++ ...tersListUpdateConfigurationsMockTests.java | 48 + ...vateEndpointConnectionPropertiesTests.java | 39 + .../ServerPrivateEndpointConnectionTests.java | 23 + ...nkServiceConnectionStatePropertyTests.java | 32 + .../ServerPropertiesForCreateTests.java | 58 ++ .../ServerPropertiesForGeoRestoreTests.java | 61 ++ .../ServerPropertiesForReplicaTests.java | 61 ++ .../ServerPropertiesForRestoreTests.java | 65 ++ .../generated/ServerPropertiesTests.java | 81 ++ .../generated/ServersCreateMockTests.java | 108 +++ .../generated/ServersDeleteMockTests.java | 33 + ...tByResourceGroupWithResponseMockTests.java | 72 ++ .../ServersListByResourceGroupMockTests.java | 76 ++ .../generated/ServersListMockTests.java | 74 ++ .../generated/ServersRestartMockTests.java | 33 + .../postgresql/generated/SkuTests.java | 39 + .../generated/StorageProfileTests.java | 37 + .../postgresql/generated/TagsObjectTests.java | 38 + .../VirtualNetworkRuleInnerTests.java | 29 + .../VirtualNetworkRuleListResultTests.java | 23 + .../VirtualNetworkRulePropertiesTests.java | 30 + ...alNetworkRulesCreateOrUpdateMockTests.java | 43 + .../VirtualNetworkRulesDeleteMockTests.java | 34 + ...lNetworkRulesGetWithResponseMockTests.java | 40 + ...tualNetworkRulesListByServerMockTests.java | 40 + 333 files changed, 15119 insertions(+), 4752 deletions(-) rename sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/{Utils.java => ResourceManagerUtils.java} (88%) create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-postgresql/proxy-config.json create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-postgresql/reflect-config.json create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/CheckNameAvailabilitiesExecuteWithResponseMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationInnerTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationListResultInnerTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationPropertiesTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsCreateOrUpdateMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsGetWithResponseMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsListByServerMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabaseInnerTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabaseListResultTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasePropertiesTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasesCreateOrUpdateMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasesDeleteMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasesGetWithResponseMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasesListByServerMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRuleInnerTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRuleListResultTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulePropertiesTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesCreateOrUpdateMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesDeleteMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesGetWithResponseMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesListByServerMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LocationBasedPerformanceTiersListMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LogFileInnerTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LogFileListResultTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LogFilePropertiesTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LogFilesListByServerMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/NameAvailabilityInnerTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/NameAvailabilityRequestTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/OperationDisplayTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/OperationListResultInnerTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/OperationTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/OperationsListWithResponseMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PerformanceTierListResultTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PerformanceTierPropertiesInnerTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PerformanceTierServiceLevelObjectivesTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionInnerTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionListResultTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionPropertiesTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsCreateOrUpdateMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsDeleteMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsListByServerMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointPropertyTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourceInnerTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourceListResultTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcePropertiesTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcesGetWithResponseMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcesListByServerMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkServiceConnectionStatePropertyTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/RecoverableServerPropertiesTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/RecoverableServerResourceInnerTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/RecoverableServersGetWithResponseMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ReplicasListByServerMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ResourceIdentityTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorPropertiesTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorResourceInnerTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorResourceListResultTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsCreateOrUpdateMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsDeleteMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsGetWithResponseMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsListMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerBasedPerformanceTiersListMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerForCreateTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerInnerTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerKeysDeleteMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerListResultTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerParametersListUpdateConfigurationsMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPrivateEndpointConnectionPropertiesTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPrivateEndpointConnectionTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPrivateLinkServiceConnectionStatePropertyTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesForCreateTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesForGeoRestoreTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesForReplicaTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesForRestoreTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersCreateMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersDeleteMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersGetByResourceGroupWithResponseMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersListByResourceGroupMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersListMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersRestartMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/SkuTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/StorageProfileTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/TagsObjectTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRuleInnerTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRuleListResultTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulePropertiesTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesCreateOrUpdateMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesDeleteMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesGetWithResponseMockTests.java create mode 100644 sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesListByServerMockTests.java diff --git a/eng/versioning/version_client.txt b/eng/versioning/version_client.txt index 91941cdc7b8d1..3989e27fd15ba 100644 --- a/eng/versioning/version_client.txt +++ b/eng/versioning/version_client.txt @@ -292,7 +292,7 @@ com.azure.resourcemanager:azure-resourcemanager-trafficmanager;2.45.0;2.46.0 com.azure.resourcemanager:azure-resourcemanager-test;2.0.0-beta.1;2.0.0-beta.1 com.azure.resourcemanager:azure-resourcemanager-mediaservices;2.3.0;2.4.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-mysql;1.0.2;1.1.0-beta.1 -com.azure.resourcemanager:azure-resourcemanager-postgresql;1.0.2;1.1.0-beta.1 +com.azure.resourcemanager:azure-resourcemanager-postgresql;1.0.2;1.1.0 com.azure.resourcemanager:azure-resourcemanager-hdinsight;1.0.0;1.1.0-beta.3 com.azure.resourcemanager:azure-resourcemanager-sqlvirtualmachine;1.0.0-beta.5;1.0.0-beta.6 com.azure.resourcemanager:azure-resourcemanager-relay;1.0.0-beta.3;1.1.0-beta.1 diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/CHANGELOG.md b/sdk/postgresql/azure-resourcemanager-postgresql/CHANGELOG.md index 7d96aea7da23e..ae3b23f900648 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/CHANGELOG.md +++ b/sdk/postgresql/azure-resourcemanager-postgresql/CHANGELOG.md @@ -1,14 +1,83 @@ # Release History -## 1.1.0-beta.1 (Unreleased) +## 1.1.0 (2024-12-23) -### Features Added +- Azure Resource Manager PostgreSql client library for Java. This package contains Microsoft Azure SDK for PostgreSql Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert policies, 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). ### Breaking Changes -### Bugs Fixed +#### Serialization/Deserialization change + +- `Jackson` is removed from dependency and no longer supported. + +##### Migration Guide + +If you are using `Jackson`/`ObjectMapper` for manual serialization/deserialization, configure your `ObjectMapper` for backward compatibility: +```java +objectMapper.registerModule(com.azure.core.serializer.json.jackson.JacksonJsonProvider.getJsonSerializableDatabindModule()); +``` + +### Features Added + +#### `models.ServerPropertiesForRestore` was modified + +* `createMode()` was added + +#### `models.FirewallRule` was modified + +* `resourceGroupName()` was added + +#### `models.VirtualNetworkRule` was modified + +* `resourceGroupName()` was added + +#### `models.ServerPropertiesForReplica` was modified + +* `createMode()` was added + +#### `models.Database` was modified + +* `resourceGroupName()` was added + +#### `models.ServerPropertiesForCreate` was modified + +* `createMode()` was added + +#### `models.PrivateEndpointConnection` was modified + +* `resourceGroupName()` was added + +#### `PostgreSqlManager` was modified + +* `authenticate(com.azure.core.http.HttpPipeline,com.azure.core.management.profile.AzureProfile)` was added + +#### `models.ServerKey` was modified + +* `resourceGroupName()` was added + +#### `PostgreSqlManager$Configurable` was modified + +* `withRetryOptions(com.azure.core.http.policy.RetryOptions)` was added + +#### `models.Server` was modified + +* `resourceGroupName()` was added + +#### `models.Configuration` was modified + +* `resourceGroupName()` was added + +#### `models.ServerSecurityAlertPolicy` was modified + +* `resourceGroupName()` was added + +#### `models.ServerPropertiesForDefaultCreate` was modified + +* `createMode()` was added + +#### `models.ServerPropertiesForGeoRestore` was modified -### Other Changes +* `createMode()` was added ## 1.0.2 (2022-01-24) diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/README.md b/sdk/postgresql/azure-resourcemanager-postgresql/README.md index 15ccfea024063..cc574d5a9f70c 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/README.md +++ b/sdk/postgresql/azure-resourcemanager-postgresql/README.md @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-postgresql - 1.0.2 + 1.1.0 ``` [//]: # ({x-version-update-end}) @@ -41,19 +41,15 @@ Various documentation is available to help you get started 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. +[Azure Identity][azure_identity] and [Azure Core Netty HTTP][azure_core_http_netty] packages provide the default implementation. ### Authentication -By default, Azure Active Directory token authentication depends on correct configure of following environment variables. +Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package. -- `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. +Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable. -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: +Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code: ```java AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE); @@ -74,6 +70,28 @@ See [API design][design] for general introduction on design and key concepts on ## Examples +```java +server = postgreSqlManager.servers() + .define(serverName) + .withRegion(REGION) + .withExistingResourceGroup(resourceGroupName) + .withProperties(new ServerPropertiesForDefaultCreate().withAdministratorLogin(adminName) + .withAdministratorLoginPassword(adminPwd) + .withStorageProfile(new StorageProfile().withBackupRetentionDays(7) + .withGeoRedundantBackup(GeoRedundantBackup.DISABLED) + .withStorageMB(102400) + .withStorageAutogrow(StorageAutogrow.ENABLED)) + .withSslEnforcement(SslEnforcementEnum.ENABLED) + .withPublicNetworkAccess(PublicNetworkAccessEnum.ENABLED) + .withInfrastructureEncryption(InfrastructureEncryption.DISABLED) + .withVersion(ServerVersion.ONE_ONE)) + .withIdentity(new ResourceIdentity().withType(IdentityType.SYSTEM_ASSIGNED)) + .withSku(new Sku().withName("GP_Gen5_4") + .withTier(SkuTier.GENERAL_PURPOSE) + .withCapacity(4) + .withFamily("Gen5")) + .create(); +``` [Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/postgresql/azure-resourcemanager-postgresql/SAMPLE.md) @@ -83,20 +101,26 @@ See [API design][design] for general introduction on design and key concepts on ## Contributing -For details on contributing to this repository, see the [contributing guide](https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md). +For details on contributing to this repository, see the [contributing guide][cg]. -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 +This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For more information see the [Code of Conduct FAQ][coc_faq] or contact with any additional questions or comments. [survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS [docs]: https://azure.github.io/azure-sdk-for-java/ -[jdk]: https://docs.microsoft.com/java/azure/jdk/ +[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/ [azure_subscription]: https://azure.microsoft.com/free/ [azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials [azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty [authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md [design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md +[cg]: https://github.com/Azure/azure-sdk-for-java/blob/main/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fpostgresql%2Fazure-resourcemanager-postgresql%2FREADME.png) diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/SAMPLE.md b/sdk/postgresql/azure-resourcemanager-postgresql/SAMPLE.md index d1605c3c0b563..6f479123a249c 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/SAMPLE.md +++ b/sdk/postgresql/azure-resourcemanager-postgresql/SAMPLE.md @@ -105,24 +105,26 @@ ### CheckNameAvailability_Execute ```java -import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.models.NameAvailabilityRequest; -/** Samples for CheckNameAvailability Execute. */ +/** + * Samples for CheckNameAvailability Execute. + */ public final class CheckNameAvailabilityExecuteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/CheckNameAvailability.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * CheckNameAvailability.json */ /** * Sample code: NameAvailability. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void nameAvailability(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .checkNameAvailabilities() - .executeWithResponse( - new NameAvailabilityRequest().withName("name1").withType("Microsoft.DBforPostgreSQL"), Context.NONE); + manager.checkNameAvailabilities() + .executeWithResponse(new NameAvailabilityRequest().withName("name1").withType("Microsoft.DBforPostgreSQL"), + com.azure.core.util.Context.NONE); } } ``` @@ -130,19 +132,22 @@ public final class CheckNameAvailabilityExecuteSamples { ### Configurations_CreateOrUpdate ```java -/** Samples for Configurations CreateOrUpdate. */ +/** + * Samples for Configurations CreateOrUpdate. + */ public final class ConfigurationsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationCreateOrUpdate.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ConfigurationCreateOrUpdate.json */ /** * Sample code: ConfigurationCreateOrUpdate. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void configurationCreateOrUpdate(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .configurations() + manager.configurations() .define("array_nulls") .withExistingServer("TestGroup", "testserver") .withValue("off") @@ -155,20 +160,23 @@ public final class ConfigurationsCreateOrUpdateSamples { ### Configurations_Get ```java -import com.azure.core.util.Context; - -/** Samples for Configurations Get. */ +/** + * Samples for Configurations Get. + */ public final class ConfigurationsGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationGet. + * json */ /** * Sample code: ConfigurationGet. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void configurationGet(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.configurations().getWithResponse("TestGroup", "testserver", "array_nulls", Context.NONE); + manager.configurations() + .getWithResponse("TestGroup", "testserver", "array_nulls", com.azure.core.util.Context.NONE); } } ``` @@ -176,20 +184,22 @@ public final class ConfigurationsGetSamples { ### Configurations_ListByServer ```java -import com.azure.core.util.Context; - -/** Samples for Configurations ListByServer. */ +/** + * Samples for Configurations ListByServer. + */ public final class ConfigurationsListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationListByServer.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ConfigurationListByServer.json */ /** * Sample code: ConfigurationList. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void configurationList(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.configurations().listByServer("TestGroup", "testserver", Context.NONE); + manager.configurations().listByServer("TestGroup", "testserver", com.azure.core.util.Context.NONE); } } ``` @@ -197,19 +207,22 @@ public final class ConfigurationsListByServerSamples { ### Databases_CreateOrUpdate ```java -/** Samples for Databases CreateOrUpdate. */ +/** + * Samples for Databases CreateOrUpdate. + */ public final class DatabasesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseCreate.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseCreate. + * json */ /** * Sample code: DatabaseCreate. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void databaseCreate(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .databases() + manager.databases() .define("db1") .withExistingServer("TestGroup", "testserver") .withCharset("UTF8") @@ -222,20 +235,22 @@ public final class DatabasesCreateOrUpdateSamples { ### Databases_Delete ```java -import com.azure.core.util.Context; - -/** Samples for Databases Delete. */ +/** + * Samples for Databases Delete. + */ public final class DatabasesDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseDelete.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseDelete. + * json */ /** * Sample code: DatabaseDelete. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void databaseDelete(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.databases().delete("TestGroup", "testserver", "db1", Context.NONE); + manager.databases().delete("TestGroup", "testserver", "db1", com.azure.core.util.Context.NONE); } } ``` @@ -243,20 +258,21 @@ public final class DatabasesDeleteSamples { ### Databases_Get ```java -import com.azure.core.util.Context; - -/** Samples for Databases Get. */ +/** + * Samples for Databases Get. + */ public final class DatabasesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseGet.json */ /** * Sample code: DatabaseGet. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void databaseGet(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.databases().getWithResponse("TestGroup", "testserver", "db1", Context.NONE); + manager.databases().getWithResponse("TestGroup", "testserver", "db1", com.azure.core.util.Context.NONE); } } ``` @@ -264,20 +280,22 @@ public final class DatabasesGetSamples { ### Databases_ListByServer ```java -import com.azure.core.util.Context; - -/** Samples for Databases ListByServer. */ +/** + * Samples for Databases ListByServer. + */ public final class DatabasesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseListByServer.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * DatabaseListByServer.json */ /** * Sample code: DatabaseList. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void databaseList(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.databases().listByServer("TestGroup", "testserver", Context.NONE); + manager.databases().listByServer("TestGroup", "testserver", com.azure.core.util.Context.NONE); } } ``` @@ -285,19 +303,22 @@ public final class DatabasesListByServerSamples { ### FirewallRules_CreateOrUpdate ```java -/** Samples for FirewallRules CreateOrUpdate. */ +/** + * Samples for FirewallRules CreateOrUpdate. + */ public final class FirewallRulesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleCreate.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleCreate + * .json */ /** * Sample code: FirewallRuleCreate. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void firewallRuleCreate(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .firewallRules() + manager.firewallRules() .define("rule1") .withExistingServer("TestGroup", "testserver") .withStartIpAddress("0.0.0.0") @@ -310,20 +331,22 @@ public final class FirewallRulesCreateOrUpdateSamples { ### FirewallRules_Delete ```java -import com.azure.core.util.Context; - -/** Samples for FirewallRules Delete. */ +/** + * Samples for FirewallRules Delete. + */ public final class FirewallRulesDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleDelete.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleDelete + * .json */ /** * Sample code: FirewallRuleDelete. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void firewallRuleDelete(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.firewallRules().delete("TestGroup", "testserver", "rule1", Context.NONE); + manager.firewallRules().delete("TestGroup", "testserver", "rule1", com.azure.core.util.Context.NONE); } } ``` @@ -331,20 +354,22 @@ public final class FirewallRulesDeleteSamples { ### FirewallRules_Get ```java -import com.azure.core.util.Context; - -/** Samples for FirewallRules Get. */ +/** + * Samples for FirewallRules Get. + */ public final class FirewallRulesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleGet. + * json */ /** * Sample code: FirewallRuleGet. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void firewallRuleGet(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.firewallRules().getWithResponse("TestGroup", "testserver", "rule1", Context.NONE); + manager.firewallRules().getWithResponse("TestGroup", "testserver", "rule1", com.azure.core.util.Context.NONE); } } ``` @@ -352,20 +377,22 @@ public final class FirewallRulesGetSamples { ### FirewallRules_ListByServer ```java -import com.azure.core.util.Context; - -/** Samples for FirewallRules ListByServer. */ +/** + * Samples for FirewallRules ListByServer. + */ public final class FirewallRulesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleListByServer.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * FirewallRuleListByServer.json */ /** * Sample code: FirewallRuleList. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void firewallRuleList(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.firewallRules().listByServer("TestGroup", "testserver", Context.NONE); + manager.firewallRules().listByServer("TestGroup", "testserver", com.azure.core.util.Context.NONE); } } ``` @@ -373,20 +400,22 @@ public final class FirewallRulesListByServerSamples { ### LocationBasedPerformanceTier_List ```java -import com.azure.core.util.Context; - -/** Samples for LocationBasedPerformanceTier List. */ +/** + * Samples for LocationBasedPerformanceTier List. + */ public final class LocationBasedPerformanceTierListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/PerformanceTiersListByLocation.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * PerformanceTiersListByLocation.json */ /** * Sample code: PerformanceTiersList. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void performanceTiersList(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.locationBasedPerformanceTiers().list("WestUS", Context.NONE); + manager.locationBasedPerformanceTiers().list("WestUS", com.azure.core.util.Context.NONE); } } ``` @@ -394,20 +423,22 @@ public final class LocationBasedPerformanceTierListSamples { ### LogFiles_ListByServer ```java -import com.azure.core.util.Context; - -/** Samples for LogFiles ListByServer. */ +/** + * Samples for LogFiles ListByServer. + */ public final class LogFilesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/LogFileListByServer.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * LogFileListByServer.json */ /** * Sample code: LogFileList. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void logFileList(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.logFiles().listByServer("TestGroup", "testserver", Context.NONE); + manager.logFiles().listByServer("TestGroup", "testserver", com.azure.core.util.Context.NONE); } } ``` @@ -415,20 +446,21 @@ public final class LogFilesListByServerSamples { ### Operations_List ```java -import com.azure.core.util.Context; - -/** Samples for Operations List. */ +/** + * Samples for Operations List. + */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/OperationList.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/OperationList.json */ /** * Sample code: OperationList. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void operationList(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.operations().listWithResponse(Context.NONE); + manager.operations().listWithResponse(com.azure.core.util.Context.NONE); } } ``` @@ -438,25 +470,27 @@ public final class OperationsListSamples { ```java import com.azure.resourcemanager.postgresql.models.PrivateLinkServiceConnectionStateProperty; -/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +/** + * Samples for PrivateEndpointConnections CreateOrUpdate. + */ public final class PrivateEndpointConnectionsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdate.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/ + * PrivateEndpointConnectionUpdate.json */ /** * Sample code: Approve or reject a private endpoint connection with a given name. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .privateEndpointConnections() + manager.privateEndpointConnections() .define("private-endpoint-connection-name") .withExistingServer("Default", "test-svr") .withPrivateLinkServiceConnectionState( - new PrivateLinkServiceConnectionStateProperty() - .withStatus("Approved") + new PrivateLinkServiceConnectionStateProperty().withStatus("Approved") .withDescription("Approved by johndoe@contoso.com")) .create(); } @@ -466,23 +500,24 @@ public final class PrivateEndpointConnectionsCreateOrUpdateSamples { ### PrivateEndpointConnections_Delete ```java -import com.azure.core.util.Context; - -/** Samples for PrivateEndpointConnections Delete. */ +/** + * Samples for PrivateEndpointConnections Delete. + */ public final class PrivateEndpointConnectionsDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionDelete.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/ + * PrivateEndpointConnectionDelete.json */ /** * Sample code: Deletes a private endpoint connection with a given name. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void deletesAPrivateEndpointConnectionWithAGivenName( com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .privateEndpointConnections() - .delete("Default", "test-svr", "private-endpoint-connection-name", Context.NONE); + manager.privateEndpointConnections() + .delete("Default", "test-svr", "private-endpoint-connection-name", com.azure.core.util.Context.NONE); } } ``` @@ -490,22 +525,24 @@ public final class PrivateEndpointConnectionsDeleteSamples { ### PrivateEndpointConnections_Get ```java -import com.azure.core.util.Context; - -/** Samples for PrivateEndpointConnections Get. */ +/** + * Samples for PrivateEndpointConnections Get. + */ public final class PrivateEndpointConnectionsGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/ + * PrivateEndpointConnectionGet.json */ /** * Sample code: Gets private endpoint connection. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void getsPrivateEndpointConnection(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .privateEndpointConnections() - .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", Context.NONE); + manager.privateEndpointConnections() + .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", + com.azure.core.util.Context.NONE); } } ``` @@ -513,21 +550,23 @@ public final class PrivateEndpointConnectionsGetSamples { ### PrivateEndpointConnections_ListByServer ```java -import com.azure.core.util.Context; - -/** Samples for PrivateEndpointConnections ListByServer. */ +/** + * Samples for PrivateEndpointConnections ListByServer. + */ public final class PrivateEndpointConnectionsListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionList.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/ + * PrivateEndpointConnectionList.json */ /** * Sample code: Gets list of private endpoint connections on a server. - * + * * @param manager Entry point to PostgreSqlManager. */ - public static void getsListOfPrivateEndpointConnectionsOnAServer( - com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.privateEndpointConnections().listByServer("Default", "test-svr", Context.NONE); + public static void + getsListOfPrivateEndpointConnectionsOnAServer(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { + manager.privateEndpointConnections().listByServer("Default", "test-svr", com.azure.core.util.Context.NONE); } } ``` @@ -535,31 +574,37 @@ public final class PrivateEndpointConnectionsListByServerSamples { ### PrivateEndpointConnections_UpdateTags ```java -import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.models.PrivateEndpointConnection; import java.util.HashMap; import java.util.Map; -/** Samples for PrivateEndpointConnections UpdateTags. */ +/** + * Samples for PrivateEndpointConnections UpdateTags. + */ public final class PrivateEndpointConnectionsUpdateTagsSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdateTags.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/ + * PrivateEndpointConnectionUpdateTags.json */ /** * Sample code: Update private endpoint connection Tags. - * + * * @param manager Entry point to PostgreSqlManager. */ - public static void updatePrivateEndpointConnectionTags( - com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - PrivateEndpointConnection resource = - manager - .privateEndpointConnections() - .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", Context.NONE) - .getValue(); - resource.update().withTags(mapOf("key1", "val1", "key2", "val2", "key3", "val3")).apply(); + public static void + updatePrivateEndpointConnectionTags(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { + PrivateEndpointConnection resource = manager.privateEndpointConnections() + .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags( + mapOf("key1", "fakeTokenPlaceholder", "key2", "fakeTokenPlaceholder", "key3", "fakeTokenPlaceholder")) + .apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -576,21 +621,23 @@ public final class PrivateEndpointConnectionsUpdateTagsSamples { ### PrivateLinkResources_Get ```java -import com.azure.core.util.Context; - -/** Samples for PrivateLinkResources Get. */ +/** + * Samples for PrivateLinkResources Get. + */ public final class PrivateLinkResourcesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateLinkResourcesGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/ + * PrivateLinkResourcesGet.json */ /** * Sample code: Gets a private link resource for PostgreSQL. - * + * * @param manager Entry point to PostgreSqlManager. */ - public static void getsAPrivateLinkResourceForPostgreSQL( - com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.privateLinkResources().getWithResponse("Default", "test-svr", "plr", Context.NONE); + public static void + getsAPrivateLinkResourceForPostgreSQL(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { + manager.privateLinkResources().getWithResponse("Default", "test-svr", "plr", com.azure.core.util.Context.NONE); } } ``` @@ -598,21 +645,23 @@ public final class PrivateLinkResourcesGetSamples { ### PrivateLinkResources_ListByServer ```java -import com.azure.core.util.Context; - -/** Samples for PrivateLinkResources ListByServer. */ +/** + * Samples for PrivateLinkResources ListByServer. + */ public final class PrivateLinkResourcesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateLinkResourcesList.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/ + * PrivateLinkResourcesList.json */ /** * Sample code: Gets private link resources for PostgreSQL. - * + * * @param manager Entry point to PostgreSqlManager. */ - public static void getsPrivateLinkResourcesForPostgreSQL( - com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.privateLinkResources().listByServer("Default", "test-svr", Context.NONE); + public static void + getsPrivateLinkResourcesForPostgreSQL(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { + manager.privateLinkResources().listByServer("Default", "test-svr", com.azure.core.util.Context.NONE); } } ``` @@ -620,20 +669,22 @@ public final class PrivateLinkResourcesListByServerSamples { ### RecoverableServers_Get ```java -import com.azure.core.util.Context; - -/** Samples for RecoverableServers Get. */ +/** + * Samples for RecoverableServers Get. + */ public final class RecoverableServersGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/RecoverableServersGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * RecoverableServersGet.json */ /** * Sample code: ReplicasListByServer. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void replicasListByServer(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.recoverableServers().getWithResponse("testrg", "pgtestsvc4", Context.NONE); + manager.recoverableServers().getWithResponse("testrg", "pgtestsvc4", com.azure.core.util.Context.NONE); } } ``` @@ -641,20 +692,23 @@ public final class RecoverableServersGetSamples { ### Replicas_ListByServer ```java -import com.azure.core.util.Context; - -/** Samples for Replicas ListByServer. */ +/** + * Samples for Replicas ListByServer. + */ public final class ReplicasListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ReplicasListByServer.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ReplicasListByServer.json */ /** * Sample code: ReplicasListByServer. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void replicasListByServer(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.replicas().listByServer("TestGroup_WestCentralUS", "testserver-master", Context.NONE); + manager.replicas() + .listByServer("TestGroup_WestCentralUS", "testserver-master", com.azure.core.util.Context.NONE); } } ``` @@ -662,33 +716,32 @@ public final class ReplicasListByServerSamples { ### ServerAdministrators_CreateOrUpdate ```java -import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.fluent.models.ServerAdministratorResourceInner; import com.azure.resourcemanager.postgresql.models.AdministratorType; import java.util.UUID; -/** Samples for ServerAdministrators CreateOrUpdate. */ +/** + * Samples for ServerAdministrators CreateOrUpdate. + */ public final class ServerAdministratorsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminCreateUpdate.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ServerAdminCreateUpdate.json */ /** * Sample code: ServerAdministratorCreate. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void serverAdministratorCreate(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .serverAdministrators() - .createOrUpdate( - "testrg", - "pgtestsvc4", - new ServerAdministratorResourceInner() - .withAdministratorType(AdministratorType.ACTIVE_DIRECTORY) + manager.serverAdministrators() + .createOrUpdate("testrg", "pgtestsvc4", + new ServerAdministratorResourceInner().withAdministratorType(AdministratorType.ACTIVE_DIRECTORY) .withLogin("bob@contoso.com") .withSid(UUID.fromString("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c")) .withTenantId(UUID.fromString("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c")), - Context.NONE); + com.azure.core.util.Context.NONE); } } ``` @@ -696,20 +749,22 @@ public final class ServerAdministratorsCreateOrUpdateSamples { ### ServerAdministrators_Delete ```java -import com.azure.core.util.Context; - -/** Samples for ServerAdministrators Delete. */ +/** + * Samples for ServerAdministrators Delete. + */ public final class ServerAdministratorsDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminDelete.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminDelete. + * json */ /** * Sample code: ServerAdministratorsDelete. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void serverAdministratorsDelete(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.serverAdministrators().delete("testrg", "pgtestsvc4", Context.NONE); + manager.serverAdministrators().delete("testrg", "pgtestsvc4", com.azure.core.util.Context.NONE); } } ``` @@ -717,20 +772,22 @@ public final class ServerAdministratorsDeleteSamples { ### ServerAdministrators_Get ```java -import com.azure.core.util.Context; - -/** Samples for ServerAdministrators Get. */ +/** + * Samples for ServerAdministrators Get. + */ public final class ServerAdministratorsGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminGet. + * json */ /** * Sample code: ServerAdministratorGet. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void serverAdministratorGet(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.serverAdministrators().getWithResponse("testrg", "pgtestsvc4", Context.NONE); + manager.serverAdministrators().getWithResponse("testrg", "pgtestsvc4", com.azure.core.util.Context.NONE); } } ``` @@ -738,20 +795,22 @@ public final class ServerAdministratorsGetSamples { ### ServerAdministrators_List ```java -import com.azure.core.util.Context; - -/** Samples for ServerAdministrators List. */ +/** + * Samples for ServerAdministrators List. + */ public final class ServerAdministratorsListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminList.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminList. + * json */ /** * Sample code: get a list of server administrators. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void getAListOfServerAdministrators(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.serverAdministrators().list("testrg", "pgtestsvc4", Context.NONE); + manager.serverAdministrators().list("testrg", "pgtestsvc4", com.azure.core.util.Context.NONE); } } ``` @@ -759,20 +818,22 @@ public final class ServerAdministratorsListSamples { ### ServerBasedPerformanceTier_List ```java -import com.azure.core.util.Context; - -/** Samples for ServerBasedPerformanceTier List. */ +/** + * Samples for ServerBasedPerformanceTier List. + */ public final class ServerBasedPerformanceTierListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/PerformanceTiersListByServer.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * PerformanceTiersListByServer.json */ /** * Sample code: PerformanceTiersList. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void performanceTiersList(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.serverBasedPerformanceTiers().list("TestGroup", "testserver", Context.NONE); + manager.serverBasedPerformanceTiers().list("TestGroup", "testserver", com.azure.core.util.Context.NONE); } } ``` @@ -782,20 +843,23 @@ public final class ServerBasedPerformanceTierListSamples { ```java import com.azure.resourcemanager.postgresql.models.ServerKeyType; -/** Samples for ServerKeys CreateOrUpdate. */ +/** + * Samples for ServerKeys CreateOrUpdate. + */ public final class ServerKeysCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyCreateOrUpdate.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ + * ServerKeyCreateOrUpdate.json */ /** * Sample code: Creates or updates a PostgreSQL Server key. - * + * * @param manager Entry point to PostgreSqlManager. */ - public static void createsOrUpdatesAPostgreSQLServerKey( - com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .serverKeys() + public static void + createsOrUpdatesAPostgreSQLServerKey(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { + manager.serverKeys() .define("someVault_someKey_01234567890123456789012345678901") .withExistingServer("testserver", "testrg") .withServerKeyType(ServerKeyType.AZURE_KEY_VAULT) @@ -808,22 +872,24 @@ public final class ServerKeysCreateOrUpdateSamples { ### ServerKeys_Delete ```java -import com.azure.core.util.Context; - -/** Samples for ServerKeys Delete. */ +/** + * Samples for ServerKeys Delete. + */ public final class ServerKeysDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyDelete.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyDelete. + * json */ /** * Sample code: Delete the PostgreSQL Server key. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void deleteThePostgreSQLServerKey(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .serverKeys() - .delete("testserver", "someVault_someKey_01234567890123456789012345678901", "testrg", Context.NONE); + manager.serverKeys() + .delete("testserver", "someVault_someKey_01234567890123456789012345678901", "testrg", + com.azure.core.util.Context.NONE); } } ``` @@ -831,23 +897,23 @@ public final class ServerKeysDeleteSamples { ### ServerKeys_Get ```java -import com.azure.core.util.Context; - -/** Samples for ServerKeys Get. */ +/** + * Samples for ServerKeys Get. + */ public final class ServerKeysGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyGet.json */ /** * Sample code: Get the PostgreSQL Server key. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void getThePostgreSQLServerKey(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .serverKeys() - .getWithResponse( - "testrg", "testserver", "someVault_someKey_01234567890123456789012345678901", Context.NONE); + manager.serverKeys() + .getWithResponse("testrg", "testserver", "someVault_someKey_01234567890123456789012345678901", + com.azure.core.util.Context.NONE); } } ``` @@ -855,20 +921,21 @@ public final class ServerKeysGetSamples { ### ServerKeys_List ```java -import com.azure.core.util.Context; - -/** Samples for ServerKeys List. */ +/** + * Samples for ServerKeys List. + */ public final class ServerKeysListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyList.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyList.json */ /** * Sample code: List the keys for a PostgreSQL Server. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void listTheKeysForAPostgreSQLServer(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.serverKeys().list("testrg", "testserver", Context.NONE); + manager.serverKeys().list("testrg", "testserver", com.azure.core.util.Context.NONE); } } ``` @@ -876,23 +943,26 @@ public final class ServerKeysListSamples { ### ServerParameters_ListUpdateConfigurations ```java -import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationListResultInner; -/** Samples for ServerParameters ListUpdateConfigurations. */ +/** + * Samples for ServerParameters ListUpdateConfigurations. + */ public final class ServerParametersListUpdateConfigurationsSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationsUpdateByServer.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ConfigurationsUpdateByServer.json */ /** * Sample code: ConfigurationList. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void configurationList(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .serverParameters() - .listUpdateConfigurations("TestGroup", "testserver", new ConfigurationListResultInner(), Context.NONE); + manager.serverParameters() + .listUpdateConfigurations("TestGroup", "testserver", new ConfigurationListResultInner(), + com.azure.core.util.Context.NONE); } } ``` @@ -900,51 +970,51 @@ public final class ServerParametersListUpdateConfigurationsSamples { ### ServerSecurityAlertPolicies_CreateOrUpdate ```java -import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.models.SecurityAlertPolicyName; import com.azure.resourcemanager.postgresql.models.ServerSecurityAlertPolicy; import com.azure.resourcemanager.postgresql.models.ServerSecurityAlertPolicyState; import java.util.Arrays; -/** Samples for ServerSecurityAlertPolicies CreateOrUpdate. */ +/** + * Samples for ServerSecurityAlertPolicies CreateOrUpdate. + */ public final class ServerSecurityAlertPoliciesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMin.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ServerSecurityAlertsCreateMin.json */ /** * Sample code: Update a server's threat detection policy with minimal parameters. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void updateAServerSThreatDetectionPolicyWithMinimalParameters( com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - ServerSecurityAlertPolicy resource = - manager - .serverSecurityAlertPolicies() - .getWithResponse( - "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) - .getValue(); + ServerSecurityAlertPolicy resource = manager.serverSecurityAlertPolicies() + .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, + com.azure.core.util.Context.NONE) + .getValue(); resource.update().withState(ServerSecurityAlertPolicyState.DISABLED).withEmailAccountAdmins(true).apply(); } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMax.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ServerSecurityAlertsCreateMax.json */ /** * Sample code: Update a server's threat detection policy with all parameters. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void updateAServerSThreatDetectionPolicyWithAllParameters( com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - ServerSecurityAlertPolicy resource = - manager - .serverSecurityAlertPolicies() - .getWithResponse( - "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) - .getValue(); - resource - .update() + ServerSecurityAlertPolicy resource = manager.serverSecurityAlertPolicies() + .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() .withState(ServerSecurityAlertPolicyState.ENABLED) .withDisabledAlerts(Arrays.asList("Access_Anomaly", "Usage_Anomaly")) .withEmailAddresses(Arrays.asList("testSecurityAlert@microsoft.com")) @@ -961,24 +1031,27 @@ public final class ServerSecurityAlertPoliciesCreateOrUpdateSamples { ### ServerSecurityAlertPolicies_Get ```java -import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.models.SecurityAlertPolicyName; -/** Samples for ServerSecurityAlertPolicies Get. */ +/** + * Samples for ServerSecurityAlertPolicies Get. + */ public final class ServerSecurityAlertPoliciesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ServerSecurityAlertsGet.json */ /** * Sample code: Get a server's threat detection policy. - * + * * @param manager Entry point to PostgreSqlManager. */ - public static void getAServerSThreatDetectionPolicy( - com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .serverSecurityAlertPolicies() - .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE); + public static void + getAServerSThreatDetectionPolicy(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { + manager.serverSecurityAlertPolicies() + .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, + com.azure.core.util.Context.NONE); } } ``` @@ -986,21 +1059,24 @@ public final class ServerSecurityAlertPoliciesGetSamples { ### ServerSecurityAlertPolicies_ListByServer ```java -import com.azure.core.util.Context; - -/** Samples for ServerSecurityAlertPolicies ListByServer. */ +/** + * Samples for ServerSecurityAlertPolicies ListByServer. + */ public final class ServerSecurityAlertPoliciesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsListByServer.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ServerSecurityAlertsListByServer.json */ /** * Sample code: List the server's threat detection policies. - * + * * @param manager Entry point to PostgreSqlManager. */ - public static void listTheServerSThreatDetectionPolicies( - com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.serverSecurityAlertPolicies().listByServer("securityalert-4799", "securityalert-6440", Context.NONE); + public static void + listTheServerSThreatDetectionPolicies(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { + manager.serverSecurityAlertPolicies() + .listByServer("securityalert-4799", "securityalert-6440", com.azure.core.util.Context.NONE); } } ``` @@ -1022,49 +1098,49 @@ import java.time.OffsetDateTime; import java.util.HashMap; import java.util.Map; -/** Samples for Servers Create. */ +/** + * Samples for Servers Create. + */ public final class ServersCreateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ServerCreateReplicaMode.json */ /** * Sample code: Create a replica server. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void createAReplicaServer(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .servers() + manager.servers() .define("testserver-replica1") .withRegion("westcentralus") .withExistingResourceGroup("TestGroup_WestCentralUS") - .withProperties( - new ServerPropertiesForReplica() - .withSourceServerId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master")) + .withProperties(new ServerPropertiesForReplica().withSourceServerId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master")) .withSku( new Sku().withName("GP_Gen5_2").withTier(SkuTier.GENERAL_PURPOSE).withCapacity(2).withFamily("Gen5")) .create(); } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateGeoRestoreMode.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ServerCreateGeoRestoreMode.json */ /** * Sample code: Create a server as a geo restore. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void createAServerAsAGeoRestore(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .servers() + manager.servers() .define("targetserver") .withRegion("westus") .withExistingResourceGroup("TargetResourceGroup") - .withProperties( - new ServerPropertiesForGeoRestore() - .withSourceServerId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver")) + .withProperties(new ServerPropertiesForGeoRestore().withSourceServerId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver")) .withTags(mapOf("ElasticServer", "1")) .withSku( new Sku().withName("GP_Gen5_2").withTier(SkuTier.GENERAL_PURPOSE).withCapacity(2).withFamily("Gen5")) @@ -1072,60 +1148,56 @@ public final class ServersCreateSamples { } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreate.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreate.json */ /** * Sample code: Create a new server. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void createANewServer(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .servers() + manager.servers() .define("pgtestsvc4") .withRegion("westus") .withExistingResourceGroup("TestGroup") - .withProperties( - new ServerPropertiesForDefaultCreate() - .withSslEnforcement(SslEnforcementEnum.ENABLED) - .withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_2) - .withStorageProfile( - new StorageProfile() - .withBackupRetentionDays(7) - .withGeoRedundantBackup(GeoRedundantBackup.DISABLED) - .withStorageMB(128000)) - .withAdministratorLogin("cloudsa") - .withAdministratorLoginPassword("")) + .withProperties(new ServerPropertiesForDefaultCreate().withSslEnforcement(SslEnforcementEnum.ENABLED) + .withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_2) + .withStorageProfile(new StorageProfile().withBackupRetentionDays(7) + .withGeoRedundantBackup(GeoRedundantBackup.DISABLED) + .withStorageMB(128000)) + .withAdministratorLogin("cloudsa") + .withAdministratorLoginPassword("fakeTokenPlaceholder")) .withTags(mapOf("ElasticServer", "1")) .withSku(new Sku().withName("B_Gen5_2").withTier(SkuTier.BASIC).withCapacity(2).withFamily("Gen5")) .create(); } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreatePointInTimeRestore.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ServerCreatePointInTimeRestore.json */ /** * Sample code: Create a database as a point in time restore. - * + * * @param manager Entry point to PostgreSqlManager. */ - public static void createADatabaseAsAPointInTimeRestore( - com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .servers() + public static void + createADatabaseAsAPointInTimeRestore(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { + manager.servers() .define("targetserver") .withRegion("brazilsouth") .withExistingResourceGroup("TargetResourceGroup") - .withProperties( - new ServerPropertiesForRestore() - .withSourceServerId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver") - .withRestorePointInTime(OffsetDateTime.parse("2017-12-14T00:00:37.467Z"))) + .withProperties(new ServerPropertiesForRestore().withSourceServerId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver") + .withRestorePointInTime(OffsetDateTime.parse("2017-12-14T00:00:37.467Z"))) .withTags(mapOf("ElasticServer", "1")) .withSku(new Sku().withName("B_Gen5_2").withTier(SkuTier.BASIC).withCapacity(2).withFamily("Gen5")) .create(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); @@ -1142,20 +1214,21 @@ public final class ServersCreateSamples { ### Servers_Delete ```java -import com.azure.core.util.Context; - -/** Samples for Servers Delete. */ +/** + * Samples for Servers Delete. + */ public final class ServersDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerDelete.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerDelete.json */ /** * Sample code: ServerDelete. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void serverDelete(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.servers().delete("TestGroup", "testserver", Context.NONE); + manager.servers().delete("TestGroup", "testserver", com.azure.core.util.Context.NONE); } } ``` @@ -1163,20 +1236,21 @@ public final class ServersDeleteSamples { ### Servers_GetByResourceGroup ```java -import com.azure.core.util.Context; - -/** Samples for Servers GetByResourceGroup. */ +/** + * Samples for Servers GetByResourceGroup. + */ public final class ServersGetByResourceGroupSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerGet.json */ /** * Sample code: ServerGet. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void serverGet(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.servers().getByResourceGroupWithResponse("testrg", "pgtestsvc1", Context.NONE); + manager.servers().getByResourceGroupWithResponse("testrg", "pgtestsvc1", com.azure.core.util.Context.NONE); } } ``` @@ -1184,20 +1258,21 @@ public final class ServersGetByResourceGroupSamples { ### Servers_List ```java -import com.azure.core.util.Context; - -/** Samples for Servers List. */ +/** + * Samples for Servers List. + */ public final class ServersListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerList.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerList.json */ /** * Sample code: ServerList. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void serverList(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.servers().list(Context.NONE); + manager.servers().list(com.azure.core.util.Context.NONE); } } ``` @@ -1205,20 +1280,22 @@ public final class ServersListSamples { ### Servers_ListByResourceGroup ```java -import com.azure.core.util.Context; - -/** Samples for Servers ListByResourceGroup. */ +/** + * Samples for Servers ListByResourceGroup. + */ public final class ServersListByResourceGroupSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerListByResourceGroup.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ServerListByResourceGroup.json */ /** * Sample code: ServerListByResourceGroup. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void serverListByResourceGroup(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.servers().listByResourceGroup("TestGroup", Context.NONE); + manager.servers().listByResourceGroup("TestGroup", com.azure.core.util.Context.NONE); } } ``` @@ -1226,20 +1303,21 @@ public final class ServersListByResourceGroupSamples { ### Servers_Restart ```java -import com.azure.core.util.Context; - -/** Samples for Servers Restart. */ +/** + * Samples for Servers Restart. + */ public final class ServersRestartSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerRestart.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerRestart.json */ /** * Sample code: ServerRestart. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void serverRestart(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.servers().restart("TestGroup", "testserver", Context.NONE); + manager.servers().restart("TestGroup", "testserver", com.azure.core.util.Context.NONE); } } ``` @@ -1247,26 +1325,28 @@ public final class ServersRestartSamples { ### Servers_Update ```java -import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; import com.azure.resourcemanager.postgresql.models.Server; import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum; -/** Samples for Servers Update. */ +/** + * Samples for Servers Update. + */ public final class ServersUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerUpdate.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerUpdate.json */ /** * Sample code: ServerUpdate. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void serverUpdate(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - Server resource = - manager.servers().getByResourceGroupWithResponse("testrg", "pgtestsvc4", Context.NONE).getValue(); - resource - .update() + Server resource = manager.servers() + .getByResourceGroupWithResponse("testrg", "pgtestsvc4", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() .withAdministratorLoginPassword("") .withSslEnforcement(SslEnforcementEnum.ENABLED) .withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_2) @@ -1278,20 +1358,23 @@ public final class ServersUpdateSamples { ### VirtualNetworkRules_CreateOrUpdate ```java -/** Samples for VirtualNetworkRules CreateOrUpdate. */ +/** + * Samples for VirtualNetworkRules CreateOrUpdate. + */ public final class VirtualNetworkRulesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesCreateOrUpdate.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * VirtualNetworkRulesCreateOrUpdate.json */ /** * Sample code: Create or update a virtual network rule. - * + * * @param manager Entry point to PostgreSqlManager. */ - public static void createOrUpdateAVirtualNetworkRule( - com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .virtualNetworkRules() + public static void + createOrUpdateAVirtualNetworkRule(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { + manager.virtualNetworkRules() .define("vnet-firewall-rule") .withExistingServer("TestGroup", "vnet-test-svr") .withVirtualNetworkSubnetId( @@ -1305,20 +1388,23 @@ public final class VirtualNetworkRulesCreateOrUpdateSamples { ### VirtualNetworkRules_Delete ```java -import com.azure.core.util.Context; - -/** Samples for VirtualNetworkRules Delete. */ +/** + * Samples for VirtualNetworkRules Delete. + */ public final class VirtualNetworkRulesDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesDelete.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * VirtualNetworkRulesDelete.json */ /** * Sample code: Delete a virtual network rule. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void deleteAVirtualNetworkRule(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.virtualNetworkRules().delete("TestGroup", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); + manager.virtualNetworkRules() + .delete("TestGroup", "vnet-test-svr", "vnet-firewall-rule", com.azure.core.util.Context.NONE); } } ``` @@ -1326,20 +1412,23 @@ public final class VirtualNetworkRulesDeleteSamples { ### VirtualNetworkRules_Get ```java -import com.azure.core.util.Context; - -/** Samples for VirtualNetworkRules Get. */ +/** + * Samples for VirtualNetworkRules Get. + */ public final class VirtualNetworkRulesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * VirtualNetworkRulesGet.json */ /** * Sample code: Gets a virtual network rule. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void getsAVirtualNetworkRule(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.virtualNetworkRules().getWithResponse("TestGroup", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); + manager.virtualNetworkRules() + .getWithResponse("TestGroup", "vnet-test-svr", "vnet-firewall-rule", com.azure.core.util.Context.NONE); } } ``` @@ -1347,20 +1436,22 @@ public final class VirtualNetworkRulesGetSamples { ### VirtualNetworkRules_ListByServer ```java -import com.azure.core.util.Context; - -/** Samples for VirtualNetworkRules ListByServer. */ +/** + * Samples for VirtualNetworkRules ListByServer. + */ public final class VirtualNetworkRulesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesList.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * VirtualNetworkRulesList.json */ /** * Sample code: List virtual network rules. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void listVirtualNetworkRules(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.virtualNetworkRules().listByServer("TestGroup", "vnet-test-svr", Context.NONE); + manager.virtualNetworkRules().listByServer("TestGroup", "vnet-test-svr", com.azure.core.util.Context.NONE); } } ``` diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/pom.xml b/sdk/postgresql/azure-resourcemanager-postgresql/pom.xml index a174ab1b15201..1e34b9a4416d6 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/pom.xml +++ b/sdk/postgresql/azure-resourcemanager-postgresql/pom.xml @@ -1,3 +1,8 @@ + 4.0.0 @@ -9,7 +14,7 @@ com.azure.resourcemanager azure-resourcemanager-postgresql - 1.1.0-beta.1 + 1.1.0 jar Microsoft Azure SDK for PostgreSql Management @@ -38,9 +43,10 @@ UTF-8 - true + 0 + 0 + false true - - diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/PostgreSqlManager.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/PostgreSqlManager.java index 7cdccf055dce0..383ce52843c54 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/PostgreSqlManager.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/PostgreSqlManager.java @@ -10,14 +10,16 @@ import com.azure.core.http.HttpPipelineBuilder; import com.azure.core.http.HttpPipelinePosition; import com.azure.core.http.policy.AddDatePolicy; +import com.azure.core.http.policy.AddHeadersFromContextPolicy; +import com.azure.core.http.policy.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.RetryOptions; import com.azure.core.http.policy.RetryPolicy; import com.azure.core.http.policy.UserAgentPolicy; -import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy; import com.azure.core.management.profile.AzureProfile; import com.azure.core.util.Configuration; import com.azure.core.util.logging.ClientLogger; @@ -67,9 +69,10 @@ import java.util.stream.Collectors; /** - * Entry point to PostgreSqlManager. The Microsoft Azure management API provides create, read, update, and delete - * functionality for Azure PostgreSQL resources including servers, databases, firewall rules, VNET rules, security alert - * policies, log files and configurations with new business model. + * Entry point to PostgreSqlManager. + * The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL + * resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and + * configurations with new business model. */ public final class PostgreSqlManager { private Servers servers; @@ -122,7 +125,7 @@ private PostgreSqlManager(HttpPipeline httpPipeline, AzureProfile profile, Durat /** * Creates an instance of PostgreSql service API entry point. - * + * * @param credential the credential to use. * @param profile the Azure profile for client. * @return the PostgreSql service API instance. @@ -133,24 +136,40 @@ public static PostgreSqlManager authenticate(TokenCredential credential, AzurePr return configure().authenticate(credential, profile); } + /** + * Creates an instance of PostgreSql service API entry point. + * + * @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential. + * @param profile the Azure profile for client. + * @return the PostgreSql service API instance. + */ + public static PostgreSqlManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) { + Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null."); + Objects.requireNonNull(profile, "'profile' cannot be null."); + return new PostgreSqlManager(httpPipeline, profile, null); + } + /** * Gets a Configurable instance that can be used to create PostgreSqlManager with optional configuration. - * + * * @return the Configurable instance allowing configurations. */ public static Configurable configure() { return new PostgreSqlManager.Configurable(); } - /** The Configurable allowing configurations to be set. */ + /** + * The Configurable allowing configurations to be set. + */ public static final class Configurable { - private final ClientLogger logger = new ClientLogger(Configurable.class); + private static final ClientLogger LOGGER = new ClientLogger(Configurable.class); private HttpClient httpClient; private HttpLogOptions httpLogOptions; private final List policies = new ArrayList<>(); private final List scopes = new ArrayList<>(); private RetryPolicy retryPolicy; + private RetryOptions retryOptions; private Duration defaultPollInterval; private Configurable() { @@ -211,6 +230,19 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) { return this; } + /** + * Sets the retry options for the HTTP pipeline retry policy. + *

+ * This setting has no effect, if retry policy is set via {@link #withRetryPolicy(RetryPolicy)}. + * + * @param retryOptions the retry options for the HTTP pipeline retry policy. + * @return the configurable object itself. + */ + public Configurable withRetryOptions(RetryOptions retryOptions) { + this.retryOptions = Objects.requireNonNull(retryOptions, "'retryOptions' cannot be null."); + return this; + } + /** * Sets the default poll interval, used when service does not provide "Retry-After" header. * @@ -218,9 +250,11 @@ public Configurable withRetryPolicy(RetryPolicy retryPolicy) { * @return the configurable object itself. */ public Configurable withDefaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = Objects.requireNonNull(defaultPollInterval, "'retryPolicy' cannot be null."); + this.defaultPollInterval + = Objects.requireNonNull(defaultPollInterval, "'defaultPollInterval' cannot be null."); if (this.defaultPollInterval.isNegative()) { - throw logger.logExceptionAsError(new IllegalArgumentException("'httpPipeline' cannot be negative")); + throw LOGGER + .logExceptionAsError(new IllegalArgumentException("'defaultPollInterval' cannot be negative")); } return this; } @@ -241,7 +275,7 @@ public PostgreSqlManager authenticate(TokenCredential credential, AzureProfile p .append("-") .append("com.azure.resourcemanager.postgresql") .append("/") - .append("1.0.2"); + .append("1.1.0"); if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) { userAgentBuilder.append(" (") .append(Configuration.getGlobalConfiguration().get("java.version")) @@ -258,10 +292,15 @@ public PostgreSqlManager authenticate(TokenCredential credential, AzureProfile p scopes.add(profile.getEnvironment().getManagementEndpoint() + "/.default"); } if (retryPolicy == null) { - retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + if (retryOptions != null) { + retryPolicy = new RetryPolicy(retryOptions); + } else { + retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS); + } } List policies = new ArrayList<>(); policies.add(new UserAgentPolicy(userAgentBuilder.toString())); + policies.add(new AddHeadersFromContextPolicy()); policies.add(new RequestIdPolicy()); policies.addAll(this.policies.stream() .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL) @@ -269,7 +308,7 @@ public PostgreSqlManager authenticate(TokenCredential credential, AzureProfile p HttpPolicyProviders.addBeforeRetryPolicies(policies); policies.add(retryPolicy); policies.add(new AddDatePolicy()); - policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0]))); + policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0]))); policies.addAll(this.policies.stream() .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY) .collect(Collectors.toList())); @@ -282,7 +321,11 @@ public PostgreSqlManager authenticate(TokenCredential credential, AzureProfile p } } - /** @return Resource collection API of Servers. */ + /** + * Gets the resource collection API of Servers. It manages Server. + * + * @return Resource collection API of Servers. + */ public Servers servers() { if (this.servers == null) { this.servers = new ServersImpl(clientObject.getServers(), this); @@ -290,7 +333,11 @@ public Servers servers() { return servers; } - /** @return Resource collection API of Replicas. */ + /** + * Gets the resource collection API of Replicas. + * + * @return Resource collection API of Replicas. + */ public Replicas replicas() { if (this.replicas == null) { this.replicas = new ReplicasImpl(clientObject.getReplicas(), this); @@ -298,7 +345,11 @@ public Replicas replicas() { return replicas; } - /** @return Resource collection API of FirewallRules. */ + /** + * Gets the resource collection API of FirewallRules. It manages FirewallRule. + * + * @return Resource collection API of FirewallRules. + */ public FirewallRules firewallRules() { if (this.firewallRules == null) { this.firewallRules = new FirewallRulesImpl(clientObject.getFirewallRules(), this); @@ -306,7 +357,11 @@ public FirewallRules firewallRules() { return firewallRules; } - /** @return Resource collection API of VirtualNetworkRules. */ + /** + * Gets the resource collection API of VirtualNetworkRules. It manages VirtualNetworkRule. + * + * @return Resource collection API of VirtualNetworkRules. + */ public VirtualNetworkRules virtualNetworkRules() { if (this.virtualNetworkRules == null) { this.virtualNetworkRules = new VirtualNetworkRulesImpl(clientObject.getVirtualNetworkRules(), this); @@ -314,7 +369,11 @@ public VirtualNetworkRules virtualNetworkRules() { return virtualNetworkRules; } - /** @return Resource collection API of Databases. */ + /** + * Gets the resource collection API of Databases. It manages Database. + * + * @return Resource collection API of Databases. + */ public Databases databases() { if (this.databases == null) { this.databases = new DatabasesImpl(clientObject.getDatabases(), this); @@ -322,7 +381,11 @@ public Databases databases() { return databases; } - /** @return Resource collection API of Configurations. */ + /** + * Gets the resource collection API of Configurations. It manages Configuration. + * + * @return Resource collection API of Configurations. + */ public Configurations configurations() { if (this.configurations == null) { this.configurations = new ConfigurationsImpl(clientObject.getConfigurations(), this); @@ -330,7 +393,11 @@ public Configurations configurations() { return configurations; } - /** @return Resource collection API of ServerParameters. */ + /** + * Gets the resource collection API of ServerParameters. + * + * @return Resource collection API of ServerParameters. + */ public ServerParameters serverParameters() { if (this.serverParameters == null) { this.serverParameters = new ServerParametersImpl(clientObject.getServerParameters(), this); @@ -338,7 +405,11 @@ public ServerParameters serverParameters() { return serverParameters; } - /** @return Resource collection API of LogFiles. */ + /** + * Gets the resource collection API of LogFiles. + * + * @return Resource collection API of LogFiles. + */ public LogFiles logFiles() { if (this.logFiles == null) { this.logFiles = new LogFilesImpl(clientObject.getLogFiles(), this); @@ -346,7 +417,11 @@ public LogFiles logFiles() { return logFiles; } - /** @return Resource collection API of ServerAdministrators. */ + /** + * Gets the resource collection API of ServerAdministrators. + * + * @return Resource collection API of ServerAdministrators. + */ public ServerAdministrators serverAdministrators() { if (this.serverAdministrators == null) { this.serverAdministrators = new ServerAdministratorsImpl(clientObject.getServerAdministrators(), this); @@ -354,7 +429,11 @@ public ServerAdministrators serverAdministrators() { return serverAdministrators; } - /** @return Resource collection API of RecoverableServers. */ + /** + * Gets the resource collection API of RecoverableServers. + * + * @return Resource collection API of RecoverableServers. + */ public RecoverableServers recoverableServers() { if (this.recoverableServers == null) { this.recoverableServers = new RecoverableServersImpl(clientObject.getRecoverableServers(), this); @@ -362,7 +441,11 @@ public RecoverableServers recoverableServers() { return recoverableServers; } - /** @return Resource collection API of ServerBasedPerformanceTiers. */ + /** + * Gets the resource collection API of ServerBasedPerformanceTiers. + * + * @return Resource collection API of ServerBasedPerformanceTiers. + */ public ServerBasedPerformanceTiers serverBasedPerformanceTiers() { if (this.serverBasedPerformanceTiers == null) { this.serverBasedPerformanceTiers @@ -371,7 +454,11 @@ public ServerBasedPerformanceTiers serverBasedPerformanceTiers() { return serverBasedPerformanceTiers; } - /** @return Resource collection API of LocationBasedPerformanceTiers. */ + /** + * Gets the resource collection API of LocationBasedPerformanceTiers. + * + * @return Resource collection API of LocationBasedPerformanceTiers. + */ public LocationBasedPerformanceTiers locationBasedPerformanceTiers() { if (this.locationBasedPerformanceTiers == null) { this.locationBasedPerformanceTiers @@ -380,7 +467,11 @@ public LocationBasedPerformanceTiers locationBasedPerformanceTiers() { return locationBasedPerformanceTiers; } - /** @return Resource collection API of CheckNameAvailabilities. */ + /** + * Gets the resource collection API of CheckNameAvailabilities. + * + * @return Resource collection API of CheckNameAvailabilities. + */ public CheckNameAvailabilities checkNameAvailabilities() { if (this.checkNameAvailabilities == null) { this.checkNameAvailabilities @@ -389,7 +480,11 @@ public CheckNameAvailabilities checkNameAvailabilities() { return checkNameAvailabilities; } - /** @return Resource collection API of Operations. */ + /** + * Gets the resource collection API of Operations. + * + * @return Resource collection API of Operations. + */ public Operations operations() { if (this.operations == null) { this.operations = new OperationsImpl(clientObject.getOperations(), this); @@ -397,7 +492,11 @@ public Operations operations() { return operations; } - /** @return Resource collection API of ServerSecurityAlertPolicies. */ + /** + * Gets the resource collection API of ServerSecurityAlertPolicies. It manages ServerSecurityAlertPolicy. + * + * @return Resource collection API of ServerSecurityAlertPolicies. + */ public ServerSecurityAlertPolicies serverSecurityAlertPolicies() { if (this.serverSecurityAlertPolicies == null) { this.serverSecurityAlertPolicies @@ -406,7 +505,11 @@ public ServerSecurityAlertPolicies serverSecurityAlertPolicies() { return serverSecurityAlertPolicies; } - /** @return Resource collection API of PrivateEndpointConnections. */ + /** + * Gets the resource collection API of PrivateEndpointConnections. It manages PrivateEndpointConnection. + * + * @return Resource collection API of PrivateEndpointConnections. + */ public PrivateEndpointConnections privateEndpointConnections() { if (this.privateEndpointConnections == null) { this.privateEndpointConnections @@ -415,7 +518,11 @@ public PrivateEndpointConnections privateEndpointConnections() { return privateEndpointConnections; } - /** @return Resource collection API of PrivateLinkResources. */ + /** + * Gets the resource collection API of PrivateLinkResources. + * + * @return Resource collection API of PrivateLinkResources. + */ public PrivateLinkResources privateLinkResources() { if (this.privateLinkResources == null) { this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); @@ -423,7 +530,11 @@ public PrivateLinkResources privateLinkResources() { return privateLinkResources; } - /** @return Resource collection API of ServerKeys. */ + /** + * Gets the resource collection API of ServerKeys. It manages ServerKey. + * + * @return Resource collection API of ServerKeys. + */ public ServerKeys serverKeys() { if (this.serverKeys == null) { this.serverKeys = new ServerKeysImpl(clientObject.getServerKeys(), this); @@ -432,8 +543,10 @@ public ServerKeys serverKeys() { } /** - * @return Wrapped service client PostgreSqlManagementClient providing direct access to the underlying - * auto-generated API implementation, based on Azure REST API. + * Gets wrapped service client PostgreSqlManagementClient providing direct access to the underlying auto-generated + * API implementation, based on Azure REST API. + * + * @return Wrapped service client PostgreSqlManagementClient. */ public PostgreSqlManagementClient serviceClient() { return this.clientObject; diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/CheckNameAvailabilitiesClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/CheckNameAvailabilitiesClient.java index a1e7e983e99bb..11f2bfb45ad3f 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/CheckNameAvailabilitiesClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/CheckNameAvailabilitiesClient.java @@ -10,24 +10,40 @@ import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.fluent.models.NameAvailabilityInner; import com.azure.resourcemanager.postgresql.models.NameAvailabilityRequest; +import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in CheckNameAvailabilitiesClient. */ +/** + * 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. + * @return represents a resource name availability along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - NameAvailabilityInner execute(NameAvailabilityRequest nameAvailabilityRequest); + Mono> executeWithResponseAsync(NameAvailabilityRequest nameAvailabilityRequest); + + /** + * 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono executeAsync(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. @@ -38,4 +54,16 @@ public interface CheckNameAvailabilitiesClient { @ServiceMethod(returns = ReturnType.SINGLE) Response executeWithResponse(NameAvailabilityRequest nameAvailabilityRequest, 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 com.azure.core.management.exception.ManagementException thrown 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); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ConfigurationsClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ConfigurationsClient.java index f9b690b877b11..cf30d9d6db049 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ConfigurationsClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ConfigurationsClient.java @@ -6,19 +6,25 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; 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.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationInner; +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. */ +/** + * 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. @@ -28,13 +34,45 @@ public interface ConfigurationsClient { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return represents a Configuration along with {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createOrUpdateWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, ConfigurationInner> beginCreateOrUpdateAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Configuration. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) 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. @@ -43,7 +81,7 @@ SyncPoller, ConfigurationInner> beginCreateOrUpda * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of represents a Configuration. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ConfigurationInner> beginCreateOrUpdate(String resourceGroupName, @@ -51,7 +89,23 @@ SyncPoller, ConfigurationInner> beginCreateOrUpda /** * 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createOrUpdateAsync(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. @@ -67,7 +121,7 @@ ConfigurationInner createOrUpdate(String resourceGroupName, String serverName, S /** * 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. @@ -84,21 +138,37 @@ ConfigurationInner createOrUpdate(String resourceGroupName, String serverName, S /** * 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. + * @return information about a configuration of server along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - ConfigurationInner get(String resourceGroupName, String serverName, String configurationName); + Mono> getWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(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. @@ -112,29 +182,56 @@ ConfigurationInner createOrUpdate(String resourceGroupName, String serverName, S Response getWithResponse(String resourceGroupName, String serverName, String configurationName, 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); + + /** + * 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByServerAsync(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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if 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. + * @return a list of server configurations as paginated response with {@link PagedIterable}. */ @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. + * @return a list of server configurations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByServer(String resourceGroupName, String serverName, Context context); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/DatabasesClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/DatabasesClient.java index 7237e39815a62..3439114bdcda9 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/DatabasesClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/DatabasesClient.java @@ -6,19 +6,25 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; 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.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.postgresql.fluent.models.DatabaseInner; +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. */ +/** + * 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. @@ -28,13 +34,45 @@ public interface DatabasesClient { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return represents a Database along with {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createOrUpdateWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a Database. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, DatabaseInner> beginCreateOrUpdateAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a Database. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) 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. @@ -43,7 +81,7 @@ SyncPoller, DatabaseInner> beginCreateOrUpdate(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of represents a Database. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, DatabaseInner> beginCreateOrUpdate(String resourceGroupName, @@ -51,7 +89,23 @@ SyncPoller, DatabaseInner> beginCreateOrUpdate(String /** * 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createOrUpdateAsync(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. @@ -67,7 +121,7 @@ DatabaseInner createOrUpdate(String resourceGroupName, String serverName, String /** * 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. @@ -84,7 +138,7 @@ DatabaseInner createOrUpdate(String resourceGroupName, String serverName, String /** * 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. @@ -93,12 +147,42 @@ DatabaseInner createOrUpdate(String resourceGroupName, String serverName, String * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> deleteWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginDeleteAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String 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. @@ -106,7 +190,7 @@ DatabaseInner createOrUpdate(String resourceGroupName, String serverName, String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String databaseName, @@ -114,7 +198,21 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(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. @@ -127,7 +225,7 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * 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. @@ -141,21 +239,36 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * 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. + * @return information about a database along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - DatabaseInner get(String resourceGroupName, String serverName, String databaseName); + Mono> getWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(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. @@ -169,29 +282,56 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String Response getWithResponse(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); + + /** + * 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByServerAsync(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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if 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. + * @return a List of databases as paginated response with {@link PagedIterable}. */ @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. + * @return a List of databases as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByServer(String resourceGroupName, String serverName, Context context); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/FirewallRulesClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/FirewallRulesClient.java index f04761601d245..48e7e02dcf821 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/FirewallRulesClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/FirewallRulesClient.java @@ -6,19 +6,25 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; 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.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.postgresql.fluent.models.FirewallRuleInner; +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. */ +/** + * 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. @@ -28,13 +34,45 @@ public interface FirewallRulesClient { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return represents a server firewall rule along with {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createOrUpdateWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a server firewall rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a server firewall rule. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) 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. @@ -43,7 +81,7 @@ SyncPoller, FirewallRuleInner> beginCreateOrUpdate * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of represents a server firewall rule. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, FirewallRuleInner> beginCreateOrUpdate(String resourceGroupName, @@ -51,7 +89,23 @@ SyncPoller, FirewallRuleInner> beginCreateOrUpdate /** * 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createOrUpdateAsync(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. @@ -67,7 +121,7 @@ FirewallRuleInner createOrUpdate(String resourceGroupName, String serverName, St /** * 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. @@ -84,7 +138,7 @@ FirewallRuleInner createOrUpdate(String resourceGroupName, String serverName, St /** * 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. @@ -93,13 +147,43 @@ FirewallRuleInner createOrUpdate(String resourceGroupName, String serverName, St * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> deleteWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginDeleteAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String 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. @@ -107,7 +191,7 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String firewallRuleName, @@ -115,7 +199,21 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(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. @@ -128,7 +226,7 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * 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. @@ -142,21 +240,37 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * 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. + * @return information about a server firewall rule along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName); + Mono> getWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(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. @@ -170,29 +284,56 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String Response getWithResponse(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); + + /** + * 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByServerAsync(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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if 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. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. */ @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. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByServer(String resourceGroupName, String serverName, Context context); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/LocationBasedPerformanceTiersClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/LocationBasedPerformanceTiersClient.java index 6fd31abd4e3c2..054f70789f070 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/LocationBasedPerformanceTiersClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/LocationBasedPerformanceTiersClient.java @@ -6,33 +6,48 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.fluent.models.PerformanceTierPropertiesInner; -/** An instance of this class provides access to all the operations defined in LocationBasedPerformanceTiersClient. */ +/** + * 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. + * @return a list of performance tiers as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listAsync(String locationName); + + /** + * 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 as paginated response with {@link PagedIterable}. */ @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. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(String locationName, Context context); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/LogFilesClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/LogFilesClient.java index 3e44299a7a46c..876d994380f26 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/LogFilesClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/LogFilesClient.java @@ -6,35 +6,51 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.fluent.models.LogFileInner; -/** An instance of this class provides access to all the operations defined in LogFilesClient. */ +/** + * 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. + * @return a list of log files as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByServerAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 as paginated response with {@link PagedIterable}. */ @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. + * @return a list of log files as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByServer(String resourceGroupName, String serverName, Context context); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/OperationsClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/OperationsClient.java index 0a3ef6d70390d..d805dda73f989 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/OperationsClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/OperationsClient.java @@ -9,22 +9,36 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.fluent.models.OperationListResultInner; +import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in OperationsClient. */ +/** + * 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. + * @return a list of resource provider operations along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - OperationListResultInner list(); + Mono> listWithResponseAsync(); + + /** + * 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono listAsync(); /** * 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. @@ -33,4 +47,14 @@ public interface OperationsClient { */ @ServiceMethod(returns = ReturnType.SINGLE) Response listWithResponse(Context context); + + /** + * 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(); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/PostgreSqlManagementClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/PostgreSqlManagementClient.java index 3d7521329e2d5..4f89283f8f006 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/PostgreSqlManagementClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/PostgreSqlManagementClient.java @@ -7,158 +7,160 @@ import com.azure.core.http.HttpPipeline; import java.time.Duration; -/** The interface for PostgreSqlManagementClient class. */ +/** + * The interface for PostgreSqlManagementClient class. + */ public interface PostgreSqlManagementClient { /** * 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 ServerAdministratorsClient object to access its operations. - * + * * @return the ServerAdministratorsClient object. */ ServerAdministratorsClient getServerAdministrators(); /** * 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 ServerSecurityAlertPoliciesClient object to access its operations. - * + * * @return the ServerSecurityAlertPoliciesClient object. */ ServerSecurityAlertPoliciesClient getServerSecurityAlertPolicies(); /** * 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 ServerKeysClient object to access its operations. - * + * * @return the ServerKeysClient object. */ ServerKeysClient getServerKeys(); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/PrivateEndpointConnectionsClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/PrivateEndpointConnectionsClient.java index 0d02c65c20a26..08b2cfbfffb30 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/PrivateEndpointConnectionsClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/PrivateEndpointConnectionsClient.java @@ -6,35 +6,56 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; 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.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.postgresql.fluent.models.PrivateEndpointConnectionInner; import com.azure.resourcemanager.postgresql.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. */ +/** + * 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. + * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - PrivateEndpointConnectionInner get(String resourceGroupName, String serverName, + Mono> getWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(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. @@ -48,18 +69,66 @@ PrivateEndpointConnectionInner get(String resourceGroupName, String serverName, Response getWithResponse(String resourceGroupName, String serverName, String privateEndpointConnectionName, 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 com.azure.core.management.exception.ManagementException 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); + /** * 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 parameters The parameters 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 a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createOrUpdateWithResponseAsync(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 The parameters 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 {@link PollerFlux} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, PrivateEndpointConnectionInner> beginCreateOrUpdateAsync( + 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 The parameters 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 {@link SyncPoller} for polling of a private endpoint connection. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String privateEndpointConnectionName, @@ -67,16 +136,16 @@ SyncPoller, PrivateEndpointConnection /** * 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 parameters The parameters 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 a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of a private endpoint connection. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( @@ -85,11 +154,27 @@ SyncPoller, PrivateEndpointConnection /** * 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 The parameters 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 a private endpoint connection on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createOrUpdateAsync(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 parameters The parameters 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. @@ -101,11 +186,11 @@ PrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String s /** * 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 parameters The parameters 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. @@ -118,7 +203,7 @@ PrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String s /** * 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. @@ -127,13 +212,43 @@ PrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, String s * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> deleteWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginDeleteAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String 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. @@ -141,7 +256,7 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, @@ -149,7 +264,21 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(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. @@ -162,7 +291,7 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * 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. @@ -175,8 +304,10 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); /** + * Updates tags on private endpoint connection. + * * 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. @@ -186,13 +317,51 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> updateTagsWithResponseAsync(String resourceGroupName, String serverName, + String privateEndpointConnectionName, TagsObject parameters); + + /** + * Updates tags on private endpoint connection. + * + * 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 the {@link PollerFlux} for polling of a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, PrivateEndpointConnectionInner> beginUpdateTagsAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters); + + /** + * Updates tags on private endpoint connection. + * + * 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 the {@link SyncPoller} for polling of a private endpoint connection. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, PrivateEndpointConnectionInner> beginUpdateTags( String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters); /** + * Updates tags on private endpoint connection. + * * 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. @@ -201,7 +370,7 @@ SyncPoller, PrivateEndpointConnection * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of a private endpoint connection. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, PrivateEndpointConnectionInner> beginUpdateTags( @@ -209,8 +378,28 @@ SyncPoller, PrivateEndpointConnection Context context); /** + * Updates tags on private endpoint connection. + * + * 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono updateTagsAsync(String resourceGroupName, String serverName, + String privateEndpointConnectionName, TagsObject parameters); + + /** + * Updates tags on private endpoint connection. + * * 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. @@ -225,8 +414,10 @@ PrivateEndpointConnectionInner updateTags(String resourceGroupName, String serve String privateEndpointConnectionName, TagsObject parameters); /** + * Updates tags on private endpoint connection. + * * 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. @@ -243,27 +434,40 @@ PrivateEndpointConnectionInner updateTags(String resourceGroupName, String serve /** * 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByServerAsync(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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.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. + * @return all private endpoint connections on a server as paginated response with {@link PagedIterable}. */ @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. + * @return all private endpoint connections on a server as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByServer(String resourceGroupName, String serverName, diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/PrivateLinkResourcesClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/PrivateLinkResourcesClient.java index b4bcb1bce01f5..49c7d1cab10f3 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/PrivateLinkResourcesClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/PrivateLinkResourcesClient.java @@ -6,57 +6,90 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.PagedIterable; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.fluent.models.PrivateLinkResourceInner; +import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +/** + * An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. + */ public interface PrivateLinkResourcesClient { /** * Gets the private link resources for PostgreSQL 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 PostgreSQL server. + * @return the private link resources for PostgreSQL server as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByServerAsync(String resourceGroupName, String serverName); + + /** + * Gets the private link resources for PostgreSQL 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 PostgreSQL server as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByServer(String resourceGroupName, String serverName); /** * Gets the private link resources for PostgreSQL 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 PostgreSQL server. + * @return the private link resources for PostgreSQL server as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByServer(String resourceGroupName, String serverName, Context context); /** * Gets a private link resource for PostgreSQL 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 PostgreSQL server. + * @return a private link resource for PostgreSQL server along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - PrivateLinkResourceInner get(String resourceGroupName, String serverName, String groupName); + Mono> getWithResponseAsync(String resourceGroupName, String serverName, + String groupName); + + /** + * Gets a private link resource for PostgreSQL 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 PostgreSQL server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(String resourceGroupName, String serverName, String groupName); /** * Gets a private link resource for PostgreSQL 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. @@ -69,4 +102,18 @@ public interface PrivateLinkResourcesClient { @ServiceMethod(returns = ReturnType.SINGLE) Response getWithResponse(String resourceGroupName, String serverName, String groupName, Context context); + + /** + * Gets a private link resource for PostgreSQL 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 PostgreSQL server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner get(String resourceGroupName, String serverName, String groupName); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/RecoverableServersClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/RecoverableServersClient.java index 391d9fd2f8583..785891fb4b6dd 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/RecoverableServersClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/RecoverableServersClient.java @@ -9,25 +9,41 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.fluent.models.RecoverableServerResourceInner; +import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in RecoverableServersClient. */ +/** + * An instance of this class provides access to all the operations defined in RecoverableServersClient. + */ public interface RecoverableServersClient { /** * Gets a recoverable PostgreSQL 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 PostgreSQL Server. + * @return a recoverable PostgreSQL Server along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - RecoverableServerResourceInner get(String resourceGroupName, String serverName); + Mono> getWithResponseAsync(String resourceGroupName, String serverName); + + /** + * Gets a recoverable PostgreSQL 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 PostgreSQL Server on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(String resourceGroupName, String serverName); /** * Gets a recoverable PostgreSQL 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. @@ -39,4 +55,17 @@ public interface RecoverableServersClient { @ServiceMethod(returns = ReturnType.SINGLE) Response getWithResponse(String resourceGroupName, String serverName, Context context); + + /** + * Gets a recoverable PostgreSQL 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 PostgreSQL Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + RecoverableServerResourceInner get(String resourceGroupName, String serverName); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ReplicasClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ReplicasClient.java index 0899459cb2a33..4326956587357 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ReplicasClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ReplicasClient.java @@ -6,35 +6,51 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.fluent.models.ServerInner; -/** An instance of this class provides access to all the operations defined in ReplicasClient. */ +/** + * 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. + * @return a list of servers as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByServerAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if 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 as paginated response with {@link PagedIterable}. */ @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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByServer(String resourceGroupName, String serverName, Context context); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerAdministratorsClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerAdministratorsClient.java index 52b71b3e3d4bd..c37978879dc8e 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerAdministratorsClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerAdministratorsClient.java @@ -6,32 +6,52 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; 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.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.postgresql.fluent.models.ServerAdministratorResourceInner; +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 ServerAdministratorsClient. */ +/** + * An instance of this class provides access to all the operations defined in ServerAdministratorsClient. + */ public interface ServerAdministratorsClient { /** * Gets information about a AAD server administrator. - * + * * @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 AAD server administrator. + * @return information about a AAD server administrator along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - ServerAdministratorResourceInner get(String resourceGroupName, String serverName); + Mono> getWithResponseAsync(String resourceGroupName, String serverName); /** * Gets information about a AAD server administrator. - * + * + * @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 AAD server administrator on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(String resourceGroupName, String serverName); + + /** + * Gets information about a AAD server administrator. + * * @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. @@ -44,10 +64,23 @@ public interface ServerAdministratorsClient { Response getWithResponse(String resourceGroupName, String serverName, Context context); + /** + * Gets information about a AAD server administrator. + * + * @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 AAD server administrator. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAdministratorResourceInner get(String resourceGroupName, String serverName); + /** * Creates or update active directory administrator on an existing server. The update action will overwrite the * existing administrator. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param properties The required parameters for creating or updating an AAD server administrator. @@ -55,7 +88,39 @@ Response getWithResponse(String resourceGroupN * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return represents a and external administrator to be created along with {@link Response} on successful - * completion of {@link Mono}. + * completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String serverName, + ServerAdministratorResourceInner properties); + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a and external administrator to be created. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, ServerAdministratorResourceInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties); + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a and external administrator to be created. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ServerAdministratorResourceInner> @@ -64,7 +129,7 @@ Response getWithResponse(String resourceGroupN /** * Creates or update active directory administrator on an existing server. The update action will overwrite the * existing administrator. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param properties The required parameters for creating or updating an AAD server administrator. @@ -72,8 +137,7 @@ Response getWithResponse(String resourceGroupN * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a and external administrator to be created along with {@link Response} on successful - * completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of represents a and external administrator to be created. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ServerAdministratorResourceInner> beginCreateOrUpdate( @@ -82,7 +146,23 @@ SyncPoller, ServerAdministratorReso /** * Creates or update active directory administrator on an existing server. The update action will overwrite the * existing administrator. - * + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param properties The required parameters for creating or updating an AAD server administrator. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a and external administrator to be created on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createOrUpdateAsync(String resourceGroupName, String serverName, + ServerAdministratorResourceInner properties); + + /** + * Creates or update active directory administrator on an existing server. The update action will overwrite the + * existing administrator. + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param properties The required parameters for creating or updating an AAD server administrator. @@ -98,7 +178,7 @@ ServerAdministratorResourceInner createOrUpdate(String resourceGroupName, String /** * Creates or update active directory administrator on an existing server. The update action will overwrite the * existing administrator. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param properties The required parameters for creating or updating an AAD server administrator. @@ -114,7 +194,7 @@ ServerAdministratorResourceInner createOrUpdate(String resourceGroupName, String /** * Deletes server active directory administrator. - * + * * @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. @@ -122,26 +202,65 @@ ServerAdministratorResourceInner createOrUpdate(String resourceGroupName, String * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> deleteWithResponseAsync(String resourceGroupName, String serverName); + + /** + * Deletes server active directory administrator. + * + * @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 {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName); + + /** + * Deletes server active directory administrator. + * + * @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 {@link SyncPoller} for polling of long-running operation. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String serverName); /** * Deletes server active directory administrator. - * + * * @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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, Context context); /** * Deletes server active directory administrator. - * + * + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(String resourceGroupName, String serverName); + + /** + * Deletes server active directory administrator. + * * @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. @@ -153,7 +272,7 @@ ServerAdministratorResourceInner createOrUpdate(String resourceGroupName, String /** * Deletes server active directory administrator. - * + * * @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. @@ -166,27 +285,43 @@ ServerAdministratorResourceInner createOrUpdate(String resourceGroupName, String /** * Returns a list of server Administrators. - * + * + * @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 response to a list Active Directory Administrators request as paginated response with + * {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listAsync(String resourceGroupName, String serverName); + + /** + * Returns a list of server Administrators. + * * @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 response to a list Active Directory Administrators request. + * @return the response to a list Active Directory Administrators request as paginated response with + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(String resourceGroupName, String serverName); /** * Returns a list of server Administrators. - * + * * @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 response to a list Active Directory Administrators request. + * @return the response to a list Active Directory Administrators request as paginated response with + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(String resourceGroupName, String serverName, Context context); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerBasedPerformanceTiersClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerBasedPerformanceTiersClient.java index f6fc274c05d83..31cb7e2670b4b 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerBasedPerformanceTiersClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerBasedPerformanceTiersClient.java @@ -6,35 +6,51 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.fluent.models.PerformanceTierPropertiesInner; -/** An instance of this class provides access to all the operations defined in ServerBasedPerformanceTiersClient. */ +/** + * An instance of this class provides access to all the operations defined in ServerBasedPerformanceTiersClient. + */ public interface ServerBasedPerformanceTiersClient { /** * List all the performance tiers for a PostgreSQL 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. + * @return a list of performance tiers as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listAsync(String resourceGroupName, String serverName); + + /** + * List all the performance tiers for a PostgreSQL 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 as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(String resourceGroupName, String serverName); /** * List all the performance tiers for a PostgreSQL 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. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(String resourceGroupName, String serverName, Context context); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerKeysClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerKeysClient.java index f2153ed96e9e1..71e002807d5ad 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerKeysClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerKeysClient.java @@ -6,60 +6,93 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; 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.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.postgresql.fluent.models.ServerKeyInner; +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 ServerKeysClient. */ +/** + * An instance of this class provides access to all the operations defined in ServerKeysClient. + */ public interface ServerKeysClient { /** * Gets a list of Server keys. - * + * * @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 keys. + * @return a list of Server keys as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listAsync(String resourceGroupName, String serverName); + + /** + * Gets a list of Server keys. + * + * @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 keys as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(String resourceGroupName, String serverName); /** * Gets a list of Server keys. - * + * * @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 keys. + * @return a list of Server keys as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable list(String resourceGroupName, String serverName, Context context); /** * Gets a PostgreSQL Server key. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be retrieved. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a PostgreSQL Server key. + * @return a PostgreSQL Server key along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - ServerKeyInner get(String resourceGroupName, String serverName, String keyName); + Mono> getWithResponseAsync(String resourceGroupName, String serverName, String keyName); + + /** + * Gets a PostgreSQL Server key. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL Server key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a PostgreSQL Server key on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(String resourceGroupName, String serverName, String keyName); /** * Gets a PostgreSQL Server key. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be retrieved. @@ -73,9 +106,23 @@ public interface ServerKeysClient { Response getWithResponse(String resourceGroupName, String serverName, String keyName, Context context); + /** + * Gets a PostgreSQL Server key. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL Server key to be retrieved. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a PostgreSQL Server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerKeyInner get(String resourceGroupName, String serverName, String keyName); + /** * Creates or updates a PostgreSQL Server key. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be operated on (updated or created). * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -85,13 +132,45 @@ Response getWithResponse(String resourceGroupName, String server * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a PostgreSQL Server key along with {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createOrUpdateWithResponseAsync(String serverName, String keyName, + String resourceGroupName, ServerKeyInner parameters); + + /** + * Creates or updates a PostgreSQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL Server key to be operated on (updated or created). + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The requested PostgreSQL Server key 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 the {@link PollerFlux} for polling of a PostgreSQL Server key. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, ServerKeyInner> beginCreateOrUpdateAsync(String serverName, String keyName, + String resourceGroupName, ServerKeyInner parameters); + + /** + * Creates or updates a PostgreSQL Server key. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL Server key to be operated on (updated or created). + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The requested PostgreSQL Server key 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 the {@link SyncPoller} for polling of a PostgreSQL Server key. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ServerKeyInner> beginCreateOrUpdate(String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters); /** * Creates or updates a PostgreSQL Server key. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be operated on (updated or created). * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -100,7 +179,7 @@ SyncPoller, ServerKeyInner> beginCreateOrUpdate(Strin * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a PostgreSQL Server key along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of a PostgreSQL Server key. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ServerKeyInner> beginCreateOrUpdate(String serverName, String keyName, @@ -108,7 +187,23 @@ SyncPoller, ServerKeyInner> beginCreateOrUpdate(Strin /** * Creates or updates a PostgreSQL Server key. - * + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL Server key to be operated on (updated or created). + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param parameters The requested PostgreSQL Server key 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 PostgreSQL Server key on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createOrUpdateAsync(String serverName, String keyName, String resourceGroupName, + ServerKeyInner parameters); + + /** + * Creates or updates a PostgreSQL Server key. + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be operated on (updated or created). * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -124,7 +219,7 @@ ServerKeyInner createOrUpdate(String serverName, String keyName, String resource /** * Creates or updates a PostgreSQL Server key. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be operated on (updated or created). * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -141,7 +236,7 @@ ServerKeyInner createOrUpdate(String serverName, String keyName, String resource /** * Deletes the PostgreSQL Server key with the given name. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be deleted. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -150,12 +245,41 @@ ServerKeyInner createOrUpdate(String serverName, String keyName, String resource * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> deleteWithResponseAsync(String serverName, String keyName, + String resourceGroupName); + + /** + * Deletes the PostgreSQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL Server key to be deleted. + * @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 the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginDeleteAsync(String serverName, String keyName, String resourceGroupName); + + /** + * Deletes the PostgreSQL Server key with the given name. + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL Server key to be deleted. + * @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 the {@link SyncPoller} for polling of long-running operation. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String serverName, String keyName, String resourceGroupName); /** * Deletes the PostgreSQL Server key with the given name. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be deleted. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -163,7 +287,7 @@ ServerKeyInner createOrUpdate(String serverName, String keyName, String resource * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String serverName, String keyName, String resourceGroupName, @@ -171,7 +295,21 @@ SyncPoller, Void> beginDelete(String serverName, String keyName /** * Deletes the PostgreSQL Server key with the given name. - * + * + * @param serverName The name of the server. + * @param keyName The name of the PostgreSQL Server key to be deleted. + * @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 {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(String serverName, String keyName, String resourceGroupName); + + /** + * Deletes the PostgreSQL Server key with the given name. + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be deleted. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -184,7 +322,7 @@ SyncPoller, Void> beginDelete(String serverName, String keyName /** * Deletes the PostgreSQL Server key with the given name. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be deleted. * @param resourceGroupName The name of the resource group. The name is case insensitive. diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerParametersClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerParametersClient.java index cac6f0c599b06..98a34d2d36855 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerParametersClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerParametersClient.java @@ -9,15 +9,20 @@ 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.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.postgresql.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. */ +/** + * 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. @@ -26,13 +31,44 @@ public interface ServerParametersClient { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of server configurations along with {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> listUpdateConfigurationsWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, ConfigurationListResultInner> + beginListUpdateConfigurationsAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a list of server configurations. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) 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. @@ -40,7 +76,7 @@ public interface ServerParametersClient { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of a list of server configurations. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ConfigurationListResultInner> beginListUpdateConfigurations( @@ -48,7 +84,22 @@ SyncPoller, ConfigurationListResultInne /** * 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono listUpdateConfigurationsAsync(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. @@ -63,7 +114,7 @@ ConfigurationListResultInner listUpdateConfigurations(String resourceGroupName, /** * 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. diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerSecurityAlertPoliciesClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerSecurityAlertPoliciesClient.java index 74264da411185..1106c8363aaa1 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerSecurityAlertPoliciesClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerSecurityAlertPoliciesClient.java @@ -6,35 +6,56 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; 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.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.postgresql.fluent.models.ServerSecurityAlertPolicyInner; import com.azure.resourcemanager.postgresql.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. */ +/** + * 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. + * @return a server's security alert policy along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - ServerSecurityAlertPolicyInner get(String resourceGroupName, String serverName, + Mono> getWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(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. @@ -48,9 +69,24 @@ ServerSecurityAlertPolicyInner get(String resourceGroupName, String serverName, Response getWithResponse(String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, 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 com.azure.core.management.exception.ManagementException 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); + /** * 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. @@ -60,6 +96,39 @@ Response getWithResponse(String resourceGroupNam * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a server security alert policy along with {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createOrUpdateWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, ServerSecurityAlertPolicyInner> beginCreateOrUpdateAsync( + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a server security alert policy. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, @@ -67,7 +136,7 @@ SyncPoller, ServerSecurityAlertPolicy /** * 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. @@ -76,7 +145,7 @@ SyncPoller, ServerSecurityAlertPolicy * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of a server security alert policy. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( @@ -85,7 +154,23 @@ SyncPoller, ServerSecurityAlertPolicy /** * 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createOrUpdateAsync(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. @@ -101,7 +186,7 @@ ServerSecurityAlertPolicyInner createOrUpdate(String resourceGroupName, String s /** * 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. @@ -118,27 +203,40 @@ ServerSecurityAlertPolicyInner createOrUpdate(String resourceGroupName, String s /** * Get the server's threat detection policies. - * + * + * @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 server's threat detection policies as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByServerAsync(String resourceGroupName, String serverName); + + /** + * Get the server's threat detection policies. + * * @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 server's threat detection policies. + * @return the server's threat detection policies as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByServer(String resourceGroupName, String serverName); /** * Get the server's threat detection policies. - * + * * @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 server's threat detection policies. + * @return the server's threat detection policies as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByServer(String resourceGroupName, String serverName, diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServersClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServersClient.java index d9f74a5f0e86b..b0ebd1fdae758 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServersClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServersClient.java @@ -6,21 +6,27 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; 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.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.postgresql.fluent.models.ServerInner; import com.azure.resourcemanager.postgresql.models.ServerForCreate; import com.azure.resourcemanager.postgresql.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. */ +/** + * An instance of this class provides access to all the operations defined in ServersClient. + */ public interface ServersClient { /** * Creates a new server, or will overwrite an 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. @@ -29,13 +35,43 @@ public interface ServersClient { * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return represents a server along with {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createWithResponseAsync(String resourceGroupName, String serverName, + ServerForCreate parameters); + + /** + * Creates a new server, or will overwrite an 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 the {@link PollerFlux} for polling of represents a server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, ServerInner> beginCreateAsync(String resourceGroupName, String serverName, + ServerForCreate parameters); + + /** + * Creates a new server, or will overwrite an 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 the {@link SyncPoller} for polling of represents a server. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ServerInner> beginCreate(String resourceGroupName, String serverName, ServerForCreate parameters); /** * Creates a new server, or will overwrite an 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. @@ -43,7 +79,7 @@ SyncPoller, ServerInner> beginCreate(String resourceGrou * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of represents a server. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ServerInner> beginCreate(String resourceGroupName, String serverName, @@ -51,7 +87,21 @@ SyncPoller, ServerInner> beginCreate(String resourceGrou /** * Creates a new server, or will overwrite an 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createAsync(String resourceGroupName, String serverName, ServerForCreate parameters); + + /** + * Creates a new server, or will overwrite an 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. @@ -65,7 +115,7 @@ SyncPoller, ServerInner> beginCreate(String resourceGrou /** * Creates a new server, or will overwrite an 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. @@ -81,7 +131,7 @@ SyncPoller, ServerInner> beginCreate(String resourceGrou /** * 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. @@ -90,6 +140,38 @@ SyncPoller, ServerInner> beginCreate(String resourceGrou * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return represents a server along with {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> updateWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of represents a server. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, ServerInner> beginUpdateAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of represents a server. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ServerInner> beginUpdate(String resourceGroupName, String serverName, ServerUpdateParameters parameters); @@ -97,7 +179,7 @@ SyncPoller, ServerInner> beginUpdate(String resourceGrou /** * 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. @@ -105,7 +187,7 @@ SyncPoller, ServerInner> beginUpdate(String resourceGrou * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of represents a server. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, ServerInner> beginUpdate(String resourceGroupName, String serverName, @@ -114,7 +196,22 @@ SyncPoller, ServerInner> beginUpdate(String resourceGrou /** * 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono updateAsync(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. @@ -129,7 +226,7 @@ SyncPoller, ServerInner> beginUpdate(String resourceGrou /** * 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. @@ -144,7 +241,7 @@ SyncPoller, ServerInner> beginUpdate(String resourceGrou /** * 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. @@ -152,26 +249,65 @@ SyncPoller, ServerInner> beginUpdate(String resourceGrou * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> deleteWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginDeleteAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String 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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) 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. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(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. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -183,7 +319,7 @@ SyncPoller, ServerInner> beginUpdate(String resourceGrou /** * 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. @@ -196,20 +332,33 @@ SyncPoller, ServerInner> beginUpdate(String resourceGrou /** * 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. + * @return information about a server along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - ServerInner getByResourceGroup(String resourceGroupName, String serverName); + Mono> getByResourceGroupWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getByResourceGroupAsync(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. @@ -221,56 +370,91 @@ SyncPoller, ServerInner> beginUpdate(String resourceGrou @ServiceMethod(returns = ReturnType.SINGLE) Response getByResourceGroupWithResponse(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); + + /** + * 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByResourceGroupAsync(String resourceGroupName); + /** * 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listAsync(); + + /** + * 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @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. @@ -278,26 +462,65 @@ SyncPoller, ServerInner> beginUpdate(String resourceGrou * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> restartWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginRestartAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> 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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) 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. + * @return A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono restartAsync(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. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -309,7 +532,7 @@ SyncPoller, ServerInner> beginUpdate(String resourceGrou /** * 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. diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/VirtualNetworkRulesClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/VirtualNetworkRulesClient.java index cfd34569b3f8c..7785dccb195c6 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/VirtualNetworkRulesClient.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/VirtualNetworkRulesClient.java @@ -6,33 +6,54 @@ import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedFlux; 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.PollerFlux; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.postgresql.fluent.models.VirtualNetworkRuleInner; +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. */ +/** + * 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. + * @return a virtual network rule along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - VirtualNetworkRuleInner get(String resourceGroupName, String serverName, String virtualNetworkRuleName); + Mono> getWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono getAsync(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. @@ -46,9 +67,23 @@ public interface VirtualNetworkRulesClient { Response getWithResponse(String resourceGroupName, String serverName, String virtualNetworkRuleName, 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 com.azure.core.management.exception.ManagementException 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); + /** * 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. @@ -58,13 +93,45 @@ Response getWithResponse(String resourceGroupName, Stri * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a virtual network rule along with {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> createOrUpdateWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, VirtualNetworkRuleInner> beginCreateOrUpdateAsync( + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of a virtual network rule. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) 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. @@ -73,7 +140,7 @@ SyncPoller, VirtualNetworkRuleInner> beginCr * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of a virtual network rule. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( @@ -82,7 +149,23 @@ SyncPoller, VirtualNetworkRuleInner> beginCr /** * 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 on successful completion of {@link Mono}. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono createOrUpdateAsync(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. @@ -98,7 +181,7 @@ VirtualNetworkRuleInner createOrUpdate(String resourceGroupName, String serverNa /** * 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. @@ -115,7 +198,7 @@ VirtualNetworkRuleInner createOrUpdate(String resourceGroupName, String serverNa /** * 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. @@ -124,13 +207,43 @@ VirtualNetworkRuleInner createOrUpdate(String resourceGroupName, String serverNa * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the {@link Response} on successful completion of {@link Mono}. */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono>> deleteWithResponseAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link PollerFlux} for polling of long-running operation. + */ + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + PollerFlux, Void> beginDeleteAsync(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the {@link SyncPoller} for polling of long-running operation. + */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String 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. @@ -138,7 +251,7 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, @@ -146,7 +259,21 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * 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 A {@link Mono} that completes when a successful response is received. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Mono deleteAsync(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. @@ -159,7 +286,7 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * 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. @@ -173,27 +300,40 @@ SyncPoller, Void> beginDelete(String resourceGroupName, String /** * 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 as paginated response with {@link PagedFlux}. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedFlux listByServerAsync(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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if 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. + * @return a list of virtual network rules in a server as paginated response with {@link PagedIterable}. */ @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. + * @return a list of virtual network rules in a server as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) PagedIterable listByServer(String resourceGroupName, String serverName, Context context); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ConfigurationInner.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ConfigurationInner.java index 1922e79e2e40b..67bb75669eadd 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ConfigurationInner.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ConfigurationInner.java @@ -6,34 +6,84 @@ 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; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** Represents a Configuration. */ +/** + * Represents a Configuration. + */ @Fluent public final class ConfigurationInner extends ProxyResource { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ConfigurationInner.class); - /* * The properties of a configuration. */ - @JsonProperty(value = "properties") private ConfigurationProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ConfigurationInner class. + */ + public ConfigurationInner() { + } + /** * Get the innerProperties property: The properties of a configuration. - * + * * @return the innerProperties value. */ private ConfigurationProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the value property: Value of the configuration. - * + * * @return the value value. */ public String value() { @@ -42,7 +92,7 @@ public String value() { /** * Set the value property: Value of the configuration. - * + * * @param value the value value to set. * @return the ConfigurationInner object itself. */ @@ -56,7 +106,7 @@ public ConfigurationInner withValue(String value) { /** * Get the description property: Description of the configuration. - * + * * @return the description value. */ public String description() { @@ -65,7 +115,7 @@ public String description() { /** * Get the defaultValue property: Default value of the configuration. - * + * * @return the defaultValue value. */ public String defaultValue() { @@ -74,7 +124,7 @@ public String defaultValue() { /** * Get the dataType property: Data type of the configuration. - * + * * @return the dataType value. */ public String dataType() { @@ -83,7 +133,7 @@ public String dataType() { /** * Get the allowedValues property: Allowed values of the configuration. - * + * * @return the allowedValues value. */ public String allowedValues() { @@ -92,7 +142,7 @@ public String allowedValues() { /** * Get the source property: Source of the configuration. - * + * * @return the source value. */ public String source() { @@ -101,7 +151,7 @@ public String source() { /** * Set the source property: Source of the configuration. - * + * * @param source the source value to set. * @return the ConfigurationInner object itself. */ @@ -115,7 +165,7 @@ public ConfigurationInner withSource(String source) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -123,4 +173,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConfigurationInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConfigurationInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ConfigurationInner. + */ + public static ConfigurationInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConfigurationInner deserializedConfigurationInner = new ConfigurationInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedConfigurationInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedConfigurationInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedConfigurationInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedConfigurationInner.innerProperties = ConfigurationProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedConfigurationInner; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ConfigurationListResultInner.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ConfigurationListResultInner.java index 6a23ee92f3e6c..c8bb6c2eb2615 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ConfigurationListResultInner.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ConfigurationListResultInner.java @@ -5,26 +5,32 @@ package com.azure.resourcemanager.postgresql.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 com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; -/** A list of server configurations. */ +/** + * A list of server configurations. + */ @Fluent -public final class ConfigurationListResultInner { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ConfigurationListResultInner.class); - +public final class ConfigurationListResultInner implements JsonSerializable { /* * The list of server configurations. */ - @JsonProperty(value = "value") private List value; + /** + * Creates an instance of ConfigurationListResultInner class. + */ + public ConfigurationListResultInner() { + } + /** * Get the value property: The list of server configurations. - * + * * @return the value value. */ public List value() { @@ -33,7 +39,7 @@ public List value() { /** * Set the value property: The list of server configurations. - * + * * @param value the value value to set. * @return the ConfigurationListResultInner object itself. */ @@ -44,7 +50,7 @@ public ConfigurationListResultInner withValue(List value) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -52,4 +58,41 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConfigurationListResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConfigurationListResultInner if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ConfigurationListResultInner. + */ + public static ConfigurationListResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConfigurationListResultInner deserializedConfigurationListResultInner = new ConfigurationListResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ConfigurationInner.fromJson(reader1)); + deserializedConfigurationListResultInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedConfigurationListResultInner; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ConfigurationProperties.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ConfigurationProperties.java index a9381a5937081..a298749274e5f 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ConfigurationProperties.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ConfigurationProperties.java @@ -5,55 +5,56 @@ package com.azure.resourcemanager.postgresql.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** The properties of a configuration. */ +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties of a configuration. + */ @Fluent -public final class ConfigurationProperties { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ConfigurationProperties.class); - +public final class ConfigurationProperties implements JsonSerializable { /* * Value of the configuration. */ - @JsonProperty(value = "value") private String value; /* * Description of the configuration. */ - @JsonProperty(value = "description", access = JsonProperty.Access.WRITE_ONLY) private String description; /* * Default value of the configuration. */ - @JsonProperty(value = "defaultValue", access = JsonProperty.Access.WRITE_ONLY) private String defaultValue; /* * Data type of the configuration. */ - @JsonProperty(value = "dataType", access = JsonProperty.Access.WRITE_ONLY) private String dataType; /* * Allowed values of the configuration. */ - @JsonProperty(value = "allowedValues", access = JsonProperty.Access.WRITE_ONLY) private String allowedValues; /* * Source of the configuration. */ - @JsonProperty(value = "source") private String source; + /** + * Creates an instance of ConfigurationProperties class. + */ + public ConfigurationProperties() { + } + /** * Get the value property: Value of the configuration. - * + * * @return the value value. */ public String value() { @@ -62,7 +63,7 @@ public String value() { /** * Set the value property: Value of the configuration. - * + * * @param value the value value to set. * @return the ConfigurationProperties object itself. */ @@ -73,7 +74,7 @@ public ConfigurationProperties withValue(String value) { /** * Get the description property: Description of the configuration. - * + * * @return the description value. */ public String description() { @@ -82,7 +83,7 @@ public String description() { /** * Get the defaultValue property: Default value of the configuration. - * + * * @return the defaultValue value. */ public String defaultValue() { @@ -91,7 +92,7 @@ public String defaultValue() { /** * Get the dataType property: Data type of the configuration. - * + * * @return the dataType value. */ public String dataType() { @@ -100,7 +101,7 @@ public String dataType() { /** * Get the allowedValues property: Allowed values of the configuration. - * + * * @return the allowedValues value. */ public String allowedValues() { @@ -109,7 +110,7 @@ public String allowedValues() { /** * Get the source property: Source of the configuration. - * + * * @return the source value. */ public String source() { @@ -118,7 +119,7 @@ public String source() { /** * Set the source property: Source of the configuration. - * + * * @param source the source value to set. * @return the ConfigurationProperties object itself. */ @@ -129,9 +130,56 @@ public ConfigurationProperties withSource(String source) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("value", this.value); + jsonWriter.writeStringField("source", this.source); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ConfigurationProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ConfigurationProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ConfigurationProperties. + */ + public static ConfigurationProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ConfigurationProperties deserializedConfigurationProperties = new ConfigurationProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + deserializedConfigurationProperties.value = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedConfigurationProperties.description = reader.getString(); + } else if ("defaultValue".equals(fieldName)) { + deserializedConfigurationProperties.defaultValue = reader.getString(); + } else if ("dataType".equals(fieldName)) { + deserializedConfigurationProperties.dataType = reader.getString(); + } else if ("allowedValues".equals(fieldName)) { + deserializedConfigurationProperties.allowedValues = reader.getString(); + } else if ("source".equals(fieldName)) { + deserializedConfigurationProperties.source = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedConfigurationProperties; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/DatabaseInner.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/DatabaseInner.java index c07b5ac1e6315..8e4f3872f3414 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/DatabaseInner.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/DatabaseInner.java @@ -6,34 +6,84 @@ 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; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** Represents a Database. */ +/** + * Represents a Database. + */ @Fluent public final class DatabaseInner extends ProxyResource { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(DatabaseInner.class); - /* * The properties of a database. */ - @JsonProperty(value = "properties") private DatabaseProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of DatabaseInner class. + */ + public DatabaseInner() { + } + /** * Get the innerProperties property: The properties of a database. - * + * * @return the innerProperties value. */ private DatabaseProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the charset property: The charset of the database. - * + * * @return the charset value. */ public String charset() { @@ -42,7 +92,7 @@ public String charset() { /** * Set the charset property: The charset of the database. - * + * * @param charset the charset value to set. * @return the DatabaseInner object itself. */ @@ -56,7 +106,7 @@ public DatabaseInner withCharset(String charset) { /** * Get the collation property: The collation of the database. - * + * * @return the collation value. */ public String collation() { @@ -65,7 +115,7 @@ public String collation() { /** * Set the collation property: The collation of the database. - * + * * @param collation the collation value to set. * @return the DatabaseInner object itself. */ @@ -79,7 +129,7 @@ public DatabaseInner withCollation(String collation) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -87,4 +137,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the DatabaseInner. + */ + public static DatabaseInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseInner deserializedDatabaseInner = new DatabaseInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedDatabaseInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedDatabaseInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedDatabaseInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedDatabaseInner.innerProperties = DatabaseProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseInner; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/DatabaseProperties.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/DatabaseProperties.java index 077f8ad70ea41..af96265f284d6 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/DatabaseProperties.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/DatabaseProperties.java @@ -5,31 +5,36 @@ package com.azure.resourcemanager.postgresql.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 com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** The properties of a database. */ +/** + * The properties of a database. + */ @Fluent -public final class DatabaseProperties { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(DatabaseProperties.class); - +public final class DatabaseProperties implements JsonSerializable { /* * The charset of the database. */ - @JsonProperty(value = "charset") private String charset; /* * The collation of the database. */ - @JsonProperty(value = "collation") private String collation; + /** + * Creates an instance of DatabaseProperties class. + */ + public DatabaseProperties() { + } + /** * Get the charset property: The charset of the database. - * + * * @return the charset value. */ public String charset() { @@ -38,7 +43,7 @@ public String charset() { /** * Set the charset property: The charset of the database. - * + * * @param charset the charset value to set. * @return the DatabaseProperties object itself. */ @@ -49,7 +54,7 @@ public DatabaseProperties withCharset(String charset) { /** * Get the collation property: The collation of the database. - * + * * @return the collation value. */ public String collation() { @@ -58,7 +63,7 @@ public String collation() { /** * Set the collation property: The collation of the database. - * + * * @param collation the collation value to set. * @return the DatabaseProperties object itself. */ @@ -69,9 +74,48 @@ public DatabaseProperties withCollation(String collation) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("charset", this.charset); + jsonWriter.writeStringField("collation", this.collation); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DatabaseProperties. + */ + public static DatabaseProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseProperties deserializedDatabaseProperties = new DatabaseProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("charset".equals(fieldName)) { + deserializedDatabaseProperties.charset = reader.getString(); + } else if ("collation".equals(fieldName)) { + deserializedDatabaseProperties.collation = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseProperties; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/FirewallRuleInner.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/FirewallRuleInner.java index 9067b347dcdef..2362e7625121f 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/FirewallRuleInner.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/FirewallRuleInner.java @@ -7,33 +7,84 @@ 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; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** Represents a server firewall rule. */ +/** + * Represents a server firewall rule. + */ @Fluent public final class FirewallRuleInner extends ProxyResource { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(FirewallRuleInner.class); - /* * The properties of a firewall rule. */ - @JsonProperty(value = "properties", required = true) private FirewallRuleProperties innerProperties = new FirewallRuleProperties(); + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of FirewallRuleInner class. + */ + public FirewallRuleInner() { + } + /** * Get the innerProperties property: The properties of a firewall rule. - * + * * @return the innerProperties value. */ private FirewallRuleProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the startIpAddress property: The start IP address of the server firewall rule. Must be IPv4 format. - * + * * @return the startIpAddress value. */ public String startIpAddress() { @@ -42,7 +93,7 @@ public String 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. */ @@ -56,7 +107,7 @@ public FirewallRuleInner withStartIpAddress(String startIpAddress) { /** * Get the endIpAddress property: The end IP address of the server firewall rule. Must be IPv4 format. - * + * * @return the endIpAddress value. */ public String endIpAddress() { @@ -65,7 +116,7 @@ public String 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. */ @@ -79,15 +130,61 @@ public FirewallRuleInner withEndIpAddress(String endIpAddress) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (innerProperties() == null) { - throw logger.logExceptionAsError( - new IllegalArgumentException("Missing required property innerProperties in model FirewallRuleInner")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property innerProperties in model FirewallRuleInner")); } else { innerProperties().validate(); } } + + private static final ClientLogger LOGGER = new ClientLogger(FirewallRuleInner.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FirewallRuleInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FirewallRuleInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FirewallRuleInner. + */ + public static FirewallRuleInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FirewallRuleInner deserializedFirewallRuleInner = new FirewallRuleInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedFirewallRuleInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedFirewallRuleInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedFirewallRuleInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedFirewallRuleInner.innerProperties = FirewallRuleProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedFirewallRuleInner; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/FirewallRuleProperties.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/FirewallRuleProperties.java index a60dcd2a1d460..0e01548fa22c5 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/FirewallRuleProperties.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/FirewallRuleProperties.java @@ -6,30 +6,36 @@ 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.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** The properties of a server firewall rule. */ +/** + * The properties of a server firewall rule. + */ @Fluent -public final class FirewallRuleProperties { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(FirewallRuleProperties.class); - +public final class FirewallRuleProperties implements JsonSerializable { /* * The start IP address of the server firewall rule. Must be IPv4 format. */ - @JsonProperty(value = "startIpAddress", required = true) private String startIpAddress; /* * The end IP address of the server firewall rule. Must be IPv4 format. */ - @JsonProperty(value = "endIpAddress", required = true) private String endIpAddress; + /** + * Creates an instance of FirewallRuleProperties class. + */ + public FirewallRuleProperties() { + } + /** * Get the startIpAddress property: The start IP address of the server firewall rule. Must be IPv4 format. - * + * * @return the startIpAddress value. */ public String startIpAddress() { @@ -38,7 +44,7 @@ public String 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 FirewallRuleProperties object itself. */ @@ -49,7 +55,7 @@ public FirewallRuleProperties withStartIpAddress(String startIpAddress) { /** * Get the endIpAddress property: The end IP address of the server firewall rule. Must be IPv4 format. - * + * * @return the endIpAddress value. */ public String endIpAddress() { @@ -58,7 +64,7 @@ public String 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 FirewallRuleProperties object itself. */ @@ -69,17 +75,61 @@ public FirewallRuleProperties withEndIpAddress(String endIpAddress) { /** * 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 FirewallRuleProperties")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property startIpAddress in model FirewallRuleProperties")); } if (endIpAddress() == null) { - throw logger.logExceptionAsError( - new IllegalArgumentException("Missing required property endIpAddress in model FirewallRuleProperties")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property endIpAddress in model FirewallRuleProperties")); } } + + private static final ClientLogger LOGGER = new ClientLogger(FirewallRuleProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("startIpAddress", this.startIpAddress); + jsonWriter.writeStringField("endIpAddress", this.endIpAddress); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FirewallRuleProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FirewallRuleProperties if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the FirewallRuleProperties. + */ + public static FirewallRuleProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FirewallRuleProperties deserializedFirewallRuleProperties = new FirewallRuleProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("startIpAddress".equals(fieldName)) { + deserializedFirewallRuleProperties.startIpAddress = reader.getString(); + } else if ("endIpAddress".equals(fieldName)) { + deserializedFirewallRuleProperties.endIpAddress = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedFirewallRuleProperties; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/LogFileInner.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/LogFileInner.java index d845912d93690..e1f8390237b49 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/LogFileInner.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/LogFileInner.java @@ -6,35 +6,85 @@ 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; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; -/** Represents a log file. */ +/** + * Represents a log file. + */ @Fluent public final class LogFileInner extends ProxyResource { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(LogFileInner.class); - /* * The properties of the log file. */ - @JsonProperty(value = "properties") private LogFileProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of LogFileInner class. + */ + public LogFileInner() { + } + /** * Get the innerProperties property: The properties of the log file. - * + * * @return the innerProperties value. */ private LogFileProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the sizeInKB property: Size of the log file. - * + * * @return the sizeInKB value. */ public Long sizeInKB() { @@ -43,7 +93,7 @@ public Long sizeInKB() { /** * Set the sizeInKB property: Size of the log file. - * + * * @param sizeInKB the sizeInKB value to set. * @return the LogFileInner object itself. */ @@ -57,7 +107,7 @@ public LogFileInner withSizeInKB(Long sizeInKB) { /** * Get the createdTime property: Creation timestamp of the log file. - * + * * @return the createdTime value. */ public OffsetDateTime createdTime() { @@ -66,7 +116,7 @@ public OffsetDateTime createdTime() { /** * Get the lastModifiedTime property: Last modified timestamp of the log file. - * + * * @return the lastModifiedTime value. */ public OffsetDateTime lastModifiedTime() { @@ -75,7 +125,7 @@ public OffsetDateTime lastModifiedTime() { /** * Get the type property: Type of the log file. - * + * * @return the type value. */ public String typePropertiesType() { @@ -84,7 +134,7 @@ public String typePropertiesType() { /** * Set the type property: Type of the log file. - * + * * @param type the type value to set. * @return the LogFileInner object itself. */ @@ -98,7 +148,7 @@ public LogFileInner withTypePropertiesType(String type) { /** * Get the url property: The url to download the log file from. - * + * * @return the url value. */ public String url() { @@ -107,7 +157,7 @@ public String url() { /** * Set the url property: The url to download the log file from. - * + * * @param url the url value to set. * @return the LogFileInner object itself. */ @@ -121,7 +171,7 @@ public LogFileInner withUrl(String url) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -129,4 +179,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LogFileInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LogFileInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the LogFileInner. + */ + public static LogFileInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LogFileInner deserializedLogFileInner = new LogFileInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedLogFileInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedLogFileInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedLogFileInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedLogFileInner.innerProperties = LogFileProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedLogFileInner; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/LogFileProperties.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/LogFileProperties.java index 1e04bea327711..9504442bf09fc 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/LogFileProperties.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/LogFileProperties.java @@ -5,50 +5,53 @@ package com.azure.resourcemanager.postgresql.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 com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; -/** The properties of a log file. */ +/** + * The properties of a log file. + */ @Fluent -public final class LogFileProperties { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(LogFileProperties.class); - +public final class LogFileProperties implements JsonSerializable { /* * Size of the log file. */ - @JsonProperty(value = "sizeInKB") private Long sizeInKB; /* * Creation timestamp of the log file. */ - @JsonProperty(value = "createdTime", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime createdTime; /* * Last modified timestamp of the log file. */ - @JsonProperty(value = "lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime lastModifiedTime; /* * Type of the log file. */ - @JsonProperty(value = "type") private String type; /* * The url to download the log file from. */ - @JsonProperty(value = "url") private String url; + /** + * Creates an instance of LogFileProperties class. + */ + public LogFileProperties() { + } + /** * Get the sizeInKB property: Size of the log file. - * + * * @return the sizeInKB value. */ public Long sizeInKB() { @@ -57,7 +60,7 @@ public Long sizeInKB() { /** * Set the sizeInKB property: Size of the log file. - * + * * @param sizeInKB the sizeInKB value to set. * @return the LogFileProperties object itself. */ @@ -68,7 +71,7 @@ public LogFileProperties withSizeInKB(Long sizeInKB) { /** * Get the createdTime property: Creation timestamp of the log file. - * + * * @return the createdTime value. */ public OffsetDateTime createdTime() { @@ -77,7 +80,7 @@ public OffsetDateTime createdTime() { /** * Get the lastModifiedTime property: Last modified timestamp of the log file. - * + * * @return the lastModifiedTime value. */ public OffsetDateTime lastModifiedTime() { @@ -86,7 +89,7 @@ public OffsetDateTime lastModifiedTime() { /** * Get the type property: Type of the log file. - * + * * @return the type value. */ public String type() { @@ -95,7 +98,7 @@ public String type() { /** * Set the type property: Type of the log file. - * + * * @param type the type value to set. * @return the LogFileProperties object itself. */ @@ -106,7 +109,7 @@ public LogFileProperties withType(String type) { /** * Get the url property: The url to download the log file from. - * + * * @return the url value. */ public String url() { @@ -115,7 +118,7 @@ public String url() { /** * Set the url property: The url to download the log file from. - * + * * @param url the url value to set. * @return the LogFileProperties object itself. */ @@ -126,9 +129,57 @@ public LogFileProperties withUrl(String url) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("sizeInKB", this.sizeInKB); + jsonWriter.writeStringField("type", this.type); + jsonWriter.writeStringField("url", this.url); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LogFileProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LogFileProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the LogFileProperties. + */ + public static LogFileProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LogFileProperties deserializedLogFileProperties = new LogFileProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("sizeInKB".equals(fieldName)) { + deserializedLogFileProperties.sizeInKB = reader.getNullable(JsonReader::getLong); + } else if ("createdTime".equals(fieldName)) { + deserializedLogFileProperties.createdTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("lastModifiedTime".equals(fieldName)) { + deserializedLogFileProperties.lastModifiedTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("type".equals(fieldName)) { + deserializedLogFileProperties.type = reader.getString(); + } else if ("url".equals(fieldName)) { + deserializedLogFileProperties.url = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedLogFileProperties; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/NameAvailabilityInner.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/NameAvailabilityInner.java index 8a759f07140a6..9944566e4439c 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/NameAvailabilityInner.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/NameAvailabilityInner.java @@ -5,37 +5,41 @@ package com.azure.resourcemanager.postgresql.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 com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** Represents a resource name availability. */ +/** + * Represents a resource name availability. + */ @Fluent -public final class NameAvailabilityInner { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(NameAvailabilityInner.class); - +public final class NameAvailabilityInner implements JsonSerializable { /* * 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; + /** + * Creates an instance of NameAvailabilityInner class. + */ + public NameAvailabilityInner() { + } + /** * Get the message property: Error Message. - * + * * @return the message value. */ public String message() { @@ -44,7 +48,7 @@ public String message() { /** * Set the message property: Error Message. - * + * * @param message the message value to set. * @return the NameAvailabilityInner object itself. */ @@ -55,7 +59,7 @@ public NameAvailabilityInner withMessage(String message) { /** * Get the nameAvailable property: Indicates whether the resource name is available. - * + * * @return the nameAvailable value. */ public Boolean nameAvailable() { @@ -64,7 +68,7 @@ public Boolean nameAvailable() { /** * Set the nameAvailable property: Indicates whether the resource name is available. - * + * * @param nameAvailable the nameAvailable value to set. * @return the NameAvailabilityInner object itself. */ @@ -75,7 +79,7 @@ public NameAvailabilityInner withNameAvailable(Boolean nameAvailable) { /** * Get the reason property: Reason for name being unavailable. - * + * * @return the reason value. */ public String reason() { @@ -84,7 +88,7 @@ public String reason() { /** * Set the reason property: Reason for name being unavailable. - * + * * @param reason the reason value to set. * @return the NameAvailabilityInner object itself. */ @@ -95,9 +99,51 @@ public NameAvailabilityInner withReason(String reason) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("message", this.message); + jsonWriter.writeBooleanField("nameAvailable", this.nameAvailable); + jsonWriter.writeStringField("reason", this.reason); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NameAvailabilityInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NameAvailabilityInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the NameAvailabilityInner. + */ + public static NameAvailabilityInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NameAvailabilityInner deserializedNameAvailabilityInner = new NameAvailabilityInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("message".equals(fieldName)) { + deserializedNameAvailabilityInner.message = reader.getString(); + } else if ("nameAvailable".equals(fieldName)) { + deserializedNameAvailabilityInner.nameAvailable = reader.getNullable(JsonReader::getBoolean); + } else if ("reason".equals(fieldName)) { + deserializedNameAvailabilityInner.reason = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNameAvailabilityInner; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/OperationListResultInner.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/OperationListResultInner.java index 989845621a2b9..9f814748c493c 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/OperationListResultInner.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/OperationListResultInner.java @@ -5,27 +5,33 @@ package com.azure.resourcemanager.postgresql.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.models.Operation; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** A list of resource provider operations. */ +/** + * A list of resource provider operations. + */ @Fluent -public final class OperationListResultInner { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(OperationListResultInner.class); - +public final class OperationListResultInner implements JsonSerializable { /* * The list of resource provider operations. */ - @JsonProperty(value = "value") private List value; + /** + * Creates an instance of OperationListResultInner class. + */ + public OperationListResultInner() { + } + /** * Get the value property: The list of resource provider operations. - * + * * @return the value value. */ public List value() { @@ -34,7 +40,7 @@ public List value() { /** * Set the value property: The list of resource provider operations. - * + * * @param value the value value to set. * @return the OperationListResultInner object itself. */ @@ -45,7 +51,7 @@ public OperationListResultInner withValue(List value) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -53,4 +59,41 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationListResultInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationListResultInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationListResultInner. + */ + public static OperationListResultInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationListResultInner deserializedOperationListResultInner = new OperationListResultInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> Operation.fromJson(reader1)); + deserializedOperationListResultInner.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedOperationListResultInner; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/PerformanceTierPropertiesInner.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/PerformanceTierPropertiesInner.java index 81da8eb95059a..c1479f3d030d6 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/PerformanceTierPropertiesInner.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/PerformanceTierPropertiesInner.java @@ -5,69 +5,68 @@ package com.azure.resourcemanager.postgresql.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.models.PerformanceTierServiceLevelObjectives; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** Performance tier properties. */ +/** + * Performance tier properties. + */ @Fluent -public final class PerformanceTierPropertiesInner { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(PerformanceTierPropertiesInner.class); - +public final class PerformanceTierPropertiesInner implements JsonSerializable { /* * 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; + /** + * Creates an instance of PerformanceTierPropertiesInner class. + */ + public PerformanceTierPropertiesInner() { + } + /** * Get the id property: ID of the performance tier. - * + * * @return the id value. */ public String id() { @@ -76,7 +75,7 @@ public String id() { /** * Set the id property: ID of the performance tier. - * + * * @param id the id value to set. * @return the PerformanceTierPropertiesInner object itself. */ @@ -87,7 +86,7 @@ public PerformanceTierPropertiesInner withId(String id) { /** * Get the maxBackupRetentionDays property: Maximum Backup retention in days for the performance tier edition. - * + * * @return the maxBackupRetentionDays value. */ public Integer maxBackupRetentionDays() { @@ -96,7 +95,7 @@ public Integer 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. */ @@ -107,7 +106,7 @@ public PerformanceTierPropertiesInner withMaxBackupRetentionDays(Integer maxBack /** * Get the minBackupRetentionDays property: Minimum Backup retention in days for the performance tier edition. - * + * * @return the minBackupRetentionDays value. */ public Integer minBackupRetentionDays() { @@ -116,7 +115,7 @@ public Integer 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. */ @@ -127,7 +126,7 @@ public PerformanceTierPropertiesInner withMinBackupRetentionDays(Integer minBack /** * Get the maxStorageMB property: Max storage allowed for a server. - * + * * @return the maxStorageMB value. */ public Integer maxStorageMB() { @@ -136,7 +135,7 @@ public Integer maxStorageMB() { /** * Set the maxStorageMB property: Max storage allowed for a server. - * + * * @param maxStorageMB the maxStorageMB value to set. * @return the PerformanceTierPropertiesInner object itself. */ @@ -147,7 +146,7 @@ public PerformanceTierPropertiesInner withMaxStorageMB(Integer maxStorageMB) { /** * Get the minLargeStorageMB property: Max storage allowed for a server. - * + * * @return the minLargeStorageMB value. */ public Integer minLargeStorageMB() { @@ -156,7 +155,7 @@ public Integer minLargeStorageMB() { /** * Set the minLargeStorageMB property: Max storage allowed for a server. - * + * * @param minLargeStorageMB the minLargeStorageMB value to set. * @return the PerformanceTierPropertiesInner object itself. */ @@ -167,7 +166,7 @@ public PerformanceTierPropertiesInner withMinLargeStorageMB(Integer minLargeStor /** * Get the maxLargeStorageMB property: Max storage allowed for a server. - * + * * @return the maxLargeStorageMB value. */ public Integer maxLargeStorageMB() { @@ -176,7 +175,7 @@ public Integer maxLargeStorageMB() { /** * Set the maxLargeStorageMB property: Max storage allowed for a server. - * + * * @param maxLargeStorageMB the maxLargeStorageMB value to set. * @return the PerformanceTierPropertiesInner object itself. */ @@ -187,7 +186,7 @@ public PerformanceTierPropertiesInner withMaxLargeStorageMB(Integer maxLargeStor /** * Get the minStorageMB property: Max storage allowed for a server. - * + * * @return the minStorageMB value. */ public Integer minStorageMB() { @@ -196,7 +195,7 @@ public Integer minStorageMB() { /** * Set the minStorageMB property: Max storage allowed for a server. - * + * * @param minStorageMB the minStorageMB value to set. * @return the PerformanceTierPropertiesInner object itself. */ @@ -207,7 +206,7 @@ public PerformanceTierPropertiesInner withMinStorageMB(Integer minStorageMB) { /** * Get the serviceLevelObjectives property: Service level objectives associated with the performance tier. - * + * * @return the serviceLevelObjectives value. */ public List serviceLevelObjectives() { @@ -216,7 +215,7 @@ public List 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. */ @@ -228,7 +227,7 @@ public List serviceLevelObjectives() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -236,4 +235,69 @@ public void validate() { serviceLevelObjectives().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeNumberField("maxBackupRetentionDays", this.maxBackupRetentionDays); + jsonWriter.writeNumberField("minBackupRetentionDays", this.minBackupRetentionDays); + jsonWriter.writeNumberField("maxStorageMB", this.maxStorageMB); + jsonWriter.writeNumberField("minLargeStorageMB", this.minLargeStorageMB); + jsonWriter.writeNumberField("maxLargeStorageMB", this.maxLargeStorageMB); + jsonWriter.writeNumberField("minStorageMB", this.minStorageMB); + jsonWriter.writeArrayField("serviceLevelObjectives", this.serviceLevelObjectives, + (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PerformanceTierPropertiesInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PerformanceTierPropertiesInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PerformanceTierPropertiesInner. + */ + public static PerformanceTierPropertiesInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PerformanceTierPropertiesInner deserializedPerformanceTierPropertiesInner + = new PerformanceTierPropertiesInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPerformanceTierPropertiesInner.id = reader.getString(); + } else if ("maxBackupRetentionDays".equals(fieldName)) { + deserializedPerformanceTierPropertiesInner.maxBackupRetentionDays + = reader.getNullable(JsonReader::getInt); + } else if ("minBackupRetentionDays".equals(fieldName)) { + deserializedPerformanceTierPropertiesInner.minBackupRetentionDays + = reader.getNullable(JsonReader::getInt); + } else if ("maxStorageMB".equals(fieldName)) { + deserializedPerformanceTierPropertiesInner.maxStorageMB = reader.getNullable(JsonReader::getInt); + } else if ("minLargeStorageMB".equals(fieldName)) { + deserializedPerformanceTierPropertiesInner.minLargeStorageMB + = reader.getNullable(JsonReader::getInt); + } else if ("maxLargeStorageMB".equals(fieldName)) { + deserializedPerformanceTierPropertiesInner.maxLargeStorageMB + = reader.getNullable(JsonReader::getInt); + } else if ("minStorageMB".equals(fieldName)) { + deserializedPerformanceTierPropertiesInner.minStorageMB = reader.getNullable(JsonReader::getInt); + } else if ("serviceLevelObjectives".equals(fieldName)) { + List serviceLevelObjectives + = reader.readArray(reader1 -> PerformanceTierServiceLevelObjectives.fromJson(reader1)); + deserializedPerformanceTierPropertiesInner.serviceLevelObjectives = serviceLevelObjectives; + } else { + reader.skipChildren(); + } + } + + return deserializedPerformanceTierPropertiesInner; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/PrivateEndpointConnectionInner.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/PrivateEndpointConnectionInner.java index 07987c49f59d1..28569ce9fec5c 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/PrivateEndpointConnectionInner.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/PrivateEndpointConnectionInner.java @@ -6,36 +6,86 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.models.PrivateEndpointProperty; import com.azure.resourcemanager.postgresql.models.PrivateLinkServiceConnectionStateProperty; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; -/** A private endpoint connection. */ +/** + * A private endpoint connection. + */ @Fluent public final class PrivateEndpointConnectionInner extends ProxyResource { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionInner.class); - /* * Resource properties. */ - @JsonProperty(value = "properties") private PrivateEndpointConnectionProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of PrivateEndpointConnectionInner class. + */ + public PrivateEndpointConnectionInner() { + } + /** * Get the innerProperties property: Resource properties. - * + * * @return the innerProperties value. */ private PrivateEndpointConnectionProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the privateEndpoint property: Private endpoint which the connection belongs to. - * + * * @return the privateEndpoint value. */ public PrivateEndpointProperty privateEndpoint() { @@ -44,7 +94,7 @@ public PrivateEndpointProperty privateEndpoint() { /** * Set the privateEndpoint property: Private endpoint which the connection belongs to. - * + * * @param privateEndpoint the privateEndpoint value to set. * @return the PrivateEndpointConnectionInner object itself. */ @@ -58,7 +108,7 @@ public PrivateEndpointConnectionInner withPrivateEndpoint(PrivateEndpointPropert /** * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. - * + * * @return the privateLinkServiceConnectionState value. */ public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { @@ -67,7 +117,7 @@ public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionSta /** * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. - * + * * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. * @return the PrivateEndpointConnectionInner object itself. */ @@ -82,7 +132,7 @@ public PrivateEndpointConnectionInner withPrivateLinkServiceConnectionState( /** * Get the provisioningState property: State of the private endpoint connection. - * + * * @return the provisioningState value. */ public String provisioningState() { @@ -91,7 +141,7 @@ public String provisioningState() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -99,4 +149,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateEndpointConnectionInner. + */ + public static PrivateEndpointConnectionInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionInner deserializedPrivateEndpointConnectionInner + = new PrivateEndpointConnectionInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPrivateEndpointConnectionInner.innerProperties + = PrivateEndpointConnectionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionInner; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/PrivateEndpointConnectionProperties.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/PrivateEndpointConnectionProperties.java index 1572ac8441e98..9a3116d026dcb 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/PrivateEndpointConnectionProperties.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/PrivateEndpointConnectionProperties.java @@ -5,39 +5,44 @@ package com.azure.resourcemanager.postgresql.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.models.PrivateEndpointProperty; import com.azure.resourcemanager.postgresql.models.PrivateLinkServiceConnectionStateProperty; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; -/** Properties of a private endpoint connection. */ +/** + * Properties of a private endpoint connection. + */ @Fluent -public final class PrivateEndpointConnectionProperties { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionProperties.class); - +public final class PrivateEndpointConnectionProperties + implements JsonSerializable { /* * Private endpoint which the connection belongs to. */ - @JsonProperty(value = "privateEndpoint") private PrivateEndpointProperty privateEndpoint; /* * Connection state of the private endpoint connection. */ - @JsonProperty(value = "privateLinkServiceConnectionState") private PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; /* * State of the private endpoint connection. */ - @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) private String provisioningState; + /** + * Creates an instance of PrivateEndpointConnectionProperties class. + */ + public PrivateEndpointConnectionProperties() { + } + /** * Get the privateEndpoint property: Private endpoint which the connection belongs to. - * + * * @return the privateEndpoint value. */ public PrivateEndpointProperty privateEndpoint() { @@ -46,7 +51,7 @@ public PrivateEndpointProperty privateEndpoint() { /** * Set the privateEndpoint property: Private endpoint which the connection belongs to. - * + * * @param privateEndpoint the privateEndpoint value to set. * @return the PrivateEndpointConnectionProperties object itself. */ @@ -57,7 +62,7 @@ public PrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpointPr /** * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. - * + * * @return the privateLinkServiceConnectionState value. */ public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { @@ -66,7 +71,7 @@ public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionSta /** * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. - * + * * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. * @return the PrivateEndpointConnectionProperties object itself. */ @@ -78,7 +83,7 @@ public PrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState /** * Get the provisioningState property: State of the private endpoint connection. - * + * * @return the provisioningState value. */ public String provisioningState() { @@ -87,7 +92,7 @@ public String provisioningState() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -98,4 +103,48 @@ public void validate() { privateLinkServiceConnectionState().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("privateEndpoint", this.privateEndpoint); + jsonWriter.writeJsonField("privateLinkServiceConnectionState", this.privateLinkServiceConnectionState); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionProperties if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateEndpointConnectionProperties. + */ + public static PrivateEndpointConnectionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionProperties deserializedPrivateEndpointConnectionProperties + = new PrivateEndpointConnectionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("privateEndpoint".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateEndpoint + = PrivateEndpointProperty.fromJson(reader); + } else if ("privateLinkServiceConnectionState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.privateLinkServiceConnectionState + = PrivateLinkServiceConnectionStateProperty.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedPrivateEndpointConnectionProperties.provisioningState = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionProperties; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/PrivateLinkResourceInner.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/PrivateLinkResourceInner.java index 9fc7851d86e56..0220ef9eacda6 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/PrivateLinkResourceInner.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/PrivateLinkResourceInner.java @@ -6,35 +6,85 @@ import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.models.PrivateLinkResourceProperties; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; -/** A private link resource. */ +/** + * 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; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of PrivateLinkResourceInner class. + */ + public PrivateLinkResourceInner() { + } + /** * Get the properties property: The private link resource group id. - * + * * @return the properties value. */ public PrivateLinkResourceProperties properties() { return this.properties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -42,4 +92,46 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceInner if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateLinkResourceInner. + */ + public static PrivateLinkResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceInner deserializedPrivateLinkResourceInner = new PrivateLinkResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateLinkResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedPrivateLinkResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedPrivateLinkResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedPrivateLinkResourceInner.properties = PrivateLinkResourceProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceInner; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/RecoverableServerProperties.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/RecoverableServerProperties.java index 268d6e8489dac..2a3e3c849c62e 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/RecoverableServerProperties.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/RecoverableServerProperties.java @@ -5,55 +5,56 @@ package com.azure.resourcemanager.postgresql.fluent.models; import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** The recoverable server's properties. */ +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The recoverable server's properties. + */ @Immutable -public final class RecoverableServerProperties { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(RecoverableServerProperties.class); - +public final class RecoverableServerProperties implements JsonSerializable { /* * The last available backup date time. */ - @JsonProperty(value = "lastAvailableBackupDateTime", access = JsonProperty.Access.WRITE_ONLY) private String lastAvailableBackupDateTime; /* * The service level objective */ - @JsonProperty(value = "serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) private String serviceLevelObjective; /* * Edition of the performance tier. */ - @JsonProperty(value = "edition", access = JsonProperty.Access.WRITE_ONLY) private String edition; /* * vCore associated with the service level objective */ - @JsonProperty(value = "vCore", access = JsonProperty.Access.WRITE_ONLY) private Integer vCore; /* * Hardware generation associated with the service level objective */ - @JsonProperty(value = "hardwareGeneration", access = JsonProperty.Access.WRITE_ONLY) private String hardwareGeneration; /* * The PostgreSQL version */ - @JsonProperty(value = "version", access = JsonProperty.Access.WRITE_ONLY) private String version; + /** + * Creates an instance of RecoverableServerProperties class. + */ + public RecoverableServerProperties() { + } + /** * Get the lastAvailableBackupDateTime property: The last available backup date time. - * + * * @return the lastAvailableBackupDateTime value. */ public String lastAvailableBackupDateTime() { @@ -62,7 +63,7 @@ public String lastAvailableBackupDateTime() { /** * Get the serviceLevelObjective property: The service level objective. - * + * * @return the serviceLevelObjective value. */ public String serviceLevelObjective() { @@ -71,7 +72,7 @@ public String serviceLevelObjective() { /** * Get the edition property: Edition of the performance tier. - * + * * @return the edition value. */ public String edition() { @@ -80,7 +81,7 @@ public String edition() { /** * Get the vCore property: vCore associated with the service level objective. - * + * * @return the vCore value. */ public Integer vCore() { @@ -89,7 +90,7 @@ public Integer vCore() { /** * Get the hardwareGeneration property: Hardware generation associated with the service level objective. - * + * * @return the hardwareGeneration value. */ public String hardwareGeneration() { @@ -98,7 +99,7 @@ public String hardwareGeneration() { /** * Get the version property: The PostgreSQL version. - * + * * @return the version value. */ public String version() { @@ -107,9 +108,54 @@ public String version() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecoverableServerProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecoverableServerProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the RecoverableServerProperties. + */ + public static RecoverableServerProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecoverableServerProperties deserializedRecoverableServerProperties = new RecoverableServerProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("lastAvailableBackupDateTime".equals(fieldName)) { + deserializedRecoverableServerProperties.lastAvailableBackupDateTime = reader.getString(); + } else if ("serviceLevelObjective".equals(fieldName)) { + deserializedRecoverableServerProperties.serviceLevelObjective = reader.getString(); + } else if ("edition".equals(fieldName)) { + deserializedRecoverableServerProperties.edition = reader.getString(); + } else if ("vCore".equals(fieldName)) { + deserializedRecoverableServerProperties.vCore = reader.getNullable(JsonReader::getInt); + } else if ("hardwareGeneration".equals(fieldName)) { + deserializedRecoverableServerProperties.hardwareGeneration = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedRecoverableServerProperties.version = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedRecoverableServerProperties; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/RecoverableServerResourceInner.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/RecoverableServerResourceInner.java index a362a85033972..182e49533296a 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/RecoverableServerResourceInner.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/RecoverableServerResourceInner.java @@ -4,36 +4,86 @@ package com.azure.resourcemanager.postgresql.fluent.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.core.management.ProxyResource; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** A recoverable server resource. */ -@Fluent +/** + * A recoverable server resource. + */ +@Immutable public final class RecoverableServerResourceInner extends ProxyResource { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(RecoverableServerResourceInner.class); - /* * Resource properties. */ - @JsonProperty(value = "properties") private RecoverableServerProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of RecoverableServerResourceInner class. + */ + public RecoverableServerResourceInner() { + } + /** * Get the innerProperties property: Resource properties. - * + * * @return the innerProperties value. */ private RecoverableServerProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the lastAvailableBackupDateTime property: The last available backup date time. - * + * * @return the lastAvailableBackupDateTime value. */ public String lastAvailableBackupDateTime() { @@ -42,7 +92,7 @@ public String lastAvailableBackupDateTime() { /** * Get the serviceLevelObjective property: The service level objective. - * + * * @return the serviceLevelObjective value. */ public String serviceLevelObjective() { @@ -51,7 +101,7 @@ public String serviceLevelObjective() { /** * Get the edition property: Edition of the performance tier. - * + * * @return the edition value. */ public String edition() { @@ -60,7 +110,7 @@ public String edition() { /** * Get the vCore property: vCore associated with the service level objective. - * + * * @return the vCore value. */ public Integer vCore() { @@ -69,7 +119,7 @@ public Integer vCore() { /** * Get the hardwareGeneration property: Hardware generation associated with the service level objective. - * + * * @return the hardwareGeneration value. */ public String hardwareGeneration() { @@ -78,7 +128,7 @@ public String hardwareGeneration() { /** * Get the version property: The PostgreSQL version. - * + * * @return the version value. */ public String version() { @@ -87,7 +137,7 @@ public String version() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -95,4 +145,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of RecoverableServerResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of RecoverableServerResourceInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the RecoverableServerResourceInner. + */ + public static RecoverableServerResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + RecoverableServerResourceInner deserializedRecoverableServerResourceInner + = new RecoverableServerResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedRecoverableServerResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedRecoverableServerResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedRecoverableServerResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedRecoverableServerResourceInner.innerProperties + = RecoverableServerProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedRecoverableServerResourceInner; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/SecurityAlertPolicyProperties.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/SecurityAlertPolicyProperties.java index 0e719d2d7bb0f..00c7ae07dbb10 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/SecurityAlertPolicyProperties.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/SecurityAlertPolicyProperties.java @@ -6,66 +6,65 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.models.ServerSecurityAlertPolicyState; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** Properties of a security alert policy. */ +/** + * Properties of a security alert policy. + */ @Fluent -public final class SecurityAlertPolicyProperties { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(SecurityAlertPolicyProperties.class); - +public final class SecurityAlertPolicyProperties implements JsonSerializable { /* * Specifies the state of the policy, whether it is enabled or disabled. */ - @JsonProperty(value = "state", required = true) private ServerSecurityAlertPolicyState state; /* - * Specifies an array of alerts that are disabled. Allowed values are: - * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly + * Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability, + * Access_Anomaly */ - @JsonProperty(value = "disabledAlerts") private List disabledAlerts; /* * Specifies an array of e-mail addresses to which the alert is sent. */ - @JsonProperty(value = "emailAddresses") private List emailAddresses; /* * Specifies that the alert is sent to the account administrators. */ - @JsonProperty(value = "emailAccountAdmins") private Boolean emailAccountAdmins; /* - * Specifies the blob storage endpoint (e.g. - * https://MyAccount.blob.core.windows.net). This blob storage will hold + * 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 = "storageEndpoint") private String storageEndpoint; /* - * Specifies the identifier key of the Threat Detection audit storage - * account. + * Specifies the identifier key of the Threat Detection audit storage account. */ - @JsonProperty(value = "storageAccountAccessKey") private String storageAccountAccessKey; /* * Specifies the number of days to keep in the Threat Detection audit logs. */ - @JsonProperty(value = "retentionDays") private Integer retentionDays; + /** + * Creates an instance of SecurityAlertPolicyProperties class. + */ + public SecurityAlertPolicyProperties() { + } + /** * Get the state property: Specifies the state of the policy, whether it is enabled or disabled. - * + * * @return the state value. */ public ServerSecurityAlertPolicyState state() { @@ -74,7 +73,7 @@ public ServerSecurityAlertPolicyState 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 SecurityAlertPolicyProperties object itself. */ @@ -86,7 +85,7 @@ public SecurityAlertPolicyProperties withState(ServerSecurityAlertPolicyState st /** * 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() { @@ -96,7 +95,7 @@ public List 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 SecurityAlertPolicyProperties object itself. */ @@ -107,7 +106,7 @@ public SecurityAlertPolicyProperties withDisabledAlerts(List disabledAle /** * Get the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. - * + * * @return the emailAddresses value. */ public List emailAddresses() { @@ -116,7 +115,7 @@ public List 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 SecurityAlertPolicyProperties object itself. */ @@ -127,7 +126,7 @@ public SecurityAlertPolicyProperties withEmailAddresses(List emailAddres /** * Get the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. - * + * * @return the emailAccountAdmins value. */ public Boolean emailAccountAdmins() { @@ -136,7 +135,7 @@ public Boolean emailAccountAdmins() { /** * Set the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. - * + * * @param emailAccountAdmins the emailAccountAdmins value to set. * @return the SecurityAlertPolicyProperties object itself. */ @@ -148,7 +147,7 @@ public SecurityAlertPolicyProperties withEmailAccountAdmins(Boolean emailAccount /** * 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() { @@ -158,7 +157,7 @@ public String 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 SecurityAlertPolicyProperties object itself. */ @@ -170,7 +169,7 @@ public SecurityAlertPolicyProperties withStorageEndpoint(String storageEndpoint) /** * Get the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage * account. - * + * * @return the storageAccountAccessKey value. */ public String storageAccountAccessKey() { @@ -180,7 +179,7 @@ public String 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 SecurityAlertPolicyProperties object itself. */ @@ -191,7 +190,7 @@ public SecurityAlertPolicyProperties withStorageAccountAccessKey(String storageA /** * Get the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. - * + * * @return the retentionDays value. */ public Integer retentionDays() { @@ -200,7 +199,7 @@ public Integer 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 SecurityAlertPolicyProperties object itself. */ @@ -211,13 +210,78 @@ public SecurityAlertPolicyProperties withRetentionDays(Integer retentionDays) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (state() == null) { - throw logger.logExceptionAsError( - new IllegalArgumentException("Missing required property state in model SecurityAlertPolicyProperties")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property state in model SecurityAlertPolicyProperties")); } } + + private static final ClientLogger LOGGER = new ClientLogger(SecurityAlertPolicyProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("state", this.state == null ? null : this.state.toString()); + jsonWriter.writeArrayField("disabledAlerts", this.disabledAlerts, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeArrayField("emailAddresses", this.emailAddresses, + (writer, element) -> writer.writeString(element)); + jsonWriter.writeBooleanField("emailAccountAdmins", this.emailAccountAdmins); + jsonWriter.writeStringField("storageEndpoint", this.storageEndpoint); + jsonWriter.writeStringField("storageAccountAccessKey", this.storageAccountAccessKey); + jsonWriter.writeNumberField("retentionDays", this.retentionDays); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of SecurityAlertPolicyProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of SecurityAlertPolicyProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the SecurityAlertPolicyProperties. + */ + public static SecurityAlertPolicyProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + SecurityAlertPolicyProperties deserializedSecurityAlertPolicyProperties + = new SecurityAlertPolicyProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("state".equals(fieldName)) { + deserializedSecurityAlertPolicyProperties.state + = ServerSecurityAlertPolicyState.fromString(reader.getString()); + } else if ("disabledAlerts".equals(fieldName)) { + List disabledAlerts = reader.readArray(reader1 -> reader1.getString()); + deserializedSecurityAlertPolicyProperties.disabledAlerts = disabledAlerts; + } else if ("emailAddresses".equals(fieldName)) { + List emailAddresses = reader.readArray(reader1 -> reader1.getString()); + deserializedSecurityAlertPolicyProperties.emailAddresses = emailAddresses; + } else if ("emailAccountAdmins".equals(fieldName)) { + deserializedSecurityAlertPolicyProperties.emailAccountAdmins + = reader.getNullable(JsonReader::getBoolean); + } else if ("storageEndpoint".equals(fieldName)) { + deserializedSecurityAlertPolicyProperties.storageEndpoint = reader.getString(); + } else if ("storageAccountAccessKey".equals(fieldName)) { + deserializedSecurityAlertPolicyProperties.storageAccountAccessKey = reader.getString(); + } else if ("retentionDays".equals(fieldName)) { + deserializedSecurityAlertPolicyProperties.retentionDays = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedSecurityAlertPolicyProperties; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerAdministratorProperties.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerAdministratorProperties.java index b4a2d9908fb36..738c49a956705 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerAdministratorProperties.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerAdministratorProperties.java @@ -6,44 +6,49 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.models.AdministratorType; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; +import java.util.Objects; import java.util.UUID; -/** The properties of an server Administrator. */ +/** + * The properties of an server Administrator. + */ @Fluent -public final class ServerAdministratorProperties { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerAdministratorProperties.class); - +public final class ServerAdministratorProperties implements JsonSerializable { /* * The type of administrator. */ - @JsonProperty(value = "administratorType", required = true) private AdministratorType administratorType; /* * The server administrator login account name. */ - @JsonProperty(value = "login", required = true) private String login; /* * The server administrator Sid (Secure ID). */ - @JsonProperty(value = "sid", required = true) private UUID sid; /* * The server Active Directory Administrator tenant id. */ - @JsonProperty(value = "tenantId", required = true) private UUID tenantId; + /** + * Creates an instance of ServerAdministratorProperties class. + */ + public ServerAdministratorProperties() { + } + /** * Get the administratorType property: The type of administrator. - * + * * @return the administratorType value. */ public AdministratorType administratorType() { @@ -52,7 +57,7 @@ public AdministratorType administratorType() { /** * Set the administratorType property: The type of administrator. - * + * * @param administratorType the administratorType value to set. * @return the ServerAdministratorProperties object itself. */ @@ -63,7 +68,7 @@ public ServerAdministratorProperties withAdministratorType(AdministratorType adm /** * Get the login property: The server administrator login account name. - * + * * @return the login value. */ public String login() { @@ -72,7 +77,7 @@ public String login() { /** * Set the login property: The server administrator login account name. - * + * * @param login the login value to set. * @return the ServerAdministratorProperties object itself. */ @@ -83,7 +88,7 @@ public ServerAdministratorProperties withLogin(String login) { /** * Get the sid property: The server administrator Sid (Secure ID). - * + * * @return the sid value. */ public UUID sid() { @@ -92,7 +97,7 @@ public UUID sid() { /** * Set the sid property: The server administrator Sid (Secure ID). - * + * * @param sid the sid value to set. * @return the ServerAdministratorProperties object itself. */ @@ -103,7 +108,7 @@ public ServerAdministratorProperties withSid(UUID sid) { /** * Get the tenantId property: The server Active Directory Administrator tenant id. - * + * * @return the tenantId value. */ public UUID tenantId() { @@ -112,7 +117,7 @@ public UUID tenantId() { /** * Set the tenantId property: The server Active Directory Administrator tenant id. - * + * * @param tenantId the tenantId value to set. * @return the ServerAdministratorProperties object itself. */ @@ -123,25 +128,82 @@ public ServerAdministratorProperties withTenantId(UUID tenantId) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (administratorType() == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( - "Missing required property administratorType in model ServerAdministratorProperties")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property administratorType in model ServerAdministratorProperties")); } if (login() == null) { - throw logger.logExceptionAsError( - new IllegalArgumentException("Missing required property login in model ServerAdministratorProperties")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property login in model ServerAdministratorProperties")); } if (sid() == null) { - throw logger.logExceptionAsError( - new IllegalArgumentException("Missing required property sid in model ServerAdministratorProperties")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sid in model ServerAdministratorProperties")); } if (tenantId() == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( - "Missing required property tenantId in model ServerAdministratorProperties")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property tenantId in model ServerAdministratorProperties")); } } + + private static final ClientLogger LOGGER = new ClientLogger(ServerAdministratorProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("administratorType", + this.administratorType == null ? null : this.administratorType.toString()); + jsonWriter.writeStringField("login", this.login); + jsonWriter.writeStringField("sid", Objects.toString(this.sid, null)); + jsonWriter.writeStringField("tenantId", Objects.toString(this.tenantId, null)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerAdministratorProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerAdministratorProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ServerAdministratorProperties. + */ + public static ServerAdministratorProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerAdministratorProperties deserializedServerAdministratorProperties + = new ServerAdministratorProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("administratorType".equals(fieldName)) { + deserializedServerAdministratorProperties.administratorType + = AdministratorType.fromString(reader.getString()); + } else if ("login".equals(fieldName)) { + deserializedServerAdministratorProperties.login = reader.getString(); + } else if ("sid".equals(fieldName)) { + deserializedServerAdministratorProperties.sid + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("tenantId".equals(fieldName)) { + deserializedServerAdministratorProperties.tenantId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedServerAdministratorProperties; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerAdministratorResourceInner.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerAdministratorResourceInner.java index b1ceedb0f03ff..9a5acd00d2f7e 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerAdministratorResourceInner.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerAdministratorResourceInner.java @@ -6,36 +6,86 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.models.AdministratorType; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.UUID; -/** Represents a and external administrator to be created. */ +/** + * Represents a and external administrator to be created. + */ @Fluent public final class ServerAdministratorResourceInner extends ProxyResource { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerAdministratorResourceInner.class); - /* * Properties of the server AAD administrator. */ - @JsonProperty(value = "properties") private ServerAdministratorProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ServerAdministratorResourceInner class. + */ + public ServerAdministratorResourceInner() { + } + /** * Get the innerProperties property: Properties of the server AAD administrator. - * + * * @return the innerProperties value. */ private ServerAdministratorProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the administratorType property: The type of administrator. - * + * * @return the administratorType value. */ public AdministratorType administratorType() { @@ -44,7 +94,7 @@ public AdministratorType administratorType() { /** * Set the administratorType property: The type of administrator. - * + * * @param administratorType the administratorType value to set. * @return the ServerAdministratorResourceInner object itself. */ @@ -58,7 +108,7 @@ public ServerAdministratorResourceInner withAdministratorType(AdministratorType /** * Get the login property: The server administrator login account name. - * + * * @return the login value. */ public String login() { @@ -67,7 +117,7 @@ public String login() { /** * Set the login property: The server administrator login account name. - * + * * @param login the login value to set. * @return the ServerAdministratorResourceInner object itself. */ @@ -81,7 +131,7 @@ public ServerAdministratorResourceInner withLogin(String login) { /** * Get the sid property: The server administrator Sid (Secure ID). - * + * * @return the sid value. */ public UUID sid() { @@ -90,7 +140,7 @@ public UUID sid() { /** * Set the sid property: The server administrator Sid (Secure ID). - * + * * @param sid the sid value to set. * @return the ServerAdministratorResourceInner object itself. */ @@ -104,7 +154,7 @@ public ServerAdministratorResourceInner withSid(UUID sid) { /** * Get the tenantId property: The server Active Directory Administrator tenant id. - * + * * @return the tenantId value. */ public UUID tenantId() { @@ -113,7 +163,7 @@ public UUID tenantId() { /** * Set the tenantId property: The server Active Directory Administrator tenant id. - * + * * @param tenantId the tenantId value to set. * @return the ServerAdministratorResourceInner object itself. */ @@ -127,7 +177,7 @@ public ServerAdministratorResourceInner withTenantId(UUID tenantId) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -135,4 +185,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerAdministratorResourceInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerAdministratorResourceInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ServerAdministratorResourceInner. + */ + public static ServerAdministratorResourceInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerAdministratorResourceInner deserializedServerAdministratorResourceInner + = new ServerAdministratorResourceInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedServerAdministratorResourceInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedServerAdministratorResourceInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedServerAdministratorResourceInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedServerAdministratorResourceInner.innerProperties + = ServerAdministratorProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedServerAdministratorResourceInner; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerInner.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerInner.java index d12495d6b4a00..a3dd05c12acca 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerInner.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerInner.java @@ -6,7 +6,9 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.Resource; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.models.InfrastructureEncryption; import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; import com.azure.resourcemanager.postgresql.models.PublicNetworkAccessEnum; @@ -17,39 +19,55 @@ import com.azure.resourcemanager.postgresql.models.Sku; import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum; import com.azure.resourcemanager.postgresql.models.StorageProfile; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; import java.util.List; import java.util.Map; -/** Represents a server. */ +/** + * Represents a server. + */ @Fluent public final class ServerInner extends Resource { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerInner.class); - /* * The Azure Active Directory identity of the server. */ - @JsonProperty(value = "identity") private ResourceIdentity identity; /* * The SKU (pricing tier) of the server. */ - @JsonProperty(value = "sku") private Sku sku; /* * Properties of the server. */ - @JsonProperty(value = "properties") private ServerProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ServerInner class. + */ + public ServerInner() { + } + /** * Get the identity property: The Azure Active Directory identity of the server. - * + * * @return the identity value. */ public ResourceIdentity identity() { @@ -58,7 +76,7 @@ public ResourceIdentity identity() { /** * Set the identity property: The Azure Active Directory identity of the server. - * + * * @param identity the identity value to set. * @return the ServerInner object itself. */ @@ -69,7 +87,7 @@ public ServerInner withIdentity(ResourceIdentity identity) { /** * Get the sku property: The SKU (pricing tier) of the server. - * + * * @return the sku value. */ public Sku sku() { @@ -78,7 +96,7 @@ public Sku sku() { /** * Set the sku property: The SKU (pricing tier) of the server. - * + * * @param sku the sku value to set. * @return the ServerInner object itself. */ @@ -89,21 +107,55 @@ public ServerInner withSku(Sku sku) { /** * Get the innerProperties property: Properties of the server. - * + * * @return the innerProperties value. */ private ServerProperties innerProperties() { return this.innerProperties; } - /** {@inheritDoc} */ + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + + /** + * {@inheritDoc} + */ @Override public ServerInner withLocation(String location) { super.withLocation(location); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerInner withTags(Map tags) { super.withTags(tags); @@ -113,7 +165,7 @@ public ServerInner withTags(Map tags) { /** * 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() { @@ -123,7 +175,7 @@ public String 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. */ @@ -137,7 +189,7 @@ public ServerInner withAdministratorLogin(String administratorLogin) { /** * Get the version property: Server version. - * + * * @return the version value. */ public ServerVersion version() { @@ -146,7 +198,7 @@ public ServerVersion version() { /** * Set the version property: Server version. - * + * * @param version the version value to set. * @return the ServerInner object itself. */ @@ -160,7 +212,7 @@ public ServerInner withVersion(ServerVersion version) { /** * Get the sslEnforcement property: Enable ssl enforcement or not when connect to server. - * + * * @return the sslEnforcement value. */ public SslEnforcementEnum sslEnforcement() { @@ -169,7 +221,7 @@ public SslEnforcementEnum 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. */ @@ -183,7 +235,7 @@ public ServerInner withSslEnforcement(SslEnforcementEnum sslEnforcement) { /** * Get the minimalTlsVersion property: Enforce a minimal Tls version for the server. - * + * * @return the minimalTlsVersion value. */ public MinimalTlsVersionEnum minimalTlsVersion() { @@ -192,7 +244,7 @@ public MinimalTlsVersionEnum minimalTlsVersion() { /** * Set the minimalTlsVersion property: Enforce a minimal Tls version for the server. - * + * * @param minimalTlsVersion the minimalTlsVersion value to set. * @return the ServerInner object itself. */ @@ -207,7 +259,7 @@ public ServerInner withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion /** * Get the byokEnforcement property: Status showing whether the server data encryption is enabled with * customer-managed keys. - * + * * @return the byokEnforcement value. */ public String byokEnforcement() { @@ -216,7 +268,7 @@ public String byokEnforcement() { /** * Get the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. - * + * * @return the infrastructureEncryption value. */ public InfrastructureEncryption infrastructureEncryption() { @@ -225,7 +277,7 @@ public InfrastructureEncryption infrastructureEncryption() { /** * Set the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. - * + * * @param infrastructureEncryption the infrastructureEncryption value to set. * @return the ServerInner object itself. */ @@ -239,7 +291,7 @@ public ServerInner withInfrastructureEncryption(InfrastructureEncryption infrast /** * Get the userVisibleState property: A state of a server that is visible to user. - * + * * @return the userVisibleState value. */ public ServerState userVisibleState() { @@ -248,7 +300,7 @@ public ServerState 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. */ @@ -262,7 +314,7 @@ public ServerInner withUserVisibleState(ServerState userVisibleState) { /** * Get the fullyQualifiedDomainName property: The fully qualified domain name of a server. - * + * * @return the fullyQualifiedDomainName value. */ public String fullyQualifiedDomainName() { @@ -271,7 +323,7 @@ public String 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. */ @@ -285,7 +337,7 @@ public ServerInner withFullyQualifiedDomainName(String fullyQualifiedDomainName) /** * Get the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). - * + * * @return the earliestRestoreDate value. */ public OffsetDateTime earliestRestoreDate() { @@ -294,7 +346,7 @@ public OffsetDateTime earliestRestoreDate() { /** * Set the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). - * + * * @param earliestRestoreDate the earliestRestoreDate value to set. * @return the ServerInner object itself. */ @@ -308,7 +360,7 @@ public ServerInner withEarliestRestoreDate(OffsetDateTime earliestRestoreDate) { /** * Get the storageProfile property: Storage profile of a server. - * + * * @return the storageProfile value. */ public StorageProfile storageProfile() { @@ -317,7 +369,7 @@ public StorageProfile storageProfile() { /** * Set the storageProfile property: Storage profile of a server. - * + * * @param storageProfile the storageProfile value to set. * @return the ServerInner object itself. */ @@ -331,7 +383,7 @@ public ServerInner withStorageProfile(StorageProfile storageProfile) { /** * Get the replicationRole property: The replication role of the server. - * + * * @return the replicationRole value. */ public String replicationRole() { @@ -340,7 +392,7 @@ public String replicationRole() { /** * Set the replicationRole property: The replication role of the server. - * + * * @param replicationRole the replicationRole value to set. * @return the ServerInner object itself. */ @@ -354,7 +406,7 @@ public ServerInner withReplicationRole(String replicationRole) { /** * Get the masterServerId property: The master server id of a replica server. - * + * * @return the masterServerId value. */ public String masterServerId() { @@ -363,7 +415,7 @@ public String 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. */ @@ -377,7 +429,7 @@ public ServerInner withMasterServerId(String masterServerId) { /** * Get the replicaCapacity property: The maximum number of replicas that a master server can have. - * + * * @return the replicaCapacity value. */ public Integer replicaCapacity() { @@ -386,7 +438,7 @@ public Integer 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. */ @@ -401,7 +453,7 @@ public ServerInner withReplicaCapacity(Integer replicaCapacity) { /** * 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() { @@ -411,7 +463,7 @@ public PublicNetworkAccessEnum 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. */ @@ -425,7 +477,7 @@ public ServerInner withPublicNetworkAccess(PublicNetworkAccessEnum publicNetwork /** * Get the privateEndpointConnections property: List of private endpoint connections on a server. - * + * * @return the privateEndpointConnections value. */ public List privateEndpointConnections() { @@ -434,7 +486,7 @@ public List privateEndpointConnections() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -448,4 +500,60 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("location", location()); + jsonWriter.writeMapField("tags", tags(), (writer, element) -> writer.writeString(element)); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeJsonField("sku", this.sku); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ServerInner. + */ + public static ServerInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerInner deserializedServerInner = new ServerInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedServerInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedServerInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedServerInner.type = reader.getString(); + } else if ("location".equals(fieldName)) { + deserializedServerInner.withLocation(reader.getString()); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedServerInner.withTags(tags); + } else if ("identity".equals(fieldName)) { + deserializedServerInner.identity = ResourceIdentity.fromJson(reader); + } else if ("sku".equals(fieldName)) { + deserializedServerInner.sku = Sku.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedServerInner.innerProperties = ServerProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedServerInner; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerKeyInner.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerKeyInner.java index 1453f303d85ec..5c5ffbdb2b9cf 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerKeyInner.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerKeyInner.java @@ -6,33 +6,52 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.models.ServerKeyType; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; -/** A PostgreSQL Server key. */ +/** + * A PostgreSQL Server key. + */ @Fluent public final class ServerKeyInner extends ProxyResource { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerKeyInner.class); - /* * Kind of encryption protector used to protect the key. */ - @JsonProperty(value = "kind", access = JsonProperty.Access.WRITE_ONLY) private String kind; /* * Properties of the ServerKey Resource. */ - @JsonProperty(value = "properties") private ServerKeyProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ServerKeyInner class. + */ + public ServerKeyInner() { + } + /** * Get the kind property: Kind of encryption protector used to protect the key. - * + * * @return the kind value. */ public String kind() { @@ -41,16 +60,46 @@ public String kind() { /** * Get the innerProperties property: Properties of the ServerKey Resource. - * + * * @return the innerProperties value. */ private ServerKeyProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the serverKeyType property: The key type like 'AzureKeyVault'. - * + * * @return the serverKeyType value. */ public ServerKeyType serverKeyType() { @@ -59,7 +108,7 @@ public ServerKeyType serverKeyType() { /** * Set the serverKeyType property: The key type like 'AzureKeyVault'. - * + * * @param serverKeyType the serverKeyType value to set. * @return the ServerKeyInner object itself. */ @@ -73,7 +122,7 @@ public ServerKeyInner withServerKeyType(ServerKeyType serverKeyType) { /** * Get the uri property: The URI of the key. - * + * * @return the uri value. */ public String uri() { @@ -82,7 +131,7 @@ public String uri() { /** * Set the uri property: The URI of the key. - * + * * @param uri the uri value to set. * @return the ServerKeyInner object itself. */ @@ -96,7 +145,7 @@ public ServerKeyInner withUri(String uri) { /** * Get the creationDate property: The key creation date. - * + * * @return the creationDate value. */ public OffsetDateTime creationDate() { @@ -105,7 +154,7 @@ public OffsetDateTime creationDate() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -113,4 +162,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerKeyInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerKeyInner if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ServerKeyInner. + */ + public static ServerKeyInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerKeyInner deserializedServerKeyInner = new ServerKeyInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedServerKeyInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedServerKeyInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedServerKeyInner.type = reader.getString(); + } else if ("kind".equals(fieldName)) { + deserializedServerKeyInner.kind = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedServerKeyInner.innerProperties = ServerKeyProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedServerKeyInner; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerKeyProperties.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerKeyProperties.java index c770bf87bdcba..bbb015250df1c 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerKeyProperties.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerKeyProperties.java @@ -5,39 +5,45 @@ package com.azure.resourcemanager.postgresql.fluent.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.models.ServerKeyType; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; -/** Properties for a key execution. */ +/** + * Properties for a key execution. + */ @Fluent -public final class ServerKeyProperties { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerKeyProperties.class); - +public final class ServerKeyProperties implements JsonSerializable { /* * The key type like 'AzureKeyVault'. */ - @JsonProperty(value = "serverKeyType", required = true) private ServerKeyType serverKeyType; /* * The URI of the key. */ - @JsonProperty(value = "uri") private String uri; /* * The key creation date. */ - @JsonProperty(value = "creationDate", access = JsonProperty.Access.WRITE_ONLY) private OffsetDateTime creationDate; + /** + * Creates an instance of ServerKeyProperties class. + */ + public ServerKeyProperties() { + } + /** * Get the serverKeyType property: The key type like 'AzureKeyVault'. - * + * * @return the serverKeyType value. */ public ServerKeyType serverKeyType() { @@ -46,7 +52,7 @@ public ServerKeyType serverKeyType() { /** * Set the serverKeyType property: The key type like 'AzureKeyVault'. - * + * * @param serverKeyType the serverKeyType value to set. * @return the ServerKeyProperties object itself. */ @@ -57,7 +63,7 @@ public ServerKeyProperties withServerKeyType(ServerKeyType serverKeyType) { /** * Get the uri property: The URI of the key. - * + * * @return the uri value. */ public String uri() { @@ -66,7 +72,7 @@ public String uri() { /** * Set the uri property: The URI of the key. - * + * * @param uri the uri value to set. * @return the ServerKeyProperties object itself. */ @@ -77,7 +83,7 @@ public ServerKeyProperties withUri(String uri) { /** * Get the creationDate property: The key creation date. - * + * * @return the creationDate value. */ public OffsetDateTime creationDate() { @@ -86,13 +92,59 @@ public OffsetDateTime creationDate() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (serverKeyType() == null) { - throw logger.logExceptionAsError( - new IllegalArgumentException("Missing required property serverKeyType in model ServerKeyProperties")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property serverKeyType in model ServerKeyProperties")); } } + + private static final ClientLogger LOGGER = new ClientLogger(ServerKeyProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("serverKeyType", this.serverKeyType == null ? null : this.serverKeyType.toString()); + jsonWriter.writeStringField("uri", this.uri); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerKeyProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerKeyProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ServerKeyProperties. + */ + public static ServerKeyProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerKeyProperties deserializedServerKeyProperties = new ServerKeyProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("serverKeyType".equals(fieldName)) { + deserializedServerKeyProperties.serverKeyType = ServerKeyType.fromString(reader.getString()); + } else if ("uri".equals(fieldName)) { + deserializedServerKeyProperties.uri = reader.getString(); + } else if ("creationDate".equals(fieldName)) { + deserializedServerKeyProperties.creationDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedServerKeyProperties; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerProperties.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerProperties.java index 4574a2ffaf310..e82c2a5716c25 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerProperties.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerProperties.java @@ -5,7 +5,11 @@ package com.azure.resourcemanager.postgresql.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.CoreUtils; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.models.InfrastructureEncryption; import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; import com.azure.resourcemanager.postgresql.models.PublicNetworkAccessEnum; @@ -14,114 +18,103 @@ import com.azure.resourcemanager.postgresql.models.ServerVersion; import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum; import com.azure.resourcemanager.postgresql.models.StorageProfile; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; import java.util.List; -/** The properties of a server. */ +/** + * The properties of a server. + */ @Fluent -public final class ServerProperties { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerProperties.class); - +public final class ServerProperties implements JsonSerializable { /* - * The administrator's login name of a server. Can only be specified when - * the server is being created (and is required for creation). + * 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") private String administratorLogin; /* * Server version. */ - @JsonProperty(value = "version") private ServerVersion version; /* * Enable ssl enforcement or not when connect to server. */ - @JsonProperty(value = "sslEnforcement") private SslEnforcementEnum sslEnforcement; /* * Enforce a minimal Tls version for the server. */ - @JsonProperty(value = "minimalTlsVersion") private MinimalTlsVersionEnum minimalTlsVersion; /* - * Status showing whether the server data encryption is enabled with - * customer-managed keys. + * Status showing whether the server data encryption is enabled with customer-managed keys. */ - @JsonProperty(value = "byokEnforcement", access = JsonProperty.Access.WRITE_ONLY) private String byokEnforcement; /* * Status showing whether the server enabled infrastructure encryption. */ - @JsonProperty(value = "infrastructureEncryption") private InfrastructureEncryption infrastructureEncryption; /* * A state of a server that is visible to user. */ - @JsonProperty(value = "userVisibleState") private ServerState userVisibleState; /* * The fully qualified domain name of a server. */ - @JsonProperty(value = "fullyQualifiedDomainName") private String fullyQualifiedDomainName; /* * Earliest restore point creation time (ISO8601 format) */ - @JsonProperty(value = "earliestRestoreDate") private OffsetDateTime earliestRestoreDate; /* * Storage profile of a server. */ - @JsonProperty(value = "storageProfile") private StorageProfile storageProfile; /* * The replication role of the server. */ - @JsonProperty(value = "replicationRole") private String replicationRole; /* * The master server id of a replica server. */ - @JsonProperty(value = "masterServerId") private String masterServerId; /* * The maximum number of replicas that a master server can have. */ - @JsonProperty(value = "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' + * 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; /* * List of private endpoint connections on a server */ - @JsonProperty(value = "privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) private List privateEndpointConnections; + /** + * Creates an instance of ServerProperties class. + */ + public ServerProperties() { + } + /** * 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() { @@ -131,7 +124,7 @@ public String 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 ServerProperties object itself. */ @@ -142,7 +135,7 @@ public ServerProperties withAdministratorLogin(String administratorLogin) { /** * Get the version property: Server version. - * + * * @return the version value. */ public ServerVersion version() { @@ -151,7 +144,7 @@ public ServerVersion version() { /** * Set the version property: Server version. - * + * * @param version the version value to set. * @return the ServerProperties object itself. */ @@ -162,7 +155,7 @@ public ServerProperties withVersion(ServerVersion version) { /** * Get the sslEnforcement property: Enable ssl enforcement or not when connect to server. - * + * * @return the sslEnforcement value. */ public SslEnforcementEnum sslEnforcement() { @@ -171,7 +164,7 @@ public SslEnforcementEnum sslEnforcement() { /** * Set the sslEnforcement property: Enable ssl enforcement or not when connect to server. - * + * * @param sslEnforcement the sslEnforcement value to set. * @return the ServerProperties object itself. */ @@ -182,7 +175,7 @@ public ServerProperties withSslEnforcement(SslEnforcementEnum sslEnforcement) { /** * Get the minimalTlsVersion property: Enforce a minimal Tls version for the server. - * + * * @return the minimalTlsVersion value. */ public MinimalTlsVersionEnum minimalTlsVersion() { @@ -191,7 +184,7 @@ public MinimalTlsVersionEnum minimalTlsVersion() { /** * Set the minimalTlsVersion property: Enforce a minimal Tls version for the server. - * + * * @param minimalTlsVersion the minimalTlsVersion value to set. * @return the ServerProperties object itself. */ @@ -203,7 +196,7 @@ public ServerProperties withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVe /** * Get the byokEnforcement property: Status showing whether the server data encryption is enabled with * customer-managed keys. - * + * * @return the byokEnforcement value. */ public String byokEnforcement() { @@ -212,7 +205,7 @@ public String byokEnforcement() { /** * Get the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. - * + * * @return the infrastructureEncryption value. */ public InfrastructureEncryption infrastructureEncryption() { @@ -221,7 +214,7 @@ public InfrastructureEncryption infrastructureEncryption() { /** * Set the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. - * + * * @param infrastructureEncryption the infrastructureEncryption value to set. * @return the ServerProperties object itself. */ @@ -232,7 +225,7 @@ public ServerProperties withInfrastructureEncryption(InfrastructureEncryption in /** * Get the userVisibleState property: A state of a server that is visible to user. - * + * * @return the userVisibleState value. */ public ServerState userVisibleState() { @@ -241,7 +234,7 @@ public ServerState userVisibleState() { /** * Set the userVisibleState property: A state of a server that is visible to user. - * + * * @param userVisibleState the userVisibleState value to set. * @return the ServerProperties object itself. */ @@ -252,7 +245,7 @@ public ServerProperties withUserVisibleState(ServerState userVisibleState) { /** * Get the fullyQualifiedDomainName property: The fully qualified domain name of a server. - * + * * @return the fullyQualifiedDomainName value. */ public String fullyQualifiedDomainName() { @@ -261,7 +254,7 @@ public String fullyQualifiedDomainName() { /** * Set the fullyQualifiedDomainName property: The fully qualified domain name of a server. - * + * * @param fullyQualifiedDomainName the fullyQualifiedDomainName value to set. * @return the ServerProperties object itself. */ @@ -272,7 +265,7 @@ public ServerProperties withFullyQualifiedDomainName(String fullyQualifiedDomain /** * Get the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). - * + * * @return the earliestRestoreDate value. */ public OffsetDateTime earliestRestoreDate() { @@ -281,7 +274,7 @@ public OffsetDateTime earliestRestoreDate() { /** * Set the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). - * + * * @param earliestRestoreDate the earliestRestoreDate value to set. * @return the ServerProperties object itself. */ @@ -292,7 +285,7 @@ public ServerProperties withEarliestRestoreDate(OffsetDateTime earliestRestoreDa /** * Get the storageProfile property: Storage profile of a server. - * + * * @return the storageProfile value. */ public StorageProfile storageProfile() { @@ -301,7 +294,7 @@ public StorageProfile storageProfile() { /** * Set the storageProfile property: Storage profile of a server. - * + * * @param storageProfile the storageProfile value to set. * @return the ServerProperties object itself. */ @@ -312,7 +305,7 @@ public ServerProperties withStorageProfile(StorageProfile storageProfile) { /** * Get the replicationRole property: The replication role of the server. - * + * * @return the replicationRole value. */ public String replicationRole() { @@ -321,7 +314,7 @@ public String replicationRole() { /** * Set the replicationRole property: The replication role of the server. - * + * * @param replicationRole the replicationRole value to set. * @return the ServerProperties object itself. */ @@ -332,7 +325,7 @@ public ServerProperties withReplicationRole(String replicationRole) { /** * Get the masterServerId property: The master server id of a replica server. - * + * * @return the masterServerId value. */ public String masterServerId() { @@ -341,7 +334,7 @@ public String masterServerId() { /** * Set the masterServerId property: The master server id of a replica server. - * + * * @param masterServerId the masterServerId value to set. * @return the ServerProperties object itself. */ @@ -352,7 +345,7 @@ public ServerProperties withMasterServerId(String masterServerId) { /** * Get the replicaCapacity property: The maximum number of replicas that a master server can have. - * + * * @return the replicaCapacity value. */ public Integer replicaCapacity() { @@ -361,7 +354,7 @@ public Integer 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 ServerProperties object itself. */ @@ -373,7 +366,7 @@ public ServerProperties withReplicaCapacity(Integer replicaCapacity) { /** * 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() { @@ -383,7 +376,7 @@ public PublicNetworkAccessEnum 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 ServerProperties object itself. */ @@ -394,7 +387,7 @@ public ServerProperties withPublicNetworkAccess(PublicNetworkAccessEnum publicNe /** * Get the privateEndpointConnections property: List of private endpoint connections on a server. - * + * * @return the privateEndpointConnections value. */ public List privateEndpointConnections() { @@ -403,7 +396,7 @@ public List privateEndpointConnections() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -414,4 +407,94 @@ public void validate() { privateEndpointConnections().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("administratorLogin", this.administratorLogin); + jsonWriter.writeStringField("version", this.version == null ? null : this.version.toString()); + jsonWriter.writeStringField("sslEnforcement", + this.sslEnforcement == null ? null : this.sslEnforcement.toString()); + jsonWriter.writeStringField("minimalTlsVersion", + this.minimalTlsVersion == null ? null : this.minimalTlsVersion.toString()); + jsonWriter.writeStringField("infrastructureEncryption", + this.infrastructureEncryption == null ? null : this.infrastructureEncryption.toString()); + jsonWriter.writeStringField("userVisibleState", + this.userVisibleState == null ? null : this.userVisibleState.toString()); + jsonWriter.writeStringField("fullyQualifiedDomainName", this.fullyQualifiedDomainName); + jsonWriter.writeStringField("earliestRestoreDate", + this.earliestRestoreDate == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.earliestRestoreDate)); + jsonWriter.writeJsonField("storageProfile", this.storageProfile); + jsonWriter.writeStringField("replicationRole", this.replicationRole); + jsonWriter.writeStringField("masterServerId", this.masterServerId); + jsonWriter.writeNumberField("replicaCapacity", this.replicaCapacity); + jsonWriter.writeStringField("publicNetworkAccess", + this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerProperties if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ServerProperties. + */ + public static ServerProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerProperties deserializedServerProperties = new ServerProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("administratorLogin".equals(fieldName)) { + deserializedServerProperties.administratorLogin = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedServerProperties.version = ServerVersion.fromString(reader.getString()); + } else if ("sslEnforcement".equals(fieldName)) { + deserializedServerProperties.sslEnforcement = SslEnforcementEnum.fromString(reader.getString()); + } else if ("minimalTlsVersion".equals(fieldName)) { + deserializedServerProperties.minimalTlsVersion + = MinimalTlsVersionEnum.fromString(reader.getString()); + } else if ("byokEnforcement".equals(fieldName)) { + deserializedServerProperties.byokEnforcement = reader.getString(); + } else if ("infrastructureEncryption".equals(fieldName)) { + deserializedServerProperties.infrastructureEncryption + = InfrastructureEncryption.fromString(reader.getString()); + } else if ("userVisibleState".equals(fieldName)) { + deserializedServerProperties.userVisibleState = ServerState.fromString(reader.getString()); + } else if ("fullyQualifiedDomainName".equals(fieldName)) { + deserializedServerProperties.fullyQualifiedDomainName = reader.getString(); + } else if ("earliestRestoreDate".equals(fieldName)) { + deserializedServerProperties.earliestRestoreDate = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("storageProfile".equals(fieldName)) { + deserializedServerProperties.storageProfile = StorageProfile.fromJson(reader); + } else if ("replicationRole".equals(fieldName)) { + deserializedServerProperties.replicationRole = reader.getString(); + } else if ("masterServerId".equals(fieldName)) { + deserializedServerProperties.masterServerId = reader.getString(); + } else if ("replicaCapacity".equals(fieldName)) { + deserializedServerProperties.replicaCapacity = reader.getNullable(JsonReader::getInt); + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedServerProperties.publicNetworkAccess + = PublicNetworkAccessEnum.fromString(reader.getString()); + } else if ("privateEndpointConnections".equals(fieldName)) { + List privateEndpointConnections + = reader.readArray(reader1 -> ServerPrivateEndpointConnection.fromJson(reader1)); + deserializedServerProperties.privateEndpointConnections = privateEndpointConnections; + } else { + reader.skipChildren(); + } + } + + return deserializedServerProperties; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerSecurityAlertPolicyInner.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerSecurityAlertPolicyInner.java index 1a738d0d61e6c..c123b0a4bb936 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerSecurityAlertPolicyInner.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerSecurityAlertPolicyInner.java @@ -6,36 +6,86 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.models.ServerSecurityAlertPolicyState; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** A server security alert policy. */ +/** + * A server security alert policy. + */ @Fluent public final class ServerSecurityAlertPolicyInner extends ProxyResource { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerSecurityAlertPolicyInner.class); - /* * Resource properties. */ - @JsonProperty(value = "properties") private SecurityAlertPolicyProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of ServerSecurityAlertPolicyInner class. + */ + public ServerSecurityAlertPolicyInner() { + } + /** * Get the innerProperties property: Resource properties. - * + * * @return the innerProperties value. */ private SecurityAlertPolicyProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the state property: Specifies the state of the policy, whether it is enabled or disabled. - * + * * @return the state value. */ public ServerSecurityAlertPolicyState state() { @@ -44,7 +94,7 @@ public ServerSecurityAlertPolicyState 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. */ @@ -59,7 +109,7 @@ public ServerSecurityAlertPolicyInner withState(ServerSecurityAlertPolicyState s /** * 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() { @@ -69,7 +119,7 @@ public List 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. */ @@ -83,7 +133,7 @@ public ServerSecurityAlertPolicyInner withDisabledAlerts(List disabledAl /** * Get the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. - * + * * @return the emailAddresses value. */ public List emailAddresses() { @@ -92,7 +142,7 @@ public List 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. */ @@ -106,7 +156,7 @@ public ServerSecurityAlertPolicyInner withEmailAddresses(List emailAddre /** * Get the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. - * + * * @return the emailAccountAdmins value. */ public Boolean emailAccountAdmins() { @@ -115,7 +165,7 @@ public Boolean 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. */ @@ -130,7 +180,7 @@ public ServerSecurityAlertPolicyInner withEmailAccountAdmins(Boolean emailAccoun /** * 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() { @@ -140,7 +190,7 @@ public String 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. */ @@ -155,7 +205,7 @@ public ServerSecurityAlertPolicyInner withStorageEndpoint(String storageEndpoint /** * Get the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage * account. - * + * * @return the storageAccountAccessKey value. */ public String storageAccountAccessKey() { @@ -165,7 +215,7 @@ public String 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. */ @@ -179,7 +229,7 @@ public ServerSecurityAlertPolicyInner withStorageAccountAccessKey(String storage /** * Get the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. - * + * * @return the retentionDays value. */ public Integer retentionDays() { @@ -188,7 +238,7 @@ public Integer 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. */ @@ -202,7 +252,7 @@ public ServerSecurityAlertPolicyInner withRetentionDays(Integer retentionDays) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -210,4 +260,49 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerSecurityAlertPolicyInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerSecurityAlertPolicyInner if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ServerSecurityAlertPolicyInner. + */ + public static ServerSecurityAlertPolicyInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerSecurityAlertPolicyInner deserializedServerSecurityAlertPolicyInner + = new ServerSecurityAlertPolicyInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedServerSecurityAlertPolicyInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedServerSecurityAlertPolicyInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedServerSecurityAlertPolicyInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedServerSecurityAlertPolicyInner.innerProperties + = SecurityAlertPolicyProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedServerSecurityAlertPolicyInner; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerUpdateParametersProperties.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerUpdateParametersProperties.java index 8dcfd2cd63c60..23b45df9466dc 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerUpdateParametersProperties.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/ServerUpdateParametersProperties.java @@ -5,67 +5,67 @@ package com.azure.resourcemanager.postgresql.fluent.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; import com.azure.resourcemanager.postgresql.models.PublicNetworkAccessEnum; import com.azure.resourcemanager.postgresql.models.ServerVersion; import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum; import com.azure.resourcemanager.postgresql.models.StorageProfile; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; -/** The properties that can be updated for a server. */ +/** + * The properties that can be updated for a server. + */ @Fluent -public final class ServerUpdateParametersProperties { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerUpdateParametersProperties.class); - +public final class ServerUpdateParametersProperties implements JsonSerializable { /* * Storage profile of a server. */ - @JsonProperty(value = "storageProfile") private StorageProfile storageProfile; /* * The password of the administrator login. */ - @JsonProperty(value = "administratorLoginPassword") private String administratorLoginPassword; /* * The version of a server. */ - @JsonProperty(value = "version") private ServerVersion version; /* * Enable ssl enforcement or not when connect to server. */ - @JsonProperty(value = "sslEnforcement") private SslEnforcementEnum sslEnforcement; /* * Enforce a minimal Tls version for the server. */ - @JsonProperty(value = "minimalTlsVersion") private MinimalTlsVersionEnum minimalTlsVersion; /* - * Whether or not public network access is allowed for this server. Value - * is optional but if passed in, must be 'Enabled' or 'Disabled' + * 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; /* * The replication role of the server. */ - @JsonProperty(value = "replicationRole") private String replicationRole; + /** + * Creates an instance of ServerUpdateParametersProperties class. + */ + public ServerUpdateParametersProperties() { + } + /** * Get the storageProfile property: Storage profile of a server. - * + * * @return the storageProfile value. */ public StorageProfile storageProfile() { @@ -74,7 +74,7 @@ public StorageProfile storageProfile() { /** * Set the storageProfile property: Storage profile of a server. - * + * * @param storageProfile the storageProfile value to set. * @return the ServerUpdateParametersProperties object itself. */ @@ -85,7 +85,7 @@ public ServerUpdateParametersProperties withStorageProfile(StorageProfile storag /** * Get the administratorLoginPassword property: The password of the administrator login. - * + * * @return the administratorLoginPassword value. */ public String administratorLoginPassword() { @@ -94,7 +94,7 @@ public String administratorLoginPassword() { /** * Set the administratorLoginPassword property: The password of the administrator login. - * + * * @param administratorLoginPassword the administratorLoginPassword value to set. * @return the ServerUpdateParametersProperties object itself. */ @@ -105,7 +105,7 @@ public ServerUpdateParametersProperties withAdministratorLoginPassword(String ad /** * Get the version property: The version of a server. - * + * * @return the version value. */ public ServerVersion version() { @@ -114,7 +114,7 @@ public ServerVersion version() { /** * Set the version property: The version of a server. - * + * * @param version the version value to set. * @return the ServerUpdateParametersProperties object itself. */ @@ -125,7 +125,7 @@ public ServerUpdateParametersProperties withVersion(ServerVersion version) { /** * Get the sslEnforcement property: Enable ssl enforcement or not when connect to server. - * + * * @return the sslEnforcement value. */ public SslEnforcementEnum sslEnforcement() { @@ -134,7 +134,7 @@ public SslEnforcementEnum sslEnforcement() { /** * Set the sslEnforcement property: Enable ssl enforcement or not when connect to server. - * + * * @param sslEnforcement the sslEnforcement value to set. * @return the ServerUpdateParametersProperties object itself. */ @@ -145,7 +145,7 @@ public ServerUpdateParametersProperties withSslEnforcement(SslEnforcementEnum ss /** * Get the minimalTlsVersion property: Enforce a minimal Tls version for the server. - * + * * @return the minimalTlsVersion value. */ public MinimalTlsVersionEnum minimalTlsVersion() { @@ -154,7 +154,7 @@ public MinimalTlsVersionEnum minimalTlsVersion() { /** * Set the minimalTlsVersion property: Enforce a minimal Tls version for the server. - * + * * @param minimalTlsVersion the minimalTlsVersion value to set. * @return the ServerUpdateParametersProperties object itself. */ @@ -166,7 +166,7 @@ public ServerUpdateParametersProperties withMinimalTlsVersion(MinimalTlsVersionE /** * 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() { @@ -176,7 +176,7 @@ public PublicNetworkAccessEnum 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 ServerUpdateParametersProperties object itself. */ @@ -187,7 +187,7 @@ public ServerUpdateParametersProperties withPublicNetworkAccess(PublicNetworkAcc /** * Get the replicationRole property: The replication role of the server. - * + * * @return the replicationRole value. */ public String replicationRole() { @@ -196,7 +196,7 @@ public String replicationRole() { /** * Set the replicationRole property: The replication role of the server. - * + * * @param replicationRole the replicationRole value to set. * @return the ServerUpdateParametersProperties object itself. */ @@ -207,7 +207,7 @@ public ServerUpdateParametersProperties withReplicationRole(String replicationRo /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -215,4 +215,65 @@ public void validate() { storageProfile().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("storageProfile", this.storageProfile); + jsonWriter.writeStringField("administratorLoginPassword", this.administratorLoginPassword); + jsonWriter.writeStringField("version", this.version == null ? null : this.version.toString()); + jsonWriter.writeStringField("sslEnforcement", + this.sslEnforcement == null ? null : this.sslEnforcement.toString()); + jsonWriter.writeStringField("minimalTlsVersion", + this.minimalTlsVersion == null ? null : this.minimalTlsVersion.toString()); + jsonWriter.writeStringField("publicNetworkAccess", + this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); + jsonWriter.writeStringField("replicationRole", this.replicationRole); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerUpdateParametersProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerUpdateParametersProperties if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServerUpdateParametersProperties. + */ + public static ServerUpdateParametersProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerUpdateParametersProperties deserializedServerUpdateParametersProperties + = new ServerUpdateParametersProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("storageProfile".equals(fieldName)) { + deserializedServerUpdateParametersProperties.storageProfile = StorageProfile.fromJson(reader); + } else if ("administratorLoginPassword".equals(fieldName)) { + deserializedServerUpdateParametersProperties.administratorLoginPassword = reader.getString(); + } else if ("version".equals(fieldName)) { + deserializedServerUpdateParametersProperties.version = ServerVersion.fromString(reader.getString()); + } else if ("sslEnforcement".equals(fieldName)) { + deserializedServerUpdateParametersProperties.sslEnforcement + = SslEnforcementEnum.fromString(reader.getString()); + } else if ("minimalTlsVersion".equals(fieldName)) { + deserializedServerUpdateParametersProperties.minimalTlsVersion + = MinimalTlsVersionEnum.fromString(reader.getString()); + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedServerUpdateParametersProperties.publicNetworkAccess + = PublicNetworkAccessEnum.fromString(reader.getString()); + } else if ("replicationRole".equals(fieldName)) { + deserializedServerUpdateParametersProperties.replicationRole = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedServerUpdateParametersProperties; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/VirtualNetworkRuleInner.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/VirtualNetworkRuleInner.java index 03b50bcc49292..e449c4cec52e4 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/VirtualNetworkRuleInner.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/VirtualNetworkRuleInner.java @@ -6,35 +6,85 @@ import com.azure.core.annotation.Fluent; import com.azure.core.management.ProxyResource; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.models.VirtualNetworkRuleState; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; -/** A virtual network rule. */ +/** + * A virtual network rule. + */ @Fluent public final class VirtualNetworkRuleInner extends ProxyResource { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(VirtualNetworkRuleInner.class); - /* * Resource properties. */ - @JsonProperty(value = "properties") private VirtualNetworkRuleProperties innerProperties; + /* + * The type of the resource. + */ + private String type; + + /* + * The name of the resource. + */ + private String name; + + /* + * Fully qualified resource Id for the resource. + */ + private String id; + + /** + * Creates an instance of VirtualNetworkRuleInner class. + */ + public VirtualNetworkRuleInner() { + } + /** * Get the innerProperties property: Resource properties. - * + * * @return the innerProperties value. */ private VirtualNetworkRuleProperties innerProperties() { return this.innerProperties; } + /** + * Get the type property: The type of the resource. + * + * @return the type value. + */ + @Override + public String type() { + return this.type; + } + + /** + * Get the name property: The name of the resource. + * + * @return the name value. + */ + @Override + public String name() { + return this.name; + } + + /** + * Get the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + @Override + public String id() { + return this.id; + } + /** * Get the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. - * + * * @return the virtualNetworkSubnetId value. */ public String virtualNetworkSubnetId() { @@ -43,7 +93,7 @@ public String 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. */ @@ -58,7 +108,7 @@ public VirtualNetworkRuleInner withVirtualNetworkSubnetId(String virtualNetworkS /** * Get the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet * service endpoint enabled. - * + * * @return the ignoreMissingVnetServiceEndpoint value. */ public Boolean ignoreMissingVnetServiceEndpoint() { @@ -68,7 +118,7 @@ public Boolean 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. */ @@ -82,7 +132,7 @@ public VirtualNetworkRuleInner withIgnoreMissingVnetServiceEndpoint(Boolean igno /** * Get the state property: Virtual Network Rule State. - * + * * @return the state value. */ public VirtualNetworkRuleState state() { @@ -91,7 +141,7 @@ public VirtualNetworkRuleState state() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -99,4 +149,47 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.innerProperties); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualNetworkRuleInner from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualNetworkRuleInner if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VirtualNetworkRuleInner. + */ + public static VirtualNetworkRuleInner fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualNetworkRuleInner deserializedVirtualNetworkRuleInner = new VirtualNetworkRuleInner(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedVirtualNetworkRuleInner.id = reader.getString(); + } else if ("name".equals(fieldName)) { + deserializedVirtualNetworkRuleInner.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedVirtualNetworkRuleInner.type = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedVirtualNetworkRuleInner.innerProperties = VirtualNetworkRuleProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualNetworkRuleInner; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/VirtualNetworkRuleProperties.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/VirtualNetworkRuleProperties.java index e635ef7c3be52..55b3fa21916b9 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/VirtualNetworkRuleProperties.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/VirtualNetworkRuleProperties.java @@ -6,38 +6,42 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.models.VirtualNetworkRuleState; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; -/** Properties of a virtual network rule. */ +/** + * Properties of a virtual network rule. + */ @Fluent -public final class VirtualNetworkRuleProperties { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(VirtualNetworkRuleProperties.class); - +public final class VirtualNetworkRuleProperties implements JsonSerializable { /* * The ARM resource id of the virtual network subnet. */ - @JsonProperty(value = "virtualNetworkSubnetId", required = true) private String virtualNetworkSubnetId; /* - * Create firewall rule before the virtual network has vnet service - * endpoint enabled. + * Create firewall rule before the virtual network has vnet service endpoint enabled. */ - @JsonProperty(value = "ignoreMissingVnetServiceEndpoint") private Boolean ignoreMissingVnetServiceEndpoint; /* * Virtual Network Rule State */ - @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) private VirtualNetworkRuleState state; + /** + * Creates an instance of VirtualNetworkRuleProperties class. + */ + public VirtualNetworkRuleProperties() { + } + /** * Get the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. - * + * * @return the virtualNetworkSubnetId value. */ public String virtualNetworkSubnetId() { @@ -46,7 +50,7 @@ public String virtualNetworkSubnetId() { /** * Set the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. - * + * * @param virtualNetworkSubnetId the virtualNetworkSubnetId value to set. * @return the VirtualNetworkRuleProperties object itself. */ @@ -58,7 +62,7 @@ public VirtualNetworkRuleProperties withVirtualNetworkSubnetId(String virtualNet /** * Get the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet * service endpoint enabled. - * + * * @return the ignoreMissingVnetServiceEndpoint value. */ public Boolean ignoreMissingVnetServiceEndpoint() { @@ -68,7 +72,7 @@ public Boolean 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 VirtualNetworkRuleProperties object itself. */ @@ -79,7 +83,7 @@ public VirtualNetworkRuleProperties withIgnoreMissingVnetServiceEndpoint(Boolean /** * Get the state property: Virtual Network Rule State. - * + * * @return the state value. */ public VirtualNetworkRuleState state() { @@ -88,13 +92,60 @@ public VirtualNetworkRuleState state() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { if (virtualNetworkSubnetId() == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( - "Missing required property virtualNetworkSubnetId in model VirtualNetworkRuleProperties")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property virtualNetworkSubnetId in model VirtualNetworkRuleProperties")); } } + + private static final ClientLogger LOGGER = new ClientLogger(VirtualNetworkRuleProperties.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("virtualNetworkSubnetId", this.virtualNetworkSubnetId); + jsonWriter.writeBooleanField("ignoreMissingVnetServiceEndpoint", this.ignoreMissingVnetServiceEndpoint); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualNetworkRuleProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualNetworkRuleProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the VirtualNetworkRuleProperties. + */ + public static VirtualNetworkRuleProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualNetworkRuleProperties deserializedVirtualNetworkRuleProperties = new VirtualNetworkRuleProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("virtualNetworkSubnetId".equals(fieldName)) { + deserializedVirtualNetworkRuleProperties.virtualNetworkSubnetId = reader.getString(); + } else if ("ignoreMissingVnetServiceEndpoint".equals(fieldName)) { + deserializedVirtualNetworkRuleProperties.ignoreMissingVnetServiceEndpoint + = reader.getNullable(JsonReader::getBoolean); + } else if ("state".equals(fieldName)) { + deserializedVirtualNetworkRuleProperties.state + = VirtualNetworkRuleState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualNetworkRuleProperties; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/package-info.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/package-info.java index 85cfa30947c78..0c2e49a329db1 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/package-info.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/models/package-info.java @@ -3,8 +3,9 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * Package containing the inner data models for PostgreSqlManagementClient. The Microsoft Azure management API provides - * create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall - * rules, VNET rules, security alert policies, log files and configurations with new business model. + * Package containing the inner data models for PostgreSqlManagementClient. + * The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL + * resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and + * configurations with new business model. */ package com.azure.resourcemanager.postgresql.fluent.models; diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/package-info.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/package-info.java index aff9cf0e5bea9..737da7da7552b 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/package-info.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/package-info.java @@ -3,8 +3,9 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * Package containing the service clients for PostgreSqlManagementClient. The Microsoft Azure management API provides - * create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall - * rules, VNET rules, security alert policies, log files and configurations with new business model. + * Package containing the service clients for PostgreSqlManagementClient. + * The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL + * resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and + * configurations with new business model. */ package com.azure.resourcemanager.postgresql.fluent; diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/CheckNameAvailabilitiesClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/CheckNameAvailabilitiesClientImpl.java index e908fc41567ff..091bda9588d98 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/CheckNameAvailabilitiesClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/CheckNameAvailabilitiesClientImpl.java @@ -22,25 +22,28 @@ 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.postgresql.fluent.CheckNameAvailabilitiesClient; import com.azure.resourcemanager.postgresql.fluent.models.NameAvailabilityInner; import com.azure.resourcemanager.postgresql.models.NameAvailabilityRequest; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in CheckNameAvailabilitiesClient. */ +/** + * 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. */ + /** + * The proxy service used to perform REST calls. + */ private final CheckNameAvailabilitiesService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final PostgreSqlManagementClientImpl client; /** * Initializes an instance of CheckNameAvailabilitiesClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ CheckNameAvailabilitiesClientImpl(PostgreSqlManagementClientImpl client) { @@ -55,7 +58,7 @@ public final class CheckNameAvailabilitiesClientImpl implements CheckNameAvailab */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface CheckNameAvailabilitiesService { + public interface CheckNameAvailabilitiesService { @Headers({ "Content-Type: application/json" }) @Post("/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability") @ExpectedResponses({ 200 }) @@ -68,16 +71,16 @@ Mono> execute(@HostParam("$host") String endpoin /** * 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 along with {@link Response} on successful completion of {@link - * Mono}. + * @return represents a resource name availability along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> + public Mono> executeWithResponseAsync(NameAvailabilityRequest nameAvailabilityRequest) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -103,14 +106,14 @@ Mono> execute(@HostParam("$host") String endpoin /** * 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 along with {@link Response} on successful completion of {@link - * Mono}. + * @return represents a resource name availability along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> @@ -138,7 +141,7 @@ Mono> execute(@HostParam("$host") String endpoin /** * 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. @@ -146,43 +149,37 @@ Mono> execute(@HostParam("$host") String endpoin * @return represents a resource name availability on successful completion of {@link Mono}. */ @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(); - } - }); + public Mono executeAsync(NameAvailabilityRequest nameAvailabilityRequest) { + return executeWithResponseAsync(nameAvailabilityRequest).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * 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. + * @return represents a resource name availability along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public NameAvailabilityInner execute(NameAvailabilityRequest nameAvailabilityRequest) { - return executeAsync(nameAvailabilityRequest).block(); + public Response executeWithResponse(NameAvailabilityRequest nameAvailabilityRequest, + Context context) { + return executeWithResponseAsync(nameAvailabilityRequest, context).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 along with {@link Response}. + * @return represents a resource name availability. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response executeWithResponse(NameAvailabilityRequest nameAvailabilityRequest, - Context context) { - return executeWithResponseAsync(nameAvailabilityRequest, context).block(); + public NameAvailabilityInner execute(NameAvailabilityRequest nameAvailabilityRequest) { + return executeWithResponse(nameAvailabilityRequest, Context.NONE).getValue(); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/CheckNameAvailabilitiesImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/CheckNameAvailabilitiesImpl.java index 0f064b415f607..905b6d709e0a0 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/CheckNameAvailabilitiesImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/CheckNameAvailabilitiesImpl.java @@ -13,11 +13,9 @@ import com.azure.resourcemanager.postgresql.models.CheckNameAvailabilities; import com.azure.resourcemanager.postgresql.models.NameAvailability; import com.azure.resourcemanager.postgresql.models.NameAvailabilityRequest; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class CheckNameAvailabilitiesImpl implements CheckNameAvailabilities { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(CheckNameAvailabilitiesImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(CheckNameAvailabilitiesImpl.class); private final CheckNameAvailabilitiesClient innerClient; @@ -29,15 +27,6 @@ public CheckNameAvailabilitiesImpl(CheckNameAvailabilitiesClient 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 @@ -50,6 +39,15 @@ public Response executeWithResponse(NameAvailabilityRequest na } } + public NameAvailability execute(NameAvailabilityRequest nameAvailabilityRequest) { + NameAvailabilityInner inner = this.serviceClient().execute(nameAvailabilityRequest); + if (inner != null) { + return new NameAvailabilityImpl(inner, this.manager()); + } else { + return null; + } + } + private CheckNameAvailabilitiesClient serviceClient() { return this.innerClient; } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationImpl.java index 02d1e778805f7..6c15205d4165c 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationImpl.java @@ -49,6 +49,10 @@ public String source() { return this.innerModel().source(); } + public String resourceGroupName() { + return resourceGroupName; + } + public ConfigurationInner innerModel() { return this.innerObject; } @@ -111,9 +115,9 @@ public Configuration apply(Context context) { com.azure.resourcemanager.postgresql.PostgreSqlManager 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"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "servers"); + this.configurationName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "configurations"); } public Configuration refresh() { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationsClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationsClientImpl.java index aed2231657cf1..7636a46350a46 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationsClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationsClientImpl.java @@ -28,7 +28,6 @@ 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.postgresql.fluent.ConfigurationsClient; @@ -38,19 +37,23 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in ConfigurationsClient. */ +/** + * 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. */ + /** + * The proxy service used to perform REST calls. + */ private final ConfigurationsService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final PostgreSqlManagementClientImpl client; /** * Initializes an instance of ConfigurationsClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ ConfigurationsClientImpl(PostgreSqlManagementClientImpl client) { @@ -65,10 +68,9 @@ public final class ConfigurationsClientImpl implements ConfigurationsClient { */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface ConfigurationsService { + public interface ConfigurationsService { @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/configurations/{configurationName}") + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}") @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> createOrUpdate(@HostParam("$host") String endpoint, @@ -79,8 +81,7 @@ Mono>> createOrUpdate(@HostParam("$host") String endpo Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/configurations/{configurationName}") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations/{configurationName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get(@HostParam("$host") String endpoint, @@ -90,8 +91,7 @@ Mono> get(@HostParam("$host") String endpoint, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/configurations") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/configurations") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByServer(@HostParam("$host") String endpoint, @@ -102,7 +102,7 @@ Mono> listByServer(@HostParam("$host") St /** * 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. @@ -113,8 +113,8 @@ Mono> listByServer(@HostParam("$host") St * @return represents a Configuration along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String serverName, String configurationName, ConfigurationInner parameters) { + public 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.")); @@ -150,7 +150,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * 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. @@ -197,7 +197,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * 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. @@ -205,10 +205,10 @@ private Mono>> createOrUpdateWithResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of represents a Configuration. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ConfigurationInner> beginCreateOrUpdateAsync( + public PollerFlux, ConfigurationInner> beginCreateOrUpdateAsync( String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, serverName, configurationName, parameters); @@ -218,7 +218,7 @@ private PollerFlux, ConfigurationInner> beginCrea /** * 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. @@ -227,7 +227,7 @@ private PollerFlux, ConfigurationInner> beginCrea * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of represents a Configuration. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ConfigurationInner> beginCreateOrUpdateAsync( @@ -242,7 +242,7 @@ private PollerFlux, ConfigurationInner> beginCrea /** * 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. @@ -250,17 +250,18 @@ private PollerFlux, ConfigurationInner> beginCrea * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of represents a Configuration. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ConfigurationInner> beginCreateOrUpdate(String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { - return beginCreateOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters).getSyncPoller(); + return this.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. @@ -269,18 +270,18 @@ public SyncPoller, ConfigurationInner> beginCreat * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of represents a Configuration. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ConfigurationInner> beginCreateOrUpdate(String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters, Context context) { - return beginCreateOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters, context) + return this.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. @@ -291,7 +292,7 @@ public SyncPoller, ConfigurationInner> beginCreat * @return represents a Configuration on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String serverName, + public Mono createOrUpdateAsync(String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { return beginCreateOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters).last() .flatMap(this.client::getLroFinalResultOrError); @@ -299,7 +300,7 @@ private Mono createOrUpdateAsync(String resourceGroupName, S /** * 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. @@ -319,7 +320,7 @@ private Mono createOrUpdateAsync(String resourceGroupName, S /** * 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. @@ -337,7 +338,7 @@ public ConfigurationInner createOrUpdate(String resourceGroupName, String server /** * 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. @@ -356,7 +357,7 @@ public ConfigurationInner createOrUpdate(String resourceGroupName, String server /** * 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. @@ -364,10 +365,10 @@ public ConfigurationInner createOrUpdate(String resourceGroupName, String server * @throws 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 along with {@link Response} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, String serverName, + public Mono> getWithResponseAsync(String resourceGroupName, String serverName, String configurationName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -398,7 +399,7 @@ private Mono> getWithResponseAsync(String resourceG /** * 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. @@ -407,7 +408,7 @@ private Mono> getWithResponseAsync(String resourceG * @throws 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 along with {@link Response} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync(String resourceGroupName, String serverName, @@ -440,7 +441,7 @@ private Mono> getWithResponseAsync(String resourceG /** * 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. @@ -450,61 +451,55 @@ private Mono> getWithResponseAsync(String resourceG * @return information about a configuration of server on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String serverName, String configurationName) { + public 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(); - } - }); + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * 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. + * @return information about a configuration of server along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ConfigurationInner get(String resourceGroupName, String serverName, String configurationName) { - return getAsync(resourceGroupName, serverName, configurationName).block(); + public Response getWithResponse(String resourceGroupName, String serverName, + String configurationName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, configurationName, 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. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 along with {@link Response}. + * @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(); + public ConfigurationInner get(String resourceGroupName, String serverName, String configurationName) { + return getWithResponse(resourceGroupName, serverName, configurationName, Context.NONE).getValue(); } /** * 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 along with {@link PagedResponse} on successful completion of {@link - * Mono}. + * @return a list of server configurations along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerSinglePageAsync(String resourceGroupName, @@ -536,15 +531,15 @@ private Mono> listByServerSinglePageAsync(Stri /** * 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 along with {@link PagedResponse} on successful completion of {@link - * Mono}. + * @return a list of server configurations along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerSinglePageAsync(String resourceGroupName, @@ -576,29 +571,29 @@ private Mono> listByServerSinglePageAsync(Stri /** * 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. + * @return a list of server configurations as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + public 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. + * @return a list of server configurations as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync(String resourceGroupName, String serverName, @@ -608,13 +603,13 @@ private PagedFlux listByServerAsync(String resourceGroupName /** * 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. + * @return a list of server configurations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName) { @@ -623,14 +618,14 @@ public PagedIterable listByServer(String resourceGroupName, /** * 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. + * @return a list of server configurations as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName, diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationsImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationsImpl.java index ade3313d87213..549762cf8c21c 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationsImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationsImpl.java @@ -13,11 +13,9 @@ import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationInner; import com.azure.resourcemanager.postgresql.models.Configuration; import com.azure.resourcemanager.postgresql.models.Configurations; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class ConfigurationsImpl implements Configurations { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ConfigurationsImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(ConfigurationsImpl.class); private final ConfigurationsClient innerClient; @@ -29,15 +27,6 @@ public ConfigurationsImpl(ConfigurationsClient 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 @@ -50,50 +39,59 @@ public Response getWithResponse(String resourceGroupName, String } } + 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 PagedIterable listByServer(String resourceGroupName, String serverName) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); - return Utils.mapPage(inner, inner1 -> new ConfigurationImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ConfigurationImpl(inner1, this.manager())); } public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); - return Utils.mapPage(inner, inner1 -> new ConfigurationImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ConfigurationImpl(inner1, this.manager())); } public Configuration getById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String configurationName = ResourceManagerUtils.getValueFromIdByName(id, "configurations"); if (configurationName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String configurationName = ResourceManagerUtils.getValueFromIdByName(id, "configurations"); if (configurationName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabaseImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabaseImpl.java index dea8e83d6f214..af2339c507467 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabaseImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabaseImpl.java @@ -33,6 +33,10 @@ public String collation() { return this.innerModel().collation(); } + public String resourceGroupName() { + return resourceGroupName; + } + public DatabaseInner innerModel() { return this.innerObject; } @@ -94,9 +98,9 @@ public Database apply(Context context) { DatabaseImpl(DatabaseInner innerObject, com.azure.resourcemanager.postgresql.PostgreSqlManager 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"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "servers"); + this.databaseName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "databases"); } public Database refresh() { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabasesClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabasesClientImpl.java index 01b7dfc154ea0..e8da4192e8c29 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabasesClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabasesClientImpl.java @@ -29,7 +29,6 @@ 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.postgresql.fluent.DatabasesClient; @@ -39,19 +38,23 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in DatabasesClient. */ +/** + * 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. */ + /** + * The proxy service used to perform REST calls. + */ private final DatabasesService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final PostgreSqlManagementClientImpl client; /** * Initializes an instance of DatabasesClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ DatabasesClientImpl(PostgreSqlManagementClientImpl client) { @@ -66,10 +69,9 @@ public final class DatabasesClientImpl implements DatabasesClient { */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface DatabasesService { + public interface DatabasesService { @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/databases/{databaseName}") + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}") @ExpectedResponses({ 200, 201, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> createOrUpdate(@HostParam("$host") String endpoint, @@ -79,8 +81,7 @@ Mono>> createOrUpdate(@HostParam("$host") String endpo @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/databases/{databaseName}") + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}") @ExpectedResponses({ 200, 202, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete(@HostParam("$host") String endpoint, @@ -89,8 +90,7 @@ Mono>> delete(@HostParam("$host") String endpoint, @PathParam("databaseName") String databaseName, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/databases/{databaseName}") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases/{databaseName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get(@HostParam("$host") String endpoint, @@ -99,8 +99,7 @@ Mono> get(@HostParam("$host") String endpoint, @PathParam("databaseName") String databaseName, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/databases") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/databases") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByServer(@HostParam("$host") String endpoint, @@ -111,7 +110,7 @@ Mono> listByServer(@HostParam("$host") String endpo /** * 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. @@ -122,8 +121,8 @@ Mono> listByServer(@HostParam("$host") String endpo * @return represents a Database along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String serverName, String databaseName, DatabaseInner parameters) { + public 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.")); @@ -156,7 +155,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * 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. @@ -202,7 +201,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * 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. @@ -210,10 +209,10 @@ private Mono>> createOrUpdateWithResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of represents a Database. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, DatabaseInner> beginCreateOrUpdateAsync(String resourceGroupName, + public PollerFlux, DatabaseInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters); @@ -223,7 +222,7 @@ private PollerFlux, DatabaseInner> beginCreateOrUpdate /** * 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. @@ -232,7 +231,7 @@ private PollerFlux, DatabaseInner> beginCreateOrUpdate * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of represents a Database. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, DatabaseInner> beginCreateOrUpdateAsync(String resourceGroupName, @@ -246,7 +245,7 @@ private PollerFlux, DatabaseInner> beginCreateOrUpdate /** * 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. @@ -254,17 +253,17 @@ private PollerFlux, DatabaseInner> beginCreateOrUpdate * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of represents a Database. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, DatabaseInner> beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { - return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller(); + return this.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. @@ -273,18 +272,18 @@ public SyncPoller, DatabaseInner> beginCreateOrUpdate( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of represents a Database. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, DatabaseInner> beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { - return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context) + return this.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. @@ -295,7 +294,7 @@ public SyncPoller, DatabaseInner> beginCreateOrUpdate( * @return represents a Database on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, + public Mono createOrUpdateAsync(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).last() .flatMap(this.client::getLroFinalResultOrError); @@ -303,7 +302,7 @@ private Mono createOrUpdateAsync(String resourceGroupName, String /** * 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. @@ -323,7 +322,7 @@ private Mono createOrUpdateAsync(String resourceGroupName, String /** * 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. @@ -341,7 +340,7 @@ public DatabaseInner createOrUpdate(String resourceGroupName, String serverName, /** * 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. @@ -360,7 +359,7 @@ public DatabaseInner createOrUpdate(String resourceGroupName, String serverName, /** * 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. @@ -370,7 +369,7 @@ public DatabaseInner createOrUpdate(String resourceGroupName, String serverName, * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, String serverName, + public Mono>> deleteWithResponseAsync(String resourceGroupName, String serverName, String databaseName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -400,7 +399,7 @@ private Mono>> deleteWithResponseAsync(String resource /** * 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. @@ -440,17 +439,17 @@ private Mono>> deleteWithResponseAsync(String resource /** * 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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName, + public 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, @@ -459,7 +458,7 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup /** * 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. @@ -467,7 +466,7 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName, @@ -481,24 +480,24 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup /** * 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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String databaseName) { - return beginDeleteAsync(resourceGroupName, serverName, databaseName).getSyncPoller(); + return this.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. @@ -506,17 +505,17 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String databaseName, Context context) { - return beginDeleteAsync(resourceGroupName, serverName, databaseName, context).getSyncPoller(); + return this.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. @@ -526,14 +525,14 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String serverName, String databaseName) { + public 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. @@ -551,7 +550,7 @@ private Mono deleteAsync(String resourceGroupName, String serverName, Stri /** * 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. @@ -566,7 +565,7 @@ public void delete(String resourceGroupName, String serverName, String databaseN /** * 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. @@ -582,7 +581,7 @@ public void delete(String resourceGroupName, String serverName, String databaseN /** * 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. @@ -592,7 +591,7 @@ public void delete(String resourceGroupName, String serverName, String databaseN * @return information about a database along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, String serverName, + public Mono> getWithResponseAsync(String resourceGroupName, String serverName, String databaseName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -622,7 +621,7 @@ private Mono> getWithResponseAsync(String resourceGroupN /** * 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. @@ -662,7 +661,7 @@ private Mono> getWithResponseAsync(String resourceGroupN /** * 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. @@ -672,54 +671,48 @@ private Mono> getWithResponseAsync(String resourceGroupN * @return information about a database on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String serverName, String databaseName) { + public 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(); - } - }); + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * 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. + * @return information about a database along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public DatabaseInner get(String resourceGroupName, String serverName, String databaseName) { - return getAsync(resourceGroupName, serverName, databaseName).block(); + public Response getWithResponse(String resourceGroupName, String serverName, String databaseName, + Context context) { + return getWithResponseAsync(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. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 along with {@link Response}. + * @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(); + public DatabaseInner get(String resourceGroupName, String serverName, String databaseName) { + return getWithResponse(resourceGroupName, serverName, databaseName, Context.NONE).getValue(); } /** * 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. @@ -757,7 +750,7 @@ private Mono> listByServerSinglePageAsync(String re /** * 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. @@ -796,29 +789,29 @@ private Mono> listByServerSinglePageAsync(String re /** * 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. + * @return a List of databases as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + public 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. + * @return a List of databases as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { @@ -827,13 +820,13 @@ private PagedFlux listByServerAsync(String resourceGroupName, Str /** * 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. + * @return a List of databases as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName) { @@ -842,14 +835,14 @@ public PagedIterable listByServer(String resourceGroupName, Strin /** * 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. + * @return a List of databases as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabasesImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabasesImpl.java index e13c59be64312..86fa5544f981e 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabasesImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabasesImpl.java @@ -13,11 +13,9 @@ import com.azure.resourcemanager.postgresql.fluent.models.DatabaseInner; import com.azure.resourcemanager.postgresql.models.Database; import com.azure.resourcemanager.postgresql.models.Databases; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class DatabasesImpl implements Databases { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(DatabasesImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(DatabasesImpl.class); private final DatabasesClient innerClient; @@ -37,15 +35,6 @@ public void delete(String resourceGroupName, String serverName, String databaseN 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 @@ -58,87 +47,96 @@ public Response getWithResponse(String resourceGroupName, String serve } } + 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 PagedIterable listByServer(String resourceGroupName, String serverName) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); - return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager())); } public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); - return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager())); } public Database getById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String databaseName = ResourceManagerUtils.getValueFromIdByName(id, "databases"); if (databaseName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String databaseName = ResourceManagerUtils.getValueFromIdByName(id, "databases"); if (databaseName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String databaseName = ResourceManagerUtils.getValueFromIdByName(id, "databases"); if (databaseName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String databaseName = ResourceManagerUtils.getValueFromIdByName(id, "databases"); if (databaseName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRuleImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRuleImpl.java index 602f061a8f245..37e79770ebced 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRuleImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRuleImpl.java @@ -33,6 +33,10 @@ public String endIpAddress() { return this.innerModel().endIpAddress(); } + public String resourceGroupName() { + return resourceGroupName; + } + public FirewallRuleInner innerModel() { return this.innerObject; } @@ -95,9 +99,9 @@ public FirewallRule apply(Context context) { com.azure.resourcemanager.postgresql.PostgreSqlManager 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"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "servers"); + this.firewallRuleName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "firewallRules"); } public FirewallRule refresh() { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRulesClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRulesClientImpl.java index ca962ee3f2997..046cab4d2e623 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRulesClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRulesClientImpl.java @@ -29,7 +29,6 @@ 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.postgresql.fluent.FirewallRulesClient; @@ -39,19 +38,23 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in FirewallRulesClient. */ +/** + * 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. */ + /** + * The proxy service used to perform REST calls. + */ private final FirewallRulesService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final PostgreSqlManagementClientImpl client; /** * Initializes an instance of FirewallRulesClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ FirewallRulesClientImpl(PostgreSqlManagementClientImpl client) { @@ -66,10 +69,9 @@ public final class FirewallRulesClientImpl implements FirewallRulesClient { */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface FirewallRulesService { + public interface FirewallRulesService { @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/firewallRules/{firewallRuleName}") + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}") @ExpectedResponses({ 200, 201, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> createOrUpdate(@HostParam("$host") String endpoint, @@ -80,8 +82,7 @@ Mono>> createOrUpdate(@HostParam("$host") String endpo Context context); @Headers({ "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/firewallRules/{firewallRuleName}") + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}") @ExpectedResponses({ 200, 202, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete(@HostParam("$host") String endpoint, @@ -91,8 +92,7 @@ Mono>> delete(@HostParam("$host") String endpoint, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/firewallRules/{firewallRuleName}") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules/{firewallRuleName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get(@HostParam("$host") String endpoint, @@ -102,8 +102,7 @@ Mono> get(@HostParam("$host") String endpoint, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/firewallRules") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/firewallRules") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByServer(@HostParam("$host") String endpoint, @@ -114,7 +113,7 @@ Mono> listByServer(@HostParam("$host") String e /** * 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. @@ -125,8 +124,8 @@ Mono> listByServer(@HostParam("$host") String e * @return represents a server firewall rule along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String serverName, String firewallRuleName, FirewallRuleInner parameters) { + public 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.")); @@ -162,7 +161,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * 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. @@ -209,7 +208,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * 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. @@ -217,10 +216,10 @@ private Mono>> createOrUpdateWithResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of represents a server firewall rule. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync( + public PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync( String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { Mono>> mono = createOrUpdateWithResponseAsync(resourceGroupName, serverName, firewallRuleName, parameters); @@ -230,7 +229,7 @@ private PollerFlux, FirewallRuleInner> beginCreate /** * 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. @@ -239,7 +238,7 @@ private PollerFlux, FirewallRuleInner> beginCreate * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of represents a server firewall rule. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, FirewallRuleInner> beginCreateOrUpdateAsync( @@ -254,7 +253,7 @@ private PollerFlux, FirewallRuleInner> beginCreate /** * 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. @@ -262,17 +261,18 @@ private PollerFlux, FirewallRuleInner> beginCreate * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of represents a server firewall rule. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, FirewallRuleInner> beginCreateOrUpdate(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { - return beginCreateOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters).getSyncPoller(); + return this.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. @@ -281,18 +281,18 @@ public SyncPoller, FirewallRuleInner> beginCreateO * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of represents a server firewall rule. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, FirewallRuleInner> beginCreateOrUpdate(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters, Context context) { - return beginCreateOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters, context) + return this.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. @@ -303,7 +303,7 @@ public SyncPoller, FirewallRuleInner> beginCreateO * @return represents a server firewall rule on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String serverName, + public Mono createOrUpdateAsync(String resourceGroupName, String serverName, String firewallRuleName, FirewallRuleInner parameters) { return beginCreateOrUpdateAsync(resourceGroupName, serverName, firewallRuleName, parameters).last() .flatMap(this.client::getLroFinalResultOrError); @@ -311,7 +311,7 @@ private Mono createOrUpdateAsync(String resourceGroupName, St /** * 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. @@ -331,7 +331,7 @@ private Mono createOrUpdateAsync(String resourceGroupName, St /** * 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. @@ -349,7 +349,7 @@ public FirewallRuleInner createOrUpdate(String resourceGroupName, String serverN /** * 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. @@ -368,7 +368,7 @@ public FirewallRuleInner createOrUpdate(String resourceGroupName, String serverN /** * 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. @@ -378,7 +378,7 @@ public FirewallRuleInner createOrUpdate(String resourceGroupName, String serverN * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, String serverName, + public Mono>> deleteWithResponseAsync(String resourceGroupName, String serverName, String firewallRuleName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -409,7 +409,7 @@ private Mono>> deleteWithResponseAsync(String resource /** * 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. @@ -450,17 +450,17 @@ private Mono>> deleteWithResponseAsync(String resource /** * 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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName, + public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName, String firewallRuleName) { Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, firewallRuleName); @@ -470,7 +470,7 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup /** * 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. @@ -478,7 +478,7 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName, @@ -492,24 +492,24 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup /** * 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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String firewallRuleName) { - return beginDeleteAsync(resourceGroupName, serverName, firewallRuleName).getSyncPoller(); + return this.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. @@ -517,17 +517,17 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String firewallRuleName, Context context) { - return beginDeleteAsync(resourceGroupName, serverName, firewallRuleName, context).getSyncPoller(); + return this.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. @@ -537,14 +537,14 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String serverName, String firewallRuleName) { + public 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. @@ -563,7 +563,7 @@ private Mono deleteAsync(String resourceGroupName, String serverName, Stri /** * 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. @@ -578,7 +578,7 @@ public void delete(String resourceGroupName, String serverName, String firewallR /** * 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. @@ -594,18 +594,18 @@ public void delete(String resourceGroupName, String serverName, String firewallR /** * 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 along with {@link Response} on successful completion of {@link - * Mono}. + * @return information about a server firewall rule along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, String serverName, + public Mono> getWithResponseAsync(String resourceGroupName, String serverName, String firewallRuleName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -636,7 +636,7 @@ private Mono> getWithResponseAsync(String resourceGr /** * 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. @@ -644,8 +644,8 @@ private Mono> getWithResponseAsync(String resourceGr * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 along with {@link Response} on successful completion of {@link - * Mono}. + * @return information about a server firewall rule along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync(String resourceGroupName, String serverName, @@ -678,7 +678,7 @@ private Mono> getWithResponseAsync(String resourceGr /** * 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. @@ -688,54 +688,48 @@ private Mono> getWithResponseAsync(String resourceGr * @return information about a server firewall rule on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String serverName, String firewallRuleName) { + public 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(); - } - }); + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * 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. + * @return information about a server firewall rule along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName) { - return getAsync(resourceGroupName, serverName, firewallRuleName).block(); + public Response getWithResponse(String resourceGroupName, String serverName, + String firewallRuleName, Context context) { + return getWithResponseAsync(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. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 along with {@link Response}. + * @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(); + public FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName) { + return getWithResponse(resourceGroupName, serverName, firewallRuleName, Context.NONE).getValue(); } /** * 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. @@ -773,7 +767,7 @@ private Mono> listByServerSinglePageAsync(Strin /** * 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. @@ -812,29 +806,29 @@ private Mono> listByServerSinglePageAsync(Strin /** * 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. + * @return a list of firewall rules as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + public 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. + * @return a list of firewall rules as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync(String resourceGroupName, String serverName, @@ -844,13 +838,13 @@ private PagedFlux listByServerAsync(String resourceGroupName, /** * 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. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName) { @@ -859,14 +853,14 @@ public PagedIterable listByServer(String resourceGroupName, S /** * 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. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRulesImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRulesImpl.java index 893d53ca00b7c..cf80a39d46a2e 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRulesImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRulesImpl.java @@ -13,11 +13,9 @@ import com.azure.resourcemanager.postgresql.fluent.models.FirewallRuleInner; import com.azure.resourcemanager.postgresql.models.FirewallRule; import com.azure.resourcemanager.postgresql.models.FirewallRules; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class FirewallRulesImpl implements FirewallRules { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(FirewallRulesImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(FirewallRulesImpl.class); private final FirewallRulesClient innerClient; @@ -37,15 +35,6 @@ public void delete(String resourceGroupName, String serverName, String firewallR 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 @@ -58,88 +47,97 @@ public Response getWithResponse(String resourceGroupName, String s } } + 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 PagedIterable listByServer(String resourceGroupName, String serverName) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); - return Utils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager())); } public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); - return Utils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager())); } public FirewallRule getById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String firewallRuleName = ResourceManagerUtils.getValueFromIdByName(id, "firewallRules"); if (firewallRuleName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String firewallRuleName = ResourceManagerUtils.getValueFromIdByName(id, "firewallRules"); if (firewallRuleName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String firewallRuleName = ResourceManagerUtils.getValueFromIdByName(id, "firewallRules"); if (firewallRuleName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String firewallRuleName = ResourceManagerUtils.getValueFromIdByName(id, "firewallRules"); if (firewallRuleName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LocationBasedPerformanceTiersClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LocationBasedPerformanceTiersClientImpl.java index e453645b9453a..aff92ed8dd349 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LocationBasedPerformanceTiersClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LocationBasedPerformanceTiersClientImpl.java @@ -25,25 +25,28 @@ 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.postgresql.fluent.LocationBasedPerformanceTiersClient; import com.azure.resourcemanager.postgresql.fluent.models.PerformanceTierPropertiesInner; import com.azure.resourcemanager.postgresql.models.PerformanceTierListResult; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in LocationBasedPerformanceTiersClient. */ +/** + * 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. */ + /** + * The proxy service used to perform REST calls. + */ private final LocationBasedPerformanceTiersService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final PostgreSqlManagementClientImpl client; /** * Initializes an instance of LocationBasedPerformanceTiersClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ LocationBasedPerformanceTiersClientImpl(PostgreSqlManagementClientImpl client) { @@ -58,10 +61,9 @@ public final class LocationBasedPerformanceTiersClientImpl implements LocationBa */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface LocationBasedPerformanceTiersService { + public interface LocationBasedPerformanceTiersService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}" - + "/performanceTiers") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}/performanceTiers") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list(@HostParam("$host") String endpoint, @@ -71,7 +73,7 @@ Mono> list(@HostParam("$host") String endpoi /** * 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. @@ -103,7 +105,7 @@ private Mono> listSinglePageAsync( /** * 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. @@ -136,27 +138,27 @@ private Mono> listSinglePageAsync( /** * 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. + * @return a list of performance tiers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String locationName) { + public 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. + * @return a list of performance tiers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(String locationName, Context context) { @@ -165,12 +167,12 @@ private PagedFlux listAsync(String locationName, /** * 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. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String locationName) { @@ -179,13 +181,13 @@ public 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 ManagementException thrown if 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. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String locationName, Context context) { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LocationBasedPerformanceTiersImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LocationBasedPerformanceTiersImpl.java index d1720901cd842..17eca2d823353 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LocationBasedPerformanceTiersImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LocationBasedPerformanceTiersImpl.java @@ -11,11 +11,9 @@ import com.azure.resourcemanager.postgresql.fluent.models.PerformanceTierPropertiesInner; import com.azure.resourcemanager.postgresql.models.LocationBasedPerformanceTiers; import com.azure.resourcemanager.postgresql.models.PerformanceTierProperties; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class LocationBasedPerformanceTiersImpl implements LocationBasedPerformanceTiers { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(LocationBasedPerformanceTiersImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(LocationBasedPerformanceTiersImpl.class); private final LocationBasedPerformanceTiersClient innerClient; @@ -29,12 +27,12 @@ public LocationBasedPerformanceTiersImpl(LocationBasedPerformanceTiersClient inn public PagedIterable list(String locationName) { PagedIterable inner = this.serviceClient().list(locationName); - return Utils.mapPage(inner, inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager())); } public PagedIterable list(String locationName, Context context) { PagedIterable inner = this.serviceClient().list(locationName, context); - return Utils.mapPage(inner, inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager())); } private LocationBasedPerformanceTiersClient serviceClient() { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFilesClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFilesClientImpl.java index f1296996a20b9..ae56e15c8feac 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFilesClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFilesClientImpl.java @@ -25,25 +25,28 @@ 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.postgresql.fluent.LogFilesClient; import com.azure.resourcemanager.postgresql.fluent.models.LogFileInner; import com.azure.resourcemanager.postgresql.models.LogFileListResult; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in LogFilesClient. */ +/** + * 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. */ + /** + * The proxy service used to perform REST calls. + */ private final LogFilesService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final PostgreSqlManagementClientImpl client; /** * Initializes an instance of LogFilesClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ LogFilesClientImpl(PostgreSqlManagementClientImpl client) { @@ -57,10 +60,9 @@ public final class LogFilesClientImpl implements LogFilesClient { */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface LogFilesService { + public interface LogFilesService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/logFiles") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/logFiles") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByServer(@HostParam("$host") String endpoint, @@ -71,7 +73,7 @@ Mono> listByServer(@HostParam("$host") String endpoi /** * 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. @@ -108,7 +110,7 @@ private Mono> listByServerSinglePageAsync(String res /** * 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. @@ -147,29 +149,29 @@ private Mono> listByServerSinglePageAsync(String res /** * 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. + * @return a list of log files as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + public 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. + * @return a list of log files as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { @@ -178,13 +180,13 @@ private PagedFlux listByServerAsync(String resourceGroupName, Stri /** * 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. + * @return a list of log files as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName) { @@ -193,14 +195,14 @@ public PagedIterable listByServer(String resourceGroupName, String /** * 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. + * @return a list of log files as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFilesImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFilesImpl.java index 1fbd3e6825abc..e44ecbd382655 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFilesImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFilesImpl.java @@ -11,11 +11,9 @@ import com.azure.resourcemanager.postgresql.fluent.models.LogFileInner; import com.azure.resourcemanager.postgresql.models.LogFile; import com.azure.resourcemanager.postgresql.models.LogFiles; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class LogFilesImpl implements LogFiles { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(LogFilesImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(LogFilesImpl.class); private final LogFilesClient innerClient; @@ -29,12 +27,12 @@ public LogFilesImpl(LogFilesClient innerClient, public PagedIterable listByServer(String resourceGroupName, String serverName) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); - return Utils.mapPage(inner, inner1 -> new LogFileImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new LogFileImpl(inner1, this.manager())); } public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); - return Utils.mapPage(inner, inner1 -> new LogFileImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new LogFileImpl(inner1, this.manager())); } private LogFilesClient serviceClient() { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationsClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationsClientImpl.java index ce2f1a2fe76e6..f253f72151e46 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationsClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationsClientImpl.java @@ -20,24 +20,27 @@ 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.postgresql.fluent.OperationsClient; import com.azure.resourcemanager.postgresql.fluent.models.OperationListResultInner; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in OperationsClient. */ +/** + * 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. */ + /** + * The proxy service used to perform REST calls. + */ private final OperationsService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final PostgreSqlManagementClientImpl client; /** * Initializes an instance of OperationsClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ OperationsClientImpl(PostgreSqlManagementClientImpl client) { @@ -52,7 +55,7 @@ public final class OperationsClientImpl implements OperationsClient { */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface OperationsService { + public interface OperationsService { @Headers({ "Content-Type: application/json" }) @Get("/providers/Microsoft.DBforPostgreSQL/operations") @ExpectedResponses({ 200 }) @@ -63,14 +66,14 @@ Mono> list(@HostParam("$host") String endpoin /** * 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 along with {@link Response} on successful completion of {@link - * Mono}. + * @return a list of resource provider operations along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listWithResponseAsync() { + public Mono> listWithResponseAsync() { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -83,13 +86,13 @@ private Mono> listWithResponseAsync() { /** * 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 along with {@link Response} on successful completion of {@link - * Mono}. + * @return a list of resource provider operations along with {@link Response} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listWithResponseAsync(Context context) { @@ -105,45 +108,39 @@ private Mono> listWithResponseAsync(Context c /** * 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 on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono listAsync() { - return listWithResponseAsync().flatMap((Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + public Mono listAsync() { + return listWithResponseAsync().flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * 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. + * @return a list of resource provider operations along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public OperationListResultInner list() { - return listAsync().block(); + public Response listWithResponse(Context context) { + return listWithResponseAsync(context).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 along with {@link Response}. + * @return a list of resource provider operations. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response listWithResponse(Context context) { - return listWithResponseAsync(context).block(); + public OperationListResultInner list() { + return listWithResponse(Context.NONE).getValue(); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationsImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationsImpl.java index 321cc17cdc6fd..ba96515e5e204 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationsImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationsImpl.java @@ -12,11 +12,9 @@ import com.azure.resourcemanager.postgresql.fluent.models.OperationListResultInner; import com.azure.resourcemanager.postgresql.models.OperationListResult; import com.azure.resourcemanager.postgresql.models.Operations; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class OperationsImpl implements Operations { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(OperationsImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(OperationsImpl.class); private final OperationsClient innerClient; @@ -28,20 +26,20 @@ public OperationsImpl(OperationsClient innerClient, this.serviceManager = serviceManager; } - public OperationListResult list() { - OperationListResultInner inner = this.serviceClient().list(); + public Response listWithResponse(Context context) { + Response inner = this.serviceClient().listWithResponse(context); if (inner != null) { - return new OperationListResultImpl(inner, this.manager()); + return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), + new OperationListResultImpl(inner.getValue(), this.manager())); } else { return null; } } - public Response listWithResponse(Context context) { - Response inner = this.serviceClient().listWithResponse(context); + public OperationListResult list() { + OperationListResultInner inner = this.serviceClient().list(); if (inner != null) { - return new SimpleResponse<>(inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new OperationListResultImpl(inner.getValue(), this.manager())); + return new OperationListResultImpl(inner, this.manager()); } else { return null; } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PostgreSqlManagementClientBuilder.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PostgreSqlManagementClientBuilder.java index 5fdad568bb7c7..837fa4fba6a34 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PostgreSqlManagementClientBuilder.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PostgreSqlManagementClientBuilder.java @@ -7,7 +7,6 @@ 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; @@ -15,7 +14,9 @@ import com.azure.core.util.serializer.SerializerAdapter; import java.time.Duration; -/** A builder for creating a new instance of the PostgreSqlManagementClientImpl type. */ +/** + * A builder for creating a new instance of the PostgreSqlManagementClientImpl type. + */ @ServiceClientBuilder(serviceClients = { PostgreSqlManagementClientImpl.class }) public final class PostgreSqlManagementClientBuilder { /* @@ -25,7 +26,7 @@ public final class PostgreSqlManagementClientBuilder { /** * Sets The ID of the target subscription. - * + * * @param subscriptionId the subscriptionId value. * @return the PostgreSqlManagementClientBuilder. */ @@ -41,7 +42,7 @@ public PostgreSqlManagementClientBuilder subscriptionId(String subscriptionId) { /** * Sets server parameter. - * + * * @param endpoint the endpoint value. * @return the PostgreSqlManagementClientBuilder. */ @@ -57,7 +58,7 @@ public PostgreSqlManagementClientBuilder endpoint(String endpoint) { /** * Sets The environment to connect to. - * + * * @param environment the environment value. * @return the PostgreSqlManagementClientBuilder. */ @@ -67,34 +68,34 @@ public PostgreSqlManagementClientBuilder environment(AzureEnvironment environmen } /* - * The default poll interval for long-running operation + * The HTTP pipeline to send requests through */ - private Duration defaultPollInterval; + private HttpPipeline pipeline; /** - * Sets The default poll interval for long-running operation. - * - * @param defaultPollInterval the defaultPollInterval value. + * Sets The HTTP pipeline to send requests through. + * + * @param pipeline the pipeline value. * @return the PostgreSqlManagementClientBuilder. */ - public PostgreSqlManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { - this.defaultPollInterval = defaultPollInterval; + public PostgreSqlManagementClientBuilder pipeline(HttpPipeline pipeline) { + this.pipeline = pipeline; return this; } /* - * The HTTP pipeline to send requests through + * The default poll interval for long-running operation */ - private HttpPipeline pipeline; + private Duration defaultPollInterval; /** - * Sets The HTTP pipeline to send requests through. - * - * @param pipeline the pipeline value. + * Sets The default poll interval for long-running operation. + * + * @param defaultPollInterval the defaultPollInterval value. * @return the PostgreSqlManagementClientBuilder. */ - public PostgreSqlManagementClientBuilder pipeline(HttpPipeline pipeline) { - this.pipeline = pipeline; + public PostgreSqlManagementClientBuilder defaultPollInterval(Duration defaultPollInterval) { + this.defaultPollInterval = defaultPollInterval; return this; } @@ -105,7 +106,7 @@ public PostgreSqlManagementClientBuilder pipeline(HttpPipeline pipeline) { /** * Sets The serializer to serialize an object into a string. - * + * * @param serializerAdapter the serializerAdapter value. * @return the PostgreSqlManagementClientBuilder. */ @@ -116,29 +117,22 @@ public PostgreSqlManagementClientBuilder serializerAdapter(SerializerAdapter ser /** * Builds an instance of PostgreSqlManagementClientImpl with the provided parameters. - * + * * @return an instance of PostgreSqlManagementClientImpl. */ public PostgreSqlManagementClientImpl 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(); - } - PostgreSqlManagementClientImpl client = new PostgreSqlManagementClientImpl(pipeline, serializerAdapter, - defaultPollInterval, environment, subscriptionId, endpoint); + String localEndpoint = (endpoint != null) ? endpoint : "https://management.azure.com"; + AzureEnvironment localEnvironment = (environment != null) ? environment : AzureEnvironment.AZURE; + HttpPipeline localPipeline = (pipeline != null) + ? pipeline + : new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(); + Duration localDefaultPollInterval + = (defaultPollInterval != null) ? defaultPollInterval : Duration.ofSeconds(30); + SerializerAdapter localSerializerAdapter = (serializerAdapter != null) + ? serializerAdapter + : SerializerFactory.createDefaultManagementSerializerAdapter(); + PostgreSqlManagementClientImpl client = new PostgreSqlManagementClientImpl(localPipeline, + localSerializerAdapter, localDefaultPollInterval, localEnvironment, this.subscriptionId, localEndpoint); return client; } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PostgreSqlManagementClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PostgreSqlManagementClientImpl.java index 3852084a1f3cb..63dd8c899099f 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PostgreSqlManagementClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PostgreSqlManagementClientImpl.java @@ -5,6 +5,7 @@ package com.azure.resourcemanager.postgresql.implementation; import com.azure.core.annotation.ServiceClient; +import com.azure.core.http.HttpHeaderName; import com.azure.core.http.HttpHeaders; import com.azure.core.http.HttpPipeline; import com.azure.core.http.HttpResponse; @@ -15,6 +16,7 @@ import com.azure.core.management.polling.PollResult; import com.azure.core.management.polling.PollerFactory; import com.azure.core.util.Context; +import com.azure.core.util.CoreUtils; import com.azure.core.util.logging.ClientLogger; import com.azure.core.util.polling.AsyncPollResponse; import com.azure.core.util.polling.LongRunningOperationStatus; @@ -46,285 +48,330 @@ 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 PostgreSqlManagementClientImpl type. */ +/** + * Initializes a new instance of the PostgreSqlManagementClientImpl type. + */ @ServiceClient(builder = PostgreSqlManagementClientBuilder.class) public final class PostgreSqlManagementClientImpl implements PostgreSqlManagementClient { - private final ClientLogger logger = new ClientLogger(PostgreSqlManagementClientImpl.class); - - /** The ID of the target subscription. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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 ServerAdministratorsClient object to access its operations. */ + /** + * The ServerAdministratorsClient object to access its operations. + */ private final ServerAdministratorsClient serverAdministrators; /** * Gets the ServerAdministratorsClient object to access its operations. - * + * * @return the ServerAdministratorsClient object. */ public ServerAdministratorsClient getServerAdministrators() { return this.serverAdministrators; } - /** The RecoverableServersClient object to access its operations. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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 ServerSecurityAlertPoliciesClient object to access its operations. */ + /** + * 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; } - /** The PrivateEndpointConnectionsClient object to access its operations. */ + /** + * 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. */ + /** + * 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 ServerKeysClient object to access its operations. */ + /** + * The ServerKeysClient object to access its operations. + */ private final ServerKeysClient serverKeys; /** * Gets the ServerKeysClient object to access its operations. - * + * * @return the ServerKeysClient object. */ public ServerKeysClient getServerKeys() { @@ -333,7 +380,7 @@ public ServerKeysClient getServerKeys() { /** * Initializes an instance of PostgreSqlManagementClient 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. @@ -370,7 +417,7 @@ public ServerKeysClient getServerKeys() { /** * Gets default client context. - * + * * @return the default client context. */ public Context getContext() { @@ -379,20 +426,17 @@ public Context getContext() { /** * 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; + return CoreUtils.mergeContexts(this.getContext(), context); } /** * Gets long running operation result. - * + * * @param activationResponse the response of activation operation. * @param httpPipeline the http pipeline. * @param pollResultType type of poll result. @@ -410,7 +454,7 @@ public PollerFlux, U> getLroResult(Mono type of poll result. * @param type of final result. @@ -437,7 +481,7 @@ public Mono getLroFinalResultOrError(AsyncPollResponse, managementError = null; } } catch (IOException | RuntimeException ioe) { - logger.logThrowableAsWarning(ioe); + LOGGER.logThrowableAsWarning(ioe); } } } else { @@ -473,7 +517,7 @@ public int getStatusCode() { } public String getHeaderValue(String s) { - return httpHeaders.getValue(s); + return httpHeaders.getValue(HttpHeaderName.fromString(s)); } public HttpHeaders getHeaders() { @@ -496,4 +540,6 @@ public Mono getBodyAsString(Charset charset) { return Mono.just(new String(responseBody, charset)); } } + + private static final ClientLogger LOGGER = new ClientLogger(PostgreSqlManagementClientImpl.class); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionImpl.java index 20846919b54ab..6ccf542e38de2 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionImpl.java @@ -42,6 +42,10 @@ public String provisioningState() { return this.innerModel().provisioningState(); } + public String resourceGroupName() { + return resourceGroupName; + } + public PrivateEndpointConnectionInner innerModel() { return this.innerObject; } @@ -108,9 +112,10 @@ public PrivateEndpointConnection apply(Context context) { com.azure.resourcemanager.postgresql.PostgreSqlManager 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"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "servers"); + this.privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "privateEndpointConnections"); } public PrivateEndpointConnection refresh() { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionsClientImpl.java index 054790f9640e1..3b567bb447986 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionsClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionsClientImpl.java @@ -30,7 +30,6 @@ 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.postgresql.fluent.PrivateEndpointConnectionsClient; @@ -41,19 +40,23 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +/** + * 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. */ + /** + * The proxy service used to perform REST calls. + */ private final PrivateEndpointConnectionsService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final PostgreSqlManagementClientImpl client; /** * Initializes an instance of PrivateEndpointConnectionsClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ PrivateEndpointConnectionsClientImpl(PostgreSqlManagementClientImpl client) { @@ -68,10 +71,9 @@ public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpoi */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface PrivateEndpointConnectionsService { + public interface PrivateEndpointConnectionsService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get(@HostParam("$host") String endpoint, @@ -81,8 +83,7 @@ Mono> get(@HostParam("$host") String en @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> createOrUpdate(@HostParam("$host") String endpoint, @@ -93,8 +94,7 @@ Mono>> createOrUpdate(@HostParam("$host") String endpo @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") @ExpectedResponses({ 200, 202, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete(@HostParam("$host") String endpoint, @@ -104,8 +104,7 @@ Mono>> delete(@HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> updateTags(@HostParam("$host") String endpoint, @@ -116,8 +115,7 @@ Mono>> updateTags(@HostParam("$host") String endpoint, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/privateEndpointConnections") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateEndpointConnections") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByServer(@HostParam("$host") String endpoint, @@ -136,7 +134,7 @@ Mono> listByServerNext( /** * 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. @@ -146,7 +144,7 @@ Mono> listByServerNext( * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, + public Mono> getWithResponseAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -177,7 +175,7 @@ private Mono> getWithResponseAsync(Stri /** * 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. @@ -218,7 +216,7 @@ private Mono> getWithResponseAsync(Stri /** * 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. @@ -228,68 +226,62 @@ private Mono> getWithResponseAsync(Stri * @return a private endpoint connection on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String serverName, + public 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(); - } - }); + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Gets a private endpoint connection. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param 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. + * @return a private endpoint connection along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PrivateEndpointConnectionInner get(String resourceGroupName, String serverName, - String privateEndpointConnectionName) { - return getAsync(resourceGroupName, serverName, privateEndpointConnectionName).block(); + public Response getWithResponse(String resourceGroupName, String serverName, + String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, context).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 along with {@link Response}. + * @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(); + public PrivateEndpointConnectionInner get(String resourceGroupName, String serverName, + String privateEndpointConnectionName) { + return getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, Context.NONE).getValue(); } /** * Approve or reject a private endpoint connection with a given name. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. - * @param parameters A private endpoint connection. + * @param parameters The parameters 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 private endpoint connection along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String serverName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { + public 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.")); @@ -325,11 +317,11 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * 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 parameters The parameters 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. @@ -373,18 +365,18 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * 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 parameters The parameters 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 private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of a private endpoint connection. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, PrivateEndpointConnectionInner> + public PollerFlux, PrivateEndpointConnectionInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { Mono>> mono @@ -396,16 +388,16 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * 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 parameters The parameters 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 private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of a private endpoint connection. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, PrivateEndpointConnectionInner> @@ -421,59 +413,60 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * 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 parameters The parameters 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 private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of a private endpoint connection. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { - return beginCreateOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) + return this.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 parameters The parameters 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 private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of a private endpoint connection. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters, Context context) { - return beginCreateOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, - context).getSyncPoller(); + return this + .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. + * @param parameters The parameters 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 private endpoint connection on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String serverName, + public Mono createOrUpdateAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName, PrivateEndpointConnectionInner parameters) { return beginCreateOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters).last() .flatMap(this.client::getLroFinalResultOrError); @@ -481,11 +474,11 @@ private Mono createOrUpdateAsync(String resource /** * 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 parameters The parameters 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. @@ -501,11 +494,11 @@ private Mono createOrUpdateAsync(String resource /** * 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 parameters The parameters 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. @@ -519,11 +512,11 @@ public PrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, S /** * 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 parameters The parameters 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. @@ -539,7 +532,7 @@ public PrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, S /** * 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. @@ -549,7 +542,7 @@ public PrivateEndpointConnectionInner createOrUpdate(String resourceGroupName, S * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, String serverName, + public Mono>> deleteWithResponseAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -580,7 +573,7 @@ private Mono>> deleteWithResponseAsync(String resource /** * 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. @@ -621,17 +614,17 @@ private Mono>> deleteWithResponseAsync(String resource /** * 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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName, + public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName) { Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName); @@ -641,7 +634,7 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup /** * 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. @@ -649,7 +642,7 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName, @@ -663,24 +656,24 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup /** * 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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String privateEndpointConnectionName) { - return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName).getSyncPoller(); + return this.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. @@ -688,17 +681,18 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { - return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName, context).getSyncPoller(); + return this.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. @@ -708,14 +702,14 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + public 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. @@ -734,7 +728,7 @@ private Mono deleteAsync(String resourceGroupName, String serverName, Stri /** * 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. @@ -749,7 +743,7 @@ public void delete(String resourceGroupName, String serverName, String privateEn /** * 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. @@ -765,8 +759,10 @@ public void delete(String resourceGroupName, String serverName, String privateEn } /** + * Updates tags on private endpoint connection. + * * 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. @@ -777,7 +773,7 @@ public void delete(String resourceGroupName, String serverName, String privateEn * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> updateTagsWithResponseAsync(String resourceGroupName, String serverName, + public Mono>> updateTagsWithResponseAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -813,8 +809,10 @@ private Mono>> updateTagsWithResponseAsync(String reso } /** + * Updates tags on private endpoint connection. + * * 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. @@ -860,8 +858,10 @@ private Mono>> updateTagsWithResponseAsync(String reso } /** + * Updates tags on private endpoint connection. + * * 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. @@ -869,10 +869,10 @@ private Mono>> updateTagsWithResponseAsync(String reso * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of a private endpoint connection. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, PrivateEndpointConnectionInner> beginUpdateTagsAsync( + public PollerFlux, PrivateEndpointConnectionInner> beginUpdateTagsAsync( String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters) { Mono>> mono = updateTagsWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters); @@ -882,8 +882,10 @@ private PollerFlux, PrivateEndpointCo } /** + * Updates tags on private endpoint connection. + * * 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. @@ -892,7 +894,7 @@ private PollerFlux, PrivateEndpointCo * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of a private endpoint connection. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, PrivateEndpointConnectionInner> beginUpdateTagsAsync( @@ -907,8 +909,10 @@ private PollerFlux, PrivateEndpointCo } /** + * Updates tags on private endpoint connection. + * * 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. @@ -916,18 +920,20 @@ private PollerFlux, PrivateEndpointCo * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of a private endpoint connection. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, PrivateEndpointConnectionInner> beginUpdateTags( String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters) { - return beginUpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) + return this.beginUpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) .getSyncPoller(); } /** + * Updates tags on private endpoint connection. + * * 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. @@ -936,19 +942,22 @@ public SyncPoller, PrivateEndpointCon * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a private endpoint connection along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of a private endpoint connection. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, PrivateEndpointConnectionInner> beginUpdateTags( String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters, Context context) { - return beginUpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + return this + .beginUpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) .getSyncPoller(); } /** + * Updates tags on private endpoint connection. + * * 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. @@ -959,15 +968,17 @@ public SyncPoller, PrivateEndpointCon * @return a private endpoint connection on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateTagsAsync(String resourceGroupName, String serverName, + public Mono updateTagsAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters) { return beginUpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters).last() .flatMap(this.client::getLroFinalResultOrError); } /** + * Updates tags on private endpoint connection. + * * 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. @@ -987,8 +998,10 @@ private Mono updateTagsAsync(String resourceGrou } /** + * Updates tags on private endpoint connection. + * * 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. @@ -1005,8 +1018,10 @@ public PrivateEndpointConnectionInner updateTags(String resourceGroupName, Strin } /** + * Updates tags on private endpoint connection. + * * 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. @@ -1026,14 +1041,14 @@ public PrivateEndpointConnectionInner updateTags(String resourceGroupName, Strin /** * 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 along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerSinglePageAsync(String resourceGroupName, @@ -1065,7 +1080,7 @@ private Mono> listByServerSinglePa /** * 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. @@ -1073,7 +1088,7 @@ private Mono> listByServerSinglePa * @throws 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 along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerSinglePageAsync(String resourceGroupName, @@ -1105,30 +1120,30 @@ private Mono> listByServerSinglePa /** * 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. + * @return all private endpoint connections on a server as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + public 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. + * @return all private endpoint connections on a server as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync(String resourceGroupName, String serverName, @@ -1139,13 +1154,13 @@ private PagedFlux listByServerAsync(String resou /** * 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. + * @return all private endpoint connections on a server as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName) { @@ -1154,14 +1169,14 @@ public PagedIterable listByServer(String resourc /** * 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. + * @return all private endpoint connections on a server as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName, @@ -1171,13 +1186,13 @@ public PagedIterable listByServer(String resourc /** * Get the next page of items. - * - * @param nextLink The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of private endpoint connections along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerNextSinglePageAsync(String nextLink) { @@ -1198,14 +1213,14 @@ private Mono> listByServerNextSing /** * Get the next page of items. - * - * @param nextLink The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of private endpoint connections along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerNextSinglePageAsync(String nextLink, diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionsImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionsImpl.java index 3b0be3ea0820e..590bd72ed001a 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionsImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionsImpl.java @@ -13,11 +13,9 @@ import com.azure.resourcemanager.postgresql.fluent.models.PrivateEndpointConnectionInner; import com.azure.resourcemanager.postgresql.models.PrivateEndpointConnection; import com.azure.resourcemanager.postgresql.models.PrivateEndpointConnections; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionsImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(PrivateEndpointConnectionsImpl.class); private final PrivateEndpointConnectionsClient innerClient; @@ -29,17 +27,6 @@ public PrivateEndpointConnectionsImpl(PrivateEndpointConnectionsClient innerClie 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() @@ -52,6 +39,17 @@ public Response getWithResponse(String resourceGroupN } } + 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 void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName) { this.serviceClient().delete(resourceGroupName, serverName, privateEndpointConnectionName); } @@ -64,30 +62,31 @@ public void delete(String resourceGroupName, String serverName, String privateEn public PagedIterable listByServer(String resourceGroupName, String serverName) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); - return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); } public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); - return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager())); } public PrivateEndpointConnection getById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); if (privateEndpointConnectionName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException(String + 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) @@ -95,57 +94,60 @@ public PrivateEndpointConnection getById(String id) { } public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); if (privateEndpointConnectionName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException(String + 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"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); if (privateEndpointConnectionName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException(String + 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"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String privateEndpointConnectionName + = ResourceManagerUtils.getValueFromIdByName(id, "privateEndpointConnections"); if (privateEndpointConnectionName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException(String + 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); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourcesClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourcesClientImpl.java index 3b3bed64174e8..eadfa349e40d9 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourcesClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourcesClientImpl.java @@ -25,25 +25,28 @@ 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.postgresql.fluent.PrivateLinkResourcesClient; import com.azure.resourcemanager.postgresql.fluent.models.PrivateLinkResourceInner; import com.azure.resourcemanager.postgresql.models.PrivateLinkResourceListResult; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +/** + * 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. */ + /** + * The proxy service used to perform REST calls. + */ private final PrivateLinkResourcesService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final PostgreSqlManagementClientImpl client; /** * Initializes an instance of PrivateLinkResourcesClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ PrivateLinkResourcesClientImpl(PostgreSqlManagementClientImpl client) { @@ -58,10 +61,9 @@ public final class PrivateLinkResourcesClientImpl implements PrivateLinkResource */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface PrivateLinkResourcesService { + public interface PrivateLinkResourcesService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/privateLinkResources") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByServer(@HostParam("$host") String endpoint, @@ -70,8 +72,7 @@ Mono> listByServer(@HostParam("$host") S @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/privateLinkResources/{groupName}") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/privateLinkResources/{groupName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get(@HostParam("$host") String endpoint, @@ -90,14 +91,14 @@ Mono> listByServerNext( /** * Gets the private link resources for PostgreSQL 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 PostgreSQL server along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerSinglePageAsync(String resourceGroupName, @@ -129,7 +130,7 @@ private Mono> listByServerSinglePageAsyn /** * Gets the private link resources for PostgreSQL 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. @@ -137,7 +138,7 @@ private Mono> listByServerSinglePageAsyn * @throws ManagementException 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 PostgreSQL server along with {@link PagedResponse} on successful - * completion of {@link Mono}. + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerSinglePageAsync(String resourceGroupName, @@ -169,30 +170,30 @@ private Mono> listByServerSinglePageAsyn /** * Gets the private link resources for PostgreSQL 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 PostgreSQL server. + * @return the private link resources for PostgreSQL server as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + public PagedFlux listByServerAsync(String resourceGroupName, String serverName) { return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName), nextLink -> listByServerNextSinglePageAsync(nextLink)); } /** * Gets the private link resources for PostgreSQL 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 PostgreSQL server. + * @return the private link resources for PostgreSQL server as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync(String resourceGroupName, String serverName, @@ -203,13 +204,13 @@ private PagedFlux listByServerAsync(String resourceGro /** * Gets the private link resources for PostgreSQL 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 PostgreSQL server. + * @return the private link resources for PostgreSQL server as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName) { @@ -218,14 +219,14 @@ public PagedIterable listByServer(String resourceGroup /** * Gets the private link resources for PostgreSQL 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 PostgreSQL server. + * @return the private link resources for PostgreSQL server as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName, @@ -235,7 +236,7 @@ public PagedIterable listByServer(String resourceGroup /** * Gets a private link resource for PostgreSQL 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. @@ -243,10 +244,10 @@ public PagedIterable listByServer(String resourceGroup * @throws ManagementException 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 PostgreSQL server along with {@link Response} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, String serverName, + public Mono> getWithResponseAsync(String resourceGroupName, String serverName, String groupName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -276,7 +277,7 @@ private Mono> getWithResponseAsync(String res /** * Gets a private link resource for PostgreSQL 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. @@ -285,7 +286,7 @@ private Mono> getWithResponseAsync(String res * @throws ManagementException 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 PostgreSQL server along with {@link Response} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync(String resourceGroupName, String serverName, @@ -317,7 +318,7 @@ private Mono> getWithResponseAsync(String res /** * Gets a private link resource for PostgreSQL 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. @@ -327,60 +328,54 @@ private Mono> getWithResponseAsync(String res * @return a private link resource for PostgreSQL server on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String serverName, String groupName) { + public 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(); - } - }); + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Gets a private link resource for PostgreSQL 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 PostgreSQL server. + * @return a private link resource for PostgreSQL server along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public PrivateLinkResourceInner get(String resourceGroupName, String serverName, String groupName) { - return getAsync(resourceGroupName, serverName, groupName).block(); + public Response getWithResponse(String resourceGroupName, String serverName, + String groupName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, groupName, context).block(); } /** * Gets a private link resource for PostgreSQL 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 PostgreSQL server along with {@link Response}. + * @return a private link resource for PostgreSQL server. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceGroupName, String serverName, - String groupName, Context context) { - return getWithResponseAsync(resourceGroupName, serverName, groupName, context).block(); + public PrivateLinkResourceInner get(String resourceGroupName, String serverName, String groupName) { + return getWithResponse(resourceGroupName, serverName, groupName, Context.NONE).getValue(); } /** * Get the next page of items. - * - * @param nextLink The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of private link resources along with {@link PagedResponse} on successful completion of {@link - * Mono}. + * @return a list of private link resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerNextSinglePageAsync(String nextLink) { @@ -401,14 +396,14 @@ private Mono> listByServerNextSinglePage /** * Get the next page of items. - * - * @param nextLink The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of private link resources along with {@link PagedResponse} on successful completion of {@link - * Mono}. + * @return a list of private link resources along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerNextSinglePageAsync(String nextLink, diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourcesImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourcesImpl.java index 0bc16ac99b845..91a3106d01ecf 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourcesImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourcesImpl.java @@ -13,11 +13,9 @@ import com.azure.resourcemanager.postgresql.fluent.models.PrivateLinkResourceInner; import com.azure.resourcemanager.postgresql.models.PrivateLinkResource; import com.azure.resourcemanager.postgresql.models.PrivateLinkResources; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class PrivateLinkResourcesImpl implements PrivateLinkResources { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkResourcesImpl.class); private final PrivateLinkResourcesClient innerClient; @@ -32,23 +30,14 @@ public PrivateLinkResourcesImpl(PrivateLinkResourcesClient innerClient, public PagedIterable listByServer(String resourceGroupName, String serverName) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); - return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); } public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); - return Utils.mapPage(inner, 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; - } + return ResourceManagerUtils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager())); } public Response getWithResponse(String resourceGroupName, String serverName, String groupName, @@ -63,6 +52,15 @@ public Response getWithResponse(String resourceGroupName, S } } + 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; + } + } + private PrivateLinkResourcesClient serviceClient() { return this.innerClient; } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServersClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServersClientImpl.java index de298423937fd..7c6473cb9b315 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServersClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServersClientImpl.java @@ -21,24 +21,27 @@ 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.postgresql.fluent.RecoverableServersClient; import com.azure.resourcemanager.postgresql.fluent.models.RecoverableServerResourceInner; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in RecoverableServersClient. */ +/** + * 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. */ + /** + * The proxy service used to perform REST calls. + */ private final RecoverableServersService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final PostgreSqlManagementClientImpl client; /** * Initializes an instance of RecoverableServersClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ RecoverableServersClientImpl(PostgreSqlManagementClientImpl client) { @@ -53,10 +56,9 @@ public final class RecoverableServersClientImpl implements RecoverableServersCli */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface RecoverableServersService { + public interface RecoverableServersService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/recoverableServers") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/recoverableServers") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get(@HostParam("$host") String endpoint, @@ -67,7 +69,7 @@ Mono> get(@HostParam("$host") String en /** * Gets a recoverable PostgreSQL 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. @@ -76,7 +78,7 @@ Mono> get(@HostParam("$host") String en * @return a recoverable PostgreSQL Server along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, + public Mono> getWithResponseAsync(String resourceGroupName, String serverName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -103,7 +105,7 @@ private Mono> getWithResponseAsync(Stri /** * Gets a recoverable PostgreSQL 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. @@ -139,7 +141,7 @@ private Mono> getWithResponseAsync(Stri /** * Gets a recoverable PostgreSQL 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. @@ -148,46 +150,39 @@ private Mono> getWithResponseAsync(Stri * @return a recoverable PostgreSQL Server on successful completion of {@link Mono}. */ @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(); - } - }); + public Mono getAsync(String resourceGroupName, String serverName) { + return getWithResponseAsync(resourceGroupName, serverName).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Gets a recoverable PostgreSQL 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 PostgreSQL Server. + * @return a recoverable PostgreSQL Server along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public RecoverableServerResourceInner get(String resourceGroupName, String serverName) { - return getAsync(resourceGroupName, serverName).block(); + public Response getWithResponse(String resourceGroupName, String serverName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, context).block(); } /** * Gets a recoverable PostgreSQL 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 PostgreSQL Server along with {@link Response}. + * @return a recoverable PostgreSQL Server. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceGroupName, String serverName, - Context context) { - return getWithResponseAsync(resourceGroupName, serverName, context).block(); + public RecoverableServerResourceInner get(String resourceGroupName, String serverName) { + return getWithResponse(resourceGroupName, serverName, Context.NONE).getValue(); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServersImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServersImpl.java index 7b5cf99aeaee4..7b3ce7735653f 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServersImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServersImpl.java @@ -12,11 +12,9 @@ import com.azure.resourcemanager.postgresql.fluent.models.RecoverableServerResourceInner; import com.azure.resourcemanager.postgresql.models.RecoverableServerResource; import com.azure.resourcemanager.postgresql.models.RecoverableServers; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class RecoverableServersImpl implements RecoverableServers { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(RecoverableServersImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(RecoverableServersImpl.class); private final RecoverableServersClient innerClient; @@ -28,15 +26,6 @@ public RecoverableServersImpl(RecoverableServersClient 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 @@ -49,6 +38,15 @@ public Response getWithResponse(String resourceGroupN } } + 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; + } + } + private RecoverableServersClient serviceClient() { return this.innerClient; } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ReplicasClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ReplicasClientImpl.java index bb5e12ef84633..640bde1a59215 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ReplicasClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ReplicasClientImpl.java @@ -25,25 +25,28 @@ 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.postgresql.fluent.ReplicasClient; import com.azure.resourcemanager.postgresql.fluent.models.ServerInner; import com.azure.resourcemanager.postgresql.models.ServerListResult; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in ReplicasClient. */ +/** + * 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. */ + /** + * The proxy service used to perform REST calls. + */ private final ReplicasService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final PostgreSqlManagementClientImpl client; /** * Initializes an instance of ReplicasClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ ReplicasClientImpl(PostgreSqlManagementClientImpl client) { @@ -57,10 +60,9 @@ public final class ReplicasClientImpl implements ReplicasClient { */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface ReplicasService { + public interface ReplicasService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/replicas") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/replicas") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByServer(@HostParam("$host") String endpoint, @@ -71,7 +73,7 @@ Mono> listByServer(@HostParam("$host") String endpoin /** * 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. @@ -108,7 +110,7 @@ private Mono> listByServerSinglePageAsync(String reso /** * 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. @@ -147,29 +149,29 @@ private Mono> listByServerSinglePageAsync(String reso /** * 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. + * @return a list of servers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + public 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. + * @return a list of servers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { @@ -178,13 +180,13 @@ private PagedFlux listByServerAsync(String resourceGroupName, Strin /** * 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName) { @@ -193,14 +195,14 @@ public PagedIterable listByServer(String resourceGroupName, String /** * 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ReplicasImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ReplicasImpl.java index 421c10b7b03f3..d524d241aa268 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ReplicasImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ReplicasImpl.java @@ -11,11 +11,9 @@ import com.azure.resourcemanager.postgresql.fluent.models.ServerInner; import com.azure.resourcemanager.postgresql.models.Replicas; import com.azure.resourcemanager.postgresql.models.Server; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class ReplicasImpl implements Replicas { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ReplicasImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(ReplicasImpl.class); private final ReplicasClient innerClient; @@ -29,12 +27,12 @@ public ReplicasImpl(ReplicasClient innerClient, public PagedIterable listByServer(String resourceGroupName, String serverName) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); - return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); } public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); - return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); } private ReplicasClient serviceClient() { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/Utils.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ResourceManagerUtils.java similarity index 88% rename from sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/Utils.java rename to sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ResourceManagerUtils.java index 87e6c28a2245c..6e7c3fd4af35a 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/Utils.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ResourceManagerUtils.java @@ -19,7 +19,10 @@ import java.util.stream.Stream; import reactor.core.publisher.Flux; -final class Utils { +final class ResourceManagerUtils { + private ResourceManagerUtils() { + } + static String getValueFromIdByName(String id, String name) { if (id == null) { return null; @@ -60,7 +63,7 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri segments.add(idSegment); idItrReverted.forEachRemaining(segments::add); Collections.reverse(segments); - if (segments.size() > 0 && segments.get(0).isEmpty()) { + if (!segments.isEmpty() && segments.get(0).isEmpty()) { segments.remove(0); } return String.join("/", segments); @@ -74,7 +77,7 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri } static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) { - return new PagedIterableImpl(pageIterable, mapper); + return new PagedIterableImpl<>(pageIterable, mapper); } private static final class PagedIterableImpl extends PagedIterable { @@ -124,30 +127,27 @@ public Stream> streamByPage(String continuationToken, int prefe @Override public Iterator iterator() { - return new IteratorImpl(pagedIterable.iterator(), mapper); + return new IteratorImpl<>(pagedIterable.iterator(), mapper); } @Override public Iterable> iterableByPage() { - return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(), pageMapper); } @Override public Iterable> iterableByPage(String continuationToken) { - return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(continuationToken), - pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken), pageMapper); } @Override public Iterable> iterableByPage(int preferredPageSize) { - return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(preferredPageSize), - pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(preferredPageSize), pageMapper); } @Override public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { - return new IterableImpl, PagedResponse>( - pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + return new IterableImpl<>(pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); } } @@ -189,7 +189,7 @@ private IterableImpl(Iterable iterable, Function mapper) { @Override public Iterator iterator() { - return new IteratorImpl(iterable.iterator(), mapper); + return new IteratorImpl<>(iterable.iterator(), mapper); } } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorsClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorsClientImpl.java index 220433f92f6a2..0778d0b3ea399 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorsClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorsClientImpl.java @@ -29,7 +29,6 @@ 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.postgresql.fluent.ServerAdministratorsClient; @@ -39,19 +38,23 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in ServerAdministratorsClient. */ +/** + * An instance of this class provides access to all the operations defined in ServerAdministratorsClient. + */ public final class ServerAdministratorsClientImpl implements ServerAdministratorsClient { - private final ClientLogger logger = new ClientLogger(ServerAdministratorsClientImpl.class); - - /** The proxy service used to perform REST calls. */ + /** + * The proxy service used to perform REST calls. + */ private final ServerAdministratorsService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final PostgreSqlManagementClientImpl client; /** * Initializes an instance of ServerAdministratorsClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ ServerAdministratorsClientImpl(PostgreSqlManagementClientImpl client) { @@ -66,10 +69,9 @@ public final class ServerAdministratorsClientImpl implements ServerAdministrator */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface ServerAdministratorsService { + public interface ServerAdministratorsService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/administrators/activeDirectory") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get(@HostParam("$host") String endpoint, @@ -78,8 +80,7 @@ Mono> get(@HostParam("$host") String @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/administrators/activeDirectory") + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory") @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> createOrUpdate(@HostParam("$host") String endpoint, @@ -89,8 +90,7 @@ Mono>> createOrUpdate(@HostParam("$host") String endpo @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/administrators/activeDirectory") + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators/activeDirectory") @ExpectedResponses({ 200, 202, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete(@HostParam("$host") String endpoint, @@ -99,8 +99,7 @@ Mono>> delete(@HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/administrators") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/administrators") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list(@HostParam("$host") String endpoint, @@ -111,17 +110,17 @@ Mono> list(@HostParam("$host") S /** * Gets information about a AAD server administrator. - * + * * @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 AAD server administrator along with {@link Response} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, + public Mono> getWithResponseAsync(String resourceGroupName, String serverName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -148,7 +147,7 @@ private Mono> getWithResponseAsync(St /** * Gets information about a AAD server administrator. - * + * * @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. @@ -156,7 +155,7 @@ private Mono> getWithResponseAsync(St * @throws 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 AAD server administrator along with {@link Response} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync(String resourceGroupName, @@ -185,7 +184,7 @@ private Mono> getWithResponseAsync(St /** * Gets information about a AAD server administrator. - * + * * @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. @@ -194,53 +193,46 @@ private Mono> getWithResponseAsync(St * @return information about a AAD server administrator on successful completion of {@link Mono}. */ @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(); - } - }); + public Mono getAsync(String resourceGroupName, String serverName) { + return getWithResponseAsync(resourceGroupName, serverName).flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Gets information about a AAD server administrator. - * + * * @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 AAD server administrator. + * @return information about a AAD server administrator along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ServerAdministratorResourceInner get(String resourceGroupName, String serverName) { - return getAsync(resourceGroupName, serverName).block(); + public Response getWithResponse(String resourceGroupName, String serverName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, context).block(); } /** * Gets information about a AAD server administrator. - * + * * @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 AAD server administrator along with {@link Response}. + * @return information about a AAD server administrator. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceGroupName, String serverName, - Context context) { - return getWithResponseAsync(resourceGroupName, serverName, context).block(); + public ServerAdministratorResourceInner get(String resourceGroupName, String serverName) { + return getWithResponse(resourceGroupName, serverName, Context.NONE).getValue(); } /** * Creates or update active directory administrator on an existing server. The update action will overwrite the * existing administrator. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param properties The required parameters for creating or updating an AAD server administrator. @@ -248,11 +240,11 @@ public Response getWithResponse(String resourc * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return represents a and external administrator to be created along with {@link Response} on successful - * completion of {@link Mono}. + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String serverName, ServerAdministratorResourceInner properties) { + public Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, String serverName, + ServerAdministratorResourceInner properties) { if (this.client.getEndpoint() == null) { return Mono.error( new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null.")); @@ -284,7 +276,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * Creates or update active directory administrator on an existing server. The update action will overwrite the * existing administrator. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param properties The required parameters for creating or updating an AAD server administrator. @@ -293,7 +285,7 @@ private Mono>> createOrUpdateWithResponseAsync(String * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return represents a and external administrator to be created along with {@link Response} on successful - * completion of {@link Mono}. + * completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, @@ -328,18 +320,17 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * Creates or update active directory administrator on an existing server. The update action will overwrite the * existing administrator. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param properties The required parameters for creating or updating an AAD server administrator. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a and external administrator to be created along with {@link Response} on successful - * completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of represents a and external administrator to be created. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ServerAdministratorResourceInner> + public PollerFlux, ServerAdministratorResourceInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerAdministratorResourceInner properties) { Mono>> mono @@ -352,7 +343,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * Creates or update active directory administrator on an existing server. The update action will overwrite the * existing administrator. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param properties The required parameters for creating or updating an AAD server administrator. @@ -360,8 +351,7 @@ private Mono>> createOrUpdateWithResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a and external administrator to be created along with {@link Response} on successful - * completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of represents a and external administrator to be created. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ServerAdministratorResourceInner> @@ -378,26 +368,25 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * Creates or update active directory administrator on an existing server. The update action will overwrite the * existing administrator. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param properties The required parameters for creating or updating an AAD server administrator. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a and external administrator to be created along with {@link Response} on successful - * completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of represents a and external administrator to be created. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ServerAdministratorResourceInner> beginCreateOrUpdate(String resourceGroupName, String serverName, ServerAdministratorResourceInner properties) { - return beginCreateOrUpdateAsync(resourceGroupName, serverName, properties).getSyncPoller(); + return this.beginCreateOrUpdateAsync(resourceGroupName, serverName, properties).getSyncPoller(); } /** * Creates or update active directory administrator on an existing server. The update action will overwrite the * existing administrator. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param properties The required parameters for creating or updating an AAD server administrator. @@ -405,20 +394,19 @@ private Mono>> createOrUpdateWithResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a and external administrator to be created along with {@link Response} on successful - * completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of represents a and external administrator to be created. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ServerAdministratorResourceInner> beginCreateOrUpdate(String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, Context context) { - return beginCreateOrUpdateAsync(resourceGroupName, serverName, properties, context).getSyncPoller(); + return this.beginCreateOrUpdateAsync(resourceGroupName, serverName, properties, context).getSyncPoller(); } /** * Creates or update active directory administrator on an existing server. The update action will overwrite the * existing administrator. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param properties The required parameters for creating or updating an AAD server administrator. @@ -428,7 +416,7 @@ private Mono>> createOrUpdateWithResponseAsync(String * @return represents a and external administrator to be created on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String serverName, + public Mono createOrUpdateAsync(String resourceGroupName, String serverName, ServerAdministratorResourceInner properties) { return beginCreateOrUpdateAsync(resourceGroupName, serverName, properties).last() .flatMap(this.client::getLroFinalResultOrError); @@ -437,7 +425,7 @@ private Mono createOrUpdateAsync(String resour /** * Creates or update active directory administrator on an existing server. The update action will overwrite the * existing administrator. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param properties The required parameters for creating or updating an AAD server administrator. @@ -457,7 +445,7 @@ private Mono createOrUpdateAsync(String resour /** * Creates or update active directory administrator on an existing server. The update action will overwrite the * existing administrator. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param properties The required parameters for creating or updating an AAD server administrator. @@ -475,7 +463,7 @@ public ServerAdministratorResourceInner createOrUpdate(String resourceGroupName, /** * Creates or update active directory administrator on an existing server. The update action will overwrite the * existing administrator. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param properties The required parameters for creating or updating an AAD server administrator. @@ -493,7 +481,7 @@ public ServerAdministratorResourceInner createOrUpdate(String resourceGroupName, /** * Deletes server active directory administrator. - * + * * @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. @@ -502,7 +490,7 @@ public ServerAdministratorResourceInner createOrUpdate(String resourceGroupName, * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, String serverName) { + public 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.")); @@ -528,7 +516,7 @@ private Mono>> deleteWithResponseAsync(String resource /** * Deletes server active directory administrator. - * + * * @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. @@ -564,16 +552,16 @@ private Mono>> deleteWithResponseAsync(String resource /** * Deletes server active directory administrator. - * + * * @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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName) { + public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName) { Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); @@ -581,14 +569,14 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup /** * Deletes server active directory administrator. - * + * * @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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName, @@ -601,39 +589,39 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup /** * Deletes server active directory administrator. - * + * * @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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName) { - return beginDeleteAsync(resourceGroupName, serverName).getSyncPoller(); + return this.beginDeleteAsync(resourceGroupName, serverName).getSyncPoller(); } /** * Deletes server active directory administrator. - * + * * @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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, Context context) { - return beginDeleteAsync(resourceGroupName, serverName, context).getSyncPoller(); + return this.beginDeleteAsync(resourceGroupName, serverName, context).getSyncPoller(); } /** * Deletes server active directory administrator. - * + * * @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. @@ -642,13 +630,13 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String serverName) { + public Mono deleteAsync(String resourceGroupName, String serverName) { return beginDeleteAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); } /** * Deletes server active directory administrator. - * + * * @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. @@ -665,7 +653,7 @@ private Mono deleteAsync(String resourceGroupName, String serverName, Cont /** * Deletes server active directory administrator. - * + * * @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. @@ -679,7 +667,7 @@ public void delete(String resourceGroupName, String serverName) { /** * Deletes server active directory administrator. - * + * * @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. @@ -694,14 +682,14 @@ public void delete(String resourceGroupName, String serverName, Context context) /** * Returns a list of server Administrators. - * + * * @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 response to a list Active Directory Administrators request along with {@link PagedResponse} on - * successful completion of {@link Mono}. + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync(String resourceGroupName, @@ -733,7 +721,7 @@ private Mono> listSinglePageAsyn /** * Returns a list of server Administrators. - * + * * @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. @@ -741,7 +729,7 @@ private Mono> listSinglePageAsyn * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the response to a list Active Directory Administrators request along with {@link PagedResponse} on - * successful completion of {@link Mono}. + * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listSinglePageAsync(String resourceGroupName, @@ -773,29 +761,31 @@ private Mono> listSinglePageAsyn /** * Returns a list of server Administrators. - * + * * @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 response to a list Active Directory Administrators request. + * @return the response to a list Active Directory Administrators request as paginated response with + * {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String serverName) { + public PagedFlux listAsync(String resourceGroupName, String serverName) { return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serverName)); } /** * Returns a list of server Administrators. - * + * * @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 response to a list Active Directory Administrators request. + * @return the response to a list Active Directory Administrators request as paginated response with + * {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(String resourceGroupName, String serverName, @@ -805,13 +795,14 @@ private PagedFlux listAsync(String resourceGro /** * Returns a list of server Administrators. - * + * * @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 response to a list Active Directory Administrators request. + * @return the response to a list Active Directory Administrators request as paginated response with + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String serverName) { @@ -820,14 +811,15 @@ public PagedIterable list(String resourceGroup /** * Returns a list of server Administrators. - * + * * @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 response to a list Active Directory Administrators request. + * @return the response to a list Active Directory Administrators request as paginated response with + * {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String serverName, diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorsImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorsImpl.java index d7b23d95c8be3..b800964b7911e 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorsImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorsImpl.java @@ -13,11 +13,9 @@ import com.azure.resourcemanager.postgresql.fluent.models.ServerAdministratorResourceInner; import com.azure.resourcemanager.postgresql.models.ServerAdministratorResource; import com.azure.resourcemanager.postgresql.models.ServerAdministrators; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class ServerAdministratorsImpl implements ServerAdministrators { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerAdministratorsImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(ServerAdministratorsImpl.class); private final ServerAdministratorsClient innerClient; @@ -29,15 +27,6 @@ public ServerAdministratorsImpl(ServerAdministratorsClient innerClient, this.serviceManager = serviceManager; } - public ServerAdministratorResource get(String resourceGroupName, String serverName) { - ServerAdministratorResourceInner inner = this.serviceClient().get(resourceGroupName, serverName); - if (inner != null) { - return new ServerAdministratorResourceImpl(inner, this.manager()); - } else { - return null; - } - } - public Response getWithResponse(String resourceGroupName, String serverName, Context context) { Response inner @@ -50,6 +39,15 @@ public Response getWithResponse(String resourceGrou } } + public ServerAdministratorResource get(String resourceGroupName, String serverName) { + ServerAdministratorResourceInner inner = this.serviceClient().get(resourceGroupName, serverName); + if (inner != null) { + return new ServerAdministratorResourceImpl(inner, this.manager()); + } else { + return null; + } + } + public ServerAdministratorResource createOrUpdate(String resourceGroupName, String serverName, ServerAdministratorResourceInner properties) { ServerAdministratorResourceInner inner @@ -83,14 +81,16 @@ public void delete(String resourceGroupName, String serverName, Context context) public PagedIterable list(String resourceGroupName, String serverName) { PagedIterable inner = this.serviceClient().list(resourceGroupName, serverName); - return Utils.mapPage(inner, inner1 -> new ServerAdministratorResourceImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new ServerAdministratorResourceImpl(inner1, this.manager())); } public PagedIterable list(String resourceGroupName, String serverName, Context context) { PagedIterable inner = this.serviceClient().list(resourceGroupName, serverName, context); - return Utils.mapPage(inner, inner1 -> new ServerAdministratorResourceImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, + inner1 -> new ServerAdministratorResourceImpl(inner1, this.manager())); } private ServerAdministratorsClient serviceClient() { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerBasedPerformanceTiersClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerBasedPerformanceTiersClientImpl.java index e326f1358e7ca..4dd803cc4dcd4 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerBasedPerformanceTiersClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerBasedPerformanceTiersClientImpl.java @@ -25,25 +25,28 @@ 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.postgresql.fluent.ServerBasedPerformanceTiersClient; import com.azure.resourcemanager.postgresql.fluent.models.PerformanceTierPropertiesInner; import com.azure.resourcemanager.postgresql.models.PerformanceTierListResult; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in ServerBasedPerformanceTiersClient. */ +/** + * 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. */ + /** + * The proxy service used to perform REST calls. + */ private final ServerBasedPerformanceTiersService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final PostgreSqlManagementClientImpl client; /** * Initializes an instance of ServerBasedPerformanceTiersClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ ServerBasedPerformanceTiersClientImpl(PostgreSqlManagementClientImpl client) { @@ -58,10 +61,9 @@ public final class ServerBasedPerformanceTiersClientImpl implements ServerBasedP */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface ServerBasedPerformanceTiersService { + public interface ServerBasedPerformanceTiersService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/performanceTiers") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/performanceTiers") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list(@HostParam("$host") String endpoint, @@ -72,7 +74,7 @@ Mono> list(@HostParam("$host") String endpoi /** * List all the performance tiers for a PostgreSQL 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. @@ -110,7 +112,7 @@ private Mono> listSinglePageAsync( /** * List all the performance tiers for a PostgreSQL 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. @@ -149,29 +151,29 @@ private Mono> listSinglePageAsync( /** * List all the performance tiers for a PostgreSQL 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. + * @return a list of performance tiers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String serverName) { + public PagedFlux listAsync(String resourceGroupName, String serverName) { return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serverName)); } /** * List all the performance tiers for a PostgreSQL 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. + * @return a list of performance tiers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(String resourceGroupName, String serverName, @@ -181,13 +183,13 @@ private PagedFlux listAsync(String resourceGroup /** * List all the performance tiers for a PostgreSQL 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. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String serverName) { @@ -196,14 +198,14 @@ public PagedIterable list(String resourceGroupNa /** * List all the performance tiers for a PostgreSQL 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. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String serverName, diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerBasedPerformanceTiersImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerBasedPerformanceTiersImpl.java index d5551fb1406bf..6b78bb4bfd935 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerBasedPerformanceTiersImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerBasedPerformanceTiersImpl.java @@ -11,11 +11,9 @@ import com.azure.resourcemanager.postgresql.fluent.models.PerformanceTierPropertiesInner; import com.azure.resourcemanager.postgresql.models.PerformanceTierProperties; import com.azure.resourcemanager.postgresql.models.ServerBasedPerformanceTiers; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class ServerBasedPerformanceTiersImpl implements ServerBasedPerformanceTiers { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerBasedPerformanceTiersImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(ServerBasedPerformanceTiersImpl.class); private final ServerBasedPerformanceTiersClient innerClient; @@ -29,13 +27,13 @@ public ServerBasedPerformanceTiersImpl(ServerBasedPerformanceTiersClient innerCl public PagedIterable list(String resourceGroupName, String serverName) { PagedIterable inner = this.serviceClient().list(resourceGroupName, serverName); - return Utils.mapPage(inner, inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager())); } public PagedIterable list(String resourceGroupName, String serverName, Context context) { PagedIterable inner = this.serviceClient().list(resourceGroupName, serverName, context); - return Utils.mapPage(inner, inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager())); } private ServerBasedPerformanceTiersClient serviceClient() { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerImpl.java index 1b9432d415966..9e948acc434eb 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerImpl.java @@ -137,6 +137,10 @@ public String regionName() { return this.location(); } + public String resourceGroupName() { + return resourceGroupName; + } + public ServerInner innerModel() { return this.innerObject; } @@ -201,8 +205,8 @@ public Server apply(Context context) { ServerImpl(ServerInner innerObject, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; - this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "servers"); } public Server refresh() { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeyImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeyImpl.java index 91b94835590f0..ff731a8034d67 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeyImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeyImpl.java @@ -43,6 +43,10 @@ public OffsetDateTime creationDate() { return this.innerModel().creationDate(); } + public String resourceGroupName() { + return resourceGroupName; + } + public ServerKeyInner innerModel() { return this.innerObject; } @@ -104,9 +108,9 @@ public ServerKey apply(Context context) { ServerKeyImpl(ServerKeyInner innerObject, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; - this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); - this.keyName = Utils.getValueFromIdByName(innerObject.id(), "keys"); - this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "servers"); + this.keyName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "keys"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); } public ServerKey refresh() { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeysClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeysClientImpl.java index cfacbdc656867..522aa57133961 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeysClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeysClientImpl.java @@ -29,7 +29,6 @@ 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.postgresql.fluent.ServerKeysClient; @@ -39,19 +38,23 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in ServerKeysClient. */ +/** + * An instance of this class provides access to all the operations defined in ServerKeysClient. + */ public final class ServerKeysClientImpl implements ServerKeysClient { - private final ClientLogger logger = new ClientLogger(ServerKeysClientImpl.class); - - /** The proxy service used to perform REST calls. */ + /** + * The proxy service used to perform REST calls. + */ private final ServerKeysService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final PostgreSqlManagementClientImpl client; /** * Initializes an instance of ServerKeysClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ ServerKeysClientImpl(PostgreSqlManagementClientImpl client) { @@ -66,10 +69,9 @@ public final class ServerKeysClientImpl implements ServerKeysClient { */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface ServerKeysService { + public interface ServerKeysService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/keys") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list(@HostParam("$host") String endpoint, @@ -78,8 +80,7 @@ Mono> list(@HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/keys/{keyName}") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get(@HostParam("$host") String endpoint, @@ -88,8 +89,7 @@ Mono> get(@HostParam("$host") String endpoint, @PathParam("subscriptionId") String subscriptionId, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/keys/{keyName}") + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}") @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> createOrUpdate(@HostParam("$host") String endpoint, @@ -100,8 +100,7 @@ Mono>> createOrUpdate(@HostParam("$host") String endpo Context context); @Headers({ "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/keys/{keyName}") + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/keys/{keyName}") @ExpectedResponses({ 200, 202, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete(@HostParam("$host") String endpoint, @@ -120,7 +119,7 @@ Mono> listNext(@PathParam(value = "nextLink", enco /** * Gets a list of Server keys. - * + * * @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. @@ -157,7 +156,7 @@ private Mono> listSinglePageAsync(String resourceG /** * Gets a list of Server keys. - * + * * @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. @@ -196,30 +195,30 @@ private Mono> listSinglePageAsync(String resourceG /** * Gets a list of Server keys. - * + * * @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 keys. + * @return a list of Server keys as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync(String resourceGroupName, String serverName) { + public PagedFlux listAsync(String resourceGroupName, String serverName) { return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serverName), nextLink -> listNextSinglePageAsync(nextLink)); } /** * Gets a list of Server keys. - * + * * @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 keys. + * @return a list of Server keys as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(String resourceGroupName, String serverName, Context context) { @@ -229,13 +228,13 @@ private PagedFlux listAsync(String resourceGroupName, String ser /** * Gets a list of Server keys. - * + * * @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 keys. + * @return a list of Server keys as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String serverName) { @@ -244,14 +243,14 @@ public PagedIterable list(String resourceGroupName, String serve /** * Gets a list of Server keys. - * + * * @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 keys. + * @return a list of Server keys as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(String resourceGroupName, String serverName, Context context) { @@ -260,7 +259,7 @@ public PagedIterable list(String resourceGroupName, String serve /** * Gets a PostgreSQL Server key. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be retrieved. @@ -270,7 +269,7 @@ public PagedIterable list(String resourceGroupName, String serve * @return a PostgreSQL Server key along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, String serverName, + public Mono> getWithResponseAsync(String resourceGroupName, String serverName, String keyName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -300,7 +299,7 @@ private Mono> getWithResponseAsync(String resourceGroup /** * Gets a PostgreSQL Server key. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be retrieved. @@ -340,7 +339,7 @@ private Mono> getWithResponseAsync(String resourceGroup /** * Gets a PostgreSQL Server key. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be retrieved. @@ -350,53 +349,48 @@ private Mono> getWithResponseAsync(String resourceGroup * @return a PostgreSQL Server key on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String serverName, String keyName) { - return getWithResponseAsync(resourceGroupName, serverName, keyName).flatMap((Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + public Mono getAsync(String resourceGroupName, String serverName, String keyName) { + return getWithResponseAsync(resourceGroupName, serverName, keyName) + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * Gets a PostgreSQL Server key. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be retrieved. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a PostgreSQL Server key. + * @return a PostgreSQL Server key along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ServerKeyInner get(String resourceGroupName, String serverName, String keyName) { - return getAsync(resourceGroupName, serverName, keyName).block(); + public Response getWithResponse(String resourceGroupName, String serverName, String keyName, + Context context) { + return getWithResponseAsync(resourceGroupName, serverName, keyName, context).block(); } /** * Gets a PostgreSQL Server key. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be retrieved. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a PostgreSQL Server key along with {@link Response}. + * @return a PostgreSQL Server key. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getWithResponse(String resourceGroupName, String serverName, String keyName, - Context context) { - return getWithResponseAsync(resourceGroupName, serverName, keyName, context).block(); + public ServerKeyInner get(String resourceGroupName, String serverName, String keyName) { + return getWithResponse(resourceGroupName, serverName, keyName, Context.NONE).getValue(); } /** * Creates or updates a PostgreSQL Server key. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be operated on (updated or created). * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -407,7 +401,7 @@ public Response getWithResponse(String resourceGroupName, String * @return a PostgreSQL Server key along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String serverName, String keyName, + public Mono>> createOrUpdateWithResponseAsync(String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -442,7 +436,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * Creates or updates a PostgreSQL Server key. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be operated on (updated or created). * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -488,7 +482,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * Creates or updates a PostgreSQL Server key. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be operated on (updated or created). * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -496,10 +490,10 @@ private Mono>> createOrUpdateWithResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a PostgreSQL Server key along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of a PostgreSQL Server key. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ServerKeyInner> beginCreateOrUpdateAsync(String serverName, + public PollerFlux, ServerKeyInner> beginCreateOrUpdateAsync(String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters) { Mono>> mono = createOrUpdateWithResponseAsync(serverName, keyName, resourceGroupName, parameters); @@ -509,7 +503,7 @@ private PollerFlux, ServerKeyInner> beginCreateOrUpda /** * Creates or updates a PostgreSQL Server key. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be operated on (updated or created). * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -518,7 +512,7 @@ private PollerFlux, ServerKeyInner> beginCreateOrUpda * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a PostgreSQL Server key along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of a PostgreSQL Server key. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ServerKeyInner> beginCreateOrUpdateAsync(String serverName, @@ -532,7 +526,7 @@ private PollerFlux, ServerKeyInner> beginCreateOrUpda /** * Creates or updates a PostgreSQL Server key. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be operated on (updated or created). * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -540,17 +534,17 @@ private PollerFlux, ServerKeyInner> beginCreateOrUpda * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a PostgreSQL Server key along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of a PostgreSQL Server key. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ServerKeyInner> beginCreateOrUpdate(String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters) { - return beginCreateOrUpdateAsync(serverName, keyName, resourceGroupName, parameters).getSyncPoller(); + return this.beginCreateOrUpdateAsync(serverName, keyName, resourceGroupName, parameters).getSyncPoller(); } /** * Creates or updates a PostgreSQL Server key. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be operated on (updated or created). * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -559,17 +553,18 @@ public SyncPoller, ServerKeyInner> beginCreateOrUpdat * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a PostgreSQL Server key along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of a PostgreSQL Server key. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ServerKeyInner> beginCreateOrUpdate(String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters, Context context) { - return beginCreateOrUpdateAsync(serverName, keyName, resourceGroupName, parameters, context).getSyncPoller(); + return this.beginCreateOrUpdateAsync(serverName, keyName, resourceGroupName, parameters, context) + .getSyncPoller(); } /** * Creates or updates a PostgreSQL Server key. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be operated on (updated or created). * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -580,7 +575,7 @@ public SyncPoller, ServerKeyInner> beginCreateOrUpdat * @return a PostgreSQL Server key on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String serverName, String keyName, String resourceGroupName, + public Mono createOrUpdateAsync(String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters) { return beginCreateOrUpdateAsync(serverName, keyName, resourceGroupName, parameters).last() .flatMap(this.client::getLroFinalResultOrError); @@ -588,7 +583,7 @@ private Mono createOrUpdateAsync(String serverName, String keyNa /** * Creates or updates a PostgreSQL Server key. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be operated on (updated or created). * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -608,7 +603,7 @@ private Mono createOrUpdateAsync(String serverName, String keyNa /** * Creates or updates a PostgreSQL Server key. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be operated on (updated or created). * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -626,7 +621,7 @@ public ServerKeyInner createOrUpdate(String serverName, String keyName, String r /** * Creates or updates a PostgreSQL Server key. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be operated on (updated or created). * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -645,7 +640,7 @@ public ServerKeyInner createOrUpdate(String serverName, String keyName, String r /** * Deletes the PostgreSQL Server key with the given name. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be deleted. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -655,7 +650,7 @@ public ServerKeyInner createOrUpdate(String serverName, String keyName, String r * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String serverName, String keyName, + public Mono>> deleteWithResponseAsync(String serverName, String keyName, String resourceGroupName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -685,7 +680,7 @@ private Mono>> deleteWithResponseAsync(String serverNa /** * Deletes the PostgreSQL Server key with the given name. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be deleted. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -725,17 +720,17 @@ private Mono>> deleteWithResponseAsync(String serverNa /** * Deletes the PostgreSQL Server key with the given name. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be deleted. * @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 the {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String serverName, String keyName, + public PollerFlux, Void> beginDeleteAsync(String serverName, String keyName, String resourceGroupName) { Mono>> mono = deleteWithResponseAsync(serverName, keyName, resourceGroupName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, @@ -744,7 +739,7 @@ private PollerFlux, Void> beginDeleteAsync(String serverName, S /** * Deletes the PostgreSQL Server key with the given name. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be deleted. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -752,7 +747,7 @@ private PollerFlux, Void> beginDeleteAsync(String serverName, S * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync(String serverName, String keyName, @@ -766,23 +761,23 @@ private PollerFlux, Void> beginDeleteAsync(String serverName, S /** * Deletes the PostgreSQL Server key with the given name. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be deleted. * @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 the {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String serverName, String keyName, String resourceGroupName) { - return beginDeleteAsync(serverName, keyName, resourceGroupName).getSyncPoller(); + return this.beginDeleteAsync(serverName, keyName, resourceGroupName).getSyncPoller(); } /** * Deletes the PostgreSQL Server key with the given name. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be deleted. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -790,17 +785,17 @@ public SyncPoller, Void> beginDelete(String serverName, String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String serverName, String keyName, String resourceGroupName, Context context) { - return beginDeleteAsync(serverName, keyName, resourceGroupName, context).getSyncPoller(); + return this.beginDeleteAsync(serverName, keyName, resourceGroupName, context).getSyncPoller(); } /** * Deletes the PostgreSQL Server key with the given name. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be deleted. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -810,14 +805,14 @@ public SyncPoller, Void> beginDelete(String serverName, String * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String serverName, String keyName, String resourceGroupName) { + public Mono deleteAsync(String serverName, String keyName, String resourceGroupName) { return beginDeleteAsync(serverName, keyName, resourceGroupName).last() .flatMap(this.client::getLroFinalResultOrError); } /** * Deletes the PostgreSQL Server key with the given name. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be deleted. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -835,7 +830,7 @@ private Mono deleteAsync(String serverName, String keyName, String resourc /** * Deletes the PostgreSQL Server key with the given name. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be deleted. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -850,7 +845,7 @@ public void delete(String serverName, String keyName, String resourceGroupName) /** * Deletes the PostgreSQL Server key with the given name. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be deleted. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -866,13 +861,13 @@ public void delete(String serverName, String keyName, String resourceGroupName, /** * Get the next page of items. - * - * @param nextLink The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of PostgreSQL Server keys along with {@link PagedResponse} on successful completion of {@link - * Mono}. + * @return a list of PostgreSQL Server keys along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink) { @@ -892,14 +887,14 @@ private Mono> listNextSinglePageAsync(String nextL /** * Get the next page of items. - * - * @param nextLink The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of PostgreSQL Server keys along with {@link PagedResponse} on successful completion of {@link - * Mono}. + * @return a list of PostgreSQL Server keys along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listNextSinglePageAsync(String nextLink, Context context) { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeysImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeysImpl.java index 8209280a4eef1..249959974e61b 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeysImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeysImpl.java @@ -13,11 +13,9 @@ import com.azure.resourcemanager.postgresql.fluent.models.ServerKeyInner; import com.azure.resourcemanager.postgresql.models.ServerKey; import com.azure.resourcemanager.postgresql.models.ServerKeys; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class ServerKeysImpl implements ServerKeys { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerKeysImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(ServerKeysImpl.class); private final ServerKeysClient innerClient; @@ -31,21 +29,12 @@ public ServerKeysImpl(ServerKeysClient innerClient, public PagedIterable list(String resourceGroupName, String serverName) { PagedIterable inner = this.serviceClient().list(resourceGroupName, serverName); - return Utils.mapPage(inner, inner1 -> new ServerKeyImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ServerKeyImpl(inner1, this.manager())); } public PagedIterable list(String resourceGroupName, String serverName, Context context) { PagedIterable inner = this.serviceClient().list(resourceGroupName, serverName, context); - return Utils.mapPage(inner, inner1 -> new ServerKeyImpl(inner1, this.manager())); - } - - public ServerKey get(String resourceGroupName, String serverName, String keyName) { - ServerKeyInner inner = this.serviceClient().get(resourceGroupName, serverName, keyName); - if (inner != null) { - return new ServerKeyImpl(inner, this.manager()); - } else { - return null; - } + return ResourceManagerUtils.mapPage(inner, inner1 -> new ServerKeyImpl(inner1, this.manager())); } public Response getWithResponse(String resourceGroupName, String serverName, String keyName, @@ -60,6 +49,15 @@ public Response getWithResponse(String resourceGroupName, String serv } } + public ServerKey get(String resourceGroupName, String serverName, String keyName) { + ServerKeyInner inner = this.serviceClient().get(resourceGroupName, serverName, keyName); + if (inner != null) { + return new ServerKeyImpl(inner, this.manager()); + } else { + return null; + } + } + public void delete(String serverName, String keyName, String resourceGroupName) { this.serviceClient().delete(serverName, keyName, resourceGroupName); } @@ -69,76 +67,76 @@ public void delete(String serverName, String keyName, String resourceGroupName, } public ServerKey getById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } - String keyName = Utils.getValueFromIdByName(id, "keys"); + String keyName = ResourceManagerUtils.getValueFromIdByName(id, "keys"); if (keyName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); } return this.getWithResponse(resourceGroupName, serverName, keyName, Context.NONE).getValue(); } public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } - String keyName = Utils.getValueFromIdByName(id, "keys"); + String keyName = ResourceManagerUtils.getValueFromIdByName(id, "keys"); if (keyName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); } return this.getWithResponse(resourceGroupName, serverName, keyName, context); } public void deleteById(String id) { - String serverName = Utils.getValueFromIdByName(id, "servers"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } - String keyName = Utils.getValueFromIdByName(id, "keys"); + String keyName = ResourceManagerUtils.getValueFromIdByName(id, "keys"); if (keyName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); } - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } this.delete(serverName, keyName, resourceGroupName, Context.NONE); } public void deleteByIdWithResponse(String id, Context context) { - String serverName = Utils.getValueFromIdByName(id, "servers"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } - String keyName = Utils.getValueFromIdByName(id, "keys"); + String keyName = ResourceManagerUtils.getValueFromIdByName(id, "keys"); if (keyName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'keys'.", id))); } - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } this.delete(serverName, keyName, resourceGroupName, context); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerParametersClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerParametersClientImpl.java index d0a3de433ff57..82301a1f9e017 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerParametersClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerParametersClientImpl.java @@ -23,7 +23,6 @@ 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.postgresql.fluent.ServerParametersClient; @@ -32,19 +31,23 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in ServerParametersClient. */ +/** + * 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. */ + /** + * The proxy service used to perform REST calls. + */ private final ServerParametersService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final PostgreSqlManagementClientImpl client; /** * Initializes an instance of ServerParametersClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ ServerParametersClientImpl(PostgreSqlManagementClientImpl client) { @@ -59,10 +62,9 @@ public final class ServerParametersClientImpl implements ServerParametersClient */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface ServerParametersService { + public interface ServerParametersService { @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/updateConfigurations") + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/updateConfigurations") @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> listUpdateConfigurations(@HostParam("$host") String endpoint, @@ -74,7 +76,7 @@ Mono>> listUpdateConfigurations(@HostParam("$host") St /** * 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. @@ -84,7 +86,7 @@ Mono>> listUpdateConfigurations(@HostParam("$host") St * @return a list of server configurations along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> listUpdateConfigurationsWithResponseAsync(String resourceGroupName, + public Mono>> listUpdateConfigurationsWithResponseAsync(String resourceGroupName, String serverName, ConfigurationListResultInner value) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -116,7 +118,7 @@ private Mono>> listUpdateConfigurationsWithResponseAsy /** * 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. @@ -158,17 +160,17 @@ private Mono>> listUpdateConfigurationsWithResponseAsy /** * 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of a list of server configurations. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ConfigurationListResultInner> + public PollerFlux, ConfigurationListResultInner> beginListUpdateConfigurationsAsync(String resourceGroupName, String serverName, ConfigurationListResultInner value) { Mono>> mono @@ -180,7 +182,7 @@ private Mono>> listUpdateConfigurationsWithResponseAsy /** * 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. @@ -188,7 +190,7 @@ private Mono>> listUpdateConfigurationsWithResponseAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of a list of server configurations. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ConfigurationListResultInner> @@ -204,24 +206,24 @@ private Mono>> listUpdateConfigurationsWithResponseAsy /** * 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of a list of server configurations. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ConfigurationListResultInner> beginListUpdateConfigurations(String resourceGroupName, String serverName, ConfigurationListResultInner value) { - return beginListUpdateConfigurationsAsync(resourceGroupName, serverName, value).getSyncPoller(); + return this.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. @@ -229,18 +231,18 @@ private Mono>> listUpdateConfigurationsWithResponseAsy * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of a list of server configurations. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ConfigurationListResultInner> beginListUpdateConfigurations(String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context) { - return beginListUpdateConfigurationsAsync(resourceGroupName, serverName, value, context).getSyncPoller(); + return this.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. @@ -250,15 +252,15 @@ private Mono>> listUpdateConfigurationsWithResponseAsy * @return a list of server configurations on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono listUpdateConfigurationsAsync(String resourceGroupName, - String serverName, ConfigurationListResultInner value) { + public 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. @@ -277,7 +279,7 @@ private Mono listUpdateConfigurationsAsync(String /** * 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. @@ -294,7 +296,7 @@ public ConfigurationListResultInner listUpdateConfigurations(String resourceGrou /** * 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. diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerParametersImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerParametersImpl.java index cd599373a6c6e..0c22d70e8d9ec 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerParametersImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerParametersImpl.java @@ -10,11 +10,9 @@ import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationListResultInner; import com.azure.resourcemanager.postgresql.models.ConfigurationListResult; import com.azure.resourcemanager.postgresql.models.ServerParameters; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class ServerParametersImpl implements ServerParameters { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerParametersImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(ServerParametersImpl.class); private final ServerParametersClient innerClient; diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPoliciesClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPoliciesClientImpl.java index b1fcc4fe1583c..a9a7d62c0a824 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPoliciesClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPoliciesClientImpl.java @@ -28,7 +28,6 @@ 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.postgresql.fluent.ServerSecurityAlertPoliciesClient; @@ -39,19 +38,23 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in ServerSecurityAlertPoliciesClient. */ +/** + * 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. */ + /** + * The proxy service used to perform REST calls. + */ private final ServerSecurityAlertPoliciesService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final PostgreSqlManagementClientImpl client; /** * Initializes an instance of ServerSecurityAlertPoliciesClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ ServerSecurityAlertPoliciesClientImpl(PostgreSqlManagementClientImpl client) { @@ -66,10 +69,9 @@ public final class ServerSecurityAlertPoliciesClientImpl implements ServerSecuri */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface ServerSecurityAlertPoliciesService { + public interface ServerSecurityAlertPoliciesService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get(@HostParam("$host") String endpoint, @@ -79,8 +81,7 @@ Mono> get(@HostParam("$host") String en @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> createOrUpdate(@HostParam("$host") String endpoint, @@ -91,8 +92,7 @@ Mono>> createOrUpdate(@HostParam("$host") String endpo @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/securityAlertPolicies") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/securityAlertPolicies") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByServer(@HostParam("$host") String endpoint, @@ -111,7 +111,7 @@ Mono> listByServerNext( /** * 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. @@ -121,7 +121,7 @@ Mono> listByServerNext( * @return a server's security alert policy along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, + public Mono> getWithResponseAsync(String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -152,7 +152,7 @@ private Mono> getWithResponseAsync(Stri /** * 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. @@ -193,7 +193,7 @@ private Mono> getWithResponseAsync(Stri /** * 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. @@ -203,56 +203,50 @@ private Mono> getWithResponseAsync(Stri * @return a server's security alert policy on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String serverName, + public 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(); - } - }); + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * 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. + * @return a server's security alert policy along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ServerSecurityAlertPolicyInner get(String resourceGroupName, String serverName, - SecurityAlertPolicyName securityAlertPolicyName) { - return getAsync(resourceGroupName, serverName, securityAlertPolicyName).block(); + public Response getWithResponse(String resourceGroupName, String serverName, + SecurityAlertPolicyName securityAlertPolicyName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName, context).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 along with {@link Response}. + * @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(); + public ServerSecurityAlertPolicyInner get(String resourceGroupName, String serverName, + SecurityAlertPolicyName securityAlertPolicyName) { + return getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, Context.NONE).getValue(); } /** * 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. @@ -263,8 +257,8 @@ public Response getWithResponse(String resourceG * @return a server security alert policy along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String serverName, SecurityAlertPolicyName securityAlertPolicyName, ServerSecurityAlertPolicyInner parameters) { + public 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.")); @@ -299,7 +293,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * 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. @@ -347,7 +341,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * 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. @@ -355,10 +349,10 @@ private Mono>> createOrUpdateWithResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of a server security alert policy. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ServerSecurityAlertPolicyInner> + public PollerFlux, ServerSecurityAlertPolicyInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, ServerSecurityAlertPolicyInner parameters) { Mono>> mono @@ -370,7 +364,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * 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. @@ -379,7 +373,7 @@ private Mono>> createOrUpdateWithResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of a server security alert policy. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ServerSecurityAlertPolicyInner> @@ -396,7 +390,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * 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. @@ -404,19 +398,19 @@ private Mono>> createOrUpdateWithResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of a server security alert policy. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, ServerSecurityAlertPolicyInner parameters) { - return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters) + return this.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. @@ -425,19 +419,20 @@ public SyncPoller, ServerSecurityAler * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of a server security alert policy. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, ServerSecurityAlertPolicyInner parameters, Context context) { - return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters, context) + return this + .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. @@ -448,7 +443,7 @@ public SyncPoller, ServerSecurityAler * @return a server security alert policy on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String serverName, + public Mono createOrUpdateAsync(String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, ServerSecurityAlertPolicyInner parameters) { return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters).last() .flatMap(this.client::getLroFinalResultOrError); @@ -456,7 +451,7 @@ private Mono createOrUpdateAsync(String resource /** * 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. @@ -477,7 +472,7 @@ private Mono createOrUpdateAsync(String resource /** * 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. @@ -495,7 +490,7 @@ public ServerSecurityAlertPolicyInner createOrUpdate(String resourceGroupName, S /** * 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. @@ -514,14 +509,14 @@ public ServerSecurityAlertPolicyInner createOrUpdate(String resourceGroupName, S /** * Get the server's threat detection policies. - * + * * @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 server's threat detection policies along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerSinglePageAsync(String resourceGroupName, @@ -553,7 +548,7 @@ private Mono> listByServerSinglePa /** * Get the server's threat detection policies. - * + * * @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. @@ -561,7 +556,7 @@ private Mono> listByServerSinglePa * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return the server's threat detection policies along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerSinglePageAsync(String resourceGroupName, @@ -593,30 +588,30 @@ private Mono> listByServerSinglePa /** * Get the server's threat detection policies. - * + * * @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 server's threat detection policies. + * @return the server's threat detection policies as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + public PagedFlux listByServerAsync(String resourceGroupName, String serverName) { return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName), nextLink -> listByServerNextSinglePageAsync(nextLink)); } /** * Get the server's threat detection policies. - * + * * @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 server's threat detection policies. + * @return the server's threat detection policies as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync(String resourceGroupName, String serverName, @@ -627,13 +622,13 @@ private PagedFlux listByServerAsync(String resou /** * Get the server's threat detection policies. - * + * * @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 server's threat detection policies. + * @return the server's threat detection policies as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName) { @@ -642,14 +637,14 @@ public PagedIterable listByServer(String resourc /** * Get the server's threat detection policies. - * + * * @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 server's threat detection policies. + * @return the server's threat detection policies as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName, @@ -659,13 +654,13 @@ public PagedIterable listByServer(String resourc /** * Get the next page of items. - * - * @param nextLink The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of the server's security alert policies along with {@link PagedResponse} on successful completion - * of {@link Mono}. + * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerNextSinglePageAsync(String nextLink) { @@ -686,14 +681,14 @@ private Mono> listByServerNextSing /** * Get the next page of items. - * - * @param nextLink The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of the server's security alert policies along with {@link PagedResponse} on successful completion - * of {@link Mono}. + * of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerNextSinglePageAsync(String nextLink, diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPoliciesImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPoliciesImpl.java index e998570acda03..372a4f8d21499 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPoliciesImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPoliciesImpl.java @@ -14,11 +14,9 @@ import com.azure.resourcemanager.postgresql.models.SecurityAlertPolicyName; import com.azure.resourcemanager.postgresql.models.ServerSecurityAlertPolicies; import com.azure.resourcemanager.postgresql.models.ServerSecurityAlertPolicy; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class ServerSecurityAlertPoliciesImpl implements ServerSecurityAlertPolicies { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerSecurityAlertPoliciesImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(ServerSecurityAlertPoliciesImpl.class); private final ServerSecurityAlertPoliciesClient innerClient; @@ -30,17 +28,6 @@ public ServerSecurityAlertPoliciesImpl(ServerSecurityAlertPoliciesClient innerCl 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 @@ -53,56 +40,69 @@ public Response getWithResponse(String resourceGroupN } } + 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 PagedIterable listByServer(String resourceGroupName, String serverName) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); - return Utils.mapPage(inner, inner1 -> new ServerSecurityAlertPolicyImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ServerSecurityAlertPolicyImpl(inner1, this.manager())); } public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); - return Utils.mapPage(inner, inner1 -> new ServerSecurityAlertPolicyImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ServerSecurityAlertPolicyImpl(inner1, this.manager())); } public ServerSecurityAlertPolicy getById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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 securityAlertPolicyNameLocal = ResourceManagerUtils.getValueFromIdByName(id, "securityAlertPolicies"); + if (securityAlertPolicyNameLocal == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", id))); } + SecurityAlertPolicyName securityAlertPolicyName + = SecurityAlertPolicyName.fromString(securityAlertPolicyNameLocal); return this.getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, Context.NONE).getValue(); } public Response getByIdWithResponse(String id, Context context) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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 securityAlertPolicyNameLocal = ResourceManagerUtils.getValueFromIdByName(id, "securityAlertPolicies"); + if (securityAlertPolicyNameLocal == null) { + throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", id))); } + SecurityAlertPolicyName securityAlertPolicyName + = SecurityAlertPolicyName.fromString(securityAlertPolicyNameLocal); return this.getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, context); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPolicyImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPolicyImpl.java index d03f88a5f6321..44f643ca909d9 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPolicyImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPolicyImpl.java @@ -68,6 +68,10 @@ public Integer retentionDays() { return this.innerModel().retentionDays(); } + public String resourceGroupName() { + return resourceGroupName; + } + public ServerSecurityAlertPolicyInner innerModel() { return this.innerObject; } @@ -131,10 +135,10 @@ public ServerSecurityAlertPolicy apply(Context context) { com.azure.resourcemanager.postgresql.PostgreSqlManager 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")); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "servers"); + this.securityAlertPolicyName = SecurityAlertPolicyName + .fromString(ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "securityAlertPolicies")); } public ServerSecurityAlertPolicy refresh() { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServersClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServersClientImpl.java index c74dadd7c75b3..46bb90a30fd7f 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServersClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServersClientImpl.java @@ -31,7 +31,6 @@ 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.postgresql.fluent.ServersClient; @@ -43,19 +42,23 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in ServersClient. */ +/** + * 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. */ + /** + * The proxy service used to perform REST calls. + */ private final ServersService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final PostgreSqlManagementClientImpl client; /** * Initializes an instance of ServersClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ ServersClientImpl(PostgreSqlManagementClientImpl client) { @@ -69,10 +72,9 @@ public final class ServersClientImpl implements ServersClient { */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface ServersService { + public interface ServersService { @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}") + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}") @ExpectedResponses({ 200, 201, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create(@HostParam("$host") String endpoint, @@ -82,8 +84,7 @@ Mono>> create(@HostParam("$host") String endpoint, Context context); @Headers({ "Content-Type: application/json" }) - @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}") + @Patch("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}") @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> update(@HostParam("$host") String endpoint, @@ -93,8 +94,7 @@ Mono>> update(@HostParam("$host") String endpoint, Context context); @Headers({ "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}") + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}") @ExpectedResponses({ 200, 202, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete(@HostParam("$host") String endpoint, @@ -103,8 +103,7 @@ Mono>> delete(@HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> getByResourceGroup(@HostParam("$host") String endpoint, @@ -113,8 +112,7 @@ Mono> getByResourceGroup(@HostParam("$host") String endpoi @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroup(@HostParam("$host") String endpoint, @@ -131,8 +129,7 @@ Mono> list(@HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); @Headers({ "Content-Type: application/json" }) - @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/restart") + @Post("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/restart") @ExpectedResponses({ 200, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> restart(@HostParam("$host") String endpoint, @@ -143,7 +140,7 @@ Mono>> restart(@HostParam("$host") String endpoint, /** * Creates a new server, or will overwrite an 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. @@ -153,7 +150,7 @@ Mono>> restart(@HostParam("$host") String endpoint, * @return represents a server along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createWithResponseAsync(String resourceGroupName, String serverName, + public Mono>> createWithResponseAsync(String resourceGroupName, String serverName, ServerForCreate parameters) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -185,7 +182,7 @@ private Mono>> createWithResponseAsync(String resource /** * Creates a new server, or will overwrite an 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. @@ -227,17 +224,17 @@ private Mono>> createWithResponseAsync(String resource /** * Creates a new server, or will overwrite an 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of represents a server. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ServerInner> beginCreateAsync(String resourceGroupName, + public PollerFlux, ServerInner> beginCreateAsync(String resourceGroupName, String serverName, ServerForCreate parameters) { Mono>> mono = createWithResponseAsync(resourceGroupName, serverName, parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), @@ -246,7 +243,7 @@ private PollerFlux, ServerInner> beginCreateAsync(String /** * Creates a new server, or will overwrite an 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. @@ -254,7 +251,7 @@ private PollerFlux, ServerInner> beginCreateAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of represents a server. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ServerInner> beginCreateAsync(String resourceGroupName, @@ -268,24 +265,24 @@ private PollerFlux, ServerInner> beginCreateAsync(String /** * Creates a new server, or will overwrite an 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of represents a server. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ServerInner> beginCreate(String resourceGroupName, String serverName, ServerForCreate parameters) { - return beginCreateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + return this.beginCreateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); } /** * Creates a new server, or will overwrite an 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. @@ -293,17 +290,17 @@ public SyncPoller, ServerInner> beginCreate(String resou * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of represents a server. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ServerInner> beginCreate(String resourceGroupName, String serverName, ServerForCreate parameters, Context context) { - return beginCreateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + return this.beginCreateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); } /** * Creates a new server, or will overwrite an 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. @@ -313,14 +310,14 @@ public SyncPoller, ServerInner> beginCreate(String resou * @return represents a server on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync(String resourceGroupName, String serverName, ServerForCreate parameters) { + public Mono createAsync(String resourceGroupName, String serverName, ServerForCreate parameters) { return beginCreateAsync(resourceGroupName, serverName, parameters).last() .flatMap(this.client::getLroFinalResultOrError); } /** * Creates a new server, or will overwrite an 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. @@ -339,7 +336,7 @@ private Mono createAsync(String resourceGroupName, String serverNam /** * Creates a new server, or will overwrite an 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. @@ -355,7 +352,7 @@ public ServerInner create(String resourceGroupName, String serverName, ServerFor /** * Creates a new server, or will overwrite an 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. @@ -374,7 +371,7 @@ public ServerInner create(String resourceGroupName, String serverName, ServerFor /** * 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. @@ -384,7 +381,7 @@ public ServerInner create(String resourceGroupName, String serverName, ServerFor * @return represents a server along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> updateWithResponseAsync(String resourceGroupName, String serverName, + public Mono>> updateWithResponseAsync(String resourceGroupName, String serverName, ServerUpdateParameters parameters) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -417,7 +414,7 @@ private Mono>> updateWithResponseAsync(String resource /** * 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. @@ -460,17 +457,17 @@ private Mono>> updateWithResponseAsync(String resource /** * 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of represents a server. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, ServerInner> beginUpdateAsync(String resourceGroupName, + public PollerFlux, ServerInner> beginUpdateAsync(String resourceGroupName, String serverName, ServerUpdateParameters parameters) { Mono>> mono = updateWithResponseAsync(resourceGroupName, serverName, parameters); return this.client.getLroResult(mono, this.client.getHttpPipeline(), @@ -480,7 +477,7 @@ private PollerFlux, ServerInner> beginUpdateAsync(String /** * 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. @@ -488,7 +485,7 @@ private PollerFlux, ServerInner> beginUpdateAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of represents a server. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, ServerInner> beginUpdateAsync(String resourceGroupName, @@ -503,25 +500,25 @@ private PollerFlux, ServerInner> beginUpdateAsync(String /** * 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of represents a server. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ServerInner> beginUpdate(String resourceGroupName, String serverName, ServerUpdateParameters parameters) { - return beginUpdateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + return this.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. @@ -529,18 +526,18 @@ public SyncPoller, ServerInner> beginUpdate(String resou * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of represents a server. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, ServerInner> beginUpdate(String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context) { - return beginUpdateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); + return this.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. @@ -550,7 +547,7 @@ public SyncPoller, ServerInner> beginUpdate(String resou * @return represents a server on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String resourceGroupName, String serverName, + public Mono updateAsync(String resourceGroupName, String serverName, ServerUpdateParameters parameters) { return beginUpdateAsync(resourceGroupName, serverName, parameters).last() .flatMap(this.client::getLroFinalResultOrError); @@ -559,7 +556,7 @@ private Mono updateAsync(String resourceGroupName, String serverNam /** * 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. @@ -579,7 +576,7 @@ private Mono updateAsync(String resourceGroupName, String serverNam /** * 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. @@ -596,7 +593,7 @@ public ServerInner update(String resourceGroupName, String serverName, ServerUpd /** * 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. @@ -614,7 +611,7 @@ public ServerInner update(String resourceGroupName, String serverName, ServerUpd /** * 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. @@ -623,7 +620,7 @@ public ServerInner update(String resourceGroupName, String serverName, ServerUpd * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, String serverName) { + public 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.")); @@ -649,7 +646,7 @@ private Mono>> deleteWithResponseAsync(String resource /** * 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. @@ -685,16 +682,16 @@ private Mono>> deleteWithResponseAsync(String resource /** * 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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName) { + public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName) { Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); @@ -702,14 +699,14 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup /** * 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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName, @@ -722,39 +719,39 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup /** * 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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName) { - return beginDeleteAsync(resourceGroupName, serverName).getSyncPoller(); + return this.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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, Context context) { - return beginDeleteAsync(resourceGroupName, serverName, context).getSyncPoller(); + return this.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. @@ -763,13 +760,13 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String serverName) { + public 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. @@ -786,7 +783,7 @@ private Mono deleteAsync(String resourceGroupName, String serverName, Cont /** * 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. @@ -800,7 +797,7 @@ public 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. @@ -815,7 +812,7 @@ public 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. @@ -824,7 +821,7 @@ public void delete(String resourceGroupName, String serverName, Context context) * @return information about a server along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, + public Mono> getByResourceGroupWithResponseAsync(String resourceGroupName, String serverName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -851,7 +848,7 @@ private Mono> getByResourceGroupWithResponseAsync(String r /** * 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. @@ -887,7 +884,7 @@ private Mono> getByResourceGroupWithResponseAsync(String r /** * 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. @@ -896,52 +893,46 @@ private Mono> getByResourceGroupWithResponseAsync(String r * @return information about a server on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getByResourceGroupAsync(String resourceGroupName, String serverName) { + public 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(); - } - }); + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * 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. + * @return information about a server along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ServerInner getByResourceGroup(String resourceGroupName, String serverName) { - return getByResourceGroupAsync(resourceGroupName, serverName).block(); + public Response getByResourceGroupWithResponse(String resourceGroupName, String serverName, + Context context) { + return getByResourceGroupWithResponseAsync(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. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws 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 along with {@link Response}. + * @return information about a server. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getByResourceGroupWithResponse(String resourceGroupName, String serverName, - Context context) { - return getByResourceGroupWithResponseAsync(resourceGroupName, serverName, context).block(); + public ServerInner getByResourceGroup(String resourceGroupName, String serverName) { + return getByResourceGroupWithResponse(resourceGroupName, serverName, Context.NONE).getValue(); } /** * 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. @@ -974,7 +965,7 @@ private Mono> listByResourceGroupSinglePageAsync(Stri /** * 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. @@ -1009,27 +1000,27 @@ private Mono> listByResourceGroupSinglePageAsync(Stri /** * 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. + * @return a list of servers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByResourceGroupAsync(String resourceGroupName) { + public 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. + * @return a list of servers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { @@ -1038,12 +1029,12 @@ private PagedFlux listByResourceGroupAsync(String resourceGroupName /** * 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName) { @@ -1052,13 +1043,13 @@ public 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 ManagementException thrown if 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { @@ -1067,7 +1058,7 @@ public PagedIterable listByResourceGroup(String resourceGroupName, /** * 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 along with {@link PagedResponse} on successful completion of {@link Mono}. @@ -1094,7 +1085,7 @@ private Mono> 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. @@ -1121,24 +1112,24 @@ private Mono> listSinglePageAsync(Context 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. + * @return a list of servers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listAsync() { + public 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. + * @return a list of servers as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(Context context) { @@ -1147,10 +1138,10 @@ private PagedFlux listAsync(Context 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list() { @@ -1159,12 +1150,12 @@ public 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 ManagementException thrown if 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable list(Context context) { @@ -1173,7 +1164,7 @@ public 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. @@ -1182,7 +1173,7 @@ public PagedIterable list(Context context) { * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> restartWithResponseAsync(String resourceGroupName, String serverName) { + public 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.")); @@ -1208,7 +1199,7 @@ private Mono>> restartWithResponseAsync(String resourc /** * 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. @@ -1244,16 +1235,16 @@ private Mono>> restartWithResponseAsync(String resourc /** * 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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginRestartAsync(String resourceGroupName, String serverName) { + public PollerFlux, Void> beginRestartAsync(String resourceGroupName, String serverName) { Mono>> mono = restartWithResponseAsync(resourceGroupName, serverName); return this.client.getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, this.client.getContext()); @@ -1261,14 +1252,14 @@ private PollerFlux, Void> beginRestartAsync(String resourceGrou /** * 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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginRestartAsync(String resourceGroupName, String serverName, @@ -1281,39 +1272,39 @@ private PollerFlux, Void> beginRestartAsync(String resourceGrou /** * 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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginRestart(String resourceGroupName, String serverName) { - return beginRestartAsync(resourceGroupName, serverName).getSyncPoller(); + return this.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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginRestart(String resourceGroupName, String serverName, Context context) { - return beginRestartAsync(resourceGroupName, serverName, context).getSyncPoller(); + return this.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. @@ -1322,13 +1313,13 @@ public SyncPoller, Void> beginRestart(String resourceGroupName, * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono restartAsync(String resourceGroupName, String serverName) { + public 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. @@ -1345,7 +1336,7 @@ private Mono restartAsync(String resourceGroupName, String serverName, Con /** * 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. @@ -1359,7 +1350,7 @@ public 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. diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServersImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServersImpl.java index 7663755c52a8d..721f1feff6ffe 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServersImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServersImpl.java @@ -13,11 +13,9 @@ import com.azure.resourcemanager.postgresql.fluent.models.ServerInner; import com.azure.resourcemanager.postgresql.models.Server; import com.azure.resourcemanager.postgresql.models.Servers; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class ServersImpl implements Servers { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServersImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(ServersImpl.class); private final ServersClient innerClient; @@ -37,15 +35,6 @@ 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 @@ -58,24 +47,33 @@ public Response getByResourceGroupWithResponse(String resourceGroupName, } } + 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 PagedIterable listByResourceGroup(String resourceGroupName) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName); - return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); } public PagedIterable listByResourceGroup(String resourceGroupName, Context context) { PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context); - return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); } public PagedIterable list() { PagedIterable inner = this.serviceClient().list(); - return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); } public PagedIterable list(Context context) { PagedIterable inner = this.serviceClient().list(context); - return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); } public void restart(String resourceGroupName, String serverName) { @@ -87,56 +85,56 @@ public void restart(String resourceGroupName, String serverName, Context context } public Server getById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + throw LOGGER.logExceptionAsError(new IllegalArgumentException( String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } this.delete(resourceGroupName, serverName, context); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRuleImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRuleImpl.java index 0bbf04c09fdc6..134e4efee5949 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRuleImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRuleImpl.java @@ -39,6 +39,10 @@ public VirtualNetworkRuleState state() { return this.innerModel().state(); } + public String resourceGroupName() { + return resourceGroupName; + } + public VirtualNetworkRuleInner innerModel() { return this.innerObject; } @@ -101,9 +105,10 @@ public VirtualNetworkRule apply(Context context) { com.azure.resourcemanager.postgresql.PostgreSqlManager 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"); + this.resourceGroupName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "resourceGroups"); + this.serverName = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "servers"); + this.virtualNetworkRuleName + = ResourceManagerUtils.getValueFromIdByName(innerObject.id(), "virtualNetworkRules"); } public VirtualNetworkRule refresh() { diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRulesClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRulesClientImpl.java index ccfc62c4e8620..2899b1afa61bb 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRulesClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRulesClientImpl.java @@ -29,7 +29,6 @@ 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.postgresql.fluent.VirtualNetworkRulesClient; @@ -39,19 +38,23 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in VirtualNetworkRulesClient. */ +/** + * 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. */ + /** + * The proxy service used to perform REST calls. + */ private final VirtualNetworkRulesService service; - /** The service client containing this operation class. */ + /** + * The service client containing this operation class. + */ private final PostgreSqlManagementClientImpl client; /** * Initializes an instance of VirtualNetworkRulesClientImpl. - * + * * @param client the instance of the service client containing this operation class. */ VirtualNetworkRulesClientImpl(PostgreSqlManagementClientImpl client) { @@ -66,10 +69,9 @@ public final class VirtualNetworkRulesClientImpl implements VirtualNetworkRulesC */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface VirtualNetworkRulesService { + public interface VirtualNetworkRulesService { @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get(@HostParam("$host") String endpoint, @@ -79,8 +81,7 @@ Mono> get(@HostParam("$host") String endpoint, Context context); @Headers({ "Content-Type: application/json" }) - @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + @Put("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") @ExpectedResponses({ 200, 201, 202 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> createOrUpdate(@HostParam("$host") String endpoint, @@ -91,8 +92,7 @@ Mono>> createOrUpdate(@HostParam("$host") String endpo Context context); @Headers({ "Accept: application/json;q=0.9", "Content-Type: application/json" }) - @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + @Delete("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") @ExpectedResponses({ 200, 202, 204 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete(@HostParam("$host") String endpoint, @@ -102,8 +102,7 @@ Mono>> delete(@HostParam("$host") String endpoint, Context context); @Headers({ "Content-Type: application/json" }) - @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" - + "/servers/{serverName}/virtualNetworkRules") + @Get("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL/servers/{serverName}/virtualNetworkRules") @ExpectedResponses({ 200 }) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByServer(@HostParam("$host") String endpoint, @@ -122,7 +121,7 @@ Mono> listByServerNext( /** * 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. @@ -132,7 +131,7 @@ Mono> listByServerNext( * @return a virtual network rule along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> getWithResponseAsync(String resourceGroupName, String serverName, + public Mono> getWithResponseAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -163,7 +162,7 @@ private Mono> getWithResponseAsync(String reso /** * 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. @@ -204,7 +203,7 @@ private Mono> getWithResponseAsync(String reso /** * 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. @@ -214,55 +213,49 @@ private Mono> getWithResponseAsync(String reso * @return a virtual network rule on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono getAsync(String resourceGroupName, String serverName, + public 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(); - } - }); + .flatMap(res -> Mono.justOrEmpty(res.getValue())); } /** * 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. + * @return a virtual network rule along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public VirtualNetworkRuleInner get(String resourceGroupName, String serverName, String virtualNetworkRuleName) { - return getAsync(resourceGroupName, serverName, virtualNetworkRuleName).block(); + public Response getWithResponse(String resourceGroupName, String serverName, + String virtualNetworkRuleName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, context).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 along with {@link Response}. + * @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(); + public VirtualNetworkRuleInner get(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, Context.NONE).getValue(); } /** * 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. @@ -273,8 +266,8 @@ public Response getWithResponse(String resourceGroupNam * @return a virtual network rule along with {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createOrUpdateWithResponseAsync(String resourceGroupName, - String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { + public 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.")); @@ -309,7 +302,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * 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. @@ -356,7 +349,7 @@ private Mono>> createOrUpdateWithResponseAsync(String /** * 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. @@ -364,10 +357,10 @@ private Mono>> createOrUpdateWithResponseAsync(String * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of a virtual network rule. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, VirtualNetworkRuleInner> beginCreateOrUpdateAsync( + public PollerFlux, VirtualNetworkRuleInner> beginCreateOrUpdateAsync( String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { Mono>> mono @@ -379,7 +372,7 @@ private PollerFlux, VirtualNetworkRuleInner> /** * 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. @@ -388,7 +381,7 @@ private PollerFlux, VirtualNetworkRuleInner> * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of a virtual network rule. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, VirtualNetworkRuleInner> beginCreateOrUpdateAsync( @@ -403,7 +396,7 @@ private PollerFlux, VirtualNetworkRuleInner> /** * 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. @@ -411,19 +404,19 @@ private PollerFlux, VirtualNetworkRuleInner> * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of a virtual network rule. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { - return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters) + return this.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. @@ -432,19 +425,19 @@ public SyncPoller, VirtualNetworkRuleInner> * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException 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 along with {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of a virtual network rule. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters, Context context) { - return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context) + return this.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. @@ -455,7 +448,7 @@ public SyncPoller, VirtualNetworkRuleInner> * @return a virtual network rule on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createOrUpdateAsync(String resourceGroupName, String serverName, + public Mono createOrUpdateAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters) { return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).last() .flatMap(this.client::getLroFinalResultOrError); @@ -463,7 +456,7 @@ private Mono createOrUpdateAsync(String resourceGroupNa /** * 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. @@ -484,7 +477,7 @@ private Mono createOrUpdateAsync(String resourceGroupNa /** * 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. @@ -502,7 +495,7 @@ public VirtualNetworkRuleInner createOrUpdate(String resourceGroupName, String s /** * 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. @@ -521,7 +514,7 @@ public VirtualNetworkRuleInner createOrUpdate(String resourceGroupName, String s /** * 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. @@ -531,7 +524,7 @@ public VirtualNetworkRuleInner createOrUpdate(String resourceGroupName, String s * @return the {@link Response} on successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> deleteWithResponseAsync(String resourceGroupName, String serverName, + public Mono>> deleteWithResponseAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { if (this.client.getEndpoint() == null) { return Mono.error( @@ -561,7 +554,7 @@ private Mono>> deleteWithResponseAsync(String resource /** * 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. @@ -601,17 +594,17 @@ private Mono>> deleteWithResponseAsync(String resource /** * 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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName, + public PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName); @@ -621,7 +614,7 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup /** * 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. @@ -629,7 +622,7 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link PollerFlux} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName, @@ -643,24 +636,24 @@ private PollerFlux, Void> beginDeleteAsync(String resourceGroup /** * 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 {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String virtualNetworkRuleName) { - return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName).getSyncPoller(); + return this.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. @@ -668,17 +661,17 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the {@link Response} on successful completion of {@link Mono}. + * @return the {@link SyncPoller} for polling of long-running operation. */ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { - return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName, context).getSyncPoller(); + return this.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. @@ -688,14 +681,14 @@ public SyncPoller, Void> beginDelete(String resourceGroupName, * @return A {@link Mono} that completes when a successful response is received. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono deleteAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + public 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. @@ -714,7 +707,7 @@ private Mono deleteAsync(String resourceGroupName, String serverName, Stri /** * 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. @@ -729,7 +722,7 @@ public void delete(String resourceGroupName, String serverName, String virtualNe /** * 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. @@ -745,14 +738,14 @@ public void delete(String resourceGroupName, String serverName, String virtualNe /** * 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 along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerSinglePageAsync(String resourceGroupName, @@ -784,7 +777,7 @@ private Mono> listByServerSinglePageAsync /** * 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. @@ -792,7 +785,7 @@ private Mono> listByServerSinglePageAsync * @throws ManagementException thrown if 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 along with {@link PagedResponse} on successful completion of - * {@link Mono}. + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerSinglePageAsync(String resourceGroupName, @@ -824,30 +817,30 @@ private Mono> listByServerSinglePageAsync /** * 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. + * @return a list of virtual network rules in a server as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + public 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. + * @return a list of virtual network rules in a server as paginated response with {@link PagedFlux}. */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync(String resourceGroupName, String serverName, @@ -858,13 +851,13 @@ private PagedFlux listByServerAsync(String resourceGrou /** * 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. + * @return a list of virtual network rules in a server as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName) { @@ -873,14 +866,14 @@ public PagedIterable listByServer(String resourceGroupN /** * 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. + * @return a list of virtual network rules in a server as paginated response with {@link PagedIterable}. */ @ServiceMethod(returns = ReturnType.COLLECTION) public PagedIterable listByServer(String resourceGroupName, String serverName, @@ -890,13 +883,13 @@ public PagedIterable listByServer(String resourceGroupN /** * Get the next page of items. - * - * @param nextLink The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if 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 along with {@link PagedResponse} on successful completion of {@link - * Mono}. + * @return a list of virtual network rules along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerNextSinglePageAsync(String nextLink) { @@ -917,14 +910,14 @@ private Mono> listByServerNextSinglePageA /** * Get the next page of items. - * - * @param nextLink The nextLink parameter. + * + * @param nextLink The URL to get the next list of items. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if 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 along with {@link PagedResponse} on successful completion of {@link - * Mono}. + * @return a list of virtual network rules along with {@link PagedResponse} on successful completion of + * {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> listByServerNextSinglePageAsync(String nextLink, diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRulesImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRulesImpl.java index cbec849829910..70aebf7fa4d9d 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRulesImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRulesImpl.java @@ -13,11 +13,9 @@ import com.azure.resourcemanager.postgresql.fluent.models.VirtualNetworkRuleInner; import com.azure.resourcemanager.postgresql.models.VirtualNetworkRule; import com.azure.resourcemanager.postgresql.models.VirtualNetworkRules; -import com.fasterxml.jackson.annotation.JsonIgnore; public final class VirtualNetworkRulesImpl implements VirtualNetworkRules { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(VirtualNetworkRulesImpl.class); + private static final ClientLogger LOGGER = new ClientLogger(VirtualNetworkRulesImpl.class); private final VirtualNetworkRulesClient innerClient; @@ -29,15 +27,6 @@ public VirtualNetworkRulesImpl(VirtualNetworkRulesClient 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 @@ -50,6 +39,15 @@ public Response getWithResponse(String resourceGroupName, St } } + 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 void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName) { this.serviceClient().delete(resourceGroupName, serverName, virtualNetworkRuleName); } @@ -60,87 +58,87 @@ public void delete(String resourceGroupName, String serverName, String virtualNe public PagedIterable listByServer(String resourceGroupName, String serverName) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); - return Utils.mapPage(inner, inner1 -> new VirtualNetworkRuleImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new VirtualNetworkRuleImpl(inner1, this.manager())); } public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context); - return Utils.mapPage(inner, inner1 -> new VirtualNetworkRuleImpl(inner1, this.manager())); + return ResourceManagerUtils.mapPage(inner, inner1 -> new VirtualNetworkRuleImpl(inner1, this.manager())); } public VirtualNetworkRule getById(String id) { - String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String virtualNetworkRuleName = ResourceManagerUtils.getValueFromIdByName(id, "virtualNetworkRules"); if (virtualNetworkRuleName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String virtualNetworkRuleName = ResourceManagerUtils.getValueFromIdByName(id, "virtualNetworkRules"); if (virtualNetworkRuleName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String virtualNetworkRuleName = ResourceManagerUtils.getValueFromIdByName(id, "virtualNetworkRules"); if (virtualNetworkRuleName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String resourceGroupName = ResourceManagerUtils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String serverName = ResourceManagerUtils.getValueFromIdByName(id, "servers"); if (serverName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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"); + String virtualNetworkRuleName = ResourceManagerUtils.getValueFromIdByName(id, "virtualNetworkRules"); if (virtualNetworkRuleName == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( + 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); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/package-info.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/package-info.java index 74f1ddc8dcf47..46fe20c952caa 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/package-info.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/package-info.java @@ -3,8 +3,9 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * Package containing the implementations for PostgreSqlManagementClient. The Microsoft Azure management API provides - * create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall - * rules, VNET rules, security alert policies, log files and configurations with new business model. + * Package containing the implementations for PostgreSqlManagementClient. + * The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL + * resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and + * configurations with new business model. */ package com.azure.resourcemanager.postgresql.implementation; diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/AdministratorType.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/AdministratorType.java index 90705162efb94..c2013643b46db 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/AdministratorType.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/AdministratorType.java @@ -4,15 +4,18 @@ package com.azure.resourcemanager.postgresql.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** Defines values for AdministratorType. */ +/** + * The type of administrator. + */ public enum AdministratorType { - /** Enum value ActiveDirectory. */ + /** + * Enum value ActiveDirectory. + */ ACTIVE_DIRECTORY("ActiveDirectory"); - /** The actual serialized value for a AdministratorType instance. */ + /** + * The actual serialized value for a AdministratorType instance. + */ private final String value; AdministratorType(String value) { @@ -21,12 +24,14 @@ public enum AdministratorType { /** * Parses a serialized value to a AdministratorType instance. - * + * * @param value the serialized value to parse. * @return the parsed AdministratorType object, or null if unable to parse. */ - @JsonCreator public static AdministratorType fromString(String value) { + if (value == null) { + return null; + } AdministratorType[] items = AdministratorType.values(); for (AdministratorType item : items) { if (item.toString().equalsIgnoreCase(value)) { @@ -36,7 +41,9 @@ public static AdministratorType fromString(String value) { return null; } - @JsonValue + /** + * {@inheritDoc} + */ @Override public String toString() { return this.value; diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/CheckNameAvailabilities.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/CheckNameAvailabilities.java index 566075005f100..c367ea76c6b57 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/CheckNameAvailabilities.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/CheckNameAvailabilities.java @@ -7,28 +7,30 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of CheckNameAvailabilities. */ +/** + * 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. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown 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. + * @return represents a resource name availability along with {@link Response}. */ - NameAvailability execute(NameAvailabilityRequest nameAvailabilityRequest); + Response executeWithResponse(NameAvailabilityRequest nameAvailabilityRequest, Context context); /** * 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 along with {@link Response}. + * @return represents a resource name availability. */ - Response executeWithResponse(NameAvailabilityRequest nameAvailabilityRequest, Context context); + NameAvailability execute(NameAvailabilityRequest nameAvailabilityRequest); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Configuration.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Configuration.java index eefaa588fa655..ef5f6a4e097eb 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Configuration.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Configuration.java @@ -7,94 +7,111 @@ import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationInner; -/** An immutable client-side representation of Configuration. */ +/** + * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + /** * Gets the inner com.azure.resourcemanager.postgresql.fluent.models.ConfigurationInner object. - * + * * @return the inner object. */ ConfigurationInner innerModel(); - /** The entirety of the Configuration definition. */ + /** + * The entirety of the Configuration definition. + */ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } - /** The Configuration definition stages. */ + /** + * The Configuration definition stages. + */ interface DefinitionStages { - /** The first stage of the Configuration definition. */ + /** + * The first stage of the Configuration definition. + */ interface Blank extends WithParentResource { } - /** The stage of the Configuration definition allowing to specify parent resource. */ + /** + * 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. @@ -109,36 +126,40 @@ interface WithParentResource { 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. */ + /** + * 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. */ + /** + * 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. */ @@ -148,47 +169,55 @@ interface WithSource { /** * Begins update for the Configuration resource. - * + * * @return the stage of resource update. */ Configuration.Update update(); - /** The template for Configuration 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. */ + /** + * The Configuration update stages. + */ interface UpdateStages { - /** The stage of the Configuration update allowing to specify value. */ + /** + * 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. */ + /** + * 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. */ @@ -198,14 +227,14 @@ interface WithSource { /** * 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. */ diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ConfigurationListResult.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ConfigurationListResult.java index 989f6cd336b81..2c59c3cc1a665 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ConfigurationListResult.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ConfigurationListResult.java @@ -7,18 +7,20 @@ import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationListResultInner; import java.util.List; -/** An immutable client-side representation of ConfigurationListResult. */ +/** + * 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.postgresql.fluent.models.ConfigurationListResultInner object. - * + * * @return the inner object. */ ConfigurationListResultInner innerModel(); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Configurations.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Configurations.java index 11b95a12cb493..586b76e2c2147 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Configurations.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Configurations.java @@ -8,64 +8,66 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of Configurations. */ +/** + * 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. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.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. + * @return information about a configuration of server along with {@link Response}. */ - Configuration get(String resourceGroupName, String serverName, String configurationName); + Response getWithResponse(String resourceGroupName, String serverName, String configurationName, + 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. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.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 along with {@link Response}. + * @return information about a configuration of server. */ - Response getWithResponse(String resourceGroupName, String serverName, String configurationName, - Context context); + Configuration get(String resourceGroupName, String serverName, String configurationName); /** * 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. + * @return a list of server configurations as paginated response with {@link PagedIterable}. */ 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. + * @return a list of server configurations as paginated response with {@link PagedIterable}. */ 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. @@ -76,7 +78,7 @@ Response getWithResponse(String resourceGroupName, String serverN /** * 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. @@ -88,7 +90,7 @@ Response getWithResponse(String resourceGroupName, String serverN /** * Begins definition for a new Configuration resource. - * + * * @param name resource name. * @return the first stage of the new Configuration definition. */ diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/CreateMode.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/CreateMode.java index 261635242333a..7a79a6a204acc 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/CreateMode.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/CreateMode.java @@ -5,35 +5,56 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for CreateMode. */ +/** + * The mode to create a new server. + */ public final class CreateMode extends ExpandableStringEnum { - /** Static value Default for CreateMode. */ + /** + * Static value Default for CreateMode. + */ public static final CreateMode DEFAULT = fromString("Default"); - /** Static value PointInTimeRestore for CreateMode. */ + /** + * Static value PointInTimeRestore for CreateMode. + */ public static final CreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); - /** Static value GeoRestore for CreateMode. */ + /** + * Static value GeoRestore for CreateMode. + */ public static final CreateMode GEO_RESTORE = fromString("GeoRestore"); - /** Static value Replica for CreateMode. */ + /** + * Static value Replica for CreateMode. + */ public static final CreateMode REPLICA = fromString("Replica"); + /** + * Creates a new instance of CreateMode value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public CreateMode() { + } + /** * 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. */ + /** + * Gets known CreateMode values. + * + * @return known CreateMode values. + */ public static Collection values() { return values(CreateMode.class); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Database.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Database.java index a05db3ec9fb91..292a7b3d617ea 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Database.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Database.java @@ -7,66 +7,83 @@ import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.fluent.models.DatabaseInner; -/** An immutable client-side representation of Database. */ +/** + * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + /** * Gets the inner com.azure.resourcemanager.postgresql.fluent.models.DatabaseInner object. - * + * * @return the inner object. */ DatabaseInner innerModel(); - /** The entirety of the Database definition. */ + /** + * The entirety of the Database definition. + */ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } - /** The Database definition stages. */ + /** + * The Database definition stages. + */ interface DefinitionStages { - /** The first stage of the Database definition. */ + /** + * The first stage of the Database definition. + */ interface Blank extends WithParentResource { } - /** The stage of the Database definition allowing to specify parent resource. */ + /** + * 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. @@ -81,36 +98,40 @@ interface WithParentResource { 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. */ + /** + * 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. */ + /** + * 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. */ @@ -120,47 +141,55 @@ interface WithCollation { /** * Begins update for the Database resource. - * + * * @return the stage of resource update. */ Database.Update update(); - /** The template for Database 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. */ + /** + * The Database update stages. + */ interface UpdateStages { - /** The stage of the Database update allowing to specify charset. */ + /** + * 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. */ + /** + * 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. */ @@ -170,14 +199,14 @@ interface WithCollation { /** * 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. */ diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/DatabaseListResult.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/DatabaseListResult.java index 1c6e624f6897d..fc107e021c741 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/DatabaseListResult.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/DatabaseListResult.java @@ -5,27 +5,33 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.fluent.models.DatabaseInner; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** A List of databases. */ +/** + * A List of databases. + */ @Fluent -public final class DatabaseListResult { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(DatabaseListResult.class); - +public final class DatabaseListResult implements JsonSerializable { /* * The list of databases housed in a server */ - @JsonProperty(value = "value") private List value; + /** + * Creates an instance of DatabaseListResult class. + */ + public DatabaseListResult() { + } + /** * Get the value property: The list of databases housed in a server. - * + * * @return the value value. */ public List value() { @@ -34,7 +40,7 @@ public List 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. */ @@ -45,7 +51,7 @@ public DatabaseListResult withValue(List value) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -53,4 +59,41 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of DatabaseListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of DatabaseListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the DatabaseListResult. + */ + public static DatabaseListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + DatabaseListResult deserializedDatabaseListResult = new DatabaseListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> DatabaseInner.fromJson(reader1)); + deserializedDatabaseListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedDatabaseListResult; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Databases.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Databases.java index cd6453a5ba68d..22fcc0b135bcc 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Databases.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Databases.java @@ -8,11 +8,13 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of Databases. */ +/** + * 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. @@ -24,7 +26,7 @@ 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. @@ -37,60 +39,60 @@ public interface Databases { /** * 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. + * @return information about a database along with {@link Response}. */ - Database get(String resourceGroupName, String serverName, String databaseName); + Response getWithResponse(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. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.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 along with {@link Response}. + * @return information about a database. */ - Response getWithResponse(String resourceGroupName, String serverName, String databaseName, - Context context); + Database get(String resourceGroupName, String serverName, String databaseName); /** * 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. + * @return a List of databases as paginated response with {@link PagedIterable}. */ 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. + * @return a List of databases as paginated response with {@link PagedIterable}. */ 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. @@ -101,7 +103,7 @@ Response getWithResponse(String resourceGroupName, String serverName, /** * 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. @@ -113,7 +115,7 @@ Response getWithResponse(String resourceGroupName, String serverName, /** * 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. @@ -123,7 +125,7 @@ Response getWithResponse(String resourceGroupName, String serverName, /** * 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. @@ -134,7 +136,7 @@ Response getWithResponse(String resourceGroupName, String serverName, /** * Begins definition for a new Database resource. - * + * * @param name resource name. * @return the first stage of the new Database definition. */ diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/FirewallRule.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/FirewallRule.java index 87d94256fbb77..ccfa7bcb88f6e 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/FirewallRule.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/FirewallRule.java @@ -7,66 +7,83 @@ import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.fluent.models.FirewallRuleInner; -/** An immutable client-side representation of FirewallRule. */ +/** + * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + /** * Gets the inner com.azure.resourcemanager.postgresql.fluent.models.FirewallRuleInner object. - * + * * @return the inner object. */ FirewallRuleInner innerModel(); - /** The entirety of the FirewallRule definition. */ + /** + * The entirety of the FirewallRule definition. + */ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithStartIpAddress, DefinitionStages.WithEndIpAddress, DefinitionStages.WithCreate { } - /** The FirewallRule definition stages. */ + /** + * The FirewallRule definition stages. + */ interface DefinitionStages { - /** The first stage of the FirewallRule definition. */ + /** + * The first stage of the FirewallRule definition. + */ interface Blank extends WithParentResource { } - /** The stage of the FirewallRule definition allowing to specify parent resource. */ + /** + * 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. @@ -74,24 +91,28 @@ interface WithParentResource { WithStartIpAddress withExistingServer(String resourceGroupName, String serverName); } - /** The stage of the FirewallRule definition allowing to specify startIpAddress. */ + /** + * 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. */ + /** + * 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. */ @@ -105,14 +126,14 @@ interface WithEndIpAddress { 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. */ @@ -122,49 +143,57 @@ interface WithCreate { /** * Begins update for the FirewallRule resource. - * + * * @return the stage of resource update. */ FirewallRule.Update update(); - /** The template for FirewallRule 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. */ + /** + * The FirewallRule update stages. + */ interface UpdateStages { - /** The stage of the FirewallRule update allowing to specify startIpAddress. */ + /** + * 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. */ + /** + * 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. */ @@ -174,14 +203,14 @@ interface WithEndIpAddress { /** * 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. */ diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/FirewallRuleListResult.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/FirewallRuleListResult.java index 6f65b2aa6883c..9ba2245f8ce11 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/FirewallRuleListResult.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/FirewallRuleListResult.java @@ -5,27 +5,33 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.fluent.models.FirewallRuleInner; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** A list of firewall rules. */ +/** + * A list of firewall rules. + */ @Fluent -public final class FirewallRuleListResult { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(FirewallRuleListResult.class); - +public final class FirewallRuleListResult implements JsonSerializable { /* * The list of firewall rules in a server. */ - @JsonProperty(value = "value") private List value; + /** + * Creates an instance of FirewallRuleListResult class. + */ + public FirewallRuleListResult() { + } + /** * Get the value property: The list of firewall rules in a server. - * + * * @return the value value. */ public List value() { @@ -34,7 +40,7 @@ public List 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. */ @@ -45,7 +51,7 @@ public FirewallRuleListResult withValue(List value) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -53,4 +59,41 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of FirewallRuleListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of FirewallRuleListResult if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the FirewallRuleListResult. + */ + public static FirewallRuleListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + FirewallRuleListResult deserializedFirewallRuleListResult = new FirewallRuleListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> FirewallRuleInner.fromJson(reader1)); + deserializedFirewallRuleListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedFirewallRuleListResult; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/FirewallRules.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/FirewallRules.java index 4d526223164c3..b6dd9987d8fc8 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/FirewallRules.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/FirewallRules.java @@ -8,11 +8,13 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of FirewallRules. */ +/** + * 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. @@ -24,7 +26,7 @@ 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. @@ -37,60 +39,60 @@ public interface FirewallRules { /** * 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. + * @return information about a server firewall rule along with {@link Response}. */ - FirewallRule get(String resourceGroupName, String serverName, String firewallRuleName); + Response getWithResponse(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. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.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 along with {@link Response}. + * @return information about a server firewall rule. */ - Response getWithResponse(String resourceGroupName, String serverName, String firewallRuleName, - Context context); + FirewallRule get(String resourceGroupName, String serverName, String firewallRuleName); /** * 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. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. */ 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. + * @return a list of firewall rules as paginated response with {@link PagedIterable}. */ 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. @@ -101,7 +103,7 @@ Response getWithResponse(String resourceGroupName, String serverNa /** * 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. @@ -113,7 +115,7 @@ Response getWithResponse(String resourceGroupName, String serverNa /** * 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. @@ -123,7 +125,7 @@ Response getWithResponse(String resourceGroupName, String serverNa /** * 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. @@ -134,7 +136,7 @@ Response getWithResponse(String resourceGroupName, String serverNa /** * Begins definition for a new FirewallRule resource. - * + * * @param name resource name. * @return the first stage of the new FirewallRule definition. */ diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/GeoRedundantBackup.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/GeoRedundantBackup.java index 0f21c9763b178..6954026c45f71 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/GeoRedundantBackup.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/GeoRedundantBackup.java @@ -5,29 +5,46 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for GeoRedundantBackup. */ +/** + * Enable Geo-redundant or not for server backup. + */ public final class GeoRedundantBackup extends ExpandableStringEnum { - /** Static value Enabled for GeoRedundantBackup. */ + /** + * Static value Enabled for GeoRedundantBackup. + */ public static final GeoRedundantBackup ENABLED = fromString("Enabled"); - /** Static value Disabled for GeoRedundantBackup. */ + /** + * Static value Disabled for GeoRedundantBackup. + */ public static final GeoRedundantBackup DISABLED = fromString("Disabled"); + /** + * Creates a new instance of GeoRedundantBackup value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public GeoRedundantBackup() { + } + /** * 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. */ + /** + * Gets known GeoRedundantBackup values. + * + * @return known GeoRedundantBackup values. + */ public static Collection values() { return values(GeoRedundantBackup.class); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/IdentityType.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/IdentityType.java index 01d6e4ec7d7b2..7bfd907451847 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/IdentityType.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/IdentityType.java @@ -5,26 +5,42 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for IdentityType. */ +/** + * The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active Directory + * principal for the resource. + */ public final class IdentityType extends ExpandableStringEnum { - /** Static value SystemAssigned for IdentityType. */ + /** + * Static value SystemAssigned for IdentityType. + */ public static final IdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + /** + * Creates a new instance of IdentityType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public IdentityType() { + } + /** * Creates or finds a IdentityType from its string representation. - * + * * @param name a name to look for. * @return the corresponding IdentityType. */ - @JsonCreator public static IdentityType fromString(String name) { return fromString(name, IdentityType.class); } - /** @return known IdentityType values. */ + /** + * Gets known IdentityType values. + * + * @return known IdentityType values. + */ public static Collection values() { return values(IdentityType.class); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/InfrastructureEncryption.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/InfrastructureEncryption.java index daf24145f3655..fbda03164157d 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/InfrastructureEncryption.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/InfrastructureEncryption.java @@ -5,29 +5,47 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for InfrastructureEncryption. */ +/** + * Add a second layer of encryption for your data using new encryption algorithm which gives additional data protection. + * Value is optional but if passed in, must be 'Disabled' or 'Enabled'. + */ public final class InfrastructureEncryption extends ExpandableStringEnum { - /** Static value Enabled for InfrastructureEncryption. */ + /** + * Static value Enabled for InfrastructureEncryption. + */ public static final InfrastructureEncryption ENABLED = fromString("Enabled"); - /** Static value Disabled for InfrastructureEncryption. */ + /** + * Static value Disabled for InfrastructureEncryption. + */ public static final InfrastructureEncryption DISABLED = fromString("Disabled"); + /** + * Creates a new instance of InfrastructureEncryption value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public InfrastructureEncryption() { + } + /** * Creates or finds a InfrastructureEncryption from its string representation. - * + * * @param name a name to look for. * @return the corresponding InfrastructureEncryption. */ - @JsonCreator public static InfrastructureEncryption fromString(String name) { return fromString(name, InfrastructureEncryption.class); } - /** @return known InfrastructureEncryption values. */ + /** + * Gets known InfrastructureEncryption values. + * + * @return known InfrastructureEncryption values. + */ public static Collection values() { return values(InfrastructureEncryption.class); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/LocationBasedPerformanceTiers.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/LocationBasedPerformanceTiers.java index 8a1bd181effc7..462b424aa6035 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/LocationBasedPerformanceTiers.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/LocationBasedPerformanceTiers.java @@ -7,28 +7,30 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; -/** Resource collection API of LocationBasedPerformanceTiers. */ +/** + * 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. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ 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. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ PagedIterable list(String locationName, Context context); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/LogFile.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/LogFile.java index c10c01046c5f2..c6172ff94dd91 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/LogFile.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/LogFile.java @@ -7,67 +7,69 @@ import com.azure.resourcemanager.postgresql.fluent.models.LogFileInner; import java.time.OffsetDateTime; -/** An immutable client-side representation of LogFile. */ +/** + * 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.postgresql.fluent.models.LogFileInner object. - * + * * @return the inner object. */ LogFileInner innerModel(); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/LogFileListResult.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/LogFileListResult.java index 66c0c261a6e69..b9580c3a9f1e4 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/LogFileListResult.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/LogFileListResult.java @@ -5,27 +5,33 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.fluent.models.LogFileInner; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** A list of log files. */ +/** + * A list of log files. + */ @Fluent -public final class LogFileListResult { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(LogFileListResult.class); - +public final class LogFileListResult implements JsonSerializable { /* * The list of log files. */ - @JsonProperty(value = "value") private List value; + /** + * Creates an instance of LogFileListResult class. + */ + public LogFileListResult() { + } + /** * Get the value property: The list of log files. - * + * * @return the value value. */ public List value() { @@ -34,7 +40,7 @@ public List value() { /** * Set the value property: The list of log files. - * + * * @param value the value value to set. * @return the LogFileListResult object itself. */ @@ -45,7 +51,7 @@ public LogFileListResult withValue(List value) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -53,4 +59,41 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of LogFileListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of LogFileListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the LogFileListResult. + */ + public static LogFileListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + LogFileListResult deserializedLogFileListResult = new LogFileListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> LogFileInner.fromJson(reader1)); + deserializedLogFileListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedLogFileListResult; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/LogFiles.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/LogFiles.java index 256ab02e39714..3a56b4f7ed2a6 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/LogFiles.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/LogFiles.java @@ -7,30 +7,32 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; -/** Resource collection API of LogFiles. */ +/** + * 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. + * @return a list of log files as paginated response with {@link PagedIterable}. */ 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. + * @return a list of log files as paginated response with {@link PagedIterable}. */ PagedIterable listByServer(String resourceGroupName, String serverName, Context context); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/MinimalTlsVersionEnum.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/MinimalTlsVersionEnum.java index e7f4484e3a198..a5942c434fd6a 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/MinimalTlsVersionEnum.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/MinimalTlsVersionEnum.java @@ -5,35 +5,56 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for MinimalTlsVersionEnum. */ +/** + * Enforce a minimal Tls version for the server. + */ public final class MinimalTlsVersionEnum extends ExpandableStringEnum { - /** Static value TLS1_0 for MinimalTlsVersionEnum. */ + /** + * Static value TLS1_0 for MinimalTlsVersionEnum. + */ public static final MinimalTlsVersionEnum TLS1_0 = fromString("TLS1_0"); - /** Static value TLS1_1 for MinimalTlsVersionEnum. */ + /** + * Static value TLS1_1 for MinimalTlsVersionEnum. + */ public static final MinimalTlsVersionEnum TLS1_1 = fromString("TLS1_1"); - /** Static value TLS1_2 for MinimalTlsVersionEnum. */ + /** + * Static value TLS1_2 for MinimalTlsVersionEnum. + */ public static final MinimalTlsVersionEnum TLS1_2 = fromString("TLS1_2"); - /** Static value TLSEnforcementDisabled for MinimalTlsVersionEnum. */ + /** + * Static value TLSEnforcementDisabled for MinimalTlsVersionEnum. + */ public static final MinimalTlsVersionEnum TLSENFORCEMENT_DISABLED = fromString("TLSEnforcementDisabled"); + /** + * Creates a new instance of MinimalTlsVersionEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public MinimalTlsVersionEnum() { + } + /** * Creates or finds a MinimalTlsVersionEnum from its string representation. - * + * * @param name a name to look for. * @return the corresponding MinimalTlsVersionEnum. */ - @JsonCreator public static MinimalTlsVersionEnum fromString(String name) { return fromString(name, MinimalTlsVersionEnum.class); } - /** @return known MinimalTlsVersionEnum values. */ + /** + * Gets known MinimalTlsVersionEnum values. + * + * @return known MinimalTlsVersionEnum values. + */ public static Collection values() { return values(MinimalTlsVersionEnum.class); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/NameAvailability.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/NameAvailability.java index b70b7b718ecf5..63d5fba5a823b 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/NameAvailability.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/NameAvailability.java @@ -6,32 +6,34 @@ import com.azure.resourcemanager.postgresql.fluent.models.NameAvailabilityInner; -/** An immutable client-side representation of NameAvailability. */ +/** + * 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.postgresql.fluent.models.NameAvailabilityInner object. - * + * * @return the inner object. */ NameAvailabilityInner innerModel(); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/NameAvailabilityRequest.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/NameAvailabilityRequest.java index 2e1b2bb7928ae..6b7c3443ba589 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/NameAvailabilityRequest.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/NameAvailabilityRequest.java @@ -6,30 +6,36 @@ 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.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** Request from client to check resource name availability. */ +/** + * Request from client to check resource name availability. + */ @Fluent -public final class NameAvailabilityRequest { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(NameAvailabilityRequest.class); - +public final class NameAvailabilityRequest implements JsonSerializable { /* * Resource name to verify. */ - @JsonProperty(value = "name", required = true) private String name; /* * Resource type used for verification. */ - @JsonProperty(value = "type") private String type; + /** + * Creates an instance of NameAvailabilityRequest class. + */ + public NameAvailabilityRequest() { + } + /** * Get the name property: Resource name to verify. - * + * * @return the name value. */ public String name() { @@ -38,7 +44,7 @@ public String name() { /** * Set the name property: Resource name to verify. - * + * * @param name the name value to set. * @return the NameAvailabilityRequest object itself. */ @@ -49,7 +55,7 @@ public NameAvailabilityRequest withName(String name) { /** * Get the type property: Resource type used for verification. - * + * * @return the type value. */ public String type() { @@ -58,7 +64,7 @@ public String type() { /** * Set the type property: Resource type used for verification. - * + * * @param type the type value to set. * @return the NameAvailabilityRequest object itself. */ @@ -69,13 +75,55 @@ public NameAvailabilityRequest withType(String type) { /** * 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")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property name in model NameAvailabilityRequest")); } } + + private static final ClientLogger LOGGER = new ClientLogger(NameAvailabilityRequest.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("type", this.type); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of NameAvailabilityRequest from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of NameAvailabilityRequest if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the NameAvailabilityRequest. + */ + public static NameAvailabilityRequest fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + NameAvailabilityRequest deserializedNameAvailabilityRequest = new NameAvailabilityRequest(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedNameAvailabilityRequest.name = reader.getString(); + } else if ("type".equals(fieldName)) { + deserializedNameAvailabilityRequest.type = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedNameAvailabilityRequest; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Operation.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Operation.java index f1adc7166f281..ca56d48ac5ba8 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Operation.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Operation.java @@ -5,47 +5,47 @@ package com.azure.resourcemanager.postgresql.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.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; -/** REST API operation definition. */ +/** + * REST API operation definition. + */ @Immutable -public final class Operation { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(Operation.class); - +public final class Operation implements JsonSerializable { /* * 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. + * 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) - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map properties; + /** + * Creates an instance of Operation class. + */ + public Operation() { + } + /** * Get the name property: The name of the operation being performed on this particular object. - * + * * @return the name value. */ public String name() { @@ -54,7 +54,7 @@ public String name() { /** * Get the display property: The localized display information for this particular operation or action. - * + * * @return the display value. */ public OperationDisplay display() { @@ -63,7 +63,7 @@ public OperationDisplay display() { /** * Get the origin property: The intended executor of the operation. - * + * * @return the origin value. */ public OperationOrigin origin() { @@ -72,7 +72,7 @@ public OperationOrigin origin() { /** * Get the properties property: Additional descriptions for the operation. - * + * * @return the properties value. */ public Map properties() { @@ -81,7 +81,7 @@ public Map properties() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -89,4 +89,46 @@ public void validate() { display().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Operation from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Operation if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the Operation. + */ + public static Operation fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Operation deserializedOperation = new Operation(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedOperation.name = reader.getString(); + } else if ("display".equals(fieldName)) { + deserializedOperation.display = OperationDisplay.fromJson(reader); + } else if ("origin".equals(fieldName)) { + deserializedOperation.origin = OperationOrigin.fromString(reader.getString()); + } else if ("properties".equals(fieldName)) { + Map properties = reader.readMap(reader1 -> reader1.readUntyped()); + deserializedOperation.properties = properties; + } else { + reader.skipChildren(); + } + } + + return deserializedOperation; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/OperationDisplay.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/OperationDisplay.java index 4784addc788cb..0bf320be78c0c 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/OperationDisplay.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/OperationDisplay.java @@ -5,43 +5,46 @@ package com.azure.resourcemanager.postgresql.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 com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** Display metadata associated with the operation. */ +/** + * Display metadata associated with the operation. + */ @Immutable -public final class OperationDisplay { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(OperationDisplay.class); - +public final class OperationDisplay implements JsonSerializable { /* * 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; + /** + * Creates an instance of OperationDisplay class. + */ + public OperationDisplay() { + } + /** * Get the provider property: Operation resource provider name. - * + * * @return the provider value. */ public String provider() { @@ -50,7 +53,7 @@ public String provider() { /** * Get the resource property: Resource on which the operation is performed. - * + * * @return the resource value. */ public String resource() { @@ -59,7 +62,7 @@ public String resource() { /** * Get the operation property: Localized friendly name for the operation. - * + * * @return the operation value. */ public String operation() { @@ -68,7 +71,7 @@ public String operation() { /** * Get the description property: Operation description. - * + * * @return the description value. */ public String description() { @@ -77,9 +80,50 @@ public String description() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of OperationDisplay from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of OperationDisplay if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the OperationDisplay. + */ + public static OperationDisplay fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + OperationDisplay deserializedOperationDisplay = new OperationDisplay(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("provider".equals(fieldName)) { + deserializedOperationDisplay.provider = reader.getString(); + } else if ("resource".equals(fieldName)) { + deserializedOperationDisplay.resource = reader.getString(); + } else if ("operation".equals(fieldName)) { + deserializedOperationDisplay.operation = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedOperationDisplay.description = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedOperationDisplay; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/OperationListResult.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/OperationListResult.java index 8e4b7593340d4..f9d19e5ba75ed 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/OperationListResult.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/OperationListResult.java @@ -7,18 +7,20 @@ import com.azure.resourcemanager.postgresql.fluent.models.OperationListResultInner; import java.util.List; -/** An immutable client-side representation of OperationListResult. */ +/** + * 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.postgresql.fluent.models.OperationListResultInner object. - * + * * @return the inner object. */ OperationListResultInner innerModel(); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/OperationOrigin.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/OperationOrigin.java index 8035a3e26dd95..7240408e16b30 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/OperationOrigin.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/OperationOrigin.java @@ -5,32 +5,51 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for OperationOrigin. */ +/** + * The intended executor of the operation. + */ public final class OperationOrigin extends ExpandableStringEnum { - /** Static value NotSpecified for OperationOrigin. */ + /** + * Static value NotSpecified for OperationOrigin. + */ public static final OperationOrigin NOT_SPECIFIED = fromString("NotSpecified"); - /** Static value user for OperationOrigin. */ + /** + * Static value user for OperationOrigin. + */ public static final OperationOrigin USER = fromString("user"); - /** Static value system for OperationOrigin. */ + /** + * Static value system for OperationOrigin. + */ public static final OperationOrigin SYSTEM = fromString("system"); + /** + * Creates a new instance of OperationOrigin value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public OperationOrigin() { + } + /** * 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. */ + /** + * Gets known OperationOrigin values. + * + * @return known OperationOrigin values. + */ public static Collection values() { return values(OperationOrigin.class); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Operations.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Operations.java index d4e50da61549a..c9b0d4cb98722 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Operations.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Operations.java @@ -7,25 +7,27 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of Operations. */ +/** + * Resource collection API of Operations. + */ public interface Operations { /** * 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. + * @return a list of resource provider operations along with {@link Response}. */ - OperationListResult list(); + Response listWithResponse(Context context); /** * 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 along with {@link Response}. + * @return a list of resource provider operations. */ - Response listWithResponse(Context context); + OperationListResult list(); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PerformanceTierListResult.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PerformanceTierListResult.java index d1035efa70ecb..45f8360f078c0 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PerformanceTierListResult.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PerformanceTierListResult.java @@ -5,27 +5,33 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.fluent.models.PerformanceTierPropertiesInner; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** A list of performance tiers. */ +/** + * A list of performance tiers. + */ @Fluent -public final class PerformanceTierListResult { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(PerformanceTierListResult.class); - +public final class PerformanceTierListResult implements JsonSerializable { /* * The list of performance tiers */ - @JsonProperty(value = "value") private List value; + /** + * Creates an instance of PerformanceTierListResult class. + */ + public PerformanceTierListResult() { + } + /** * Get the value property: The list of performance tiers. - * + * * @return the value value. */ public List value() { @@ -34,7 +40,7 @@ public List value() { /** * Set the value property: The list of performance tiers. - * + * * @param value the value value to set. * @return the PerformanceTierListResult object itself. */ @@ -45,7 +51,7 @@ public PerformanceTierListResult withValue(List /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -53,4 +59,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PerformanceTierListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PerformanceTierListResult if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PerformanceTierListResult. + */ + public static PerformanceTierListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PerformanceTierListResult deserializedPerformanceTierListResult = new PerformanceTierListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PerformanceTierPropertiesInner.fromJson(reader1)); + deserializedPerformanceTierListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedPerformanceTierListResult; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PerformanceTierProperties.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PerformanceTierProperties.java index 41567fc10c32a..171ce3ff2d2a5 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PerformanceTierProperties.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PerformanceTierProperties.java @@ -7,67 +7,69 @@ import com.azure.resourcemanager.postgresql.fluent.models.PerformanceTierPropertiesInner; import java.util.List; -/** An immutable client-side representation of PerformanceTierProperties. */ +/** + * 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.postgresql.fluent.models.PerformanceTierPropertiesInner object. - * + * * @return the inner object. */ PerformanceTierPropertiesInner innerModel(); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PerformanceTierServiceLevelObjectives.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PerformanceTierServiceLevelObjectives.java index 2cfaab104cb8d..8a6fd1469275b 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PerformanceTierServiceLevelObjectives.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PerformanceTierServiceLevelObjectives.java @@ -5,67 +5,67 @@ package com.azure.resourcemanager.postgresql.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.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** Service level objectives for performance tier. */ +/** + * Service level objectives for performance tier. + */ @Fluent -public final class PerformanceTierServiceLevelObjectives { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(PerformanceTierServiceLevelObjectives.class); - +public final class PerformanceTierServiceLevelObjectives + implements JsonSerializable { /* * 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; + /** + * Creates an instance of PerformanceTierServiceLevelObjectives class. + */ + public PerformanceTierServiceLevelObjectives() { + } + /** * Get the id property: ID for the service level objective. - * + * * @return the id value. */ public String id() { @@ -74,7 +74,7 @@ public String id() { /** * Set the id property: ID for the service level objective. - * + * * @param id the id value to set. * @return the PerformanceTierServiceLevelObjectives object itself. */ @@ -85,7 +85,7 @@ public PerformanceTierServiceLevelObjectives withId(String id) { /** * Get the edition property: Edition of the performance tier. - * + * * @return the edition value. */ public String edition() { @@ -94,7 +94,7 @@ public String edition() { /** * Set the edition property: Edition of the performance tier. - * + * * @param edition the edition value to set. * @return the PerformanceTierServiceLevelObjectives object itself. */ @@ -105,7 +105,7 @@ public PerformanceTierServiceLevelObjectives withEdition(String edition) { /** * Get the vCore property: vCore associated with the service level objective. - * + * * @return the vCore value. */ public Integer vCore() { @@ -114,7 +114,7 @@ public Integer vCore() { /** * Set the vCore property: vCore associated with the service level objective. - * + * * @param vCore the vCore value to set. * @return the PerformanceTierServiceLevelObjectives object itself. */ @@ -125,7 +125,7 @@ public PerformanceTierServiceLevelObjectives withVCore(Integer vCore) { /** * Get the hardwareGeneration property: Hardware generation associated with the service level objective. - * + * * @return the hardwareGeneration value. */ public String hardwareGeneration() { @@ -134,7 +134,7 @@ public String 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. */ @@ -145,7 +145,7 @@ public PerformanceTierServiceLevelObjectives withHardwareGeneration(String hardw /** * Get the maxBackupRetentionDays property: Maximum Backup retention in days for the performance tier edition. - * + * * @return the maxBackupRetentionDays value. */ public Integer maxBackupRetentionDays() { @@ -154,7 +154,7 @@ public Integer 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. */ @@ -165,7 +165,7 @@ public PerformanceTierServiceLevelObjectives withMaxBackupRetentionDays(Integer /** * Get the minBackupRetentionDays property: Minimum Backup retention in days for the performance tier edition. - * + * * @return the minBackupRetentionDays value. */ public Integer minBackupRetentionDays() { @@ -174,7 +174,7 @@ public Integer 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. */ @@ -185,7 +185,7 @@ public PerformanceTierServiceLevelObjectives withMinBackupRetentionDays(Integer /** * Get the maxStorageMB property: Max storage allowed for a server. - * + * * @return the maxStorageMB value. */ public Integer maxStorageMB() { @@ -194,7 +194,7 @@ public Integer maxStorageMB() { /** * Set the maxStorageMB property: Max storage allowed for a server. - * + * * @param maxStorageMB the maxStorageMB value to set. * @return the PerformanceTierServiceLevelObjectives object itself. */ @@ -205,7 +205,7 @@ public PerformanceTierServiceLevelObjectives withMaxStorageMB(Integer maxStorage /** * Get the minStorageMB property: Max storage allowed for a server. - * + * * @return the minStorageMB value. */ public Integer minStorageMB() { @@ -214,7 +214,7 @@ public Integer minStorageMB() { /** * Set the minStorageMB property: Max storage allowed for a server. - * + * * @param minStorageMB the minStorageMB value to set. * @return the PerformanceTierServiceLevelObjectives object itself. */ @@ -225,9 +225,71 @@ public PerformanceTierServiceLevelObjectives withMinStorageMB(Integer minStorage /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + jsonWriter.writeStringField("edition", this.edition); + jsonWriter.writeNumberField("vCore", this.vCore); + jsonWriter.writeStringField("hardwareGeneration", this.hardwareGeneration); + jsonWriter.writeNumberField("maxBackupRetentionDays", this.maxBackupRetentionDays); + jsonWriter.writeNumberField("minBackupRetentionDays", this.minBackupRetentionDays); + jsonWriter.writeNumberField("maxStorageMB", this.maxStorageMB); + jsonWriter.writeNumberField("minStorageMB", this.minStorageMB); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PerformanceTierServiceLevelObjectives from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PerformanceTierServiceLevelObjectives if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PerformanceTierServiceLevelObjectives. + */ + public static PerformanceTierServiceLevelObjectives fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PerformanceTierServiceLevelObjectives deserializedPerformanceTierServiceLevelObjectives + = new PerformanceTierServiceLevelObjectives(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPerformanceTierServiceLevelObjectives.id = reader.getString(); + } else if ("edition".equals(fieldName)) { + deserializedPerformanceTierServiceLevelObjectives.edition = reader.getString(); + } else if ("vCore".equals(fieldName)) { + deserializedPerformanceTierServiceLevelObjectives.vCore = reader.getNullable(JsonReader::getInt); + } else if ("hardwareGeneration".equals(fieldName)) { + deserializedPerformanceTierServiceLevelObjectives.hardwareGeneration = reader.getString(); + } else if ("maxBackupRetentionDays".equals(fieldName)) { + deserializedPerformanceTierServiceLevelObjectives.maxBackupRetentionDays + = reader.getNullable(JsonReader::getInt); + } else if ("minBackupRetentionDays".equals(fieldName)) { + deserializedPerformanceTierServiceLevelObjectives.minBackupRetentionDays + = reader.getNullable(JsonReader::getInt); + } else if ("maxStorageMB".equals(fieldName)) { + deserializedPerformanceTierServiceLevelObjectives.maxStorageMB + = reader.getNullable(JsonReader::getInt); + } else if ("minStorageMB".equals(fieldName)) { + deserializedPerformanceTierServiceLevelObjectives.minStorageMB + = reader.getNullable(JsonReader::getInt); + } else { + reader.skipChildren(); + } + } + + return deserializedPerformanceTierServiceLevelObjectives; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointConnection.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointConnection.java index 2b6d54f09a1ff..93bc7998ab200 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointConnection.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointConnection.java @@ -8,73 +8,90 @@ import com.azure.resourcemanager.postgresql.fluent.models.PrivateEndpointConnectionInner; import java.util.Map; -/** An immutable client-side representation of PrivateEndpointConnection. */ +/** + * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + /** * Gets the inner com.azure.resourcemanager.postgresql.fluent.models.PrivateEndpointConnectionInner object. - * + * * @return the inner object. */ PrivateEndpointConnectionInner innerModel(); - /** The entirety of the PrivateEndpointConnection definition. */ + /** + * The entirety of the PrivateEndpointConnection definition. + */ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } - /** The PrivateEndpointConnection definition stages. */ + /** + * The PrivateEndpointConnection definition stages. + */ interface DefinitionStages { - /** The first stage of the PrivateEndpointConnection definition. */ + /** + * The first stage of the PrivateEndpointConnection definition. + */ interface Blank extends WithParentResource { } - /** The stage of the PrivateEndpointConnection definition allowing to specify parent resource. */ + /** + * 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. @@ -90,25 +107,27 @@ 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. */ + /** + * 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. */ @@ -122,7 +141,7 @@ 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. */ @@ -133,36 +152,42 @@ WithCreate withPrivateLinkServiceConnectionState( /** * Begins update for the PrivateEndpointConnection resource. - * + * * @return the stage of resource update. */ PrivateEndpointConnection.Update update(); - /** The template for PrivateEndpointConnection 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. */ + /** + * The PrivateEndpointConnection update stages. + */ interface UpdateStages { - /** The stage of the PrivateEndpointConnection update allowing to specify tags. */ + /** + * 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. */ @@ -172,14 +197,14 @@ interface WithTags { /** * 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. */ diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointConnectionListResult.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointConnectionListResult.java index bdeb14570ead0..7c1ee4b8ce9bd 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointConnectionListResult.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointConnectionListResult.java @@ -5,33 +5,39 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.fluent.models.PrivateEndpointConnectionInner; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** A list of private endpoint connections. */ +/** + * A list of private endpoint connections. + */ @Immutable -public final class PrivateEndpointConnectionListResult { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionListResult.class); - +public final class PrivateEndpointConnectionListResult + implements JsonSerializable { /* * Array of results. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * Link to retrieve next page of results. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; + /** + * Creates an instance of PrivateEndpointConnectionListResult class. + */ + public PrivateEndpointConnectionListResult() { + } + /** * Get the value property: Array of results. - * + * * @return the value value. */ public List value() { @@ -40,7 +46,7 @@ public List value() { /** * Get the nextLink property: Link to retrieve next page of results. - * + * * @return the nextLink value. */ public String nextLink() { @@ -49,7 +55,7 @@ public String nextLink() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -57,4 +63,44 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointConnectionListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointConnectionListResult if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateEndpointConnectionListResult. + */ + public static PrivateEndpointConnectionListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointConnectionListResult deserializedPrivateEndpointConnectionListResult + = new PrivateEndpointConnectionListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PrivateEndpointConnectionInner.fromJson(reader1)); + deserializedPrivateEndpointConnectionListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPrivateEndpointConnectionListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointConnectionListResult; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointConnections.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointConnections.java index dbf8705b06fe8..6a4035cfb4d8b 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointConnections.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointConnections.java @@ -8,39 +8,41 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of PrivateEndpointConnections. */ +/** + * 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. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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. + * @return a private endpoint connection along with {@link Response}. */ - PrivateEndpointConnection get(String resourceGroupName, String serverName, String privateEndpointConnectionName); + Response getWithResponse(String resourceGroupName, String serverName, + String privateEndpointConnectionName, 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. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a private endpoint connection along with {@link Response}. + * @return a private endpoint connection. */ - Response getWithResponse(String resourceGroupName, String serverName, - String privateEndpointConnectionName, Context context); + PrivateEndpointConnection get(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. @@ -52,7 +54,7 @@ Response getWithResponse(String resourceGroupName, St /** * 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. @@ -65,32 +67,32 @@ Response getWithResponse(String resourceGroupName, St /** * 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. + * @return all private endpoint connections on a server as paginated response with {@link PagedIterable}. */ 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. + * @return all private endpoint connections on a server as paginated response with {@link PagedIterable}. */ 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. @@ -101,7 +103,7 @@ Response getWithResponse(String resourceGroupName, St /** * 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. @@ -113,7 +115,7 @@ Response getWithResponse(String resourceGroupName, St /** * 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. @@ -123,7 +125,7 @@ Response getWithResponse(String resourceGroupName, St /** * 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. @@ -134,7 +136,7 @@ Response getWithResponse(String resourceGroupName, St /** * Begins definition for a new PrivateEndpointConnection resource. - * + * * @param name resource name. * @return the first stage of the new PrivateEndpointConnection definition. */ diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointProperty.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointProperty.java index 2c6303927a834..d229520589ae1 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointProperty.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointProperty.java @@ -5,25 +5,31 @@ package com.azure.resourcemanager.postgresql.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.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** The PrivateEndpointProperty model. */ +/** + * The PrivateEndpointProperty model. + */ @Fluent -public final class PrivateEndpointProperty { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(PrivateEndpointProperty.class); - +public final class PrivateEndpointProperty implements JsonSerializable { /* * Resource id of the private endpoint. */ - @JsonProperty(value = "id") private String id; + /** + * Creates an instance of PrivateEndpointProperty class. + */ + public PrivateEndpointProperty() { + } + /** * Get the id property: Resource id of the private endpoint. - * + * * @return the id value. */ public String id() { @@ -32,7 +38,7 @@ public String id() { /** * Set the id property: Resource id of the private endpoint. - * + * * @param id the id value to set. * @return the PrivateEndpointProperty object itself. */ @@ -43,9 +49,45 @@ public PrivateEndpointProperty withId(String id) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("id", this.id); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateEndpointProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateEndpointProperty if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateEndpointProperty. + */ + public static PrivateEndpointProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateEndpointProperty deserializedPrivateEndpointProperty = new PrivateEndpointProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedPrivateEndpointProperty.id = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateEndpointProperty; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointProvisioningState.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointProvisioningState.java index fbbdd761d2877..3cbe500c47dd4 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointProvisioningState.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateEndpointProvisioningState.java @@ -5,38 +5,61 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for PrivateEndpointProvisioningState. */ +/** + * State of the private endpoint connection. + */ public final class PrivateEndpointProvisioningState extends ExpandableStringEnum { - /** Static value Approving for PrivateEndpointProvisioningState. */ + /** + * Static value Approving for PrivateEndpointProvisioningState. + */ public static final PrivateEndpointProvisioningState APPROVING = fromString("Approving"); - /** Static value Ready for PrivateEndpointProvisioningState. */ + /** + * Static value Ready for PrivateEndpointProvisioningState. + */ public static final PrivateEndpointProvisioningState READY = fromString("Ready"); - /** Static value Dropping for PrivateEndpointProvisioningState. */ + /** + * Static value Dropping for PrivateEndpointProvisioningState. + */ public static final PrivateEndpointProvisioningState DROPPING = fromString("Dropping"); - /** Static value Failed for PrivateEndpointProvisioningState. */ + /** + * Static value Failed for PrivateEndpointProvisioningState. + */ public static final PrivateEndpointProvisioningState FAILED = fromString("Failed"); - /** Static value Rejecting for PrivateEndpointProvisioningState. */ + /** + * Static value Rejecting for PrivateEndpointProvisioningState. + */ public static final PrivateEndpointProvisioningState REJECTING = fromString("Rejecting"); + /** + * Creates a new instance of PrivateEndpointProvisioningState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateEndpointProvisioningState() { + } + /** * 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. */ + /** + * Gets known PrivateEndpointProvisioningState values. + * + * @return known PrivateEndpointProvisioningState values. + */ public static Collection values() { return values(PrivateEndpointProvisioningState.class); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkResource.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkResource.java index 8763a03e54fca..f682bc5856f1f 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkResource.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkResource.java @@ -6,39 +6,41 @@ import com.azure.resourcemanager.postgresql.fluent.models.PrivateLinkResourceInner; -/** An immutable client-side representation of PrivateLinkResource. */ +/** + * 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.postgresql.fluent.models.PrivateLinkResourceInner object. - * + * * @return the inner object. */ PrivateLinkResourceInner innerModel(); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkResourceListResult.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkResourceListResult.java index d87c060a4f7d5..bf1bd0f5f6748 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkResourceListResult.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkResourceListResult.java @@ -5,33 +5,38 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.fluent.models.PrivateLinkResourceInner; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** A list of private link resources. */ +/** + * A list of private link resources. + */ @Immutable -public final class PrivateLinkResourceListResult { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(PrivateLinkResourceListResult.class); - +public final class PrivateLinkResourceListResult implements JsonSerializable { /* * Array of results. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * Link to retrieve next page of results. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; + /** + * Creates an instance of PrivateLinkResourceListResult class. + */ + public PrivateLinkResourceListResult() { + } + /** * Get the value property: Array of results. - * + * * @return the value value. */ public List value() { @@ -40,7 +45,7 @@ public List value() { /** * Get the nextLink property: Link to retrieve next page of results. - * + * * @return the nextLink value. */ public String nextLink() { @@ -49,7 +54,7 @@ public String nextLink() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -57,4 +62,44 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateLinkResourceListResult. + */ + public static PrivateLinkResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceListResult deserializedPrivateLinkResourceListResult + = new PrivateLinkResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> PrivateLinkResourceInner.fromJson(reader1)); + deserializedPrivateLinkResourceListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedPrivateLinkResourceListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceListResult; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkResourceProperties.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkResourceProperties.java index 4dd7665ce48d6..230744c4e0a51 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkResourceProperties.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkResourceProperties.java @@ -5,32 +5,37 @@ package com.azure.resourcemanager.postgresql.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 com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.List; -/** Properties of a private link resource. */ +/** + * Properties of a private link resource. + */ @Immutable -public final class PrivateLinkResourceProperties { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(PrivateLinkResourceProperties.class); - +public final class PrivateLinkResourceProperties implements JsonSerializable { /* * 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; + /** + * Creates an instance of PrivateLinkResourceProperties class. + */ + public PrivateLinkResourceProperties() { + } + /** * Get the groupId property: The private link resource group id. - * + * * @return the groupId value. */ public String groupId() { @@ -39,7 +44,7 @@ public String groupId() { /** * Get the requiredMembers property: The private link resource required member names. - * + * * @return the requiredMembers value. */ public List requiredMembers() { @@ -48,9 +53,48 @@ public List requiredMembers() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkResourceProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkResourceProperties if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the PrivateLinkResourceProperties. + */ + public static PrivateLinkResourceProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkResourceProperties deserializedPrivateLinkResourceProperties + = new PrivateLinkResourceProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("groupId".equals(fieldName)) { + deserializedPrivateLinkResourceProperties.groupId = reader.getString(); + } else if ("requiredMembers".equals(fieldName)) { + List requiredMembers = reader.readArray(reader1 -> reader1.getString()); + deserializedPrivateLinkResourceProperties.requiredMembers = requiredMembers; + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkResourceProperties; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkResources.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkResources.java index b5c02a1728262..f30ca54812949 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkResources.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkResources.java @@ -8,58 +8,60 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of PrivateLinkResources. */ +/** + * Resource collection API of PrivateLinkResources. + */ public interface PrivateLinkResources { /** * Gets the private link resources for PostgreSQL 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 PostgreSQL server. + * @return the private link resources for PostgreSQL server as paginated response with {@link PagedIterable}. */ PagedIterable listByServer(String resourceGroupName, String serverName); /** * Gets the private link resources for PostgreSQL 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 PostgreSQL server. + * @return the private link resources for PostgreSQL server as paginated response with {@link PagedIterable}. */ PagedIterable listByServer(String resourceGroupName, String serverName, Context context); /** * Gets a private link resource for PostgreSQL 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 PostgreSQL server. + * @return a private link resource for PostgreSQL server along with {@link Response}. */ - PrivateLinkResource get(String resourceGroupName, String serverName, String groupName); + Response getWithResponse(String resourceGroupName, String serverName, String groupName, + Context context); /** * Gets a private link resource for PostgreSQL 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 PostgreSQL server along with {@link Response}. + * @return a private link resource for PostgreSQL server. */ - Response getWithResponse(String resourceGroupName, String serverName, String groupName, - Context context); + PrivateLinkResource get(String resourceGroupName, String serverName, String groupName); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkServiceConnectionStateActionsRequire.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkServiceConnectionStateActionsRequire.java index 925cbe3e5876c..91c957935999f 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkServiceConnectionStateActionsRequire.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkServiceConnectionStateActionsRequire.java @@ -5,27 +5,42 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for PrivateLinkServiceConnectionStateActionsRequire. */ +/** + * The actions required for private link service connection. + */ public final class PrivateLinkServiceConnectionStateActionsRequire extends ExpandableStringEnum { - /** Static value None for PrivateLinkServiceConnectionStateActionsRequire. */ + /** + * Static value None for PrivateLinkServiceConnectionStateActionsRequire. + */ public static final PrivateLinkServiceConnectionStateActionsRequire NONE = fromString("None"); + /** + * Creates a new instance of PrivateLinkServiceConnectionStateActionsRequire value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateLinkServiceConnectionStateActionsRequire() { + } + /** * 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. */ + /** + * Gets known PrivateLinkServiceConnectionStateActionsRequire values. + * + * @return known PrivateLinkServiceConnectionStateActionsRequire values. + */ public static Collection values() { return values(PrivateLinkServiceConnectionStateActionsRequire.class); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkServiceConnectionStateProperty.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkServiceConnectionStateProperty.java index 3b70eb92786d3..f2c09e00cdb9e 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkServiceConnectionStateProperty.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkServiceConnectionStateProperty.java @@ -6,36 +6,42 @@ 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.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** The PrivateLinkServiceConnectionStateProperty model. */ +/** + * The PrivateLinkServiceConnectionStateProperty model. + */ @Fluent -public final class PrivateLinkServiceConnectionStateProperty { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(PrivateLinkServiceConnectionStateProperty.class); - +public final class PrivateLinkServiceConnectionStateProperty + implements JsonSerializable { /* * 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; + /** + * Creates an instance of PrivateLinkServiceConnectionStateProperty class. + */ + public PrivateLinkServiceConnectionStateProperty() { + } + /** * Get the status property: The private link service connection status. - * + * * @return the status value. */ public String status() { @@ -44,7 +50,7 @@ public String status() { /** * Set the status property: The private link service connection status. - * + * * @param status the status value to set. * @return the PrivateLinkServiceConnectionStateProperty object itself. */ @@ -55,7 +61,7 @@ public PrivateLinkServiceConnectionStateProperty withStatus(String status) { /** * Get the description property: The private link service connection description. - * + * * @return the description value. */ public String description() { @@ -64,7 +70,7 @@ public String description() { /** * Set the description property: The private link service connection description. - * + * * @param description the description value to set. * @return the PrivateLinkServiceConnectionStateProperty object itself. */ @@ -75,7 +81,7 @@ public PrivateLinkServiceConnectionStateProperty withDescription(String descript /** * Get the actionsRequired property: The actions required for private link service connection. - * + * * @return the actionsRequired value. */ public String actionsRequired() { @@ -84,17 +90,64 @@ public String 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")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property status in model PrivateLinkServiceConnectionStateProperty")); } if (description() == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( - "Missing required property description in model PrivateLinkServiceConnectionStateProperty")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property description in model PrivateLinkServiceConnectionStateProperty")); } } + + private static final ClientLogger LOGGER = new ClientLogger(PrivateLinkServiceConnectionStateProperty.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of PrivateLinkServiceConnectionStateProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of PrivateLinkServiceConnectionStateProperty if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the PrivateLinkServiceConnectionStateProperty. + */ + public static PrivateLinkServiceConnectionStateProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + PrivateLinkServiceConnectionStateProperty deserializedPrivateLinkServiceConnectionStateProperty + = new PrivateLinkServiceConnectionStateProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionStateProperty.status = reader.getString(); + } else if ("description".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionStateProperty.description = reader.getString(); + } else if ("actionsRequired".equals(fieldName)) { + deserializedPrivateLinkServiceConnectionStateProperty.actionsRequired = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedPrivateLinkServiceConnectionStateProperty; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkServiceConnectionStateStatus.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkServiceConnectionStateStatus.java index da23b7856e54f..c8ac31b4154c7 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkServiceConnectionStateStatus.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PrivateLinkServiceConnectionStateStatus.java @@ -5,36 +5,57 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for PrivateLinkServiceConnectionStateStatus. */ +/** + * The private link service connection status. + */ public final class PrivateLinkServiceConnectionStateStatus extends ExpandableStringEnum { - /** Static value Approved for PrivateLinkServiceConnectionStateStatus. */ + /** + * Static value Approved for PrivateLinkServiceConnectionStateStatus. + */ public static final PrivateLinkServiceConnectionStateStatus APPROVED = fromString("Approved"); - /** Static value Pending for PrivateLinkServiceConnectionStateStatus. */ + /** + * Static value Pending for PrivateLinkServiceConnectionStateStatus. + */ public static final PrivateLinkServiceConnectionStateStatus PENDING = fromString("Pending"); - /** Static value Rejected for PrivateLinkServiceConnectionStateStatus. */ + /** + * Static value Rejected for PrivateLinkServiceConnectionStateStatus. + */ public static final PrivateLinkServiceConnectionStateStatus REJECTED = fromString("Rejected"); - /** Static value Disconnected for PrivateLinkServiceConnectionStateStatus. */ + /** + * Static value Disconnected for PrivateLinkServiceConnectionStateStatus. + */ public static final PrivateLinkServiceConnectionStateStatus DISCONNECTED = fromString("Disconnected"); + /** + * Creates a new instance of PrivateLinkServiceConnectionStateStatus value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PrivateLinkServiceConnectionStateStatus() { + } + /** * 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. */ + /** + * Gets known PrivateLinkServiceConnectionStateStatus values. + * + * @return known PrivateLinkServiceConnectionStateStatus values. + */ public static Collection values() { return values(PrivateLinkServiceConnectionStateStatus.class); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PublicNetworkAccessEnum.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PublicNetworkAccessEnum.java index 5ae0b86e6d65d..97fd6804821c8 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PublicNetworkAccessEnum.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/PublicNetworkAccessEnum.java @@ -5,29 +5,47 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for PublicNetworkAccessEnum. */ +/** + * Whether or not public network access is allowed for this server. Value is optional but if passed in, must be + * 'Enabled' or 'Disabled'. + */ public final class PublicNetworkAccessEnum extends ExpandableStringEnum { - /** Static value Enabled for PublicNetworkAccessEnum. */ + /** + * Static value Enabled for PublicNetworkAccessEnum. + */ public static final PublicNetworkAccessEnum ENABLED = fromString("Enabled"); - /** Static value Disabled for PublicNetworkAccessEnum. */ + /** + * Static value Disabled for PublicNetworkAccessEnum. + */ public static final PublicNetworkAccessEnum DISABLED = fromString("Disabled"); + /** + * Creates a new instance of PublicNetworkAccessEnum value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public PublicNetworkAccessEnum() { + } + /** * 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. */ + /** + * Gets known PublicNetworkAccessEnum values. + * + * @return known PublicNetworkAccessEnum values. + */ public static Collection values() { return values(PublicNetworkAccessEnum.class); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/RecoverableServerResource.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/RecoverableServerResource.java index acc1da0fbabb5..dcc5f9c242300 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/RecoverableServerResource.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/RecoverableServerResource.java @@ -6,74 +6,76 @@ import com.azure.resourcemanager.postgresql.fluent.models.RecoverableServerResourceInner; -/** An immutable client-side representation of RecoverableServerResource. */ +/** + * 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 PostgreSQL version. - * + * * @return the version value. */ String version(); /** * Gets the inner com.azure.resourcemanager.postgresql.fluent.models.RecoverableServerResourceInner object. - * + * * @return the inner object. */ RecoverableServerResourceInner innerModel(); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/RecoverableServers.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/RecoverableServers.java index 2279e05623fb8..28abf16836d5e 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/RecoverableServers.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/RecoverableServers.java @@ -7,30 +7,32 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of RecoverableServers. */ +/** + * Resource collection API of RecoverableServers. + */ public interface RecoverableServers { /** * Gets a recoverable PostgreSQL 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 PostgreSQL Server. + * @return a recoverable PostgreSQL Server along with {@link Response}. */ - RecoverableServerResource get(String resourceGroupName, String serverName); + Response getWithResponse(String resourceGroupName, String serverName, Context context); /** * Gets a recoverable PostgreSQL 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 PostgreSQL Server along with {@link Response}. + * @return a recoverable PostgreSQL Server. */ - Response getWithResponse(String resourceGroupName, String serverName, Context context); + RecoverableServerResource get(String resourceGroupName, String serverName); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Replicas.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Replicas.java index 28cfdd480747f..e06e4576aab51 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Replicas.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Replicas.java @@ -7,30 +7,32 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; -/** Resource collection API of Replicas. */ +/** + * 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ PagedIterable listByServer(String resourceGroupName, String serverName, Context context); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ResourceIdentity.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ResourceIdentity.java index 448c453c07449..3b8eb988e32ba 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ResourceIdentity.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ResourceIdentity.java @@ -5,40 +5,43 @@ package com.azure.resourcemanager.postgresql.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.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.UUID; -/** Azure Active Directory identity configuration for a resource. */ +/** + * Azure Active Directory identity configuration for a resource. + */ @Fluent -public class ResourceIdentity { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ResourceIdentity.class); - +public final class ResourceIdentity implements JsonSerializable { /* * The Azure Active Directory principal id. */ - @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) private UUID principalId; /* - * The identity type. Set this to 'SystemAssigned' in order to - * automatically create and assign an Azure Active Directory principal for - * the resource. + * The identity type. Set this to 'SystemAssigned' in order to automatically create and assign an Azure Active + * Directory principal for the resource. */ - @JsonProperty(value = "type") private IdentityType type; /* * The Azure Active Directory tenant id. */ - @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) private UUID tenantId; + /** + * Creates an instance of ResourceIdentity class. + */ + public ResourceIdentity() { + } + /** * Get the principalId property: The Azure Active Directory principal id. - * + * * @return the principalId value. */ public UUID principalId() { @@ -48,7 +51,7 @@ public UUID principalId() { /** * Get the type property: The identity type. Set this to 'SystemAssigned' in order to automatically create and * assign an Azure Active Directory principal for the resource. - * + * * @return the type value. */ public IdentityType type() { @@ -58,7 +61,7 @@ public IdentityType type() { /** * Set the type property: The identity type. Set this to 'SystemAssigned' in order to automatically create and * assign an Azure Active Directory principal for the resource. - * + * * @param type the type value to set. * @return the ResourceIdentity object itself. */ @@ -69,7 +72,7 @@ public ResourceIdentity withType(IdentityType type) { /** * Get the tenantId property: The Azure Active Directory tenant id. - * + * * @return the tenantId value. */ public UUID tenantId() { @@ -78,9 +81,51 @@ public UUID tenantId() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("type", this.type == null ? null : this.type.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ResourceIdentity from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ResourceIdentity if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ResourceIdentity. + */ + public static ResourceIdentity fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ResourceIdentity deserializedResourceIdentity = new ResourceIdentity(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("principalId".equals(fieldName)) { + deserializedResourceIdentity.principalId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else if ("type".equals(fieldName)) { + deserializedResourceIdentity.type = IdentityType.fromString(reader.getString()); + } else if ("tenantId".equals(fieldName)) { + deserializedResourceIdentity.tenantId + = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString())); + } else { + reader.skipChildren(); + } + } + + return deserializedResourceIdentity; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/SecurityAlertPolicyName.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/SecurityAlertPolicyName.java index b240c0d36f867..775fc93729c7f 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/SecurityAlertPolicyName.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/SecurityAlertPolicyName.java @@ -5,26 +5,41 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for SecurityAlertPolicyName. */ +/** + * Defines values for SecurityAlertPolicyName. + */ public final class SecurityAlertPolicyName extends ExpandableStringEnum { - /** Static value Default for SecurityAlertPolicyName. */ + /** + * Static value Default for SecurityAlertPolicyName. + */ public static final SecurityAlertPolicyName DEFAULT = fromString("Default"); + /** + * Creates a new instance of SecurityAlertPolicyName value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SecurityAlertPolicyName() { + } + /** * 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. */ + /** + * Gets known SecurityAlertPolicyName values. + * + * @return known SecurityAlertPolicyName values. + */ public static Collection values() { return values(SecurityAlertPolicyName.class); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Server.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Server.java index d43b4f3106daf..e7286447dce11 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Server.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Server.java @@ -11,53 +11,55 @@ import java.util.List; import java.util.Map; -/** An immutable client-side representation of Server. */ +/** + * 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 identity property: The Azure Active Directory identity of the server. - * + * * @return the identity value. */ ResourceIdentity identity(); /** * Gets the sku property: The SKU (pricing tier) of the server. - * + * * @return the sku value. */ Sku sku(); @@ -65,28 +67,28 @@ public interface Server { /** * 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 minimalTlsVersion property: Enforce a minimal Tls version for the server. - * + * * @return the minimalTlsVersion value. */ MinimalTlsVersionEnum minimalTlsVersion(); @@ -94,63 +96,63 @@ public interface Server { /** * Gets the byokEnforcement property: Status showing whether the server data encryption is enabled with * customer-managed keys. - * + * * @return the byokEnforcement value. */ String byokEnforcement(); /** * Gets the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. - * + * * @return the infrastructureEncryption value. */ InfrastructureEncryption infrastructureEncryption(); /** * 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(); @@ -158,55 +160,70 @@ public interface Server { /** * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + /** * Gets the inner com.azure.resourcemanager.postgresql.fluent.models.ServerInner object. - * + * * @return the inner object. */ ServerInner innerModel(); - /** The entirety of the Server definition. */ + /** + * The entirety of the Server definition. + */ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithResourceGroup, DefinitionStages.WithProperties, DefinitionStages.WithCreate { } - /** The Server definition stages. */ + /** + * The Server definition stages. + */ interface DefinitionStages { - /** The first stage of the Server definition. */ + /** + * The first stage of the Server definition. + */ interface Blank extends WithLocation { } - /** The stage of the Server definition allowing to specify location. */ + /** + * 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. */ @@ -214,29 +231,33 @@ interface WithLocation { /** * 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. */ + /** + * 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. */ + /** + * 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. */ @@ -251,47 +272,53 @@ interface WithCreate extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, 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. */ + /** + * 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 identity. */ + /** + * The stage of the Server definition allowing to specify identity. + */ interface WithIdentity { /** * Specifies the identity property: The Azure Active Directory identity of the server.. - * + * * @param identity The Azure Active Directory identity of the server. * @return the next definition stage. */ WithCreate withIdentity(ResourceIdentity identity); } - /** The stage of the Server definition allowing to specify sku. */ + /** + * 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. */ @@ -301,140 +328,164 @@ interface WithSku { /** * Begins update for the Server resource. - * + * * @return the stage of resource update. */ Server.Update update(); - /** The template for Server update. */ + /** + * The template for Server update. + */ interface Update extends UpdateStages.WithTags, UpdateStages.WithIdentity, UpdateStages.WithSku, UpdateStages.WithStorageProfile, UpdateStages.WithAdministratorLoginPassword, UpdateStages.WithVersion, UpdateStages.WithSslEnforcement, UpdateStages.WithMinimalTlsVersion, 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. */ + /** + * The Server update stages. + */ interface UpdateStages { - /** The stage of the Server update allowing to specify tags. */ + /** + * 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 identity. */ + /** + * The stage of the Server update allowing to specify identity. + */ interface WithIdentity { /** * Specifies the identity property: The Azure Active Directory identity of the server.. - * + * * @param identity The Azure Active Directory identity of the server. * @return the next definition stage. */ Update withIdentity(ResourceIdentity identity); } - /** The stage of the Server update allowing to specify sku. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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 minimalTlsVersion. */ + /** + * The stage of the Server update allowing to specify minimalTlsVersion. + */ interface WithMinimalTlsVersion { /** * Specifies the minimalTlsVersion property: Enforce a minimal Tls version for the server.. - * + * * @param minimalTlsVersion Enforce a minimal Tls version for the server. * @return the next definition stage. */ Update withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion); } - /** The stage of the Server update allowing to specify publicNetworkAccess. */ + /** + * 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'. + * 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. */ + /** + * 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. */ @@ -444,14 +495,14 @@ interface WithReplicationRole { /** * 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. */ @@ -459,7 +510,7 @@ interface WithReplicationRole { /** * Restarts a server. - * + * * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @@ -467,7 +518,7 @@ interface WithReplicationRole { /** * Restarts 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. diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerAdministratorResource.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerAdministratorResource.java index fb0409c8afc54..f1c16abbf02b7 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerAdministratorResource.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerAdministratorResource.java @@ -7,60 +7,62 @@ import com.azure.resourcemanager.postgresql.fluent.models.ServerAdministratorResourceInner; import java.util.UUID; -/** An immutable client-side representation of ServerAdministratorResource. */ +/** + * An immutable client-side representation of ServerAdministratorResource. + */ public interface ServerAdministratorResource { /** * 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 administratorType property: The type of administrator. - * + * * @return the administratorType value. */ AdministratorType administratorType(); /** * Gets the login property: The server administrator login account name. - * + * * @return the login value. */ String login(); /** * Gets the sid property: The server administrator Sid (Secure ID). - * + * * @return the sid value. */ UUID sid(); /** * Gets the tenantId property: The server Active Directory Administrator tenant id. - * + * * @return the tenantId value. */ UUID tenantId(); /** * Gets the inner com.azure.resourcemanager.postgresql.fluent.models.ServerAdministratorResourceInner object. - * + * * @return the inner object. */ ServerAdministratorResourceInner innerModel(); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerAdministratorResourceListResult.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerAdministratorResourceListResult.java index ea6e2bd3e1688..83904e500e3ed 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerAdministratorResourceListResult.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerAdministratorResourceListResult.java @@ -5,27 +5,34 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.fluent.models.ServerAdministratorResourceInner; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** The response to a list Active Directory Administrators request. */ +/** + * The response to a list Active Directory Administrators request. + */ @Fluent -public final class ServerAdministratorResourceListResult { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerAdministratorResourceListResult.class); - +public final class ServerAdministratorResourceListResult + implements JsonSerializable { /* * The list of server Active Directory Administrators for the server. */ - @JsonProperty(value = "value") private List value; + /** + * Creates an instance of ServerAdministratorResourceListResult class. + */ + public ServerAdministratorResourceListResult() { + } + /** * Get the value property: The list of server Active Directory Administrators for the server. - * + * * @return the value value. */ public List value() { @@ -34,7 +41,7 @@ public List value() { /** * Set the value property: The list of server Active Directory Administrators for the server. - * + * * @param value the value value to set. * @return the ServerAdministratorResourceListResult object itself. */ @@ -45,7 +52,7 @@ public ServerAdministratorResourceListResult withValue(List e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerAdministratorResourceListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerAdministratorResourceListResult if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServerAdministratorResourceListResult. + */ + public static ServerAdministratorResourceListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerAdministratorResourceListResult deserializedServerAdministratorResourceListResult + = new ServerAdministratorResourceListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ServerAdministratorResourceInner.fromJson(reader1)); + deserializedServerAdministratorResourceListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedServerAdministratorResourceListResult; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerAdministrators.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerAdministrators.java index f9d4d9a80b5d3..9e02d0f865f3e 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerAdministrators.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerAdministrators.java @@ -9,37 +9,39 @@ import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.fluent.models.ServerAdministratorResourceInner; -/** Resource collection API of ServerAdministrators. */ +/** + * Resource collection API of ServerAdministrators. + */ public interface ServerAdministrators { /** * Gets information about a AAD server administrator. - * + * * @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 AAD server administrator. + * @return information about a AAD server administrator along with {@link Response}. */ - ServerAdministratorResource get(String resourceGroupName, String serverName); + Response getWithResponse(String resourceGroupName, String serverName, Context context); /** * Gets information about a AAD server administrator. - * + * * @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 AAD server administrator along with {@link Response}. + * @return information about a AAD server administrator. */ - Response getWithResponse(String resourceGroupName, String serverName, Context context); + ServerAdministratorResource get(String resourceGroupName, String serverName); /** * Creates or update active directory administrator on an existing server. The update action will overwrite the * existing administrator. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param properties The required parameters for creating or updating an AAD server administrator. @@ -54,7 +56,7 @@ ServerAdministratorResource createOrUpdate(String resourceGroupName, String serv /** * Creates or update active directory administrator on an existing server. The update action will overwrite the * existing administrator. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param properties The required parameters for creating or updating an AAD server administrator. @@ -69,7 +71,7 @@ ServerAdministratorResource createOrUpdate(String resourceGroupName, String serv /** * Deletes server active directory administrator. - * + * * @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. @@ -80,7 +82,7 @@ ServerAdministratorResource createOrUpdate(String resourceGroupName, String serv /** * Deletes server active directory administrator. - * + * * @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. @@ -92,26 +94,28 @@ ServerAdministratorResource createOrUpdate(String resourceGroupName, String serv /** * Returns a list of server Administrators. - * + * * @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 response to a list Active Directory Administrators request. + * @return the response to a list Active Directory Administrators request as paginated response with + * {@link PagedIterable}. */ PagedIterable list(String resourceGroupName, String serverName); /** * Returns a list of server Administrators. - * + * * @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 response to a list Active Directory Administrators request. + * @return the response to a list Active Directory Administrators request as paginated response with + * {@link PagedIterable}. */ PagedIterable list(String resourceGroupName, String serverName, Context context); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerBasedPerformanceTiers.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerBasedPerformanceTiers.java index 10bea81fbf179..815ff601ce932 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerBasedPerformanceTiers.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerBasedPerformanceTiers.java @@ -7,30 +7,32 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; -/** Resource collection API of ServerBasedPerformanceTiers. */ +/** + * Resource collection API of ServerBasedPerformanceTiers. + */ public interface ServerBasedPerformanceTiers { /** * List all the performance tiers for a PostgreSQL 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. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ PagedIterable list(String resourceGroupName, String serverName); /** * List all the performance tiers for a PostgreSQL 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. + * @return a list of performance tiers as paginated response with {@link PagedIterable}. */ PagedIterable list(String resourceGroupName, String serverName, Context context); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerForCreate.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerForCreate.java index 5a0930e0bfce5..fe65bac756ef2 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerForCreate.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerForCreate.java @@ -6,51 +6,52 @@ import com.azure.core.annotation.Fluent; import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; -/** Represents a server to be created. */ +/** + * Represents a server to be created. + */ @Fluent -public final class ServerForCreate { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerForCreate.class); - +public final class ServerForCreate implements JsonSerializable { /* * The Azure Active Directory identity of the server. */ - @JsonProperty(value = "identity") private ResourceIdentity identity; /* * 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") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; + /** + * Creates an instance of ServerForCreate class. + */ + public ServerForCreate() { + } + /** * Get the identity property: The Azure Active Directory identity of the server. - * + * * @return the identity value. */ public ResourceIdentity identity() { @@ -59,7 +60,7 @@ public ResourceIdentity identity() { /** * Set the identity property: The Azure Active Directory identity of the server. - * + * * @param identity the identity value to set. * @return the ServerForCreate object itself. */ @@ -70,7 +71,7 @@ public ServerForCreate withIdentity(ResourceIdentity identity) { /** * Get the sku property: The SKU (pricing tier) of the server. - * + * * @return the sku value. */ public Sku sku() { @@ -79,7 +80,7 @@ public Sku sku() { /** * Set the sku property: The SKU (pricing tier) of the server. - * + * * @param sku the sku value to set. * @return the ServerForCreate object itself. */ @@ -90,7 +91,7 @@ public ServerForCreate withSku(Sku sku) { /** * Get the properties property: Properties of the server. - * + * * @return the properties value. */ public ServerPropertiesForCreate properties() { @@ -99,7 +100,7 @@ public ServerPropertiesForCreate properties() { /** * Set the properties property: Properties of the server. - * + * * @param properties the properties value to set. * @return the ServerForCreate object itself. */ @@ -110,7 +111,7 @@ public ServerForCreate withProperties(ServerPropertiesForCreate properties) { /** * Get the location property: The location the resource resides in. - * + * * @return the location value. */ public String location() { @@ -119,7 +120,7 @@ public String location() { /** * Set the location property: The location the resource resides in. - * + * * @param location the location value to set. * @return the ServerForCreate object itself. */ @@ -130,7 +131,7 @@ public ServerForCreate withLocation(String location) { /** * Get the tags property: Application-specific metadata in the form of key-value pairs. - * + * * @return the tags value. */ public Map tags() { @@ -139,7 +140,7 @@ public Map 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. */ @@ -150,7 +151,7 @@ public ServerForCreate withTags(Map tags) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -161,14 +162,66 @@ public void validate() { sku().validate(); } if (properties() == null) { - throw logger.logExceptionAsError( - new IllegalArgumentException("Missing required property properties in model ServerForCreate")); + throw LOGGER.atError() + .log(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")); + throw LOGGER.atError() + .log(new IllegalArgumentException("Missing required property location in model ServerForCreate")); } } + + private static final ClientLogger LOGGER = new ClientLogger(ServerForCreate.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("properties", this.properties); + jsonWriter.writeStringField("location", this.location); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeJsonField("sku", this.sku); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerForCreate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerForCreate if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ServerForCreate. + */ + public static ServerForCreate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerForCreate deserializedServerForCreate = new ServerForCreate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("properties".equals(fieldName)) { + deserializedServerForCreate.properties = ServerPropertiesForCreate.fromJson(reader); + } else if ("location".equals(fieldName)) { + deserializedServerForCreate.location = reader.getString(); + } else if ("identity".equals(fieldName)) { + deserializedServerForCreate.identity = ResourceIdentity.fromJson(reader); + } else if ("sku".equals(fieldName)) { + deserializedServerForCreate.sku = Sku.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedServerForCreate.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedServerForCreate; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerKey.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerKey.java index 2cef349b5e715..857e5cda66d21 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerKey.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerKey.java @@ -8,80 +8,97 @@ import com.azure.resourcemanager.postgresql.fluent.models.ServerKeyInner; import java.time.OffsetDateTime; -/** An immutable client-side representation of ServerKey. */ +/** + * An immutable client-side representation of ServerKey. + */ public interface ServerKey { /** * 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 kind property: Kind of encryption protector used to protect the key. - * + * * @return the kind value. */ String kind(); /** * Gets the serverKeyType property: The key type like 'AzureKeyVault'. - * + * * @return the serverKeyType value. */ ServerKeyType serverKeyType(); /** * Gets the uri property: The URI of the key. - * + * * @return the uri value. */ String uri(); /** * Gets the creationDate property: The key creation date. - * + * * @return the creationDate value. */ OffsetDateTime creationDate(); + /** + * Gets the name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + /** * Gets the inner com.azure.resourcemanager.postgresql.fluent.models.ServerKeyInner object. - * + * * @return the inner object. */ ServerKeyInner innerModel(); - /** The entirety of the ServerKey definition. */ + /** + * The entirety of the ServerKey definition. + */ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } - /** The ServerKey definition stages. */ + /** + * The ServerKey definition stages. + */ interface DefinitionStages { - /** The first stage of the ServerKey definition. */ + /** + * The first stage of the ServerKey definition. + */ interface Blank extends WithParentResource { } - /** The stage of the ServerKey definition allowing to specify parent resource. */ + /** + * The stage of the ServerKey definition allowing to specify parent resource. + */ interface WithParentResource { /** * Specifies serverName, resourceGroupName. - * + * * @param serverName The name of the server. * @param resourceGroupName The name of the resource group. The name is case insensitive. * @return the next definition stage. @@ -96,36 +113,40 @@ interface WithParentResource { interface WithCreate extends DefinitionStages.WithServerKeyType, DefinitionStages.WithUri { /** * Executes the create request. - * + * * @return the created resource. */ ServerKey create(); /** * Executes the create request. - * + * * @param context The context to associate with this operation. * @return the created resource. */ ServerKey create(Context context); } - /** The stage of the ServerKey definition allowing to specify serverKeyType. */ + /** + * The stage of the ServerKey definition allowing to specify serverKeyType. + */ interface WithServerKeyType { /** * Specifies the serverKeyType property: The key type like 'AzureKeyVault'.. - * + * * @param serverKeyType The key type like 'AzureKeyVault'. * @return the next definition stage. */ WithCreate withServerKeyType(ServerKeyType serverKeyType); } - /** The stage of the ServerKey definition allowing to specify uri. */ + /** + * The stage of the ServerKey definition allowing to specify uri. + */ interface WithUri { /** * Specifies the uri property: The URI of the key.. - * + * * @param uri The URI of the key. * @return the next definition stage. */ @@ -135,47 +156,55 @@ interface WithUri { /** * Begins update for the ServerKey resource. - * + * * @return the stage of resource update. */ ServerKey.Update update(); - /** The template for ServerKey update. */ + /** + * The template for ServerKey update. + */ interface Update extends UpdateStages.WithServerKeyType, UpdateStages.WithUri { /** * Executes the update request. - * + * * @return the updated resource. */ ServerKey apply(); /** * Executes the update request. - * + * * @param context The context to associate with this operation. * @return the updated resource. */ ServerKey apply(Context context); } - /** The ServerKey update stages. */ + /** + * The ServerKey update stages. + */ interface UpdateStages { - /** The stage of the ServerKey update allowing to specify serverKeyType. */ + /** + * The stage of the ServerKey update allowing to specify serverKeyType. + */ interface WithServerKeyType { /** * Specifies the serverKeyType property: The key type like 'AzureKeyVault'.. - * + * * @param serverKeyType The key type like 'AzureKeyVault'. * @return the next definition stage. */ Update withServerKeyType(ServerKeyType serverKeyType); } - /** The stage of the ServerKey update allowing to specify uri. */ + /** + * The stage of the ServerKey update allowing to specify uri. + */ interface WithUri { /** * Specifies the uri property: The URI of the key.. - * + * * @param uri The URI of the key. * @return the next definition stage. */ @@ -185,14 +214,14 @@ interface WithUri { /** * Refreshes the resource to sync with Azure. - * + * * @return the refreshed resource. */ ServerKey refresh(); /** * Refreshes the resource to sync with Azure. - * + * * @param context The context to associate with this operation. * @return the refreshed resource. */ diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerKeyListResult.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerKeyListResult.java index aba738932f65a..e79f63070e31a 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerKeyListResult.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerKeyListResult.java @@ -5,33 +5,38 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.fluent.models.ServerKeyInner; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** A list of PostgreSQL Server keys. */ +/** + * A list of PostgreSQL Server keys. + */ @Immutable -public final class ServerKeyListResult { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerKeyListResult.class); - +public final class ServerKeyListResult implements JsonSerializable { /* * A list of PostgreSQL Server keys. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * Link to retrieve next page of results. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; + /** + * Creates an instance of ServerKeyListResult class. + */ + public ServerKeyListResult() { + } + /** * Get the value property: A list of PostgreSQL Server keys. - * + * * @return the value value. */ public List value() { @@ -40,7 +45,7 @@ public List value() { /** * Get the nextLink property: Link to retrieve next page of results. - * + * * @return the nextLink value. */ public String nextLink() { @@ -49,7 +54,7 @@ public String nextLink() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -57,4 +62,42 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerKeyListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerKeyListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ServerKeyListResult. + */ + public static ServerKeyListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerKeyListResult deserializedServerKeyListResult = new ServerKeyListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ServerKeyInner.fromJson(reader1)); + deserializedServerKeyListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedServerKeyListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedServerKeyListResult; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerKeyType.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerKeyType.java index df333e4c395a3..812203dfcf6aa 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerKeyType.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerKeyType.java @@ -5,26 +5,41 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for ServerKeyType. */ +/** + * The key type like 'AzureKeyVault'. + */ public final class ServerKeyType extends ExpandableStringEnum { - /** Static value AzureKeyVault for ServerKeyType. */ + /** + * Static value AzureKeyVault for ServerKeyType. + */ public static final ServerKeyType AZURE_KEY_VAULT = fromString("AzureKeyVault"); + /** + * Creates a new instance of ServerKeyType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ServerKeyType() { + } + /** * Creates or finds a ServerKeyType from its string representation. - * + * * @param name a name to look for. * @return the corresponding ServerKeyType. */ - @JsonCreator public static ServerKeyType fromString(String name) { return fromString(name, ServerKeyType.class); } - /** @return known ServerKeyType values. */ + /** + * Gets known ServerKeyType values. + * + * @return known ServerKeyType values. + */ public static Collection values() { return values(ServerKeyType.class); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerKeys.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerKeys.java index 9e2042dd9e11f..874cb79044828 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerKeys.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerKeys.java @@ -8,63 +8,65 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of ServerKeys. */ +/** + * Resource collection API of ServerKeys. + */ public interface ServerKeys { /** * Gets a list of Server keys. - * + * * @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 keys. + * @return a list of Server keys as paginated response with {@link PagedIterable}. */ PagedIterable list(String resourceGroupName, String serverName); /** * Gets a list of Server keys. - * + * * @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 keys. + * @return a list of Server keys as paginated response with {@link PagedIterable}. */ PagedIterable list(String resourceGroupName, String serverName, Context context); /** * Gets a PostgreSQL Server key. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be retrieved. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a PostgreSQL Server key. + * @return a PostgreSQL Server key along with {@link Response}. */ - ServerKey get(String resourceGroupName, String serverName, String keyName); + Response getWithResponse(String resourceGroupName, String serverName, String keyName, Context context); /** * Gets a PostgreSQL Server key. - * + * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be retrieved. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a PostgreSQL Server key along with {@link Response}. + * @return a PostgreSQL Server key. */ - Response getWithResponse(String resourceGroupName, String serverName, String keyName, Context context); + ServerKey get(String resourceGroupName, String serverName, String keyName); /** * Deletes the PostgreSQL Server key with the given name. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be deleted. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -76,7 +78,7 @@ public interface ServerKeys { /** * Deletes the PostgreSQL Server key with the given name. - * + * * @param serverName The name of the server. * @param keyName The name of the PostgreSQL Server key to be deleted. * @param resourceGroupName The name of the resource group. The name is case insensitive. @@ -89,7 +91,7 @@ public interface ServerKeys { /** * Gets a PostgreSQL Server key. - * + * * @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. @@ -100,7 +102,7 @@ public interface ServerKeys { /** * Gets a PostgreSQL Server key. - * + * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -112,7 +114,7 @@ public interface ServerKeys { /** * Deletes the PostgreSQL Server key 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. @@ -122,7 +124,7 @@ public interface ServerKeys { /** * Deletes the PostgreSQL Server key 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. @@ -133,7 +135,7 @@ public interface ServerKeys { /** * Begins definition for a new ServerKey resource. - * + * * @param name resource name. * @return the first stage of the new ServerKey definition. */ diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerListResult.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerListResult.java index a9f7b6739b0cc..a3fbd6b350ca9 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerListResult.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerListResult.java @@ -5,27 +5,33 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.fluent.models.ServerInner; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** A list of servers. */ +/** + * A list of servers. + */ @Fluent -public final class ServerListResult { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerListResult.class); - +public final class ServerListResult implements JsonSerializable { /* * The list of servers */ - @JsonProperty(value = "value") private List value; + /** + * Creates an instance of ServerListResult class. + */ + public ServerListResult() { + } + /** * Get the value property: The list of servers. - * + * * @return the value value. */ public List value() { @@ -34,7 +40,7 @@ public List value() { /** * Set the value property: The list of servers. - * + * * @param value the value value to set. * @return the ServerListResult object itself. */ @@ -45,7 +51,7 @@ public ServerListResult withValue(List value) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -53,4 +59,41 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeArrayField("value", this.value, (writer, element) -> writer.writeJson(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerListResult if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the ServerListResult. + */ + public static ServerListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerListResult deserializedServerListResult = new ServerListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value = reader.readArray(reader1 -> ServerInner.fromJson(reader1)); + deserializedServerListResult.value = value; + } else { + reader.skipChildren(); + } + } + + return deserializedServerListResult; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerParameters.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerParameters.java index e4c187422d486..861016e5ce32e 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerParameters.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerParameters.java @@ -7,11 +7,13 @@ import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationListResultInner; -/** Resource collection API of ServerParameters. */ +/** + * 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. @@ -25,7 +27,7 @@ ConfigurationListResult listUpdateConfigurations(String resourceGroupName, Strin /** * 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. diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPrivateEndpointConnection.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPrivateEndpointConnection.java index c7194f31ca77d..8e3df54d5a667 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPrivateEndpointConnection.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPrivateEndpointConnection.java @@ -5,31 +5,36 @@ package com.azure.resourcemanager.postgresql.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 com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** A private endpoint connection under a server. */ +/** + * A private endpoint connection under a server. + */ @Immutable -public final class ServerPrivateEndpointConnection { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerPrivateEndpointConnection.class); - +public final class ServerPrivateEndpointConnection implements JsonSerializable { /* * 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; + /** + * Creates an instance of ServerPrivateEndpointConnection class. + */ + public ServerPrivateEndpointConnection() { + } + /** * Get the id property: Resource ID of the Private Endpoint Connection. - * + * * @return the id value. */ public String id() { @@ -38,7 +43,7 @@ public String id() { /** * Get the properties property: Private endpoint connection properties. - * + * * @return the properties value. */ public ServerPrivateEndpointConnectionProperties properties() { @@ -47,7 +52,7 @@ public ServerPrivateEndpointConnectionProperties properties() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -55,4 +60,43 @@ public void validate() { properties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerPrivateEndpointConnection from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerPrivateEndpointConnection if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServerPrivateEndpointConnection. + */ + public static ServerPrivateEndpointConnection fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerPrivateEndpointConnection deserializedServerPrivateEndpointConnection + = new ServerPrivateEndpointConnection(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("id".equals(fieldName)) { + deserializedServerPrivateEndpointConnection.id = reader.getString(); + } else if ("properties".equals(fieldName)) { + deserializedServerPrivateEndpointConnection.properties + = ServerPrivateEndpointConnectionProperties.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedServerPrivateEndpointConnection; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPrivateEndpointConnectionProperties.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPrivateEndpointConnectionProperties.java index 8453aa1c49e5a..861d0ea9ca322 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPrivateEndpointConnectionProperties.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPrivateEndpointConnectionProperties.java @@ -5,37 +5,42 @@ package com.azure.resourcemanager.postgresql.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.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** Properties of a private endpoint connection. */ +/** + * Properties of a private endpoint connection. + */ @Fluent -public final class ServerPrivateEndpointConnectionProperties { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerPrivateEndpointConnectionProperties.class); - +public final class ServerPrivateEndpointConnectionProperties + implements JsonSerializable { /* * 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; + /** + * Creates an instance of ServerPrivateEndpointConnectionProperties class. + */ + public ServerPrivateEndpointConnectionProperties() { + } + /** * Get the privateEndpoint property: Private endpoint which the connection belongs to. - * + * * @return the privateEndpoint value. */ public PrivateEndpointProperty privateEndpoint() { @@ -44,7 +49,7 @@ public PrivateEndpointProperty privateEndpoint() { /** * Set the privateEndpoint property: Private endpoint which the connection belongs to. - * + * * @param privateEndpoint the privateEndpoint value to set. * @return the ServerPrivateEndpointConnectionProperties object itself. */ @@ -55,7 +60,7 @@ public ServerPrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndp /** * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. - * + * * @return the privateLinkServiceConnectionState value. */ public ServerPrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { @@ -64,7 +69,7 @@ public ServerPrivateLinkServiceConnectionStateProperty privateLinkServiceConnect /** * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. - * + * * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. * @return the ServerPrivateEndpointConnectionProperties object itself. */ @@ -76,7 +81,7 @@ public ServerPrivateEndpointConnectionProperties withPrivateLinkServiceConnectio /** * Get the provisioningState property: State of the private endpoint connection. - * + * * @return the provisioningState value. */ public PrivateEndpointProvisioningState provisioningState() { @@ -85,7 +90,7 @@ public PrivateEndpointProvisioningState provisioningState() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -96,4 +101,49 @@ public void validate() { privateLinkServiceConnectionState().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("privateEndpoint", this.privateEndpoint); + jsonWriter.writeJsonField("privateLinkServiceConnectionState", this.privateLinkServiceConnectionState); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerPrivateEndpointConnectionProperties from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerPrivateEndpointConnectionProperties if the JsonReader was pointing to an instance of + * it, or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServerPrivateEndpointConnectionProperties. + */ + public static ServerPrivateEndpointConnectionProperties fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerPrivateEndpointConnectionProperties deserializedServerPrivateEndpointConnectionProperties + = new ServerPrivateEndpointConnectionProperties(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("privateEndpoint".equals(fieldName)) { + deserializedServerPrivateEndpointConnectionProperties.privateEndpoint + = PrivateEndpointProperty.fromJson(reader); + } else if ("privateLinkServiceConnectionState".equals(fieldName)) { + deserializedServerPrivateEndpointConnectionProperties.privateLinkServiceConnectionState + = ServerPrivateLinkServiceConnectionStateProperty.fromJson(reader); + } else if ("provisioningState".equals(fieldName)) { + deserializedServerPrivateEndpointConnectionProperties.provisioningState + = PrivateEndpointProvisioningState.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedServerPrivateEndpointConnectionProperties; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPrivateLinkServiceConnectionStateProperty.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPrivateLinkServiceConnectionStateProperty.java index a68370eb592bf..6fbcdb5abfb7d 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPrivateLinkServiceConnectionStateProperty.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPrivateLinkServiceConnectionStateProperty.java @@ -6,36 +6,42 @@ 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.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; -/** The ServerPrivateLinkServiceConnectionStateProperty model. */ +/** + * The ServerPrivateLinkServiceConnectionStateProperty model. + */ @Fluent -public final class ServerPrivateLinkServiceConnectionStateProperty { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerPrivateLinkServiceConnectionStateProperty.class); - +public final class ServerPrivateLinkServiceConnectionStateProperty + implements JsonSerializable { /* * 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; + /** + * Creates an instance of ServerPrivateLinkServiceConnectionStateProperty class. + */ + public ServerPrivateLinkServiceConnectionStateProperty() { + } + /** * Get the status property: The private link service connection status. - * + * * @return the status value. */ public PrivateLinkServiceConnectionStateStatus status() { @@ -44,7 +50,7 @@ public PrivateLinkServiceConnectionStateStatus status() { /** * Set the status property: The private link service connection status. - * + * * @param status the status value to set. * @return the ServerPrivateLinkServiceConnectionStateProperty object itself. */ @@ -55,7 +61,7 @@ public ServerPrivateLinkServiceConnectionStateProperty withStatus(PrivateLinkSer /** * Get the description property: The private link service connection description. - * + * * @return the description value. */ public String description() { @@ -64,7 +70,7 @@ public String description() { /** * Set the description property: The private link service connection description. - * + * * @param description the description value to set. * @return the ServerPrivateLinkServiceConnectionStateProperty object itself. */ @@ -75,7 +81,7 @@ public ServerPrivateLinkServiceConnectionStateProperty withDescription(String de /** * Get the actionsRequired property: The actions required for private link service connection. - * + * * @return the actionsRequired value. */ public PrivateLinkServiceConnectionStateActionsRequire actionsRequired() { @@ -84,17 +90,66 @@ public PrivateLinkServiceConnectionStateActionsRequire 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")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property status in model ServerPrivateLinkServiceConnectionStateProperty")); } if (description() == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( - "Missing required property description in model" + " ServerPrivateLinkServiceConnectionStateProperty")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property description in model ServerPrivateLinkServiceConnectionStateProperty")); } } + + private static final ClientLogger LOGGER = new ClientLogger(ServerPrivateLinkServiceConnectionStateProperty.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("status", this.status == null ? null : this.status.toString()); + jsonWriter.writeStringField("description", this.description); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerPrivateLinkServiceConnectionStateProperty from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerPrivateLinkServiceConnectionStateProperty if the JsonReader was pointing to an + * instance of it, or null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ServerPrivateLinkServiceConnectionStateProperty. + */ + public static ServerPrivateLinkServiceConnectionStateProperty fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerPrivateLinkServiceConnectionStateProperty deserializedServerPrivateLinkServiceConnectionStateProperty + = new ServerPrivateLinkServiceConnectionStateProperty(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("status".equals(fieldName)) { + deserializedServerPrivateLinkServiceConnectionStateProperty.status + = PrivateLinkServiceConnectionStateStatus.fromString(reader.getString()); + } else if ("description".equals(fieldName)) { + deserializedServerPrivateLinkServiceConnectionStateProperty.description = reader.getString(); + } else if ("actionsRequired".equals(fieldName)) { + deserializedServerPrivateLinkServiceConnectionStateProperty.actionsRequired + = PrivateLinkServiceConnectionStateActionsRequire.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedServerPrivateLinkServiceConnectionStateProperty; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForCreate.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForCreate.java index 33722da707fb2..79cb50ae3bedf 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForCreate.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForCreate.java @@ -5,70 +5,71 @@ package com.azure.resourcemanager.postgresql.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) }) +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties used to create a new server. + */ @Fluent -public class ServerPropertiesForCreate { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerPropertiesForCreate.class); +public class ServerPropertiesForCreate implements JsonSerializable { + /* + * The mode to create a new server. + */ + private CreateMode createMode = CreateMode.fromString("ServerPropertiesForCreate"); /* * Server version. */ - @JsonProperty(value = "version") private ServerVersion version; /* * Enable ssl enforcement or not when connect to server. */ - @JsonProperty(value = "sslEnforcement") private SslEnforcementEnum sslEnforcement; /* * Enforce a minimal Tls version for the server. */ - @JsonProperty(value = "minimalTlsVersion") private MinimalTlsVersionEnum minimalTlsVersion; /* * Status showing whether the server enabled infrastructure encryption. */ - @JsonProperty(value = "infrastructureEncryption") private InfrastructureEncryption infrastructureEncryption; /* - * Whether or not public network access is allowed for this server. Value - * is optional but if passed in, must be 'Enabled' or 'Disabled' + * 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; + /** + * Creates an instance of ServerPropertiesForCreate class. + */ + public ServerPropertiesForCreate() { + } + + /** + * Get the createMode property: The mode to create a new server. + * + * @return the createMode value. + */ + public CreateMode createMode() { + return this.createMode; + } + /** * Get the version property: Server version. - * + * * @return the version value. */ public ServerVersion version() { @@ -77,7 +78,7 @@ public ServerVersion version() { /** * Set the version property: Server version. - * + * * @param version the version value to set. * @return the ServerPropertiesForCreate object itself. */ @@ -88,7 +89,7 @@ public ServerPropertiesForCreate withVersion(ServerVersion version) { /** * Get the sslEnforcement property: Enable ssl enforcement or not when connect to server. - * + * * @return the sslEnforcement value. */ public SslEnforcementEnum sslEnforcement() { @@ -97,7 +98,7 @@ public SslEnforcementEnum 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. */ @@ -108,7 +109,7 @@ public ServerPropertiesForCreate withSslEnforcement(SslEnforcementEnum sslEnforc /** * Get the minimalTlsVersion property: Enforce a minimal Tls version for the server. - * + * * @return the minimalTlsVersion value. */ public MinimalTlsVersionEnum minimalTlsVersion() { @@ -117,7 +118,7 @@ public MinimalTlsVersionEnum minimalTlsVersion() { /** * Set the minimalTlsVersion property: Enforce a minimal Tls version for the server. - * + * * @param minimalTlsVersion the minimalTlsVersion value to set. * @return the ServerPropertiesForCreate object itself. */ @@ -128,7 +129,7 @@ public ServerPropertiesForCreate withMinimalTlsVersion(MinimalTlsVersionEnum min /** * Get the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. - * + * * @return the infrastructureEncryption value. */ public InfrastructureEncryption infrastructureEncryption() { @@ -137,7 +138,7 @@ public InfrastructureEncryption infrastructureEncryption() { /** * Set the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. - * + * * @param infrastructureEncryption the infrastructureEncryption value to set. * @return the ServerPropertiesForCreate object itself. */ @@ -149,7 +150,7 @@ public ServerPropertiesForCreate withInfrastructureEncryption(InfrastructureEncr /** * 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() { @@ -159,7 +160,7 @@ public PublicNetworkAccessEnum 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. */ @@ -170,7 +171,7 @@ public ServerPropertiesForCreate withPublicNetworkAccess(PublicNetworkAccessEnum /** * Get the storageProfile property: Storage profile of a server. - * + * * @return the storageProfile value. */ public StorageProfile storageProfile() { @@ -179,7 +180,7 @@ public StorageProfile storageProfile() { /** * Set the storageProfile property: Storage profile of a server. - * + * * @param storageProfile the storageProfile value to set. * @return the ServerPropertiesForCreate object itself. */ @@ -190,7 +191,7 @@ public ServerPropertiesForCreate withStorageProfile(StorageProfile storageProfil /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -198,4 +199,97 @@ public void validate() { storageProfile().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + jsonWriter.writeStringField("version", this.version == null ? null : this.version.toString()); + jsonWriter.writeStringField("sslEnforcement", + this.sslEnforcement == null ? null : this.sslEnforcement.toString()); + jsonWriter.writeStringField("minimalTlsVersion", + this.minimalTlsVersion == null ? null : this.minimalTlsVersion.toString()); + jsonWriter.writeStringField("infrastructureEncryption", + this.infrastructureEncryption == null ? null : this.infrastructureEncryption.toString()); + jsonWriter.writeStringField("publicNetworkAccess", + this.publicNetworkAccess == null ? null : this.publicNetworkAccess.toString()); + jsonWriter.writeJsonField("storageProfile", this.storageProfile); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerPropertiesForCreate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerPropertiesForCreate if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServerPropertiesForCreate. + */ + public static ServerPropertiesForCreate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + String discriminatorValue = null; + try (JsonReader readerToUse = reader.bufferObject()) { + readerToUse.nextToken(); // Prepare for reading + while (readerToUse.nextToken() != JsonToken.END_OBJECT) { + String fieldName = readerToUse.getFieldName(); + readerToUse.nextToken(); + if ("createMode".equals(fieldName)) { + discriminatorValue = readerToUse.getString(); + break; + } else { + readerToUse.skipChildren(); + } + } + // Use the discriminator value to determine which subtype should be deserialized. + if ("Default".equals(discriminatorValue)) { + return ServerPropertiesForDefaultCreate.fromJson(readerToUse.reset()); + } else if ("PointInTimeRestore".equals(discriminatorValue)) { + return ServerPropertiesForRestore.fromJson(readerToUse.reset()); + } else if ("GeoRestore".equals(discriminatorValue)) { + return ServerPropertiesForGeoRestore.fromJson(readerToUse.reset()); + } else if ("Replica".equals(discriminatorValue)) { + return ServerPropertiesForReplica.fromJson(readerToUse.reset()); + } else { + return fromJsonKnownDiscriminator(readerToUse.reset()); + } + } + }); + } + + static ServerPropertiesForCreate fromJsonKnownDiscriminator(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerPropertiesForCreate deserializedServerPropertiesForCreate = new ServerPropertiesForCreate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("createMode".equals(fieldName)) { + deserializedServerPropertiesForCreate.createMode = CreateMode.fromString(reader.getString()); + } else if ("version".equals(fieldName)) { + deserializedServerPropertiesForCreate.version = ServerVersion.fromString(reader.getString()); + } else if ("sslEnforcement".equals(fieldName)) { + deserializedServerPropertiesForCreate.sslEnforcement + = SslEnforcementEnum.fromString(reader.getString()); + } else if ("minimalTlsVersion".equals(fieldName)) { + deserializedServerPropertiesForCreate.minimalTlsVersion + = MinimalTlsVersionEnum.fromString(reader.getString()); + } else if ("infrastructureEncryption".equals(fieldName)) { + deserializedServerPropertiesForCreate.infrastructureEncryption + = InfrastructureEncryption.fromString(reader.getString()); + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedServerPropertiesForCreate.publicNetworkAccess + = PublicNetworkAccessEnum.fromString(reader.getString()); + } else if ("storageProfile".equals(fieldName)) { + deserializedServerPropertiesForCreate.storageProfile = StorageProfile.fromJson(reader); + } else { + reader.skipChildren(); + } + } + + return deserializedServerPropertiesForCreate; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForDefaultCreate.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForDefaultCreate.java index 95ff31e3f8b78..39f345aebc509 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForDefaultCreate.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForDefaultCreate.java @@ -6,36 +6,52 @@ 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") +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties used to create a new server. + */ @Fluent public final class ServerPropertiesForDefaultCreate extends ServerPropertiesForCreate { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerPropertiesForDefaultCreate.class); + /* + * The mode to create a new server. + */ + private CreateMode createMode = CreateMode.DEFAULT; /* - * The administrator's login name of a server. Can only be specified when - * the server is being created (and is required for creation). + * 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; + /** + * Creates an instance of ServerPropertiesForDefaultCreate class. + */ + public ServerPropertiesForDefaultCreate() { + } + + /** + * Get the createMode property: The mode to create a new server. + * + * @return the createMode value. + */ + @Override + public CreateMode createMode() { + return this.createMode; + } + /** * 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() { @@ -45,7 +61,7 @@ public String 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. */ @@ -56,7 +72,7 @@ public ServerPropertiesForDefaultCreate withAdministratorLogin(String administra /** * Get the administratorLoginPassword property: The password of the administrator login. - * + * * @return the administratorLoginPassword value. */ public String administratorLoginPassword() { @@ -65,7 +81,7 @@ public String administratorLoginPassword() { /** * Set the administratorLoginPassword property: The password of the administrator login. - * + * * @param administratorLoginPassword the administratorLoginPassword value to set. * @return the ServerPropertiesForDefaultCreate object itself. */ @@ -74,28 +90,36 @@ public ServerPropertiesForDefaultCreate withAdministratorLoginPassword(String ad return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForDefaultCreate withVersion(ServerVersion version) { super.withVersion(version); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForDefaultCreate withSslEnforcement(SslEnforcementEnum sslEnforcement) { super.withSslEnforcement(sslEnforcement); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForDefaultCreate withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { super.withMinimalTlsVersion(minimalTlsVersion); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForDefaultCreate withInfrastructureEncryption(InfrastructureEncryption infrastructureEncryption) { @@ -103,14 +127,18 @@ public ServerPropertiesForDefaultCreate withMinimalTlsVersion(MinimalTlsVersionE return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForDefaultCreate withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { super.withPublicNetworkAccess(publicNetworkAccess); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForDefaultCreate withStorageProfile(StorageProfile storageProfile) { super.withStorageProfile(storageProfile); @@ -119,19 +147,95 @@ public ServerPropertiesForDefaultCreate withStorageProfile(StorageProfile storag /** * 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")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property administratorLogin in model ServerPropertiesForDefaultCreate")); } if (administratorLoginPassword() == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( - "Missing required property administratorLoginPassword in model" + " ServerPropertiesForDefaultCreate")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property administratorLoginPassword in model ServerPropertiesForDefaultCreate")); + } + if (storageProfile() != null) { + storageProfile().validate(); } } + + private static final ClientLogger LOGGER = new ClientLogger(ServerPropertiesForDefaultCreate.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("version", version() == null ? null : version().toString()); + jsonWriter.writeStringField("sslEnforcement", sslEnforcement() == null ? null : sslEnforcement().toString()); + jsonWriter.writeStringField("minimalTlsVersion", + minimalTlsVersion() == null ? null : minimalTlsVersion().toString()); + jsonWriter.writeStringField("infrastructureEncryption", + infrastructureEncryption() == null ? null : infrastructureEncryption().toString()); + jsonWriter.writeStringField("publicNetworkAccess", + publicNetworkAccess() == null ? null : publicNetworkAccess().toString()); + jsonWriter.writeJsonField("storageProfile", storageProfile()); + jsonWriter.writeStringField("administratorLogin", this.administratorLogin); + jsonWriter.writeStringField("administratorLoginPassword", this.administratorLoginPassword); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerPropertiesForDefaultCreate from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerPropertiesForDefaultCreate if the JsonReader was pointing to an instance of it, or + * null if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ServerPropertiesForDefaultCreate. + */ + public static ServerPropertiesForDefaultCreate fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerPropertiesForDefaultCreate deserializedServerPropertiesForDefaultCreate + = new ServerPropertiesForDefaultCreate(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("version".equals(fieldName)) { + deserializedServerPropertiesForDefaultCreate + .withVersion(ServerVersion.fromString(reader.getString())); + } else if ("sslEnforcement".equals(fieldName)) { + deserializedServerPropertiesForDefaultCreate + .withSslEnforcement(SslEnforcementEnum.fromString(reader.getString())); + } else if ("minimalTlsVersion".equals(fieldName)) { + deserializedServerPropertiesForDefaultCreate + .withMinimalTlsVersion(MinimalTlsVersionEnum.fromString(reader.getString())); + } else if ("infrastructureEncryption".equals(fieldName)) { + deserializedServerPropertiesForDefaultCreate + .withInfrastructureEncryption(InfrastructureEncryption.fromString(reader.getString())); + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedServerPropertiesForDefaultCreate + .withPublicNetworkAccess(PublicNetworkAccessEnum.fromString(reader.getString())); + } else if ("storageProfile".equals(fieldName)) { + deserializedServerPropertiesForDefaultCreate.withStorageProfile(StorageProfile.fromJson(reader)); + } else if ("administratorLogin".equals(fieldName)) { + deserializedServerPropertiesForDefaultCreate.administratorLogin = reader.getString(); + } else if ("administratorLoginPassword".equals(fieldName)) { + deserializedServerPropertiesForDefaultCreate.administratorLoginPassword = reader.getString(); + } else if ("createMode".equals(fieldName)) { + deserializedServerPropertiesForDefaultCreate.createMode = CreateMode.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedServerPropertiesForDefaultCreate; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForGeoRestore.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForGeoRestore.java index d590bee5ca43e..c3f05ce1747a7 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForGeoRestore.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForGeoRestore.java @@ -6,28 +6,45 @@ 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") +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties used to create a new server by restoring to a different region from a geo replicated backup. + */ @Fluent public final class ServerPropertiesForGeoRestore extends ServerPropertiesForCreate { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerPropertiesForGeoRestore.class); + /* + * The mode to create a new server. + */ + private CreateMode createMode = CreateMode.GEO_RESTORE; /* * The source server id to restore from. */ - @JsonProperty(value = "sourceServerId", required = true) private String sourceServerId; + /** + * Creates an instance of ServerPropertiesForGeoRestore class. + */ + public ServerPropertiesForGeoRestore() { + } + + /** + * Get the createMode property: The mode to create a new server. + * + * @return the createMode value. + */ + @Override + public CreateMode createMode() { + return this.createMode; + } + /** * Get the sourceServerId property: The source server id to restore from. - * + * * @return the sourceServerId value. */ public String sourceServerId() { @@ -36,7 +53,7 @@ public String sourceServerId() { /** * Set the sourceServerId property: The source server id to restore from. - * + * * @param sourceServerId the sourceServerId value to set. * @return the ServerPropertiesForGeoRestore object itself. */ @@ -45,28 +62,36 @@ public ServerPropertiesForGeoRestore withSourceServerId(String sourceServerId) { return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForGeoRestore withVersion(ServerVersion version) { super.withVersion(version); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForGeoRestore withSslEnforcement(SslEnforcementEnum sslEnforcement) { super.withSslEnforcement(sslEnforcement); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForGeoRestore withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { super.withMinimalTlsVersion(minimalTlsVersion); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForGeoRestore withInfrastructureEncryption(InfrastructureEncryption infrastructureEncryption) { @@ -74,14 +99,18 @@ public ServerPropertiesForGeoRestore withMinimalTlsVersion(MinimalTlsVersionEnum return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForGeoRestore withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { super.withPublicNetworkAccess(publicNetworkAccess); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForGeoRestore withStorageProfile(StorageProfile storageProfile) { super.withStorageProfile(storageProfile); @@ -90,15 +119,86 @@ public ServerPropertiesForGeoRestore withStorageProfile(StorageProfile storagePr /** * 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")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sourceServerId in model ServerPropertiesForGeoRestore")); } + if (storageProfile() != null) { + storageProfile().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerPropertiesForGeoRestore.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("version", version() == null ? null : version().toString()); + jsonWriter.writeStringField("sslEnforcement", sslEnforcement() == null ? null : sslEnforcement().toString()); + jsonWriter.writeStringField("minimalTlsVersion", + minimalTlsVersion() == null ? null : minimalTlsVersion().toString()); + jsonWriter.writeStringField("infrastructureEncryption", + infrastructureEncryption() == null ? null : infrastructureEncryption().toString()); + jsonWriter.writeStringField("publicNetworkAccess", + publicNetworkAccess() == null ? null : publicNetworkAccess().toString()); + jsonWriter.writeJsonField("storageProfile", storageProfile()); + jsonWriter.writeStringField("sourceServerId", this.sourceServerId); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerPropertiesForGeoRestore from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerPropertiesForGeoRestore if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ServerPropertiesForGeoRestore. + */ + public static ServerPropertiesForGeoRestore fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerPropertiesForGeoRestore deserializedServerPropertiesForGeoRestore + = new ServerPropertiesForGeoRestore(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("version".equals(fieldName)) { + deserializedServerPropertiesForGeoRestore.withVersion(ServerVersion.fromString(reader.getString())); + } else if ("sslEnforcement".equals(fieldName)) { + deserializedServerPropertiesForGeoRestore + .withSslEnforcement(SslEnforcementEnum.fromString(reader.getString())); + } else if ("minimalTlsVersion".equals(fieldName)) { + deserializedServerPropertiesForGeoRestore + .withMinimalTlsVersion(MinimalTlsVersionEnum.fromString(reader.getString())); + } else if ("infrastructureEncryption".equals(fieldName)) { + deserializedServerPropertiesForGeoRestore + .withInfrastructureEncryption(InfrastructureEncryption.fromString(reader.getString())); + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedServerPropertiesForGeoRestore + .withPublicNetworkAccess(PublicNetworkAccessEnum.fromString(reader.getString())); + } else if ("storageProfile".equals(fieldName)) { + deserializedServerPropertiesForGeoRestore.withStorageProfile(StorageProfile.fromJson(reader)); + } else if ("sourceServerId".equals(fieldName)) { + deserializedServerPropertiesForGeoRestore.sourceServerId = reader.getString(); + } else if ("createMode".equals(fieldName)) { + deserializedServerPropertiesForGeoRestore.createMode = CreateMode.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedServerPropertiesForGeoRestore; + }); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForReplica.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForReplica.java index 8422dcab7b94c..1326fb3cda928 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForReplica.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForReplica.java @@ -6,28 +6,45 @@ 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") +import com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * The properties to create a new replica. + */ @Fluent public final class ServerPropertiesForReplica extends ServerPropertiesForCreate { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerPropertiesForReplica.class); + /* + * The mode to create a new server. + */ + private CreateMode createMode = CreateMode.REPLICA; /* * The master server id to create replica from. */ - @JsonProperty(value = "sourceServerId", required = true) private String sourceServerId; + /** + * Creates an instance of ServerPropertiesForReplica class. + */ + public ServerPropertiesForReplica() { + } + + /** + * Get the createMode property: The mode to create a new server. + * + * @return the createMode value. + */ + @Override + public CreateMode createMode() { + return this.createMode; + } + /** * Get the sourceServerId property: The master server id to create replica from. - * + * * @return the sourceServerId value. */ public String sourceServerId() { @@ -36,7 +53,7 @@ public String 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. */ @@ -45,42 +62,54 @@ public ServerPropertiesForReplica withSourceServerId(String sourceServerId) { return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForReplica withVersion(ServerVersion version) { super.withVersion(version); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForReplica withSslEnforcement(SslEnforcementEnum sslEnforcement) { super.withSslEnforcement(sslEnforcement); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForReplica withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { super.withMinimalTlsVersion(minimalTlsVersion); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForReplica withInfrastructureEncryption(InfrastructureEncryption infrastructureEncryption) { super.withInfrastructureEncryption(infrastructureEncryption); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForReplica withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { super.withPublicNetworkAccess(publicNetworkAccess); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForReplica withStorageProfile(StorageProfile storageProfile) { super.withStorageProfile(storageProfile); @@ -89,15 +118,85 @@ public ServerPropertiesForReplica withStorageProfile(StorageProfile storageProfi /** * 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")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sourceServerId in model ServerPropertiesForReplica")); } + if (storageProfile() != null) { + storageProfile().validate(); + } + } + + private static final ClientLogger LOGGER = new ClientLogger(ServerPropertiesForReplica.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("version", version() == null ? null : version().toString()); + jsonWriter.writeStringField("sslEnforcement", sslEnforcement() == null ? null : sslEnforcement().toString()); + jsonWriter.writeStringField("minimalTlsVersion", + minimalTlsVersion() == null ? null : minimalTlsVersion().toString()); + jsonWriter.writeStringField("infrastructureEncryption", + infrastructureEncryption() == null ? null : infrastructureEncryption().toString()); + jsonWriter.writeStringField("publicNetworkAccess", + publicNetworkAccess() == null ? null : publicNetworkAccess().toString()); + jsonWriter.writeJsonField("storageProfile", storageProfile()); + jsonWriter.writeStringField("sourceServerId", this.sourceServerId); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerPropertiesForReplica from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerPropertiesForReplica if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ServerPropertiesForReplica. + */ + public static ServerPropertiesForReplica fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerPropertiesForReplica deserializedServerPropertiesForReplica = new ServerPropertiesForReplica(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("version".equals(fieldName)) { + deserializedServerPropertiesForReplica.withVersion(ServerVersion.fromString(reader.getString())); + } else if ("sslEnforcement".equals(fieldName)) { + deserializedServerPropertiesForReplica + .withSslEnforcement(SslEnforcementEnum.fromString(reader.getString())); + } else if ("minimalTlsVersion".equals(fieldName)) { + deserializedServerPropertiesForReplica + .withMinimalTlsVersion(MinimalTlsVersionEnum.fromString(reader.getString())); + } else if ("infrastructureEncryption".equals(fieldName)) { + deserializedServerPropertiesForReplica + .withInfrastructureEncryption(InfrastructureEncryption.fromString(reader.getString())); + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedServerPropertiesForReplica + .withPublicNetworkAccess(PublicNetworkAccessEnum.fromString(reader.getString())); + } else if ("storageProfile".equals(fieldName)) { + deserializedServerPropertiesForReplica.withStorageProfile(StorageProfile.fromJson(reader)); + } else if ("sourceServerId".equals(fieldName)) { + deserializedServerPropertiesForReplica.sourceServerId = reader.getString(); + } else if ("createMode".equals(fieldName)) { + deserializedServerPropertiesForReplica.createMode = CreateMode.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedServerPropertiesForReplica; + }); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForRestore.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForRestore.java index 82c18b5691048..6973c4cf21905 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForRestore.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerPropertiesForRestore.java @@ -5,37 +5,54 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.annotation.Fluent; +import com.azure.core.util.CoreUtils; 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 com.azure.json.JsonReader; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.time.OffsetDateTime; +import java.time.format.DateTimeFormatter; -/** 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") +/** + * The properties used to create a new server by restoring from a backup. + */ @Fluent public final class ServerPropertiesForRestore extends ServerPropertiesForCreate { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerPropertiesForRestore.class); + /* + * The mode to create a new server. + */ + private CreateMode createMode = CreateMode.POINT_IN_TIME_RESTORE; /* * 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. + * Restore point creation time (ISO8601 format), specifying the time to restore from. */ - @JsonProperty(value = "restorePointInTime", required = true) private OffsetDateTime restorePointInTime; + /** + * Creates an instance of ServerPropertiesForRestore class. + */ + public ServerPropertiesForRestore() { + } + + /** + * Get the createMode property: The mode to create a new server. + * + * @return the createMode value. + */ + @Override + public CreateMode createMode() { + return this.createMode; + } + /** * Get the sourceServerId property: The source server id to restore from. - * + * * @return the sourceServerId value. */ public String sourceServerId() { @@ -44,7 +61,7 @@ public String sourceServerId() { /** * Set the sourceServerId property: The source server id to restore from. - * + * * @param sourceServerId the sourceServerId value to set. * @return the ServerPropertiesForRestore object itself. */ @@ -56,7 +73,7 @@ public ServerPropertiesForRestore withSourceServerId(String sourceServerId) { /** * Get the restorePointInTime property: Restore point creation time (ISO8601 format), specifying the time to restore * from. - * + * * @return the restorePointInTime value. */ public OffsetDateTime restorePointInTime() { @@ -66,7 +83,7 @@ public OffsetDateTime 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. */ @@ -75,42 +92,54 @@ public ServerPropertiesForRestore withRestorePointInTime(OffsetDateTime restoreP return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForRestore withVersion(ServerVersion version) { super.withVersion(version); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForRestore withSslEnforcement(SslEnforcementEnum sslEnforcement) { super.withSslEnforcement(sslEnforcement); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForRestore withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { super.withMinimalTlsVersion(minimalTlsVersion); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForRestore withInfrastructureEncryption(InfrastructureEncryption infrastructureEncryption) { super.withInfrastructureEncryption(infrastructureEncryption); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForRestore withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { super.withPublicNetworkAccess(publicNetworkAccess); return this; } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override public ServerPropertiesForRestore withStorageProfile(StorageProfile storageProfile) { super.withStorageProfile(storageProfile); @@ -119,19 +148,97 @@ public ServerPropertiesForRestore withStorageProfile(StorageProfile storageProfi /** * 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")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property sourceServerId in model ServerPropertiesForRestore")); } if (restorePointInTime() == null) { - throw logger.logExceptionAsError(new IllegalArgumentException( - "Missing required property restorePointInTime in model ServerPropertiesForRestore")); + throw LOGGER.atError() + .log(new IllegalArgumentException( + "Missing required property restorePointInTime in model ServerPropertiesForRestore")); + } + if (storageProfile() != null) { + storageProfile().validate(); } } + + private static final ClientLogger LOGGER = new ClientLogger(ServerPropertiesForRestore.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("version", version() == null ? null : version().toString()); + jsonWriter.writeStringField("sslEnforcement", sslEnforcement() == null ? null : sslEnforcement().toString()); + jsonWriter.writeStringField("minimalTlsVersion", + minimalTlsVersion() == null ? null : minimalTlsVersion().toString()); + jsonWriter.writeStringField("infrastructureEncryption", + infrastructureEncryption() == null ? null : infrastructureEncryption().toString()); + jsonWriter.writeStringField("publicNetworkAccess", + publicNetworkAccess() == null ? null : publicNetworkAccess().toString()); + jsonWriter.writeJsonField("storageProfile", storageProfile()); + jsonWriter.writeStringField("sourceServerId", this.sourceServerId); + jsonWriter.writeStringField("restorePointInTime", + this.restorePointInTime == null + ? null + : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.restorePointInTime)); + jsonWriter.writeStringField("createMode", this.createMode == null ? null : this.createMode.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerPropertiesForRestore from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerPropertiesForRestore if the JsonReader was pointing to an instance of it, or null if + * it was pointing to JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the ServerPropertiesForRestore. + */ + public static ServerPropertiesForRestore fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerPropertiesForRestore deserializedServerPropertiesForRestore = new ServerPropertiesForRestore(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("version".equals(fieldName)) { + deserializedServerPropertiesForRestore.withVersion(ServerVersion.fromString(reader.getString())); + } else if ("sslEnforcement".equals(fieldName)) { + deserializedServerPropertiesForRestore + .withSslEnforcement(SslEnforcementEnum.fromString(reader.getString())); + } else if ("minimalTlsVersion".equals(fieldName)) { + deserializedServerPropertiesForRestore + .withMinimalTlsVersion(MinimalTlsVersionEnum.fromString(reader.getString())); + } else if ("infrastructureEncryption".equals(fieldName)) { + deserializedServerPropertiesForRestore + .withInfrastructureEncryption(InfrastructureEncryption.fromString(reader.getString())); + } else if ("publicNetworkAccess".equals(fieldName)) { + deserializedServerPropertiesForRestore + .withPublicNetworkAccess(PublicNetworkAccessEnum.fromString(reader.getString())); + } else if ("storageProfile".equals(fieldName)) { + deserializedServerPropertiesForRestore.withStorageProfile(StorageProfile.fromJson(reader)); + } else if ("sourceServerId".equals(fieldName)) { + deserializedServerPropertiesForRestore.sourceServerId = reader.getString(); + } else if ("restorePointInTime".equals(fieldName)) { + deserializedServerPropertiesForRestore.restorePointInTime = reader + .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())); + } else if ("createMode".equals(fieldName)) { + deserializedServerPropertiesForRestore.createMode = CreateMode.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedServerPropertiesForRestore; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicies.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicies.java index 22568eebacf55..6620dbeeba1a0 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicies.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicies.java @@ -8,65 +8,67 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of ServerSecurityAlertPolicies. */ +/** + * 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. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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. + * @return a server's security alert policy along with {@link Response}. */ - ServerSecurityAlertPolicy get(String resourceGroupName, String serverName, - SecurityAlertPolicyName securityAlertPolicyName); + Response getWithResponse(String resourceGroupName, String serverName, + SecurityAlertPolicyName securityAlertPolicyName, 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. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + * @return a server's security alert policy. */ - Response getWithResponse(String resourceGroupName, String serverName, - SecurityAlertPolicyName securityAlertPolicyName, Context context); + ServerSecurityAlertPolicy get(String resourceGroupName, String serverName, + SecurityAlertPolicyName securityAlertPolicyName); /** * Get the server's threat detection policies. - * + * * @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 server's threat detection policies. + * @return the server's threat detection policies as paginated response with {@link PagedIterable}. */ PagedIterable listByServer(String resourceGroupName, String serverName); /** * Get the server's threat detection policies. - * + * * @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 server's threat detection policies. + * @return the server's threat detection policies as paginated response with {@link PagedIterable}. */ PagedIterable listByServer(String resourceGroupName, String serverName, 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. @@ -77,7 +79,7 @@ Response getWithResponse(String resourceGroupName, St /** * 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. @@ -89,7 +91,7 @@ Response getWithResponse(String resourceGroupName, St /** * Begins definition for a new ServerSecurityAlertPolicy resource. - * + * * @param name resource name. * @return the first stage of the new ServerSecurityAlertPolicy definition. */ diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicy.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicy.java index 93b3eb2b38b43..4c583c7b47c31 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicy.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicy.java @@ -8,32 +8,34 @@ import com.azure.resourcemanager.postgresql.fluent.models.ServerSecurityAlertPolicyInner; import java.util.List; -/** An immutable client-side representation of ServerSecurityAlertPolicy. */ +/** + * 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(); @@ -41,21 +43,21 @@ public interface ServerSecurityAlertPolicy { /** * 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(); @@ -63,7 +65,7 @@ public interface ServerSecurityAlertPolicy { /** * 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(); @@ -71,41 +73,56 @@ public interface ServerSecurityAlertPolicy { /** * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + /** * Gets the inner com.azure.resourcemanager.postgresql.fluent.models.ServerSecurityAlertPolicyInner object. - * + * * @return the inner object. */ ServerSecurityAlertPolicyInner innerModel(); - /** The entirety of the ServerSecurityAlertPolicy definition. */ + /** + * The entirety of the ServerSecurityAlertPolicy definition. + */ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } - /** The ServerSecurityAlertPolicy definition stages. */ + /** + * The ServerSecurityAlertPolicy definition stages. + */ interface DefinitionStages { - /** The first stage of the ServerSecurityAlertPolicy definition. */ + /** + * The first stage of the ServerSecurityAlertPolicy definition. + */ interface Blank extends WithParentResource { } - /** The stage of the ServerSecurityAlertPolicy definition allowing to specify parent resource. */ + /** + * 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. @@ -123,101 +140,114 @@ interface WithCreate extends DefinitionStages.WithState, DefinitionStages.WithDi 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. */ + /** + * 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. */ + /** + * 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. + * Sql_Injection_Vulnerability, Access_Anomaly. * @return the next definition stage. */ WithCreate withDisabledAlerts(List disabledAlerts); } - /** The stage of the ServerSecurityAlertPolicy definition allowing to specify emailAddresses. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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. + * 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. */ + /** + * 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. + * account. * @return the next definition stage. */ WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); } - /** The stage of the ServerSecurityAlertPolicy definition allowing to specify retentionDays. */ + /** + * 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. */ @@ -227,114 +257,131 @@ interface WithRetentionDays { /** * Begins update for the ServerSecurityAlertPolicy resource. - * + * * @return the stage of resource update. */ ServerSecurityAlertPolicy.Update update(); - /** The template for ServerSecurityAlertPolicy 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. */ + /** + * The ServerSecurityAlertPolicy update stages. + */ interface UpdateStages { - /** The stage of the ServerSecurityAlertPolicy update allowing to specify state. */ + /** + * 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. */ + /** + * 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. + * Sql_Injection_Vulnerability, Access_Anomaly. * @return the next definition stage. */ Update withDisabledAlerts(List disabledAlerts); } - /** The stage of the ServerSecurityAlertPolicy update allowing to specify emailAddresses. */ + /** + * 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. */ + /** + * 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. */ + /** + * 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. + * 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. */ + /** + * 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. + * account. * @return the next definition stage. */ Update withStorageAccountAccessKey(String storageAccountAccessKey); } - /** The stage of the ServerSecurityAlertPolicy update allowing to specify retentionDays. */ + /** + * 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. */ @@ -344,14 +391,14 @@ interface WithRetentionDays { /** * 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. */ diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicyListResult.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicyListResult.java index 5afb43131425e..f442ad00cb8bc 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicyListResult.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicyListResult.java @@ -5,33 +5,39 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.fluent.models.ServerSecurityAlertPolicyInner; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** A list of the server's security alert policies. */ +/** + * A list of the server's security alert policies. + */ @Immutable -public final class ServerSecurityAlertPolicyListResult { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerSecurityAlertPolicyListResult.class); - +public final class ServerSecurityAlertPolicyListResult + implements JsonSerializable { /* * Array of results. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * Link to retrieve next page of results. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; + /** + * Creates an instance of ServerSecurityAlertPolicyListResult class. + */ + public ServerSecurityAlertPolicyListResult() { + } + /** * Get the value property: Array of results. - * + * * @return the value value. */ public List value() { @@ -40,7 +46,7 @@ public List value() { /** * Get the nextLink property: Link to retrieve next page of results. - * + * * @return the nextLink value. */ public String nextLink() { @@ -49,7 +55,7 @@ public String nextLink() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -57,4 +63,44 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerSecurityAlertPolicyListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerSecurityAlertPolicyListResult if the JsonReader was pointing to an instance of it, + * or null if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServerSecurityAlertPolicyListResult. + */ + public static ServerSecurityAlertPolicyListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerSecurityAlertPolicyListResult deserializedServerSecurityAlertPolicyListResult + = new ServerSecurityAlertPolicyListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> ServerSecurityAlertPolicyInner.fromJson(reader1)); + deserializedServerSecurityAlertPolicyListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedServerSecurityAlertPolicyListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedServerSecurityAlertPolicyListResult; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicyState.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicyState.java index 9be158c3e9929..655267c92220f 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicyState.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicyState.java @@ -4,18 +4,23 @@ package com.azure.resourcemanager.postgresql.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** Defines values for ServerSecurityAlertPolicyState. */ +/** + * Specifies the state of the policy, whether it is enabled or disabled. + */ public enum ServerSecurityAlertPolicyState { - /** Enum value Enabled. */ + /** + * Enum value Enabled. + */ ENABLED("Enabled"), - /** Enum value Disabled. */ + /** + * Enum value Disabled. + */ DISABLED("Disabled"); - /** The actual serialized value for a ServerSecurityAlertPolicyState instance. */ + /** + * The actual serialized value for a ServerSecurityAlertPolicyState instance. + */ private final String value; ServerSecurityAlertPolicyState(String value) { @@ -24,12 +29,14 @@ public enum ServerSecurityAlertPolicyState { /** * 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) { + if (value == null) { + return null; + } ServerSecurityAlertPolicyState[] items = ServerSecurityAlertPolicyState.values(); for (ServerSecurityAlertPolicyState item : items) { if (item.toString().equalsIgnoreCase(value)) { @@ -39,7 +46,9 @@ public static ServerSecurityAlertPolicyState fromString(String value) { return null; } - @JsonValue + /** + * {@inheritDoc} + */ @Override public String toString() { return this.value; diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerState.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerState.java index 3c04b348395b1..d506bfe5fd11a 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerState.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerState.java @@ -5,35 +5,56 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for ServerState. */ +/** + * A state of a server that is visible to user. + */ public final class ServerState extends ExpandableStringEnum { - /** Static value Ready for ServerState. */ + /** + * Static value Ready for ServerState. + */ public static final ServerState READY = fromString("Ready"); - /** Static value Dropping for ServerState. */ + /** + * Static value Dropping for ServerState. + */ public static final ServerState DROPPING = fromString("Dropping"); - /** Static value Disabled for ServerState. */ + /** + * Static value Disabled for ServerState. + */ public static final ServerState DISABLED = fromString("Disabled"); - /** Static value Inaccessible for ServerState. */ + /** + * Static value Inaccessible for ServerState. + */ public static final ServerState INACCESSIBLE = fromString("Inaccessible"); + /** + * Creates a new instance of ServerState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ServerState() { + } + /** * 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. */ + /** + * Gets known ServerState values. + * + * @return known ServerState values. + */ public static Collection values() { return values(ServerState.class); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerUpdateParameters.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerUpdateParameters.java index 3ef2a4f2e13e6..7597f957b084f 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerUpdateParameters.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerUpdateParameters.java @@ -5,47 +5,48 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.fluent.models.ServerUpdateParametersProperties; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.Map; -/** Parameters allowed to update for a server. */ +/** + * Parameters allowed to update for a server. + */ @Fluent -public final class ServerUpdateParameters { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(ServerUpdateParameters.class); - +public final class ServerUpdateParameters implements JsonSerializable { /* * The Azure Active Directory identity of the server. */ - @JsonProperty(value = "identity") private ResourceIdentity identity; /* * The SKU (pricing tier) of the server. */ - @JsonProperty(value = "sku") private Sku sku; /* * The properties that can be updated for a server. */ - @JsonProperty(value = "properties") private ServerUpdateParametersProperties innerProperties; /* * Application-specific metadata in the form of key-value pairs. */ - @JsonProperty(value = "tags") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; + /** + * Creates an instance of ServerUpdateParameters class. + */ + public ServerUpdateParameters() { + } + /** * Get the identity property: The Azure Active Directory identity of the server. - * + * * @return the identity value. */ public ResourceIdentity identity() { @@ -54,7 +55,7 @@ public ResourceIdentity identity() { /** * Set the identity property: The Azure Active Directory identity of the server. - * + * * @param identity the identity value to set. * @return the ServerUpdateParameters object itself. */ @@ -65,7 +66,7 @@ public ServerUpdateParameters withIdentity(ResourceIdentity identity) { /** * Get the sku property: The SKU (pricing tier) of the server. - * + * * @return the sku value. */ public Sku sku() { @@ -74,7 +75,7 @@ public Sku sku() { /** * Set the sku property: The SKU (pricing tier) of the server. - * + * * @param sku the sku value to set. * @return the ServerUpdateParameters object itself. */ @@ -85,7 +86,7 @@ public ServerUpdateParameters withSku(Sku sku) { /** * Get the innerProperties property: The properties that can be updated for a server. - * + * * @return the innerProperties value. */ private ServerUpdateParametersProperties innerProperties() { @@ -94,7 +95,7 @@ private ServerUpdateParametersProperties innerProperties() { /** * Get the tags property: Application-specific metadata in the form of key-value pairs. - * + * * @return the tags value. */ public Map tags() { @@ -103,7 +104,7 @@ public Map 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. */ @@ -114,7 +115,7 @@ public ServerUpdateParameters withTags(Map tags) { /** * Get the storageProfile property: Storage profile of a server. - * + * * @return the storageProfile value. */ public StorageProfile storageProfile() { @@ -123,7 +124,7 @@ public StorageProfile storageProfile() { /** * Set the storageProfile property: Storage profile of a server. - * + * * @param storageProfile the storageProfile value to set. * @return the ServerUpdateParameters object itself. */ @@ -137,7 +138,7 @@ public ServerUpdateParameters withStorageProfile(StorageProfile storageProfile) /** * Get the administratorLoginPassword property: The password of the administrator login. - * + * * @return the administratorLoginPassword value. */ public String administratorLoginPassword() { @@ -146,7 +147,7 @@ public String administratorLoginPassword() { /** * Set the administratorLoginPassword property: The password of the administrator login. - * + * * @param administratorLoginPassword the administratorLoginPassword value to set. * @return the ServerUpdateParameters object itself. */ @@ -160,7 +161,7 @@ public ServerUpdateParameters withAdministratorLoginPassword(String administrato /** * Get the version property: The version of a server. - * + * * @return the version value. */ public ServerVersion version() { @@ -169,7 +170,7 @@ public ServerVersion version() { /** * Set the version property: The version of a server. - * + * * @param version the version value to set. * @return the ServerUpdateParameters object itself. */ @@ -183,7 +184,7 @@ public ServerUpdateParameters withVersion(ServerVersion version) { /** * Get the sslEnforcement property: Enable ssl enforcement or not when connect to server. - * + * * @return the sslEnforcement value. */ public SslEnforcementEnum sslEnforcement() { @@ -192,7 +193,7 @@ public SslEnforcementEnum 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. */ @@ -206,7 +207,7 @@ public ServerUpdateParameters withSslEnforcement(SslEnforcementEnum sslEnforceme /** * Get the minimalTlsVersion property: Enforce a minimal Tls version for the server. - * + * * @return the minimalTlsVersion value. */ public MinimalTlsVersionEnum minimalTlsVersion() { @@ -215,7 +216,7 @@ public MinimalTlsVersionEnum minimalTlsVersion() { /** * Set the minimalTlsVersion property: Enforce a minimal Tls version for the server. - * + * * @param minimalTlsVersion the minimalTlsVersion value to set. * @return the ServerUpdateParameters object itself. */ @@ -230,7 +231,7 @@ public ServerUpdateParameters withMinimalTlsVersion(MinimalTlsVersionEnum minima /** * 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() { @@ -240,7 +241,7 @@ public PublicNetworkAccessEnum 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. */ @@ -254,7 +255,7 @@ public ServerUpdateParameters withPublicNetworkAccess(PublicNetworkAccessEnum pu /** * Get the replicationRole property: The replication role of the server. - * + * * @return the replicationRole value. */ public String replicationRole() { @@ -263,7 +264,7 @@ public String replicationRole() { /** * Set the replicationRole property: The replication role of the server. - * + * * @param replicationRole the replicationRole value to set. * @return the ServerUpdateParameters object itself. */ @@ -277,7 +278,7 @@ public ServerUpdateParameters withReplicationRole(String replicationRole) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -291,4 +292,51 @@ public void validate() { innerProperties().validate(); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeJsonField("identity", this.identity); + jsonWriter.writeJsonField("sku", this.sku); + jsonWriter.writeJsonField("properties", this.innerProperties); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of ServerUpdateParameters from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of ServerUpdateParameters if the JsonReader was pointing to an instance of it, or null if it + * was pointing to JSON null. + * @throws IOException If an error occurs while reading the ServerUpdateParameters. + */ + public static ServerUpdateParameters fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + ServerUpdateParameters deserializedServerUpdateParameters = new ServerUpdateParameters(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("identity".equals(fieldName)) { + deserializedServerUpdateParameters.identity = ResourceIdentity.fromJson(reader); + } else if ("sku".equals(fieldName)) { + deserializedServerUpdateParameters.sku = Sku.fromJson(reader); + } else if ("properties".equals(fieldName)) { + deserializedServerUpdateParameters.innerProperties + = ServerUpdateParametersProperties.fromJson(reader); + } else if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedServerUpdateParameters.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedServerUpdateParameters; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerVersion.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerVersion.java index ada4fc8487fd2..09ff5a7615a83 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerVersion.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerVersion.java @@ -5,41 +5,66 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for ServerVersion. */ +/** + * The version of a server. + */ public final class ServerVersion extends ExpandableStringEnum { - /** Static value 9.5 for ServerVersion. */ + /** + * Static value 9.5 for ServerVersion. + */ public static final ServerVersion NINE_FIVE = fromString("9.5"); - /** Static value 9.6 for ServerVersion. */ + /** + * Static value 9.6 for ServerVersion. + */ public static final ServerVersion NINE_SIX = fromString("9.6"); - /** Static value 10 for ServerVersion. */ + /** + * Static value 10 for ServerVersion. + */ public static final ServerVersion ONE_ZERO = fromString("10"); - /** Static value 10.0 for ServerVersion. */ + /** + * Static value 10.0 for ServerVersion. + */ public static final ServerVersion ONE_ZERO_ZERO = fromString("10.0"); - /** Static value 10.2 for ServerVersion. */ + /** + * Static value 10.2 for ServerVersion. + */ public static final ServerVersion ONE_ZERO_TWO = fromString("10.2"); - /** Static value 11 for ServerVersion. */ + /** + * Static value 11 for ServerVersion. + */ public static final ServerVersion ONE_ONE = fromString("11"); + /** + * Creates a new instance of ServerVersion value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public ServerVersion() { + } + /** * 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. */ + /** + * Gets known ServerVersion values. + * + * @return known ServerVersion values. + */ public static Collection values() { return values(ServerVersion.class); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Servers.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Servers.java index f523c88d7c652..c2e1c99afb4f8 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Servers.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Servers.java @@ -8,11 +8,13 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of Servers. */ +/** + * 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. @@ -23,7 +25,7 @@ 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. * @param context The context to associate with this operation. @@ -35,75 +37,75 @@ public interface Servers { /** * 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. + * @return information about a server along with {@link Response}. */ - Server getByResourceGroup(String resourceGroupName, String serverName); + Response getByResourceGroupWithResponse(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. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.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 along with {@link Response}. + * @return information about a server. */ - Response getByResourceGroupWithResponse(String resourceGroupName, String serverName, Context context); + Server getByResourceGroup(String resourceGroupName, String serverName); /** * 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ 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. + * @return a list of servers as paginated response with {@link PagedIterable}. */ 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. @@ -114,7 +116,7 @@ public interface Servers { /** * 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. @@ -126,7 +128,7 @@ public interface Servers { /** * 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. @@ -137,7 +139,7 @@ public interface Servers { /** * 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. @@ -149,7 +151,7 @@ public interface Servers { /** * 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. @@ -159,7 +161,7 @@ public interface Servers { /** * 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. @@ -170,7 +172,7 @@ public interface Servers { /** * Begins definition for a new Server resource. - * + * * @param name resource name. * @return the first stage of the new Server definition. */ diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Sku.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Sku.java index be081f714ecf0..df4b0cf254db4 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Sku.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/Sku.java @@ -6,49 +6,51 @@ 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. */ +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Billing information related properties of a server. + */ @Fluent -public final class Sku { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(Sku.class); - +public final class Sku implements JsonSerializable { /* - * The name of the sku, typically, tier + family + cores, e.g. B_Gen4_1, - * GP_Gen5_8. + * 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; + /** + * Creates an instance of Sku class. + */ + public Sku() { + } + /** * 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() { @@ -57,7 +59,7 @@ public String 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. */ @@ -68,7 +70,7 @@ public Sku withName(String name) { /** * Get the tier property: The tier of the particular SKU, e.g. Basic. - * + * * @return the tier value. */ public SkuTier tier() { @@ -77,7 +79,7 @@ public SkuTier 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. */ @@ -88,7 +90,7 @@ public Sku withTier(SkuTier tier) { /** * Get the capacity property: The scale up/out capacity, representing server's compute units. - * + * * @return the capacity value. */ public Integer capacity() { @@ -97,7 +99,7 @@ public Integer 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. */ @@ -108,7 +110,7 @@ public Sku withCapacity(Integer capacity) { /** * Get the size property: The size code, to be interpreted by resource as appropriate. - * + * * @return the size value. */ public String size() { @@ -117,7 +119,7 @@ public String 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. */ @@ -128,7 +130,7 @@ public Sku withSize(String size) { /** * Get the family property: The family of hardware. - * + * * @return the family value. */ public String family() { @@ -137,7 +139,7 @@ public String family() { /** * Set the family property: The family of hardware. - * + * * @param family the family value to set. * @return the Sku object itself. */ @@ -148,13 +150,63 @@ public Sku withFamily(String family) { /** * 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")); + throw LOGGER.atError().log(new IllegalArgumentException("Missing required property name in model Sku")); } } + + private static final ClientLogger LOGGER = new ClientLogger(Sku.class); + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeStringField("name", this.name); + jsonWriter.writeStringField("tier", this.tier == null ? null : this.tier.toString()); + jsonWriter.writeNumberField("capacity", this.capacity); + jsonWriter.writeStringField("size", this.size); + jsonWriter.writeStringField("family", this.family); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of Sku from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of Sku if the JsonReader was pointing to an instance of it, or null if it was pointing to + * JSON null. + * @throws IllegalStateException If the deserialized JSON object was missing any required properties. + * @throws IOException If an error occurs while reading the Sku. + */ + public static Sku fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + Sku deserializedSku = new Sku(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("name".equals(fieldName)) { + deserializedSku.name = reader.getString(); + } else if ("tier".equals(fieldName)) { + deserializedSku.tier = SkuTier.fromString(reader.getString()); + } else if ("capacity".equals(fieldName)) { + deserializedSku.capacity = reader.getNullable(JsonReader::getInt); + } else if ("size".equals(fieldName)) { + deserializedSku.size = reader.getString(); + } else if ("family".equals(fieldName)) { + deserializedSku.family = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedSku; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/SkuTier.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/SkuTier.java index 43e65e0da45d1..a28d1fd572474 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/SkuTier.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/SkuTier.java @@ -5,32 +5,51 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for SkuTier. */ +/** + * The tier of the particular SKU, e.g. Basic. + */ public final class SkuTier extends ExpandableStringEnum { - /** Static value Basic for SkuTier. */ + /** + * Static value Basic for SkuTier. + */ public static final SkuTier BASIC = fromString("Basic"); - /** Static value GeneralPurpose for SkuTier. */ + /** + * Static value GeneralPurpose for SkuTier. + */ public static final SkuTier GENERAL_PURPOSE = fromString("GeneralPurpose"); - /** Static value MemoryOptimized for SkuTier. */ + /** + * Static value MemoryOptimized for SkuTier. + */ public static final SkuTier MEMORY_OPTIMIZED = fromString("MemoryOptimized"); + /** + * Creates a new instance of SkuTier value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public SkuTier() { + } + /** * 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. */ + /** + * Gets known SkuTier values. + * + * @return known SkuTier values. + */ public static Collection values() { return values(SkuTier.class); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/SslEnforcementEnum.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/SslEnforcementEnum.java index 39fd54b218005..1df554772556f 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/SslEnforcementEnum.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/SslEnforcementEnum.java @@ -4,18 +4,23 @@ package com.azure.resourcemanager.postgresql.models; -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; - -/** Defines values for SslEnforcementEnum. */ +/** + * Enable ssl enforcement or not when connect to server. + */ public enum SslEnforcementEnum { - /** Enum value Enabled. */ + /** + * Enum value Enabled. + */ ENABLED("Enabled"), - /** Enum value Disabled. */ + /** + * Enum value Disabled. + */ DISABLED("Disabled"); - /** The actual serialized value for a SslEnforcementEnum instance. */ + /** + * The actual serialized value for a SslEnforcementEnum instance. + */ private final String value; SslEnforcementEnum(String value) { @@ -24,12 +29,14 @@ public enum SslEnforcementEnum { /** * 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) { + if (value == null) { + return null; + } SslEnforcementEnum[] items = SslEnforcementEnum.values(); for (SslEnforcementEnum item : items) { if (item.toString().equalsIgnoreCase(value)) { @@ -39,7 +46,9 @@ public static SslEnforcementEnum fromString(String value) { return null; } - @JsonValue + /** + * {@inheritDoc} + */ @Override public String toString() { return this.value; diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/StorageAutogrow.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/StorageAutogrow.java index 0b2d4bb38c16f..002a399a770d7 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/StorageAutogrow.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/StorageAutogrow.java @@ -5,29 +5,46 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for StorageAutogrow. */ +/** + * Enable Storage Auto Grow. + */ public final class StorageAutogrow extends ExpandableStringEnum { - /** Static value Enabled for StorageAutogrow. */ + /** + * Static value Enabled for StorageAutogrow. + */ public static final StorageAutogrow ENABLED = fromString("Enabled"); - /** Static value Disabled for StorageAutogrow. */ + /** + * Static value Disabled for StorageAutogrow. + */ public static final StorageAutogrow DISABLED = fromString("Disabled"); + /** + * Creates a new instance of StorageAutogrow value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public StorageAutogrow() { + } + /** * 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. */ + /** + * Gets known StorageAutogrow values. + * + * @return known StorageAutogrow values. + */ public static Collection values() { return values(StorageAutogrow.class); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/StorageProfile.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/StorageProfile.java index bc325e3d41fcf..5dc3c00b22c07 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/StorageProfile.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/StorageProfile.java @@ -5,43 +5,46 @@ package com.azure.resourcemanager.postgresql.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. */ +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; + +/** + * Storage Profile properties of a server. + */ @Fluent -public final class StorageProfile { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(StorageProfile.class); - +public final class StorageProfile implements JsonSerializable { /* * 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; + /** + * Creates an instance of StorageProfile class. + */ + public StorageProfile() { + } + /** * Get the backupRetentionDays property: Backup retention days for the server. - * + * * @return the backupRetentionDays value. */ public Integer backupRetentionDays() { @@ -50,7 +53,7 @@ public Integer backupRetentionDays() { /** * Set the backupRetentionDays property: Backup retention days for the server. - * + * * @param backupRetentionDays the backupRetentionDays value to set. * @return the StorageProfile object itself. */ @@ -61,7 +64,7 @@ public StorageProfile withBackupRetentionDays(Integer backupRetentionDays) { /** * Get the geoRedundantBackup property: Enable Geo-redundant or not for server backup. - * + * * @return the geoRedundantBackup value. */ public GeoRedundantBackup geoRedundantBackup() { @@ -70,7 +73,7 @@ public GeoRedundantBackup 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. */ @@ -81,7 +84,7 @@ public StorageProfile withGeoRedundantBackup(GeoRedundantBackup geoRedundantBack /** * Get the storageMB property: Max storage allowed for a server. - * + * * @return the storageMB value. */ public Integer storageMB() { @@ -90,7 +93,7 @@ public Integer storageMB() { /** * Set the storageMB property: Max storage allowed for a server. - * + * * @param storageMB the storageMB value to set. * @return the StorageProfile object itself. */ @@ -101,7 +104,7 @@ public StorageProfile withStorageMB(Integer storageMB) { /** * Get the storageAutogrow property: Enable Storage Auto Grow. - * + * * @return the storageAutogrow value. */ public StorageAutogrow storageAutogrow() { @@ -110,7 +113,7 @@ public StorageAutogrow storageAutogrow() { /** * Set the storageAutogrow property: Enable Storage Auto Grow. - * + * * @param storageAutogrow the storageAutogrow value to set. * @return the StorageProfile object itself. */ @@ -121,9 +124,56 @@ public StorageProfile withStorageAutogrow(StorageAutogrow storageAutogrow) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeNumberField("backupRetentionDays", this.backupRetentionDays); + jsonWriter.writeStringField("geoRedundantBackup", + this.geoRedundantBackup == null ? null : this.geoRedundantBackup.toString()); + jsonWriter.writeNumberField("storageMB", this.storageMB); + jsonWriter.writeStringField("storageAutogrow", + this.storageAutogrow == null ? null : this.storageAutogrow.toString()); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of StorageProfile from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of StorageProfile if the JsonReader was pointing to an instance of it, or null if it was + * pointing to JSON null. + * @throws IOException If an error occurs while reading the StorageProfile. + */ + public static StorageProfile fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + StorageProfile deserializedStorageProfile = new StorageProfile(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("backupRetentionDays".equals(fieldName)) { + deserializedStorageProfile.backupRetentionDays = reader.getNullable(JsonReader::getInt); + } else if ("geoRedundantBackup".equals(fieldName)) { + deserializedStorageProfile.geoRedundantBackup = GeoRedundantBackup.fromString(reader.getString()); + } else if ("storageMB".equals(fieldName)) { + deserializedStorageProfile.storageMB = reader.getNullable(JsonReader::getInt); + } else if ("storageAutogrow".equals(fieldName)) { + deserializedStorageProfile.storageAutogrow = StorageAutogrow.fromString(reader.getString()); + } else { + reader.skipChildren(); + } + } + + return deserializedStorageProfile; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/TagsObject.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/TagsObject.java index 8bbd451d27ad4..51f6e3b694658 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/TagsObject.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/TagsObject.java @@ -5,28 +5,32 @@ package com.azure.resourcemanager.postgresql.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.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; +import java.io.IOException; import java.util.Map; -/** Tags object for patch operations. */ +/** + * Tags object for patch operations. + */ @Fluent -public final class TagsObject { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(TagsObject.class); - +public final class TagsObject implements JsonSerializable { /* * Resource tags. */ - @JsonProperty(value = "tags") - @JsonInclude(value = JsonInclude.Include.NON_NULL, content = JsonInclude.Include.ALWAYS) private Map tags; + /** + * Creates an instance of TagsObject class. + */ + public TagsObject() { + } + /** * Get the tags property: Resource tags. - * + * * @return the tags value. */ public Map tags() { @@ -35,7 +39,7 @@ public Map tags() { /** * Set the tags property: Resource tags. - * + * * @param tags the tags value to set. * @return the TagsObject object itself. */ @@ -46,9 +50,46 @@ public TagsObject withTags(Map tags) { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element)); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of TagsObject from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of TagsObject if the JsonReader was pointing to an instance of it, or null if it was pointing + * to JSON null. + * @throws IOException If an error occurs while reading the TagsObject. + */ + public static TagsObject fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + TagsObject deserializedTagsObject = new TagsObject(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("tags".equals(fieldName)) { + Map tags = reader.readMap(reader1 -> reader1.getString()); + deserializedTagsObject.tags = tags; + } else { + reader.skipChildren(); + } + } + + return deserializedTagsObject; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/VirtualNetworkRule.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/VirtualNetworkRule.java index 94daaec10494e..16553a0f52b5a 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/VirtualNetworkRule.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/VirtualNetworkRule.java @@ -7,32 +7,34 @@ import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.fluent.models.VirtualNetworkRuleInner; -/** An immutable client-side representation of VirtualNetworkRule. */ +/** + * 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(); @@ -40,41 +42,56 @@ public interface VirtualNetworkRule { /** * 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 name of the resource group. + * + * @return the name of the resource group. + */ + String resourceGroupName(); + /** * Gets the inner com.azure.resourcemanager.postgresql.fluent.models.VirtualNetworkRuleInner object. - * + * * @return the inner object. */ VirtualNetworkRuleInner innerModel(); - /** The entirety of the VirtualNetworkRule definition. */ + /** + * The entirety of the VirtualNetworkRule definition. + */ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { } - /** The VirtualNetworkRule definition stages. */ + /** + * The VirtualNetworkRule definition stages. + */ interface DefinitionStages { - /** The first stage of the VirtualNetworkRule definition. */ + /** + * The first stage of the VirtualNetworkRule definition. + */ interface Blank extends WithParentResource { } - /** The stage of the VirtualNetworkRule definition allowing to specify parent resource. */ + /** + * 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. @@ -90,39 +107,43 @@ 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. */ + /** + * 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. */ + /** + * 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. + * endpoint enabled. * @return the next definition stage. */ WithCreate withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint); @@ -131,51 +152,59 @@ interface WithIgnoreMissingVnetServiceEndpoint { /** * Begins update for the VirtualNetworkRule resource. - * + * * @return the stage of resource update. */ VirtualNetworkRule.Update update(); - /** The template for VirtualNetworkRule 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. */ + /** + * The VirtualNetworkRule update stages. + */ interface UpdateStages { - /** The stage of the VirtualNetworkRule update allowing to specify virtualNetworkSubnetId. */ + /** + * 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. */ + /** + * 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. + * endpoint enabled. * @return the next definition stage. */ Update withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint); @@ -184,14 +213,14 @@ interface WithIgnoreMissingVnetServiceEndpoint { /** * 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. */ diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/VirtualNetworkRuleListResult.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/VirtualNetworkRuleListResult.java index c07253de33771..47392c2f716d4 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/VirtualNetworkRuleListResult.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/VirtualNetworkRuleListResult.java @@ -5,33 +5,38 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; +import com.azure.json.JsonReader; +import com.azure.json.JsonSerializable; +import com.azure.json.JsonToken; +import com.azure.json.JsonWriter; import com.azure.resourcemanager.postgresql.fluent.models.VirtualNetworkRuleInner; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import java.io.IOException; import java.util.List; -/** A list of virtual network rules. */ +/** + * A list of virtual network rules. + */ @Immutable -public final class VirtualNetworkRuleListResult { - @JsonIgnore - private final ClientLogger logger = new ClientLogger(VirtualNetworkRuleListResult.class); - +public final class VirtualNetworkRuleListResult implements JsonSerializable { /* * Array of results. */ - @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) private List value; /* * Link to retrieve next page of results. */ - @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) private String nextLink; + /** + * Creates an instance of VirtualNetworkRuleListResult class. + */ + public VirtualNetworkRuleListResult() { + } + /** * Get the value property: Array of results. - * + * * @return the value value. */ public List value() { @@ -40,7 +45,7 @@ public List value() { /** * Get the nextLink property: Link to retrieve next page of results. - * + * * @return the nextLink value. */ public String nextLink() { @@ -49,7 +54,7 @@ public String nextLink() { /** * Validates the instance. - * + * * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { @@ -57,4 +62,43 @@ public void validate() { value().forEach(e -> e.validate()); } } + + /** + * {@inheritDoc} + */ + @Override + public JsonWriter toJson(JsonWriter jsonWriter) throws IOException { + jsonWriter.writeStartObject(); + return jsonWriter.writeEndObject(); + } + + /** + * Reads an instance of VirtualNetworkRuleListResult from the JsonReader. + * + * @param jsonReader The JsonReader being read. + * @return An instance of VirtualNetworkRuleListResult if the JsonReader was pointing to an instance of it, or null + * if it was pointing to JSON null. + * @throws IOException If an error occurs while reading the VirtualNetworkRuleListResult. + */ + public static VirtualNetworkRuleListResult fromJson(JsonReader jsonReader) throws IOException { + return jsonReader.readObject(reader -> { + VirtualNetworkRuleListResult deserializedVirtualNetworkRuleListResult = new VirtualNetworkRuleListResult(); + while (reader.nextToken() != JsonToken.END_OBJECT) { + String fieldName = reader.getFieldName(); + reader.nextToken(); + + if ("value".equals(fieldName)) { + List value + = reader.readArray(reader1 -> VirtualNetworkRuleInner.fromJson(reader1)); + deserializedVirtualNetworkRuleListResult.value = value; + } else if ("nextLink".equals(fieldName)) { + deserializedVirtualNetworkRuleListResult.nextLink = reader.getString(); + } else { + reader.skipChildren(); + } + } + + return deserializedVirtualNetworkRuleListResult; + }); + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/VirtualNetworkRuleState.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/VirtualNetworkRuleState.java index 97e25b52c6d79..1fd66cedf8e4c 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/VirtualNetworkRuleState.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/VirtualNetworkRuleState.java @@ -5,38 +5,61 @@ package com.azure.resourcemanager.postgresql.models; import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; import java.util.Collection; -/** Defines values for VirtualNetworkRuleState. */ +/** + * Virtual Network Rule State. + */ public final class VirtualNetworkRuleState extends ExpandableStringEnum { - /** Static value Initializing for VirtualNetworkRuleState. */ + /** + * Static value Initializing for VirtualNetworkRuleState. + */ public static final VirtualNetworkRuleState INITIALIZING = fromString("Initializing"); - /** Static value InProgress for VirtualNetworkRuleState. */ + /** + * Static value InProgress for VirtualNetworkRuleState. + */ public static final VirtualNetworkRuleState IN_PROGRESS = fromString("InProgress"); - /** Static value Ready for VirtualNetworkRuleState. */ + /** + * Static value Ready for VirtualNetworkRuleState. + */ public static final VirtualNetworkRuleState READY = fromString("Ready"); - /** Static value Deleting for VirtualNetworkRuleState. */ + /** + * Static value Deleting for VirtualNetworkRuleState. + */ public static final VirtualNetworkRuleState DELETING = fromString("Deleting"); - /** Static value Unknown for VirtualNetworkRuleState. */ + /** + * Static value Unknown for VirtualNetworkRuleState. + */ public static final VirtualNetworkRuleState UNKNOWN = fromString("Unknown"); + /** + * Creates a new instance of VirtualNetworkRuleState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Deprecated + public VirtualNetworkRuleState() { + } + /** * 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. */ + /** + * Gets known VirtualNetworkRuleState values. + * + * @return known VirtualNetworkRuleState values. + */ public static Collection values() { return values(VirtualNetworkRuleState.class); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/VirtualNetworkRules.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/VirtualNetworkRules.java index 8917296c8f3f4..38fedc7a99fcc 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/VirtualNetworkRules.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/VirtualNetworkRules.java @@ -8,39 +8,41 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of VirtualNetworkRules. */ +/** + * 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. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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. + * @return a virtual network rule along with {@link Response}. */ - VirtualNetworkRule get(String resourceGroupName, String serverName, String virtualNetworkRuleName); + Response getWithResponse(String resourceGroupName, String serverName, + String virtualNetworkRuleName, 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. - * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException 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 along with {@link Response}. + * @return a virtual network rule. */ - Response getWithResponse(String resourceGroupName, String serverName, - String virtualNetworkRuleName, Context context); + VirtualNetworkRule get(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. @@ -52,7 +54,7 @@ Response getWithResponse(String resourceGroupName, String se /** * 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. @@ -65,32 +67,32 @@ Response getWithResponse(String resourceGroupName, String se /** * 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. + * @return a list of virtual network rules in a server as paginated response with {@link PagedIterable}. */ 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. + * @return a list of virtual network rules in a server as paginated response with {@link PagedIterable}. */ 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. @@ -101,7 +103,7 @@ Response getWithResponse(String resourceGroupName, String se /** * 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. @@ -113,7 +115,7 @@ Response getWithResponse(String resourceGroupName, String se /** * 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. @@ -123,7 +125,7 @@ Response getWithResponse(String resourceGroupName, String se /** * 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. @@ -134,7 +136,7 @@ Response getWithResponse(String resourceGroupName, String se /** * Begins definition for a new VirtualNetworkRule resource. - * + * * @param name resource name. * @return the first stage of the new VirtualNetworkRule definition. */ diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/package-info.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/package-info.java index b1870a628d773..7ccf7dd2f70b1 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/package-info.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/package-info.java @@ -3,8 +3,9 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * Package containing the data models for PostgreSqlManagementClient. The Microsoft Azure management API provides - * create, read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall - * rules, VNET rules, security alert policies, log files and configurations with new business model. + * Package containing the data models for PostgreSqlManagementClient. + * The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL + * resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and + * configurations with new business model. */ package com.azure.resourcemanager.postgresql.models; diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/package-info.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/package-info.java index 79d0ed1552146..a83d44a0372b3 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/package-info.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/package-info.java @@ -3,8 +3,9 @@ // Code generated by Microsoft (R) AutoRest Code Generator. /** - * Package containing the classes for PostgreSqlManagementClient. The Microsoft Azure management API provides create, - * read, update, and delete functionality for Azure PostgreSQL resources including servers, databases, firewall rules, - * VNET rules, security alert policies, log files and configurations with new business model. + * Package containing the classes for PostgreSqlManagementClient. + * The Microsoft Azure management API provides create, read, update, and delete functionality for Azure PostgreSQL + * resources including servers, databases, firewall rules, VNET rules, security alert policies, log files and + * configurations with new business model. */ package com.azure.resourcemanager.postgresql; diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/module-info.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/module-info.java index 2a31bdd364465..70826b34b12f9 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/module-info.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/module-info.java @@ -10,6 +10,6 @@ exports com.azure.resourcemanager.postgresql.fluent.models; exports com.azure.resourcemanager.postgresql.models; - opens com.azure.resourcemanager.postgresql.fluent.models to com.azure.core, com.fasterxml.jackson.databind; - opens com.azure.resourcemanager.postgresql.models to com.azure.core, com.fasterxml.jackson.databind; + opens com.azure.resourcemanager.postgresql.fluent.models to com.azure.core; + opens com.azure.resourcemanager.postgresql.models to com.azure.core; } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-postgresql/proxy-config.json b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-postgresql/proxy-config.json new file mode 100644 index 0000000000000..4587c5d1325b3 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-postgresql/proxy-config.json @@ -0,0 +1 @@ +[["com.azure.resourcemanager.postgresql.implementation.CheckNameAvailabilitiesClientImpl$CheckNameAvailabilitiesService"],["com.azure.resourcemanager.postgresql.implementation.ConfigurationsClientImpl$ConfigurationsService"],["com.azure.resourcemanager.postgresql.implementation.DatabasesClientImpl$DatabasesService"],["com.azure.resourcemanager.postgresql.implementation.FirewallRulesClientImpl$FirewallRulesService"],["com.azure.resourcemanager.postgresql.implementation.LocationBasedPerformanceTiersClientImpl$LocationBasedPerformanceTiersService"],["com.azure.resourcemanager.postgresql.implementation.LogFilesClientImpl$LogFilesService"],["com.azure.resourcemanager.postgresql.implementation.OperationsClientImpl$OperationsService"],["com.azure.resourcemanager.postgresql.implementation.PrivateEndpointConnectionsClientImpl$PrivateEndpointConnectionsService"],["com.azure.resourcemanager.postgresql.implementation.PrivateLinkResourcesClientImpl$PrivateLinkResourcesService"],["com.azure.resourcemanager.postgresql.implementation.RecoverableServersClientImpl$RecoverableServersService"],["com.azure.resourcemanager.postgresql.implementation.ReplicasClientImpl$ReplicasService"],["com.azure.resourcemanager.postgresql.implementation.ServerAdministratorsClientImpl$ServerAdministratorsService"],["com.azure.resourcemanager.postgresql.implementation.ServerBasedPerformanceTiersClientImpl$ServerBasedPerformanceTiersService"],["com.azure.resourcemanager.postgresql.implementation.ServerKeysClientImpl$ServerKeysService"],["com.azure.resourcemanager.postgresql.implementation.ServerParametersClientImpl$ServerParametersService"],["com.azure.resourcemanager.postgresql.implementation.ServerSecurityAlertPoliciesClientImpl$ServerSecurityAlertPoliciesService"],["com.azure.resourcemanager.postgresql.implementation.ServersClientImpl$ServersService"],["com.azure.resourcemanager.postgresql.implementation.VirtualNetworkRulesClientImpl$VirtualNetworkRulesService"]] \ No newline at end of file diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-postgresql/reflect-config.json b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-postgresql/reflect-config.json new file mode 100644 index 0000000000000..0637a088a01e8 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/resources/META-INF/native-image/com.azure.resourcemanager/azure-resourcemanager-postgresql/reflect-config.json @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/CheckNameAvailabilityExecuteSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/CheckNameAvailabilityExecuteSamples.java index 07da2962dd0c2..7faeac17700b4 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/CheckNameAvailabilityExecuteSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/CheckNameAvailabilityExecuteSamples.java @@ -4,23 +4,25 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.models.NameAvailabilityRequest; -/** Samples for CheckNameAvailability Execute. */ +/** + * Samples for CheckNameAvailability Execute. + */ public final class CheckNameAvailabilityExecuteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/CheckNameAvailability.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * CheckNameAvailability.json */ /** * Sample code: NameAvailability. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void nameAvailability(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .checkNameAvailabilities() - .executeWithResponse( - new NameAvailabilityRequest().withName("name1").withType("Microsoft.DBforPostgreSQL"), Context.NONE); + manager.checkNameAvailabilities() + .executeWithResponse(new NameAvailabilityRequest().withName("name1").withType("Microsoft.DBforPostgreSQL"), + com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsCreateOrUpdateSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsCreateOrUpdateSamples.java index f4c5552a3de8d..4e7c55588c93b 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsCreateOrUpdateSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsCreateOrUpdateSamples.java @@ -4,19 +4,22 @@ package com.azure.resourcemanager.postgresql.generated; -/** Samples for Configurations CreateOrUpdate. */ +/** + * Samples for Configurations CreateOrUpdate. + */ public final class ConfigurationsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationCreateOrUpdate.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ConfigurationCreateOrUpdate.json */ /** * Sample code: ConfigurationCreateOrUpdate. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void configurationCreateOrUpdate(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .configurations() + manager.configurations() .define("array_nulls") .withExistingServer("TestGroup", "testserver") .withValue("off") diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsGetSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsGetSamples.java index b9915135e5be8..cf66b531ced7f 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsGetSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsGetSamples.java @@ -4,19 +4,22 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for Configurations Get. */ +/** + * Samples for Configurations Get. + */ public final class ConfigurationsGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationGet. + * json */ /** * Sample code: ConfigurationGet. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void configurationGet(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.configurations().getWithResponse("TestGroup", "testserver", "array_nulls", Context.NONE); + manager.configurations() + .getWithResponse("TestGroup", "testserver", "array_nulls", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsListByServerSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsListByServerSamples.java index bc55e672cb2e2..c9d314a318a93 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsListByServerSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsListByServerSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for Configurations ListByServer. */ +/** + * Samples for Configurations ListByServer. + */ public final class ConfigurationsListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationListByServer.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ConfigurationListByServer.json */ /** * Sample code: ConfigurationList. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void configurationList(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.configurations().listByServer("TestGroup", "testserver", Context.NONE); + manager.configurations().listByServer("TestGroup", "testserver", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/DatabasesCreateOrUpdateSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/DatabasesCreateOrUpdateSamples.java index 4038146dbf3a2..3935547c7e107 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/DatabasesCreateOrUpdateSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/DatabasesCreateOrUpdateSamples.java @@ -4,19 +4,22 @@ package com.azure.resourcemanager.postgresql.generated; -/** Samples for Databases CreateOrUpdate. */ +/** + * Samples for Databases CreateOrUpdate. + */ public final class DatabasesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseCreate.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseCreate. + * json */ /** * Sample code: DatabaseCreate. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void databaseCreate(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .databases() + manager.databases() .define("db1") .withExistingServer("TestGroup", "testserver") .withCharset("UTF8") diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/DatabasesDeleteSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/DatabasesDeleteSamples.java index b289fbf030c16..fdd0383b0d920 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/DatabasesDeleteSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/DatabasesDeleteSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for Databases Delete. */ +/** + * Samples for Databases Delete. + */ public final class DatabasesDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseDelete.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseDelete. + * json */ /** * Sample code: DatabaseDelete. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void databaseDelete(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.databases().delete("TestGroup", "testserver", "db1", Context.NONE); + manager.databases().delete("TestGroup", "testserver", "db1", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/DatabasesGetSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/DatabasesGetSamples.java index 6779b3d1c68a5..034b320e07c74 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/DatabasesGetSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/DatabasesGetSamples.java @@ -4,19 +4,20 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for Databases Get. */ +/** + * Samples for Databases Get. + */ public final class DatabasesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseGet.json */ /** * Sample code: DatabaseGet. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void databaseGet(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.databases().getWithResponse("TestGroup", "testserver", "db1", Context.NONE); + manager.databases().getWithResponse("TestGroup", "testserver", "db1", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/DatabasesListByServerSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/DatabasesListByServerSamples.java index beedb2dc4285b..964051082d511 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/DatabasesListByServerSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/DatabasesListByServerSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for Databases ListByServer. */ +/** + * Samples for Databases ListByServer. + */ public final class DatabasesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseListByServer.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * DatabaseListByServer.json */ /** * Sample code: DatabaseList. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void databaseList(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.databases().listByServer("TestGroup", "testserver", Context.NONE); + manager.databases().listByServer("TestGroup", "testserver", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesCreateOrUpdateSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesCreateOrUpdateSamples.java index 5601ec632e837..d89369ca545b0 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesCreateOrUpdateSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesCreateOrUpdateSamples.java @@ -4,19 +4,22 @@ package com.azure.resourcemanager.postgresql.generated; -/** Samples for FirewallRules CreateOrUpdate. */ +/** + * Samples for FirewallRules CreateOrUpdate. + */ public final class FirewallRulesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleCreate.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleCreate + * .json */ /** * Sample code: FirewallRuleCreate. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void firewallRuleCreate(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .firewallRules() + manager.firewallRules() .define("rule1") .withExistingServer("TestGroup", "testserver") .withStartIpAddress("0.0.0.0") diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesDeleteSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesDeleteSamples.java index a5664fdf55922..0a1cfbc4daa77 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesDeleteSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesDeleteSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for FirewallRules Delete. */ +/** + * Samples for FirewallRules Delete. + */ public final class FirewallRulesDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleDelete.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleDelete + * .json */ /** * Sample code: FirewallRuleDelete. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void firewallRuleDelete(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.firewallRules().delete("TestGroup", "testserver", "rule1", Context.NONE); + manager.firewallRules().delete("TestGroup", "testserver", "rule1", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesGetSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesGetSamples.java index d05e97c993fe6..e4b2efb6e94f5 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesGetSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesGetSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for FirewallRules Get. */ +/** + * Samples for FirewallRules Get. + */ public final class FirewallRulesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleGet. + * json */ /** * Sample code: FirewallRuleGet. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void firewallRuleGet(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.firewallRules().getWithResponse("TestGroup", "testserver", "rule1", Context.NONE); + manager.firewallRules().getWithResponse("TestGroup", "testserver", "rule1", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesListByServerSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesListByServerSamples.java index 90982234c3ebf..dcf9fb6b1acb0 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesListByServerSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesListByServerSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for FirewallRules ListByServer. */ +/** + * Samples for FirewallRules ListByServer. + */ public final class FirewallRulesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleListByServer.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * FirewallRuleListByServer.json */ /** * Sample code: FirewallRuleList. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void firewallRuleList(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.firewallRules().listByServer("TestGroup", "testserver", Context.NONE); + manager.firewallRules().listByServer("TestGroup", "testserver", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/LocationBasedPerformanceTierListSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/LocationBasedPerformanceTierListSamples.java index 833d41fe37855..e3403eec2cb45 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/LocationBasedPerformanceTierListSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/LocationBasedPerformanceTierListSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for LocationBasedPerformanceTier List. */ +/** + * Samples for LocationBasedPerformanceTier List. + */ public final class LocationBasedPerformanceTierListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/PerformanceTiersListByLocation.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * PerformanceTiersListByLocation.json */ /** * Sample code: PerformanceTiersList. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void performanceTiersList(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.locationBasedPerformanceTiers().list("WestUS", Context.NONE); + manager.locationBasedPerformanceTiers().list("WestUS", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/LogFilesListByServerSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/LogFilesListByServerSamples.java index d50fa62ae8d14..55b34b79565b4 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/LogFilesListByServerSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/LogFilesListByServerSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for LogFiles ListByServer. */ +/** + * Samples for LogFiles ListByServer. + */ public final class LogFilesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/LogFileListByServer.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * LogFileListByServer.json */ /** * Sample code: LogFileList. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void logFileList(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.logFiles().listByServer("TestGroup", "testserver", Context.NONE); + manager.logFiles().listByServer("TestGroup", "testserver", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/OperationsListSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/OperationsListSamples.java index 307332a5139d1..1abdfdca64c1b 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/OperationsListSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/OperationsListSamples.java @@ -4,19 +4,20 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for Operations List. */ +/** + * Samples for Operations List. + */ public final class OperationsListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/OperationList.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/OperationList.json */ /** * Sample code: OperationList. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void operationList(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.operations().listWithResponse(Context.NONE); + manager.operations().listWithResponse(com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java index d2408a785671b..c8cc471810505 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsCreateOrUpdateSamples.java @@ -6,25 +6,27 @@ import com.azure.resourcemanager.postgresql.models.PrivateLinkServiceConnectionStateProperty; -/** Samples for PrivateEndpointConnections CreateOrUpdate. */ +/** + * Samples for PrivateEndpointConnections CreateOrUpdate. + */ public final class PrivateEndpointConnectionsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdate.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/ + * PrivateEndpointConnectionUpdate.json */ /** * Sample code: Approve or reject a private endpoint connection with a given name. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void approveOrRejectAPrivateEndpointConnectionWithAGivenName( com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .privateEndpointConnections() + manager.privateEndpointConnections() .define("private-endpoint-connection-name") .withExistingServer("Default", "test-svr") .withPrivateLinkServiceConnectionState( - new PrivateLinkServiceConnectionStateProperty() - .withStatus("Approved") + new PrivateLinkServiceConnectionStateProperty().withStatus("Approved") .withDescription("Approved by johndoe@contoso.com")) .create(); } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsDeleteSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsDeleteSamples.java index 12b91952ce0ea..9d8cdf6c8fe69 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsDeleteSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsDeleteSamples.java @@ -4,22 +4,23 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for PrivateEndpointConnections Delete. */ +/** + * Samples for PrivateEndpointConnections Delete. + */ public final class PrivateEndpointConnectionsDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionDelete.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/ + * PrivateEndpointConnectionDelete.json */ /** * Sample code: Deletes a private endpoint connection with a given name. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void deletesAPrivateEndpointConnectionWithAGivenName( com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .privateEndpointConnections() - .delete("Default", "test-svr", "private-endpoint-connection-name", Context.NONE); + manager.privateEndpointConnections() + .delete("Default", "test-svr", "private-endpoint-connection-name", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsGetSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsGetSamples.java index fa536de3af5c6..9a88249a10d7a 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsGetSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsGetSamples.java @@ -4,21 +4,23 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for PrivateEndpointConnections Get. */ +/** + * Samples for PrivateEndpointConnections Get. + */ public final class PrivateEndpointConnectionsGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/ + * PrivateEndpointConnectionGet.json */ /** * Sample code: Gets private endpoint connection. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void getsPrivateEndpointConnection(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .privateEndpointConnections() - .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", Context.NONE); + manager.privateEndpointConnections() + .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsListByServerSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsListByServerSamples.java index f045afa5e4ca9..b60bed4ab07df 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsListByServerSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsListByServerSamples.java @@ -4,20 +4,22 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for PrivateEndpointConnections ListByServer. */ +/** + * Samples for PrivateEndpointConnections ListByServer. + */ public final class PrivateEndpointConnectionsListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionList.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/ + * PrivateEndpointConnectionList.json */ /** * Sample code: Gets list of private endpoint connections on a server. - * + * * @param manager Entry point to PostgreSqlManager. */ - public static void getsListOfPrivateEndpointConnectionsOnAServer( - com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.privateEndpointConnections().listByServer("Default", "test-svr", Context.NONE); + public static void + getsListOfPrivateEndpointConnectionsOnAServer(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { + manager.privateEndpointConnections().listByServer("Default", "test-svr", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsUpdateTagsSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsUpdateTagsSamples.java index b51d2195b33bd..d6a985b2eb9bd 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsUpdateTagsSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsUpdateTagsSamples.java @@ -4,31 +4,37 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.models.PrivateEndpointConnection; import java.util.HashMap; import java.util.Map; -/** Samples for PrivateEndpointConnections UpdateTags. */ +/** + * Samples for PrivateEndpointConnections UpdateTags. + */ public final class PrivateEndpointConnectionsUpdateTagsSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdateTags.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/ + * PrivateEndpointConnectionUpdateTags.json */ /** * Sample code: Update private endpoint connection Tags. - * + * * @param manager Entry point to PostgreSqlManager. */ - public static void updatePrivateEndpointConnectionTags( - com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - PrivateEndpointConnection resource = - manager - .privateEndpointConnections() - .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", Context.NONE) - .getValue(); - resource.update().withTags(mapOf("key1", "val1", "key2", "val2", "key3", "val3")).apply(); + public static void + updatePrivateEndpointConnectionTags(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { + PrivateEndpointConnection resource = manager.privateEndpointConnections() + .getWithResponse("Default", "test-svr", "private-endpoint-connection-name", + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() + .withTags( + mapOf("key1", "fakeTokenPlaceholder", "key2", "fakeTokenPlaceholder", "key3", "fakeTokenPlaceholder")) + .apply(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcesGetSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcesGetSamples.java index 3435eef0cba2f..359720f2d7dcc 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcesGetSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcesGetSamples.java @@ -4,20 +4,22 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for PrivateLinkResources Get. */ +/** + * Samples for PrivateLinkResources Get. + */ public final class PrivateLinkResourcesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateLinkResourcesGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/ + * PrivateLinkResourcesGet.json */ /** * Sample code: Gets a private link resource for PostgreSQL. - * + * * @param manager Entry point to PostgreSqlManager. */ - public static void getsAPrivateLinkResourceForPostgreSQL( - com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.privateLinkResources().getWithResponse("Default", "test-svr", "plr", Context.NONE); + public static void + getsAPrivateLinkResourceForPostgreSQL(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { + manager.privateLinkResources().getWithResponse("Default", "test-svr", "plr", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcesListByServerSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcesListByServerSamples.java index 183e51c8c0e20..3cfe5d8bd80da 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcesListByServerSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcesListByServerSamples.java @@ -4,20 +4,22 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for PrivateLinkResources ListByServer. */ +/** + * Samples for PrivateLinkResources ListByServer. + */ public final class PrivateLinkResourcesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateLinkResourcesList.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/ + * PrivateLinkResourcesList.json */ /** * Sample code: Gets private link resources for PostgreSQL. - * + * * @param manager Entry point to PostgreSqlManager. */ - public static void getsPrivateLinkResourcesForPostgreSQL( - com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.privateLinkResources().listByServer("Default", "test-svr", Context.NONE); + public static void + getsPrivateLinkResourcesForPostgreSQL(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { + manager.privateLinkResources().listByServer("Default", "test-svr", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/RecoverableServersGetSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/RecoverableServersGetSamples.java index 71d5bccc4a722..57b1deac996e4 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/RecoverableServersGetSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/RecoverableServersGetSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for RecoverableServers Get. */ +/** + * Samples for RecoverableServers Get. + */ public final class RecoverableServersGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/RecoverableServersGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * RecoverableServersGet.json */ /** * Sample code: ReplicasListByServer. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void replicasListByServer(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.recoverableServers().getWithResponse("testrg", "pgtestsvc4", Context.NONE); + manager.recoverableServers().getWithResponse("testrg", "pgtestsvc4", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ReplicasListByServerSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ReplicasListByServerSamples.java index ec811638e53fa..f1f12a69072af 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ReplicasListByServerSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ReplicasListByServerSamples.java @@ -4,19 +4,22 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for Replicas ListByServer. */ +/** + * Samples for Replicas ListByServer. + */ public final class ReplicasListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ReplicasListByServer.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ReplicasListByServer.json */ /** * Sample code: ReplicasListByServer. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void replicasListByServer(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.replicas().listByServer("TestGroup_WestCentralUS", "testserver-master", Context.NONE); + manager.replicas() + .listByServer("TestGroup_WestCentralUS", "testserver-master", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsCreateOrUpdateSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsCreateOrUpdateSamples.java index 2b11f69e772f9..611e4d77326aa 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsCreateOrUpdateSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsCreateOrUpdateSamples.java @@ -4,32 +4,31 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.fluent.models.ServerAdministratorResourceInner; import com.azure.resourcemanager.postgresql.models.AdministratorType; import java.util.UUID; -/** Samples for ServerAdministrators CreateOrUpdate. */ +/** + * Samples for ServerAdministrators CreateOrUpdate. + */ public final class ServerAdministratorsCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminCreateUpdate.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ServerAdminCreateUpdate.json */ /** * Sample code: ServerAdministratorCreate. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void serverAdministratorCreate(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .serverAdministrators() - .createOrUpdate( - "testrg", - "pgtestsvc4", - new ServerAdministratorResourceInner() - .withAdministratorType(AdministratorType.ACTIVE_DIRECTORY) + manager.serverAdministrators() + .createOrUpdate("testrg", "pgtestsvc4", + new ServerAdministratorResourceInner().withAdministratorType(AdministratorType.ACTIVE_DIRECTORY) .withLogin("bob@contoso.com") .withSid(UUID.fromString("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c")) .withTenantId(UUID.fromString("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c")), - Context.NONE); + com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsDeleteSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsDeleteSamples.java index dec80f42ee625..94971111e3edb 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsDeleteSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsDeleteSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for ServerAdministrators Delete. */ +/** + * Samples for ServerAdministrators Delete. + */ public final class ServerAdministratorsDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminDelete.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminDelete. + * json */ /** * Sample code: ServerAdministratorsDelete. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void serverAdministratorsDelete(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.serverAdministrators().delete("testrg", "pgtestsvc4", Context.NONE); + manager.serverAdministrators().delete("testrg", "pgtestsvc4", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsGetSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsGetSamples.java index 0d5d3899c283a..728a68d4927b4 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsGetSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsGetSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for ServerAdministrators Get. */ +/** + * Samples for ServerAdministrators Get. + */ public final class ServerAdministratorsGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminGet. + * json */ /** * Sample code: ServerAdministratorGet. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void serverAdministratorGet(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.serverAdministrators().getWithResponse("testrg", "pgtestsvc4", Context.NONE); + manager.serverAdministrators().getWithResponse("testrg", "pgtestsvc4", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsListSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsListSamples.java index 2df8c9e153f67..ef5772834e43e 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsListSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsListSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for ServerAdministrators List. */ +/** + * Samples for ServerAdministrators List. + */ public final class ServerAdministratorsListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminList.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminList. + * json */ /** * Sample code: get a list of server administrators. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void getAListOfServerAdministrators(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.serverAdministrators().list("testrg", "pgtestsvc4", Context.NONE); + manager.serverAdministrators().list("testrg", "pgtestsvc4", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerBasedPerformanceTierListSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerBasedPerformanceTierListSamples.java index 8f11d9a5ca18f..62773f8565dbe 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerBasedPerformanceTierListSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerBasedPerformanceTierListSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for ServerBasedPerformanceTier List. */ +/** + * Samples for ServerBasedPerformanceTier List. + */ public final class ServerBasedPerformanceTierListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/PerformanceTiersListByServer.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * PerformanceTiersListByServer.json */ /** * Sample code: PerformanceTiersList. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void performanceTiersList(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.serverBasedPerformanceTiers().list("TestGroup", "testserver", Context.NONE); + manager.serverBasedPerformanceTiers().list("TestGroup", "testserver", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerKeysCreateOrUpdateSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerKeysCreateOrUpdateSamples.java index 1246ff57354f7..6d8aac4677849 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerKeysCreateOrUpdateSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerKeysCreateOrUpdateSamples.java @@ -6,20 +6,23 @@ import com.azure.resourcemanager.postgresql.models.ServerKeyType; -/** Samples for ServerKeys CreateOrUpdate. */ +/** + * Samples for ServerKeys CreateOrUpdate. + */ public final class ServerKeysCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyCreateOrUpdate.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ + * ServerKeyCreateOrUpdate.json */ /** * Sample code: Creates or updates a PostgreSQL Server key. - * + * * @param manager Entry point to PostgreSqlManager. */ - public static void createsOrUpdatesAPostgreSQLServerKey( - com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .serverKeys() + public static void + createsOrUpdatesAPostgreSQLServerKey(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { + manager.serverKeys() .define("someVault_someKey_01234567890123456789012345678901") .withExistingServer("testserver", "testrg") .withServerKeyType(ServerKeyType.AZURE_KEY_VAULT) diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerKeysDeleteSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerKeysDeleteSamples.java index 72ab47352d2a6..57c2e6047bc3f 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerKeysDeleteSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerKeysDeleteSamples.java @@ -4,21 +4,23 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for ServerKeys Delete. */ +/** + * Samples for ServerKeys Delete. + */ public final class ServerKeysDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyDelete.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyDelete. + * json */ /** * Sample code: Delete the PostgreSQL Server key. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void deleteThePostgreSQLServerKey(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .serverKeys() - .delete("testserver", "someVault_someKey_01234567890123456789012345678901", "testrg", Context.NONE); + manager.serverKeys() + .delete("testserver", "someVault_someKey_01234567890123456789012345678901", "testrg", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerKeysGetSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerKeysGetSamples.java index e0c07bde8beca..000b505666c68 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerKeysGetSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerKeysGetSamples.java @@ -4,22 +4,22 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for ServerKeys Get. */ +/** + * Samples for ServerKeys Get. + */ public final class ServerKeysGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyGet.json */ /** * Sample code: Get the PostgreSQL Server key. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void getThePostgreSQLServerKey(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .serverKeys() - .getWithResponse( - "testrg", "testserver", "someVault_someKey_01234567890123456789012345678901", Context.NONE); + manager.serverKeys() + .getWithResponse("testrg", "testserver", "someVault_someKey_01234567890123456789012345678901", + com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerKeysListSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerKeysListSamples.java index 8c06a3708a55b..e5c08a4b4f20b 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerKeysListSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerKeysListSamples.java @@ -4,19 +4,20 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for ServerKeys List. */ +/** + * Samples for ServerKeys List. + */ public final class ServerKeysListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyList.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyList.json */ /** * Sample code: List the keys for a PostgreSQL Server. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void listTheKeysForAPostgreSQLServer(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.serverKeys().list("testrg", "testserver", Context.NONE); + manager.serverKeys().list("testrg", "testserver", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerParametersListUpdateConfigurationsSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerParametersListUpdateConfigurationsSamples.java index 1fc4a533a03ff..f3d352d4e76fa 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerParametersListUpdateConfigurationsSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerParametersListUpdateConfigurationsSamples.java @@ -4,22 +4,25 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationListResultInner; -/** Samples for ServerParameters ListUpdateConfigurations. */ +/** + * Samples for ServerParameters ListUpdateConfigurations. + */ public final class ServerParametersListUpdateConfigurationsSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationsUpdateByServer.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ConfigurationsUpdateByServer.json */ /** * Sample code: ConfigurationList. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void configurationList(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .serverParameters() - .listUpdateConfigurations("TestGroup", "testserver", new ConfigurationListResultInner(), Context.NONE); + manager.serverParameters() + .listUpdateConfigurations("TestGroup", "testserver", new ConfigurationListResultInner(), + com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerSecurityAlertPoliciesCreateOrUpdateSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerSecurityAlertPoliciesCreateOrUpdateSamples.java index 25d7916af1015..32314051bd802 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerSecurityAlertPoliciesCreateOrUpdateSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerSecurityAlertPoliciesCreateOrUpdateSamples.java @@ -4,51 +4,51 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.models.SecurityAlertPolicyName; import com.azure.resourcemanager.postgresql.models.ServerSecurityAlertPolicy; import com.azure.resourcemanager.postgresql.models.ServerSecurityAlertPolicyState; import java.util.Arrays; -/** Samples for ServerSecurityAlertPolicies CreateOrUpdate. */ +/** + * Samples for ServerSecurityAlertPolicies CreateOrUpdate. + */ public final class ServerSecurityAlertPoliciesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMin.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ServerSecurityAlertsCreateMin.json */ /** * Sample code: Update a server's threat detection policy with minimal parameters. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void updateAServerSThreatDetectionPolicyWithMinimalParameters( com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - ServerSecurityAlertPolicy resource = - manager - .serverSecurityAlertPolicies() - .getWithResponse( - "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) - .getValue(); + ServerSecurityAlertPolicy resource = manager.serverSecurityAlertPolicies() + .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, + com.azure.core.util.Context.NONE) + .getValue(); resource.update().withState(ServerSecurityAlertPolicyState.DISABLED).withEmailAccountAdmins(true).apply(); } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMax.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ServerSecurityAlertsCreateMax.json */ /** * Sample code: Update a server's threat detection policy with all parameters. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void updateAServerSThreatDetectionPolicyWithAllParameters( com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - ServerSecurityAlertPolicy resource = - manager - .serverSecurityAlertPolicies() - .getWithResponse( - "securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE) - .getValue(); - resource - .update() + ServerSecurityAlertPolicy resource = manager.serverSecurityAlertPolicies() + .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, + com.azure.core.util.Context.NONE) + .getValue(); + resource.update() .withState(ServerSecurityAlertPolicyState.ENABLED) .withDisabledAlerts(Arrays.asList("Access_Anomaly", "Usage_Anomaly")) .withEmailAddresses(Arrays.asList("testSecurityAlert@microsoft.com")) diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerSecurityAlertPoliciesGetSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerSecurityAlertPoliciesGetSamples.java index 59a1379679617..4e1fee116fb14 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerSecurityAlertPoliciesGetSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerSecurityAlertPoliciesGetSamples.java @@ -4,23 +4,26 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.models.SecurityAlertPolicyName; -/** Samples for ServerSecurityAlertPolicies Get. */ +/** + * Samples for ServerSecurityAlertPolicies Get. + */ public final class ServerSecurityAlertPoliciesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ServerSecurityAlertsGet.json */ /** * Sample code: Get a server's threat detection policy. - * + * * @param manager Entry point to PostgreSqlManager. */ - public static void getAServerSThreatDetectionPolicy( - com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .serverSecurityAlertPolicies() - .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, Context.NONE); + public static void + getAServerSThreatDetectionPolicy(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { + manager.serverSecurityAlertPolicies() + .getWithResponse("securityalert-4799", "securityalert-6440", SecurityAlertPolicyName.DEFAULT, + com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerSecurityAlertPoliciesListByServerSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerSecurityAlertPoliciesListByServerSamples.java index a53dd6a809e9c..dd6f5752b4a7c 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerSecurityAlertPoliciesListByServerSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServerSecurityAlertPoliciesListByServerSamples.java @@ -4,20 +4,23 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for ServerSecurityAlertPolicies ListByServer. */ +/** + * Samples for ServerSecurityAlertPolicies ListByServer. + */ public final class ServerSecurityAlertPoliciesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsListByServer.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ServerSecurityAlertsListByServer.json */ /** * Sample code: List the server's threat detection policies. - * + * * @param manager Entry point to PostgreSqlManager. */ - public static void listTheServerSThreatDetectionPolicies( - com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.serverSecurityAlertPolicies().listByServer("securityalert-4799", "securityalert-6440", Context.NONE); + public static void + listTheServerSThreatDetectionPolicies(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { + manager.serverSecurityAlertPolicies() + .listByServer("securityalert-4799", "securityalert-6440", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersCreateSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersCreateSamples.java index 93952d638e448..d94211ceb6dff 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersCreateSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersCreateSamples.java @@ -18,49 +18,49 @@ import java.util.HashMap; import java.util.Map; -/** Samples for Servers Create. */ +/** + * Samples for Servers Create. + */ public final class ServersCreateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ServerCreateReplicaMode.json */ /** * Sample code: Create a replica server. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void createAReplicaServer(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .servers() + manager.servers() .define("testserver-replica1") .withRegion("westcentralus") .withExistingResourceGroup("TestGroup_WestCentralUS") - .withProperties( - new ServerPropertiesForReplica() - .withSourceServerId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master")) + .withProperties(new ServerPropertiesForReplica().withSourceServerId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master")) .withSku( new Sku().withName("GP_Gen5_2").withTier(SkuTier.GENERAL_PURPOSE).withCapacity(2).withFamily("Gen5")) .create(); } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateGeoRestoreMode.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ServerCreateGeoRestoreMode.json */ /** * Sample code: Create a server as a geo restore. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void createAServerAsAGeoRestore(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .servers() + manager.servers() .define("targetserver") .withRegion("westus") .withExistingResourceGroup("TargetResourceGroup") - .withProperties( - new ServerPropertiesForGeoRestore() - .withSourceServerId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver")) + .withProperties(new ServerPropertiesForGeoRestore().withSourceServerId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver")) .withTags(mapOf("ElasticServer", "1")) .withSku( new Sku().withName("GP_Gen5_2").withTier(SkuTier.GENERAL_PURPOSE).withCapacity(2).withFamily("Gen5")) @@ -68,60 +68,56 @@ public static void createAServerAsAGeoRestore(com.azure.resourcemanager.postgres } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreate.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreate.json */ /** * Sample code: Create a new server. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void createANewServer(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .servers() + manager.servers() .define("pgtestsvc4") .withRegion("westus") .withExistingResourceGroup("TestGroup") - .withProperties( - new ServerPropertiesForDefaultCreate() - .withSslEnforcement(SslEnforcementEnum.ENABLED) - .withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_2) - .withStorageProfile( - new StorageProfile() - .withBackupRetentionDays(7) - .withGeoRedundantBackup(GeoRedundantBackup.DISABLED) - .withStorageMB(128000)) - .withAdministratorLogin("cloudsa") - .withAdministratorLoginPassword("")) + .withProperties(new ServerPropertiesForDefaultCreate().withSslEnforcement(SslEnforcementEnum.ENABLED) + .withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_2) + .withStorageProfile(new StorageProfile().withBackupRetentionDays(7) + .withGeoRedundantBackup(GeoRedundantBackup.DISABLED) + .withStorageMB(128000)) + .withAdministratorLogin("cloudsa") + .withAdministratorLoginPassword("fakeTokenPlaceholder")) .withTags(mapOf("ElasticServer", "1")) .withSku(new Sku().withName("B_Gen5_2").withTier(SkuTier.BASIC).withCapacity(2).withFamily("Gen5")) .create(); } /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreatePointInTimeRestore.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ServerCreatePointInTimeRestore.json */ /** * Sample code: Create a database as a point in time restore. - * + * * @param manager Entry point to PostgreSqlManager. */ - public static void createADatabaseAsAPointInTimeRestore( - com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .servers() + public static void + createADatabaseAsAPointInTimeRestore(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { + manager.servers() .define("targetserver") .withRegion("brazilsouth") .withExistingResourceGroup("TargetResourceGroup") - .withProperties( - new ServerPropertiesForRestore() - .withSourceServerId( - "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver") - .withRestorePointInTime(OffsetDateTime.parse("2017-12-14T00:00:37.467Z"))) + .withProperties(new ServerPropertiesForRestore().withSourceServerId( + "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver") + .withRestorePointInTime(OffsetDateTime.parse("2017-12-14T00:00:37.467Z"))) .withTags(mapOf("ElasticServer", "1")) .withSku(new Sku().withName("B_Gen5_2").withTier(SkuTier.BASIC).withCapacity(2).withFamily("Gen5")) .create(); } + // Use "Map.of" if available @SuppressWarnings("unchecked") private static Map mapOf(Object... inputs) { Map map = new HashMap<>(); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersDeleteSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersDeleteSamples.java index 0a779ed17c169..75975b0427621 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersDeleteSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersDeleteSamples.java @@ -4,19 +4,20 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for Servers Delete. */ +/** + * Samples for Servers Delete. + */ public final class ServersDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerDelete.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerDelete.json */ /** * Sample code: ServerDelete. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void serverDelete(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.servers().delete("TestGroup", "testserver", Context.NONE); + manager.servers().delete("TestGroup", "testserver", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersGetByResourceGroupSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersGetByResourceGroupSamples.java index 4aa9a72ff44e1..a0c74c2b30fe5 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersGetByResourceGroupSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersGetByResourceGroupSamples.java @@ -4,19 +4,20 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for Servers GetByResourceGroup. */ +/** + * Samples for Servers GetByResourceGroup. + */ public final class ServersGetByResourceGroupSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerGet.json */ /** * Sample code: ServerGet. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void serverGet(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.servers().getByResourceGroupWithResponse("testrg", "pgtestsvc1", Context.NONE); + manager.servers().getByResourceGroupWithResponse("testrg", "pgtestsvc1", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersListByResourceGroupSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersListByResourceGroupSamples.java index 3d30ae9149f5e..a2fb15e130d25 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersListByResourceGroupSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersListByResourceGroupSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for Servers ListByResourceGroup. */ +/** + * Samples for Servers ListByResourceGroup. + */ public final class ServersListByResourceGroupSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerListByResourceGroup.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * ServerListByResourceGroup.json */ /** * Sample code: ServerListByResourceGroup. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void serverListByResourceGroup(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.servers().listByResourceGroup("TestGroup", Context.NONE); + manager.servers().listByResourceGroup("TestGroup", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersListSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersListSamples.java index ab75854d95400..3dcc353b3e174 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersListSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersListSamples.java @@ -4,19 +4,20 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for Servers List. */ +/** + * Samples for Servers List. + */ public final class ServersListSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerList.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerList.json */ /** * Sample code: ServerList. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void serverList(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.servers().list(Context.NONE); + manager.servers().list(com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersRestartSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersRestartSamples.java index ec832daa9aa0a..59a780c8a379b 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersRestartSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersRestartSamples.java @@ -4,19 +4,20 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for Servers Restart. */ +/** + * Samples for Servers Restart. + */ public final class ServersRestartSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerRestart.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerRestart.json */ /** * Sample code: ServerRestart. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void serverRestart(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.servers().restart("TestGroup", "testserver", Context.NONE); + manager.servers().restart("TestGroup", "testserver", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersUpdateSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersUpdateSamples.java index 3a42d9cf9d2ac..bdef5d99173c0 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersUpdateSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/ServersUpdateSamples.java @@ -4,26 +4,28 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; import com.azure.resourcemanager.postgresql.models.Server; import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum; -/** Samples for Servers Update. */ +/** + * Samples for Servers Update. + */ public final class ServersUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerUpdate.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerUpdate.json */ /** * Sample code: ServerUpdate. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void serverUpdate(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - Server resource = - manager.servers().getByResourceGroupWithResponse("testrg", "pgtestsvc4", Context.NONE).getValue(); - resource - .update() + Server resource = manager.servers() + .getByResourceGroupWithResponse("testrg", "pgtestsvc4", com.azure.core.util.Context.NONE) + .getValue(); + resource.update() .withAdministratorLoginPassword("") .withSslEnforcement(SslEnforcementEnum.ENABLED) .withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_2) diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesCreateOrUpdateSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesCreateOrUpdateSamples.java index 131a25e98ada0..ee91421dc6567 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesCreateOrUpdateSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesCreateOrUpdateSamples.java @@ -4,20 +4,23 @@ package com.azure.resourcemanager.postgresql.generated; -/** Samples for VirtualNetworkRules CreateOrUpdate. */ +/** + * Samples for VirtualNetworkRules CreateOrUpdate. + */ public final class VirtualNetworkRulesCreateOrUpdateSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesCreateOrUpdate.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * VirtualNetworkRulesCreateOrUpdate.json */ /** * Sample code: Create or update a virtual network rule. - * + * * @param manager Entry point to PostgreSqlManager. */ - public static void createOrUpdateAVirtualNetworkRule( - com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager - .virtualNetworkRules() + public static void + createOrUpdateAVirtualNetworkRule(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { + manager.virtualNetworkRules() .define("vnet-firewall-rule") .withExistingServer("TestGroup", "vnet-test-svr") .withVirtualNetworkSubnetId( diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesDeleteSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesDeleteSamples.java index 7e3865dd4073a..4c998fdb29757 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesDeleteSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesDeleteSamples.java @@ -4,19 +4,22 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for VirtualNetworkRules Delete. */ +/** + * Samples for VirtualNetworkRules Delete. + */ public final class VirtualNetworkRulesDeleteSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesDelete.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * VirtualNetworkRulesDelete.json */ /** * Sample code: Delete a virtual network rule. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void deleteAVirtualNetworkRule(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.virtualNetworkRules().delete("TestGroup", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); + manager.virtualNetworkRules() + .delete("TestGroup", "vnet-test-svr", "vnet-firewall-rule", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesGetSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesGetSamples.java index b4ec6f7955f09..1cb87acb9224a 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesGetSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesGetSamples.java @@ -4,19 +4,22 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for VirtualNetworkRules Get. */ +/** + * Samples for VirtualNetworkRules Get. + */ public final class VirtualNetworkRulesGetSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesGet.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * VirtualNetworkRulesGet.json */ /** * Sample code: Gets a virtual network rule. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void getsAVirtualNetworkRule(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.virtualNetworkRules().getWithResponse("TestGroup", "vnet-test-svr", "vnet-firewall-rule", Context.NONE); + manager.virtualNetworkRules() + .getWithResponse("TestGroup", "vnet-test-svr", "vnet-firewall-rule", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesListByServerSamples.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesListByServerSamples.java index e2310c5b48552..280a7cc39099e 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesListByServerSamples.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/samples/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesListByServerSamples.java @@ -4,19 +4,21 @@ package com.azure.resourcemanager.postgresql.generated; -import com.azure.core.util.Context; - -/** Samples for VirtualNetworkRules ListByServer. */ +/** + * Samples for VirtualNetworkRules ListByServer. + */ public final class VirtualNetworkRulesListByServerSamples { /* - * x-ms-original-file: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesList.json + * x-ms-original-file: + * specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ + * VirtualNetworkRulesList.json */ /** * Sample code: List virtual network rules. - * + * * @param manager Entry point to PostgreSqlManager. */ public static void listVirtualNetworkRules(com.azure.resourcemanager.postgresql.PostgreSqlManager manager) { - manager.virtualNetworkRules().listByServer("TestGroup", "vnet-test-svr", Context.NONE); + manager.virtualNetworkRules().listByServer("TestGroup", "vnet-test-svr", com.azure.core.util.Context.NONE); } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/CheckNameAvailabilitiesExecuteWithResponseMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/CheckNameAvailabilitiesExecuteWithResponseMockTests.java new file mode 100644 index 0000000000000..11362e356d4b1 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/CheckNameAvailabilitiesExecuteWithResponseMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.NameAvailability; +import com.azure.resourcemanager.postgresql.models.NameAvailabilityRequest; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class CheckNameAvailabilitiesExecuteWithResponseMockTests { + @Test + public void testExecuteWithResponse() throws Exception { + String responseStr = "{\"message\":\"jkqa\",\"nameAvailable\":true,\"reason\":\"slesjcbhernnt\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + NameAvailability response = manager.checkNameAvailabilities() + .executeWithResponse(new NameAvailabilityRequest().withName("luiqtqzfavyvnqq").withType("aryeu"), + com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("jkqa", response.message()); + Assertions.assertEquals(true, response.nameAvailable()); + Assertions.assertEquals("slesjcbhernnt", response.reason()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationInnerTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationInnerTests.java new file mode 100644 index 0000000000000..e24dd9630e364 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationInnerTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationInner; +import org.junit.jupiter.api.Assertions; + +public final class ConfigurationInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ConfigurationInner model = BinaryData.fromString( + "{\"properties\":{\"value\":\"eo\",\"description\":\"okeyyienj\",\"defaultValue\":\"lwtgrhpdj\",\"dataType\":\"umasxazjpq\",\"allowedValues\":\"gual\",\"source\":\"xxhejjzzvd\"},\"id\":\"dgwdslfhot\",\"name\":\"mcy\",\"type\":\"pwlbjnpg\"}") + .toObject(ConfigurationInner.class); + Assertions.assertEquals("eo", model.value()); + Assertions.assertEquals("xxhejjzzvd", model.source()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ConfigurationInner model = new ConfigurationInner().withValue("eo").withSource("xxhejjzzvd"); + model = BinaryData.fromObject(model).toObject(ConfigurationInner.class); + Assertions.assertEquals("eo", model.value()); + Assertions.assertEquals("xxhejjzzvd", model.source()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationListResultInnerTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationListResultInnerTests.java new file mode 100644 index 0000000000000..cbffdd8b79f55 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationListResultInnerTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationListResultInner; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class ConfigurationListResultInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ConfigurationListResultInner model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"value\":\"ugw\",\"description\":\"cglhslazjdyggdt\",\"defaultValue\":\"xhbkuofq\",\"dataType\":\"yk\",\"allowedValues\":\"enevfyexfwhybci\",\"source\":\"yvdcsitynnaa\"},\"id\":\"dectehfiqsc\",\"name\":\"eypvhezrkg\",\"type\":\"hcjrefovgmk\"},{\"properties\":{\"value\":\"eyyvxyqjpkcat\",\"description\":\"ngj\",\"defaultValue\":\"cczsq\",\"dataType\":\"hvmdajvnysounq\",\"allowedValues\":\"a\",\"source\":\"ae\"},\"id\":\"pfhyhl\",\"name\":\"rpmopjmc\",\"type\":\"atuokthfuiu\"},{\"properties\":{\"value\":\"sfcpkvxodpuozm\",\"description\":\"ydagfuaxbe\",\"defaultValue\":\"iu\",\"dataType\":\"ktwh\",\"allowedValues\":\"xw\",\"source\":\"wqsmbsur\"},\"id\":\"xim\",\"name\":\"ryocfsfksymdd\",\"type\":\"stkiiuxhqyud\"}]}") + .toObject(ConfigurationListResultInner.class); + Assertions.assertEquals("ugw", model.value().get(0).value()); + Assertions.assertEquals("yvdcsitynnaa", model.value().get(0).source()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ConfigurationListResultInner model = new ConfigurationListResultInner() + .withValue(Arrays.asList(new ConfigurationInner().withValue("ugw").withSource("yvdcsitynnaa"), + new ConfigurationInner().withValue("eyyvxyqjpkcat").withSource("ae"), + new ConfigurationInner().withValue("sfcpkvxodpuozm").withSource("wqsmbsur"))); + model = BinaryData.fromObject(model).toObject(ConfigurationListResultInner.class); + Assertions.assertEquals("ugw", model.value().get(0).value()); + Assertions.assertEquals("yvdcsitynnaa", model.value().get(0).source()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationPropertiesTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationPropertiesTests.java new file mode 100644 index 0000000000000..36cd49005591e --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationPropertiesTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationProperties; +import org.junit.jupiter.api.Assertions; + +public final class ConfigurationPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ConfigurationProperties model = BinaryData.fromString( + "{\"value\":\"ftadehxnltyfs\",\"description\":\"pusuesn\",\"defaultValue\":\"dejbavo\",\"dataType\":\"zdmohctbqvu\",\"allowedValues\":\"xdn\",\"source\":\"vo\"}") + .toObject(ConfigurationProperties.class); + Assertions.assertEquals("ftadehxnltyfs", model.value()); + Assertions.assertEquals("vo", model.source()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ConfigurationProperties model = new ConfigurationProperties().withValue("ftadehxnltyfs").withSource("vo"); + model = BinaryData.fromObject(model).toObject(ConfigurationProperties.class); + Assertions.assertEquals("ftadehxnltyfs", model.value()); + Assertions.assertEquals("vo", model.source()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsCreateOrUpdateMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsCreateOrUpdateMockTests.java new file mode 100644 index 0000000000000..51dc456380093 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsCreateOrUpdateMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.Configuration; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ConfigurationsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"value\":\"gllqwjy\",\"description\":\"jayvblmhv\",\"defaultValue\":\"uhbxvvy\",\"dataType\":\"s\",\"allowedValues\":\"byrqufeg\",\"source\":\"vwz\"},\"id\":\"bnhlmc\",\"name\":\"l\",\"type\":\"dn\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Configuration response = manager.configurations() + .define("edkowepbqpcrfk") + .withExistingServer("vezrypqlmfeo", "erqwkyhkobopg") + .withValue("csnjvcdwxlpqekft") + .withSource("aatjinrvgoupmfi") + .create(); + + Assertions.assertEquals("gllqwjy", response.value()); + Assertions.assertEquals("vwz", response.source()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsGetWithResponseMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsGetWithResponseMockTests.java new file mode 100644 index 0000000000000..f1abb9ce27424 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsGetWithResponseMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.Configuration; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ConfigurationsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"value\":\"szfjvfbgofelja\",\"description\":\"qmqhldvriii\",\"defaultValue\":\"nalghfkvtvsexso\",\"dataType\":\"el\",\"allowedValues\":\"hhahhxvrhmzkwpjg\",\"source\":\"spughftqsxhq\"},\"id\":\"ujxukndxd\",\"name\":\"grjguufzd\",\"type\":\"syqtfi\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Configuration response = manager.configurations() + .getWithResponse("frl", "zszrnwoiindfpw", "jylwbtlhflsj", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("szfjvfbgofelja", response.value()); + Assertions.assertEquals("spughftqsxhq", response.source()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsListByServerMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsListByServerMockTests.java new file mode 100644 index 0000000000000..0a1b236ef6753 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ConfigurationsListByServerMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.Configuration; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ConfigurationsListByServerMockTests { + @Test + public void testListByServer() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"value\":\"hqamvdkf\",\"description\":\"nwcvtbvkayhmtnv\",\"defaultValue\":\"iatkzwpcnp\",\"dataType\":\"cjaesgvvs\",\"allowedValues\":\"yajguqfhwygzlv\",\"source\":\"kfxu\"},\"id\":\"emdwzrmuhapfc\",\"name\":\"dpsqx\",\"type\":\"vpsvuoymgcce\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.configurations().listByServer("whbotzingamv", "phoszqz", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("hqamvdkf", response.iterator().next().value()); + Assertions.assertEquals("kfxu", response.iterator().next().source()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabaseInnerTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabaseInnerTests.java new file mode 100644 index 0000000000000..523773925cd4a --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabaseInnerTests.java @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.DatabaseInner; +import org.junit.jupiter.api.Assertions; + +public final class DatabaseInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatabaseInner model = BinaryData.fromString( + "{\"properties\":{\"charset\":\"ddglm\",\"collation\":\"hjq\"},\"id\":\"wpyeicxmqciwqvh\",\"name\":\"hix\",\"type\":\"igdtopbob\"}") + .toObject(DatabaseInner.class); + Assertions.assertEquals("ddglm", model.charset()); + Assertions.assertEquals("hjq", model.collation()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatabaseInner model = new DatabaseInner().withCharset("ddglm").withCollation("hjq"); + model = BinaryData.fromObject(model).toObject(DatabaseInner.class); + Assertions.assertEquals("ddglm", model.charset()); + Assertions.assertEquals("hjq", model.collation()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabaseListResultTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabaseListResultTests.java new file mode 100644 index 0000000000000..daff7239edaf5 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabaseListResultTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.DatabaseInner; +import com.azure.resourcemanager.postgresql.models.DatabaseListResult; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class DatabaseListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatabaseListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"charset\":\"ftutqxlngxlefgu\",\"collation\":\"xkrxdqmi\"},\"id\":\"tthzrvqd\",\"name\":\"abhjybi\",\"type\":\"ehoqfbowskan\"},{\"properties\":{\"charset\":\"zlcuiywgqywgndrv\",\"collation\":\"hzgpphrcgyncocpe\"},\"id\":\"fvm\",\"name\":\"coofsxlzev\",\"type\":\"bmqj\"},{\"properties\":{\"charset\":\"c\",\"collation\":\"mivkwlzuvcc\"},\"id\":\"wnfnbacf\",\"name\":\"onlebxetqgtzxdpn\",\"type\":\"bqqwxrj\"},{\"properties\":{\"charset\":\"llnwsubi\",\"collation\":\"jampmngnzscxaqw\"},\"id\":\"ochcbonqvpkvl\",\"name\":\"xnj\",\"type\":\"ase\"}]}") + .toObject(DatabaseListResult.class); + Assertions.assertEquals("ftutqxlngxlefgu", model.value().get(0).charset()); + Assertions.assertEquals("xkrxdqmi", model.value().get(0).collation()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatabaseListResult model = new DatabaseListResult() + .withValue(Arrays.asList(new DatabaseInner().withCharset("ftutqxlngxlefgu").withCollation("xkrxdqmi"), + new DatabaseInner().withCharset("zlcuiywgqywgndrv").withCollation("hzgpphrcgyncocpe"), + new DatabaseInner().withCharset("c").withCollation("mivkwlzuvcc"), + new DatabaseInner().withCharset("llnwsubi").withCollation("jampmngnzscxaqw"))); + model = BinaryData.fromObject(model).toObject(DatabaseListResult.class); + Assertions.assertEquals("ftutqxlngxlefgu", model.value().get(0).charset()); + Assertions.assertEquals("xkrxdqmi", model.value().get(0).collation()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasePropertiesTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasePropertiesTests.java new file mode 100644 index 0000000000000..7901e4d19d3cd --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasePropertiesTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.DatabaseProperties; +import org.junit.jupiter.api.Assertions; + +public final class DatabasePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + DatabaseProperties model = BinaryData.fromString("{\"charset\":\"ghmewuam\",\"collation\":\"hrzayvvtpgvdf\"}") + .toObject(DatabaseProperties.class); + Assertions.assertEquals("ghmewuam", model.charset()); + Assertions.assertEquals("hrzayvvtpgvdf", model.collation()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + DatabaseProperties model = new DatabaseProperties().withCharset("ghmewuam").withCollation("hrzayvvtpgvdf"); + model = BinaryData.fromObject(model).toObject(DatabaseProperties.class); + Assertions.assertEquals("ghmewuam", model.charset()); + Assertions.assertEquals("hrzayvvtpgvdf", model.collation()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasesCreateOrUpdateMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasesCreateOrUpdateMockTests.java new file mode 100644 index 0000000000000..12ef5f1738834 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasesCreateOrUpdateMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.Database; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class DatabasesCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"charset\":\"bi\",\"collation\":\"gpikpzimejza\"},\"id\":\"lfzxiavrmbzonoki\",\"name\":\"rjqc\",\"type\":\"rgz\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Database response = manager.databases() + .define("ldgmfpgvmpip") + .withExistingServer("bjbsybb", "wrv") + .withCharset("thaqfxssmwu") + .withCollation("bdsrez") + .create(); + + Assertions.assertEquals("bi", response.charset()); + Assertions.assertEquals("gpikpzimejza", response.collation()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasesDeleteMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasesDeleteMockTests.java new file mode 100644 index 0000000000000..f95e575cce048 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasesDeleteMockTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class DatabasesDeleteMockTests { + @Test + public void testDelete() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.databases().delete("nmdyodnwzxl", "jc", "nhltiugcxn", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasesGetWithResponseMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasesGetWithResponseMockTests.java new file mode 100644 index 0000000000000..f62c10b1d0543 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasesGetWithResponseMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.Database; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class DatabasesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"charset\":\"rkvfgbvfvpdbo\",\"collation\":\"cizsjqlhkrribdei\"},\"id\":\"qipqkghvxndz\",\"name\":\"mkrefajpjorwkq\",\"type\":\"yhgbijtjivfx\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Database response = manager.databases() + .getWithResponse("vvwxqi", "y", "unyowxwl", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("rkvfgbvfvpdbo", response.charset()); + Assertions.assertEquals("cizsjqlhkrribdei", response.collation()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasesListByServerMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasesListByServerMockTests.java new file mode 100644 index 0000000000000..8502be7af407f --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/DatabasesListByServerMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.Database; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class DatabasesListByServerMockTests { + @Test + public void testListByServer() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"charset\":\"xbkzbzkdvncj\",\"collation\":\"udurgkakmokz\"},\"id\":\"jjklff\",\"name\":\"mouwqlgzrfzeey\",\"type\":\"bizikayuhq\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.databases().listByServer("sjabibs", "stawfsdjpvkv", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("xbkzbzkdvncj", response.iterator().next().charset()); + Assertions.assertEquals("udurgkakmokz", response.iterator().next().collation()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRuleInnerTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRuleInnerTests.java new file mode 100644 index 0000000000000..940259cc8e2bd --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRuleInnerTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.FirewallRuleInner; +import org.junit.jupiter.api.Assertions; + +public final class FirewallRuleInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FirewallRuleInner model = BinaryData.fromString( + "{\"properties\":{\"startIpAddress\":\"wxmnteiwao\",\"endIpAddress\":\"vkmijcmmxdcuf\"},\"id\":\"fsrpymzidnse\",\"name\":\"cxtbzsg\",\"type\":\"yc\"}") + .toObject(FirewallRuleInner.class); + Assertions.assertEquals("wxmnteiwao", model.startIpAddress()); + Assertions.assertEquals("vkmijcmmxdcuf", model.endIpAddress()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FirewallRuleInner model + = new FirewallRuleInner().withStartIpAddress("wxmnteiwao").withEndIpAddress("vkmijcmmxdcuf"); + model = BinaryData.fromObject(model).toObject(FirewallRuleInner.class); + Assertions.assertEquals("wxmnteiwao", model.startIpAddress()); + Assertions.assertEquals("vkmijcmmxdcuf", model.endIpAddress()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRuleListResultTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRuleListResultTests.java new file mode 100644 index 0000000000000..2118382eb7724 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRuleListResultTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.FirewallRuleInner; +import com.azure.resourcemanager.postgresql.models.FirewallRuleListResult; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class FirewallRuleListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FirewallRuleListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"startIpAddress\":\"nrosfqpte\",\"endIpAddress\":\"hzzvypyq\"},\"id\":\"i\",\"name\":\"z\",\"type\":\"npvswjdkirso\"},{\"properties\":{\"startIpAddress\":\"dqxhcrmnohjtckwh\",\"endIpAddress\":\"soifiyipjxsqw\"},\"id\":\"gr\",\"name\":\"bznorcjxvsnby\",\"type\":\"qabnmoc\"}]}") + .toObject(FirewallRuleListResult.class); + Assertions.assertEquals("nrosfqpte", model.value().get(0).startIpAddress()); + Assertions.assertEquals("hzzvypyq", model.value().get(0).endIpAddress()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FirewallRuleListResult model = new FirewallRuleListResult().withValue( + Arrays.asList(new FirewallRuleInner().withStartIpAddress("nrosfqpte").withEndIpAddress("hzzvypyq"), + new FirewallRuleInner().withStartIpAddress("dqxhcrmnohjtckwh").withEndIpAddress("soifiyipjxsqw"))); + model = BinaryData.fromObject(model).toObject(FirewallRuleListResult.class); + Assertions.assertEquals("nrosfqpte", model.value().get(0).startIpAddress()); + Assertions.assertEquals("hzzvypyq", model.value().get(0).endIpAddress()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulePropertiesTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulePropertiesTests.java new file mode 100644 index 0000000000000..84eb497beb408 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulePropertiesTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.FirewallRuleProperties; +import org.junit.jupiter.api.Assertions; + +public final class FirewallRulePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + FirewallRuleProperties model + = BinaryData.fromString("{\"startIpAddress\":\"sne\",\"endIpAddress\":\"mdwzjeiachboo\"}") + .toObject(FirewallRuleProperties.class); + Assertions.assertEquals("sne", model.startIpAddress()); + Assertions.assertEquals("mdwzjeiachboo", model.endIpAddress()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + FirewallRuleProperties model + = new FirewallRuleProperties().withStartIpAddress("sne").withEndIpAddress("mdwzjeiachboo"); + model = BinaryData.fromObject(model).toObject(FirewallRuleProperties.class); + Assertions.assertEquals("sne", model.startIpAddress()); + Assertions.assertEquals("mdwzjeiachboo", model.endIpAddress()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesCreateOrUpdateMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesCreateOrUpdateMockTests.java new file mode 100644 index 0000000000000..733dfc8257b91 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesCreateOrUpdateMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.FirewallRule; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class FirewallRulesCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"startIpAddress\":\"kkze\",\"endIpAddress\":\"dlhewp\"},\"id\":\"sdsttwvog\",\"name\":\"bbejdcngqqm\",\"type\":\"akufgmjz\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + FirewallRule response = manager.firewallRules() + .define("lmnguxaw") + .withExistingServer("zcmrvexztvb", "qgsfraoyzkoow") + .withStartIpAddress("aldsy") + .withEndIpAddress("uximerqfobw") + .create(); + + Assertions.assertEquals("kkze", response.startIpAddress()); + Assertions.assertEquals("dlhewp", response.endIpAddress()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesDeleteMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesDeleteMockTests.java new file mode 100644 index 0000000000000..cf0cff09e332f --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesDeleteMockTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class FirewallRulesDeleteMockTests { + @Test + public void testDelete() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.firewallRules().delete("u", "gdknnqv", "aznqntoru", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesGetWithResponseMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesGetWithResponseMockTests.java new file mode 100644 index 0000000000000..46c2f81714818 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesGetWithResponseMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.FirewallRule; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class FirewallRulesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"startIpAddress\":\"zlxwabmqoefkifr\",\"endIpAddress\":\"tpuqujmq\"},\"id\":\"gkfbtndoaong\",\"name\":\"jcntuj\",\"type\":\"tcje\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + FirewallRule response = manager.firewallRules() + .getWithResponse("sgsahmkycgr", "uwjuetaeburuvdmo", "s", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("zlxwabmqoefkifr", response.startIpAddress()); + Assertions.assertEquals("tpuqujmq", response.endIpAddress()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesListByServerMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesListByServerMockTests.java new file mode 100644 index 0000000000000..8693d35eb5f19 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/FirewallRulesListByServerMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.FirewallRule; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class FirewallRulesListByServerMockTests { + @Test + public void testListByServer() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"startIpAddress\":\"gszufoxciqopid\",\"endIpAddress\":\"amcio\"},\"id\":\"hkh\",\"name\":\"zxkhnzbonlwnto\",\"type\":\"gokdwbwhks\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.firewallRules().listByServer("ftwwaezkojvdc", "zfoqouicybxar", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("gszufoxciqopid", response.iterator().next().startIpAddress()); + Assertions.assertEquals("amcio", response.iterator().next().endIpAddress()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LocationBasedPerformanceTiersListMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LocationBasedPerformanceTiersListMockTests.java new file mode 100644 index 0000000000000..e01e8b90421c2 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LocationBasedPerformanceTiersListMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.PerformanceTierProperties; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class LocationBasedPerformanceTiersListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"id\":\"jyxgtczh\",\"maxBackupRetentionDays\":1722960093,\"minBackupRetentionDays\":1160079835,\"maxStorageMB\":1835924775,\"minLargeStorageMB\":36372091,\"maxLargeStorageMB\":303349068,\"minStorageMB\":385580573,\"serviceLevelObjectives\":[{\"id\":\"bbxuripl\",\"edition\":\"n\",\"vCore\":895803414,\"hardwareGeneration\":\"x\",\"maxBackupRetentionDays\":854940072,\"minBackupRetentionDays\":1028544137,\"maxStorageMB\":674255307,\"minStorageMB\":1619197472},{\"id\":\"kl\",\"edition\":\"pluodpv\",\"vCore\":1956413749,\"hardwareGeneration\":\"lgzi\",\"maxBackupRetentionDays\":1707092311,\"minBackupRetentionDays\":1721626377,\"maxStorageMB\":1861002535,\"minStorageMB\":1268403965},{\"id\":\"tvdxeclzedqb\",\"edition\":\"hzlhplodqkdlww\",\"vCore\":551279051,\"hardwareGeneration\":\"mlkxtrqjfs\",\"maxBackupRetentionDays\":2109905275,\"minBackupRetentionDays\":1888053234,\"maxStorageMB\":2023709214,\"minStorageMB\":2036331900},{\"id\":\"wsrt\",\"edition\":\"coezbrhubskh\",\"vCore\":662703919,\"hardwareGeneration\":\"oookkqfq\",\"maxBackupRetentionDays\":958097402,\"minBackupRetentionDays\":1122494487,\"maxStorageMB\":151095052,\"minStorageMB\":471659562}]}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.locationBasedPerformanceTiers().list("fz", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("jyxgtczh", response.iterator().next().id()); + Assertions.assertEquals(1722960093, response.iterator().next().maxBackupRetentionDays()); + Assertions.assertEquals(1160079835, response.iterator().next().minBackupRetentionDays()); + Assertions.assertEquals(1835924775, response.iterator().next().maxStorageMB()); + Assertions.assertEquals(36372091, response.iterator().next().minLargeStorageMB()); + Assertions.assertEquals(303349068, response.iterator().next().maxLargeStorageMB()); + Assertions.assertEquals(385580573, response.iterator().next().minStorageMB()); + Assertions.assertEquals("bbxuripl", response.iterator().next().serviceLevelObjectives().get(0).id()); + Assertions.assertEquals("n", response.iterator().next().serviceLevelObjectives().get(0).edition()); + Assertions.assertEquals(895803414, response.iterator().next().serviceLevelObjectives().get(0).vCore()); + Assertions.assertEquals("x", response.iterator().next().serviceLevelObjectives().get(0).hardwareGeneration()); + Assertions.assertEquals(854940072, + response.iterator().next().serviceLevelObjectives().get(0).maxBackupRetentionDays()); + Assertions.assertEquals(1028544137, + response.iterator().next().serviceLevelObjectives().get(0).minBackupRetentionDays()); + Assertions.assertEquals(674255307, response.iterator().next().serviceLevelObjectives().get(0).maxStorageMB()); + Assertions.assertEquals(1619197472, response.iterator().next().serviceLevelObjectives().get(0).minStorageMB()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LogFileInnerTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LogFileInnerTests.java new file mode 100644 index 0000000000000..ce6e07beacfbd --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LogFileInnerTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.LogFileInner; +import org.junit.jupiter.api.Assertions; + +public final class LogFileInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LogFileInner model = BinaryData.fromString( + "{\"properties\":{\"sizeInKB\":5351704758336650999,\"createdTime\":\"2020-12-28T19:13:15Z\",\"lastModifiedTime\":\"2021-08-25T19:52:36Z\",\"type\":\"ldngkpoci\",\"url\":\"z\"},\"id\":\"xoegukgjnpiucgy\",\"name\":\"evqzntypmrbp\",\"type\":\"zcdrqjsdpydnfyhx\"}") + .toObject(LogFileInner.class); + Assertions.assertEquals(5351704758336650999L, model.sizeInKB()); + Assertions.assertEquals("ldngkpoci", model.typePropertiesType()); + Assertions.assertEquals("z", model.url()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LogFileInner model + = new LogFileInner().withSizeInKB(5351704758336650999L).withTypePropertiesType("ldngkpoci").withUrl("z"); + model = BinaryData.fromObject(model).toObject(LogFileInner.class); + Assertions.assertEquals(5351704758336650999L, model.sizeInKB()); + Assertions.assertEquals("ldngkpoci", model.typePropertiesType()); + Assertions.assertEquals("z", model.url()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LogFileListResultTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LogFileListResultTests.java new file mode 100644 index 0000000000000..91e0e734ee682 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LogFileListResultTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.LogFileInner; +import com.azure.resourcemanager.postgresql.models.LogFileListResult; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class LogFileListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LogFileListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"sizeInKB\":8963352586461588270,\"createdTime\":\"2021-06-17T06:36:49Z\",\"lastModifiedTime\":\"2021-02-11T00:33:58Z\",\"type\":\"yifqrvkdvjsllrmv\",\"url\":\"f\"},\"id\":\"atkpnp\",\"name\":\"lexxbczwtru\",\"type\":\"iqzbq\"},{\"properties\":{\"sizeInKB\":2872380603368123057,\"createdTime\":\"2021-03-01T06:44:22Z\",\"lastModifiedTime\":\"2020-12-31T07:20:30Z\",\"type\":\"cspkwlhzdobpxjmf\",\"url\":\"vvnchrkcc\"},\"id\":\"wwzjuqkhrsajiwku\",\"name\":\"foskghsauuimj\",\"type\":\"vxieduugidyj\"},{\"properties\":{\"sizeInKB\":3682891038702940178,\"createdTime\":\"2021-09-15T05:38:02Z\",\"lastModifiedTime\":\"2021-06-21T06:23:36Z\",\"type\":\"xc\",\"url\":\"npc\"},\"id\":\"hocohslkev\",\"name\":\"eggzfb\",\"type\":\"hfmvfaxkffe\"},{\"properties\":{\"sizeInKB\":1624318397315279611,\"createdTime\":\"2021-01-03T07:04:49Z\",\"lastModifiedTime\":\"2021-04-12T11:49:32Z\",\"type\":\"v\",\"url\":\"xmzsbbzogg\"},\"id\":\"grxwbu\",\"name\":\"vjxxjnsp\",\"type\":\"dptkoenkouk\"}]}") + .toObject(LogFileListResult.class); + Assertions.assertEquals(8963352586461588270L, model.value().get(0).sizeInKB()); + Assertions.assertEquals("yifqrvkdvjsllrmv", model.value().get(0).typePropertiesType()); + Assertions.assertEquals("f", model.value().get(0).url()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LogFileListResult model = new LogFileListResult().withValue(Arrays.asList( + new LogFileInner().withSizeInKB(8963352586461588270L) + .withTypePropertiesType("yifqrvkdvjsllrmv") + .withUrl("f"), + new LogFileInner().withSizeInKB(2872380603368123057L) + .withTypePropertiesType("cspkwlhzdobpxjmf") + .withUrl("vvnchrkcc"), + new LogFileInner().withSizeInKB(3682891038702940178L).withTypePropertiesType("xc").withUrl("npc"), + new LogFileInner().withSizeInKB(1624318397315279611L).withTypePropertiesType("v").withUrl("xmzsbbzogg"))); + model = BinaryData.fromObject(model).toObject(LogFileListResult.class); + Assertions.assertEquals(8963352586461588270L, model.value().get(0).sizeInKB()); + Assertions.assertEquals("yifqrvkdvjsllrmv", model.value().get(0).typePropertiesType()); + Assertions.assertEquals("f", model.value().get(0).url()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LogFilePropertiesTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LogFilePropertiesTests.java new file mode 100644 index 0000000000000..cc367c6ce451b --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LogFilePropertiesTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.LogFileProperties; +import org.junit.jupiter.api.Assertions; + +public final class LogFilePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + LogFileProperties model = BinaryData.fromString( + "{\"sizeInKB\":5446401731314405625,\"createdTime\":\"2021-03-05T21:12:23Z\",\"lastModifiedTime\":\"2021-05-15T00:01:52Z\",\"type\":\"ifsjttgzfbishcb\",\"url\":\"ajdeyeamdphaga\"}") + .toObject(LogFileProperties.class); + Assertions.assertEquals(5446401731314405625L, model.sizeInKB()); + Assertions.assertEquals("ifsjttgzfbishcb", model.type()); + Assertions.assertEquals("ajdeyeamdphaga", model.url()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + LogFileProperties model = new LogFileProperties().withSizeInKB(5446401731314405625L) + .withType("ifsjttgzfbishcb") + .withUrl("ajdeyeamdphaga"); + model = BinaryData.fromObject(model).toObject(LogFileProperties.class); + Assertions.assertEquals(5446401731314405625L, model.sizeInKB()); + Assertions.assertEquals("ifsjttgzfbishcb", model.type()); + Assertions.assertEquals("ajdeyeamdphaga", model.url()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LogFilesListByServerMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LogFilesListByServerMockTests.java new file mode 100644 index 0000000000000..d60c0b042475f --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/LogFilesListByServerMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.LogFile; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class LogFilesListByServerMockTests { + @Test + public void testListByServer() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"sizeInKB\":451990146790609184,\"createdTime\":\"2021-03-19T01:34:54Z\",\"lastModifiedTime\":\"2021-06-30T04:34:05Z\",\"type\":\"vj\",\"url\":\"tkfa\"},\"id\":\"nopqgikyzirtx\",\"name\":\"yuxzejntpsewgi\",\"type\":\"ilqu\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.logFiles().listByServer("pdso", "bshrnsvbuswd", com.azure.core.util.Context.NONE); + + Assertions.assertEquals(451990146790609184L, response.iterator().next().sizeInKB()); + Assertions.assertEquals("vj", response.iterator().next().typePropertiesType()); + Assertions.assertEquals("tkfa", response.iterator().next().url()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/NameAvailabilityInnerTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/NameAvailabilityInnerTests.java new file mode 100644 index 0000000000000..286489e893b87 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/NameAvailabilityInnerTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.NameAvailabilityInner; +import org.junit.jupiter.api.Assertions; + +public final class NameAvailabilityInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NameAvailabilityInner model + = BinaryData.fromString("{\"message\":\"jn\",\"nameAvailable\":true,\"reason\":\"hsmtxpsiebtfhvp\"}") + .toObject(NameAvailabilityInner.class); + Assertions.assertEquals("jn", model.message()); + Assertions.assertEquals(true, model.nameAvailable()); + Assertions.assertEquals("hsmtxpsiebtfhvp", model.reason()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NameAvailabilityInner model + = new NameAvailabilityInner().withMessage("jn").withNameAvailable(true).withReason("hsmtxpsiebtfhvp"); + model = BinaryData.fromObject(model).toObject(NameAvailabilityInner.class); + Assertions.assertEquals("jn", model.message()); + Assertions.assertEquals(true, model.nameAvailable()); + Assertions.assertEquals("hsmtxpsiebtfhvp", model.reason()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/NameAvailabilityRequestTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/NameAvailabilityRequestTests.java new file mode 100644 index 0000000000000..1a24e9abeb1aa --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/NameAvailabilityRequestTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.NameAvailabilityRequest; +import org.junit.jupiter.api.Assertions; + +public final class NameAvailabilityRequestTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + NameAvailabilityRequest model = BinaryData.fromString("{\"name\":\"iuebbaumny\",\"type\":\"ped\"}") + .toObject(NameAvailabilityRequest.class); + Assertions.assertEquals("iuebbaumny", model.name()); + Assertions.assertEquals("ped", model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + NameAvailabilityRequest model = new NameAvailabilityRequest().withName("iuebbaumny").withType("ped"); + model = BinaryData.fromObject(model).toObject(NameAvailabilityRequest.class); + Assertions.assertEquals("iuebbaumny", model.name()); + Assertions.assertEquals("ped", model.type()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/OperationDisplayTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/OperationDisplayTests.java new file mode 100644 index 0000000000000..f5806473d6ad0 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/OperationDisplayTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.OperationDisplay; + +public final class OperationDisplayTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationDisplay model = BinaryData + .fromString("{\"provider\":\"vfadmws\",\"resource\":\"r\",\"operation\":\"xpvgo\",\"description\":\"lf\"}") + .toObject(OperationDisplay.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationDisplay model = new OperationDisplay(); + model = BinaryData.fromObject(model).toObject(OperationDisplay.class); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/OperationListResultInnerTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/OperationListResultInnerTests.java new file mode 100644 index 0000000000000..b2323a427a2eb --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/OperationListResultInnerTests.java @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.OperationListResultInner; +import com.azure.resourcemanager.postgresql.models.Operation; +import java.util.Arrays; + +public final class OperationListResultInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + OperationListResultInner model = BinaryData.fromString( + "{\"value\":[{\"name\":\"skrdqmhjj\",\"display\":{\"provider\":\"ldwkyzxuutkn\",\"resource\":\"scwsv\",\"operation\":\"otogtwrupqs\",\"description\":\"nmic\"},\"origin\":\"system\",\"properties\":{\"eil\":\"datao\",\"k\":\"datavnotyfjfcnj\",\"kphywpnvjto\":\"datanxdhbt\",\"plpho\":\"datanermcl\"}},{\"name\":\"scrpabgyepsbjt\",\"display\":{\"provider\":\"ugxywpmueef\",\"resource\":\"wfqkquj\",\"operation\":\"suyonobglaocq\",\"description\":\"ccm\"},\"origin\":\"system\",\"properties\":{\"pz\":\"dataytlmoyrxvwfud\"}}]}") + .toObject(OperationListResultInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + OperationListResultInner model + = new OperationListResultInner().withValue(Arrays.asList(new Operation(), new Operation())); + model = BinaryData.fromObject(model).toObject(OperationListResultInner.class); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/OperationTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/OperationTests.java new file mode 100644 index 0000000000000..86fa183dba7b4 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/OperationTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.Operation; + +public final class OperationTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Operation model = BinaryData.fromString( + "{\"name\":\"xhdzhlrqjbhckf\",\"display\":{\"provider\":\"rxsbkyvp\",\"resource\":\"anuzbpzkafkuw\",\"operation\":\"rnwb\",\"description\":\"hhseyv\"},\"origin\":\"user\",\"properties\":{\"kdeemaofmxagkvtm\":\"dataslhs\",\"ahaquh\":\"datalmqkrhahvlj\",\"aex\":\"datadhmdua\"}}") + .toObject(Operation.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Operation model = new Operation(); + model = BinaryData.fromObject(model).toObject(Operation.class); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/OperationsListWithResponseMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/OperationsListWithResponseMockTests.java new file mode 100644 index 0000000000000..c84a5d9b9eb08 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/OperationsListWithResponseMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.OperationListResult; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class OperationsListWithResponseMockTests { + @Test + public void testListWithResponse() throws Exception { + String responseStr + = "{\"value\":[{\"name\":\"jcvb\",\"display\":{\"provider\":\"rbe\",\"resource\":\"agohbuff\",\"operation\":\"rqemvvhmxt\",\"description\":\"jfutacoebj\"},\"origin\":\"user\",\"properties\":{\"raufactkahzova\":\"datajznmwcpmguaa\",\"iuxxpshneekulfg\":\"dataj\",\"d\":\"datalqubkwdlen\"}}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + OperationListResult response + = manager.operations().listWithResponse(com.azure.core.util.Context.NONE).getValue(); + + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PerformanceTierListResultTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PerformanceTierListResultTests.java new file mode 100644 index 0000000000000..402aecc85fd5b --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PerformanceTierListResultTests.java @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.postgresql.models.PerformanceTierListResult; +import com.azure.resourcemanager.postgresql.models.PerformanceTierServiceLevelObjectives; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class PerformanceTierListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PerformanceTierListResult model = BinaryData.fromString( + "{\"value\":[{\"id\":\"ibnuqqkpik\",\"maxBackupRetentionDays\":1684029730,\"minBackupRetentionDays\":627657952,\"maxStorageMB\":2048114314,\"minLargeStorageMB\":1163936229,\"maxLargeStorageMB\":424672875,\"minStorageMB\":122504841,\"serviceLevelObjectives\":[{\"id\":\"jggmebfsiarbu\",\"edition\":\"cvpnazzmhjrunmpx\",\"vCore\":808779778,\"hardwareGeneration\":\"hrbnlankxmyskpbh\",\"maxBackupRetentionDays\":1813898530,\"minBackupRetentionDays\":2131694851,\"maxStorageMB\":2016648328,\"minStorageMB\":83692384},{\"id\":\"y\",\"edition\":\"rsyn\",\"vCore\":123803740,\"hardwareGeneration\":\"ybyxc\",\"maxBackupRetentionDays\":858824887,\"minBackupRetentionDays\":751467546,\"maxStorageMB\":2035107412,\"minStorageMB\":1122692891}]},{\"id\":\"abphlw\",\"maxBackupRetentionDays\":2142840160,\"minBackupRetentionDays\":1096564755,\"maxStorageMB\":1182551695,\"minLargeStorageMB\":1572483367,\"maxLargeStorageMB\":864051381,\"minStorageMB\":2034865697,\"serviceLevelObjectives\":[{\"id\":\"yyazttbt\",\"edition\":\"rq\",\"vCore\":1833989004,\"hardwareGeneration\":\"ckzywbiexzfeyue\",\"maxBackupRetentionDays\":537783371,\"minBackupRetentionDays\":1627970479,\"maxStorageMB\":735455048,\"minStorageMB\":1281560612},{\"id\":\"qwalmuzyoxaepd\",\"edition\":\"jancu\",\"vCore\":1487648770,\"hardwareGeneration\":\"wbavxbniwdj\",\"maxBackupRetentionDays\":511976912,\"minBackupRetentionDays\":44682703,\"maxStorageMB\":593552862,\"minStorageMB\":806707414}]}]}") + .toObject(PerformanceTierListResult.class); + Assertions.assertEquals("ibnuqqkpik", model.value().get(0).id()); + Assertions.assertEquals(1684029730, model.value().get(0).maxBackupRetentionDays()); + Assertions.assertEquals(627657952, model.value().get(0).minBackupRetentionDays()); + Assertions.assertEquals(2048114314, model.value().get(0).maxStorageMB()); + Assertions.assertEquals(1163936229, model.value().get(0).minLargeStorageMB()); + Assertions.assertEquals(424672875, model.value().get(0).maxLargeStorageMB()); + Assertions.assertEquals(122504841, model.value().get(0).minStorageMB()); + Assertions.assertEquals("jggmebfsiarbu", model.value().get(0).serviceLevelObjectives().get(0).id()); + Assertions.assertEquals("cvpnazzmhjrunmpx", model.value().get(0).serviceLevelObjectives().get(0).edition()); + Assertions.assertEquals(808779778, model.value().get(0).serviceLevelObjectives().get(0).vCore()); + Assertions.assertEquals("hrbnlankxmyskpbh", + model.value().get(0).serviceLevelObjectives().get(0).hardwareGeneration()); + Assertions.assertEquals(1813898530, + model.value().get(0).serviceLevelObjectives().get(0).maxBackupRetentionDays()); + Assertions.assertEquals(2131694851, + model.value().get(0).serviceLevelObjectives().get(0).minBackupRetentionDays()); + Assertions.assertEquals(2016648328, model.value().get(0).serviceLevelObjectives().get(0).maxStorageMB()); + Assertions.assertEquals(83692384, model.value().get(0).serviceLevelObjectives().get(0).minStorageMB()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PerformanceTierListResult model = new PerformanceTierListResult().withValue(Arrays.asList( + new PerformanceTierPropertiesInner().withId("ibnuqqkpik") + .withMaxBackupRetentionDays(1684029730) + .withMinBackupRetentionDays(627657952) + .withMaxStorageMB(2048114314) + .withMinLargeStorageMB(1163936229) + .withMaxLargeStorageMB(424672875) + .withMinStorageMB(122504841) + .withServiceLevelObjectives(Arrays.asList( + new PerformanceTierServiceLevelObjectives().withId("jggmebfsiarbu") + .withEdition("cvpnazzmhjrunmpx") + .withVCore(808779778) + .withHardwareGeneration("hrbnlankxmyskpbh") + .withMaxBackupRetentionDays(1813898530) + .withMinBackupRetentionDays(2131694851) + .withMaxStorageMB(2016648328) + .withMinStorageMB(83692384), + new PerformanceTierServiceLevelObjectives().withId("y") + .withEdition("rsyn") + .withVCore(123803740) + .withHardwareGeneration("ybyxc") + .withMaxBackupRetentionDays(858824887) + .withMinBackupRetentionDays(751467546) + .withMaxStorageMB(2035107412) + .withMinStorageMB(1122692891))), + new PerformanceTierPropertiesInner().withId("abphlw") + .withMaxBackupRetentionDays(2142840160) + .withMinBackupRetentionDays(1096564755) + .withMaxStorageMB(1182551695) + .withMinLargeStorageMB(1572483367) + .withMaxLargeStorageMB(864051381) + .withMinStorageMB(2034865697) + .withServiceLevelObjectives(Arrays.asList( + new PerformanceTierServiceLevelObjectives().withId("yyazttbt") + .withEdition("rq") + .withVCore(1833989004) + .withHardwareGeneration("ckzywbiexzfeyue") + .withMaxBackupRetentionDays(537783371) + .withMinBackupRetentionDays(1627970479) + .withMaxStorageMB(735455048) + .withMinStorageMB(1281560612), + new PerformanceTierServiceLevelObjectives().withId("qwalmuzyoxaepd") + .withEdition("jancu") + .withVCore(1487648770) + .withHardwareGeneration("wbavxbniwdj") + .withMaxBackupRetentionDays(511976912) + .withMinBackupRetentionDays(44682703) + .withMaxStorageMB(593552862) + .withMinStorageMB(806707414))))); + model = BinaryData.fromObject(model).toObject(PerformanceTierListResult.class); + Assertions.assertEquals("ibnuqqkpik", model.value().get(0).id()); + Assertions.assertEquals(1684029730, model.value().get(0).maxBackupRetentionDays()); + Assertions.assertEquals(627657952, model.value().get(0).minBackupRetentionDays()); + Assertions.assertEquals(2048114314, model.value().get(0).maxStorageMB()); + Assertions.assertEquals(1163936229, model.value().get(0).minLargeStorageMB()); + Assertions.assertEquals(424672875, model.value().get(0).maxLargeStorageMB()); + Assertions.assertEquals(122504841, model.value().get(0).minStorageMB()); + Assertions.assertEquals("jggmebfsiarbu", model.value().get(0).serviceLevelObjectives().get(0).id()); + Assertions.assertEquals("cvpnazzmhjrunmpx", model.value().get(0).serviceLevelObjectives().get(0).edition()); + Assertions.assertEquals(808779778, model.value().get(0).serviceLevelObjectives().get(0).vCore()); + Assertions.assertEquals("hrbnlankxmyskpbh", + model.value().get(0).serviceLevelObjectives().get(0).hardwareGeneration()); + Assertions.assertEquals(1813898530, + model.value().get(0).serviceLevelObjectives().get(0).maxBackupRetentionDays()); + Assertions.assertEquals(2131694851, + model.value().get(0).serviceLevelObjectives().get(0).minBackupRetentionDays()); + Assertions.assertEquals(2016648328, model.value().get(0).serviceLevelObjectives().get(0).maxStorageMB()); + Assertions.assertEquals(83692384, model.value().get(0).serviceLevelObjectives().get(0).minStorageMB()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PerformanceTierPropertiesInnerTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PerformanceTierPropertiesInnerTests.java new file mode 100644 index 0000000000000..16e5b79672984 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PerformanceTierPropertiesInnerTests.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.postgresql.models.PerformanceTierServiceLevelObjectives; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; + +public final class PerformanceTierPropertiesInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PerformanceTierPropertiesInner model = BinaryData.fromString( + "{\"id\":\"xytxhpzxbz\",\"maxBackupRetentionDays\":686718071,\"minBackupRetentionDays\":262767805,\"maxStorageMB\":1638223797,\"minLargeStorageMB\":2112719993,\"maxLargeStorageMB\":2068547199,\"minStorageMB\":1070511980,\"serviceLevelObjectives\":[{\"id\":\"qik\",\"edition\":\"bovpl\",\"vCore\":1271650742,\"hardwareGeneration\":\"vgyuguos\",\"maxBackupRetentionDays\":306118904,\"minBackupRetentionDays\":439757511,\"maxStorageMB\":941863244,\"minStorageMB\":406049393}]}") + .toObject(PerformanceTierPropertiesInner.class); + Assertions.assertEquals("xytxhpzxbz", model.id()); + Assertions.assertEquals(686718071, model.maxBackupRetentionDays()); + Assertions.assertEquals(262767805, model.minBackupRetentionDays()); + Assertions.assertEquals(1638223797, model.maxStorageMB()); + Assertions.assertEquals(2112719993, model.minLargeStorageMB()); + Assertions.assertEquals(2068547199, model.maxLargeStorageMB()); + Assertions.assertEquals(1070511980, model.minStorageMB()); + Assertions.assertEquals("qik", model.serviceLevelObjectives().get(0).id()); + Assertions.assertEquals("bovpl", model.serviceLevelObjectives().get(0).edition()); + Assertions.assertEquals(1271650742, model.serviceLevelObjectives().get(0).vCore()); + Assertions.assertEquals("vgyuguos", model.serviceLevelObjectives().get(0).hardwareGeneration()); + Assertions.assertEquals(306118904, model.serviceLevelObjectives().get(0).maxBackupRetentionDays()); + Assertions.assertEquals(439757511, model.serviceLevelObjectives().get(0).minBackupRetentionDays()); + Assertions.assertEquals(941863244, model.serviceLevelObjectives().get(0).maxStorageMB()); + Assertions.assertEquals(406049393, model.serviceLevelObjectives().get(0).minStorageMB()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PerformanceTierPropertiesInner model = new PerformanceTierPropertiesInner().withId("xytxhpzxbz") + .withMaxBackupRetentionDays(686718071) + .withMinBackupRetentionDays(262767805) + .withMaxStorageMB(1638223797) + .withMinLargeStorageMB(2112719993) + .withMaxLargeStorageMB(2068547199) + .withMinStorageMB(1070511980) + .withServiceLevelObjectives(Arrays.asList(new PerformanceTierServiceLevelObjectives().withId("qik") + .withEdition("bovpl") + .withVCore(1271650742) + .withHardwareGeneration("vgyuguos") + .withMaxBackupRetentionDays(306118904) + .withMinBackupRetentionDays(439757511) + .withMaxStorageMB(941863244) + .withMinStorageMB(406049393))); + model = BinaryData.fromObject(model).toObject(PerformanceTierPropertiesInner.class); + Assertions.assertEquals("xytxhpzxbz", model.id()); + Assertions.assertEquals(686718071, model.maxBackupRetentionDays()); + Assertions.assertEquals(262767805, model.minBackupRetentionDays()); + Assertions.assertEquals(1638223797, model.maxStorageMB()); + Assertions.assertEquals(2112719993, model.minLargeStorageMB()); + Assertions.assertEquals(2068547199, model.maxLargeStorageMB()); + Assertions.assertEquals(1070511980, model.minStorageMB()); + Assertions.assertEquals("qik", model.serviceLevelObjectives().get(0).id()); + Assertions.assertEquals("bovpl", model.serviceLevelObjectives().get(0).edition()); + Assertions.assertEquals(1271650742, model.serviceLevelObjectives().get(0).vCore()); + Assertions.assertEquals("vgyuguos", model.serviceLevelObjectives().get(0).hardwareGeneration()); + Assertions.assertEquals(306118904, model.serviceLevelObjectives().get(0).maxBackupRetentionDays()); + Assertions.assertEquals(439757511, model.serviceLevelObjectives().get(0).minBackupRetentionDays()); + Assertions.assertEquals(941863244, model.serviceLevelObjectives().get(0).maxStorageMB()); + Assertions.assertEquals(406049393, model.serviceLevelObjectives().get(0).minStorageMB()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PerformanceTierServiceLevelObjectivesTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PerformanceTierServiceLevelObjectivesTests.java new file mode 100644 index 0000000000000..0f52a4336094e --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PerformanceTierServiceLevelObjectivesTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.PerformanceTierServiceLevelObjectives; +import org.junit.jupiter.api.Assertions; + +public final class PerformanceTierServiceLevelObjectivesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PerformanceTierServiceLevelObjectives model = BinaryData.fromString( + "{\"id\":\"kfplgmgsxnk\",\"edition\":\"kde\",\"vCore\":1710407502,\"hardwareGeneration\":\"lopwiyig\",\"maxBackupRetentionDays\":2017228559,\"minBackupRetentionDays\":1945649701,\"maxStorageMB\":344801541,\"minStorageMB\":1170549879}") + .toObject(PerformanceTierServiceLevelObjectives.class); + Assertions.assertEquals("kfplgmgsxnk", model.id()); + Assertions.assertEquals("kde", model.edition()); + Assertions.assertEquals(1710407502, model.vCore()); + Assertions.assertEquals("lopwiyig", model.hardwareGeneration()); + Assertions.assertEquals(2017228559, model.maxBackupRetentionDays()); + Assertions.assertEquals(1945649701, model.minBackupRetentionDays()); + Assertions.assertEquals(344801541, model.maxStorageMB()); + Assertions.assertEquals(1170549879, model.minStorageMB()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PerformanceTierServiceLevelObjectives model = new PerformanceTierServiceLevelObjectives().withId("kfplgmgsxnk") + .withEdition("kde") + .withVCore(1710407502) + .withHardwareGeneration("lopwiyig") + .withMaxBackupRetentionDays(2017228559) + .withMinBackupRetentionDays(1945649701) + .withMaxStorageMB(344801541) + .withMinStorageMB(1170549879); + model = BinaryData.fromObject(model).toObject(PerformanceTierServiceLevelObjectives.class); + Assertions.assertEquals("kfplgmgsxnk", model.id()); + Assertions.assertEquals("kde", model.edition()); + Assertions.assertEquals(1710407502, model.vCore()); + Assertions.assertEquals("lopwiyig", model.hardwareGeneration()); + Assertions.assertEquals(2017228559, model.maxBackupRetentionDays()); + Assertions.assertEquals(1945649701, model.minBackupRetentionDays()); + Assertions.assertEquals(344801541, model.maxStorageMB()); + Assertions.assertEquals(1170549879, model.minStorageMB()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionInnerTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionInnerTests.java new file mode 100644 index 0000000000000..af5c36befcea9 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionInnerTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.postgresql.models.PrivateEndpointProperty; +import com.azure.resourcemanager.postgresql.models.PrivateLinkServiceConnectionStateProperty; +import org.junit.jupiter.api.Assertions; + +public final class PrivateEndpointConnectionInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateEndpointConnectionInner model = BinaryData.fromString( + "{\"properties\":{\"privateEndpoint\":{\"id\":\"xzvlvqhjkbegib\"},\"privateLinkServiceConnectionState\":{\"status\":\"mxiebw\",\"description\":\"aloayqcgwrtzju\",\"actionsRequired\":\"wyzmhtxon\"},\"provisioningState\":\"ts\"},\"id\":\"vjcbpwxqpsrknf\",\"name\":\"guvriuhprwmd\",\"type\":\"vxqtayriwwroyqbe\"}") + .toObject(PrivateEndpointConnectionInner.class); + Assertions.assertEquals("xzvlvqhjkbegib", model.privateEndpoint().id()); + Assertions.assertEquals("mxiebw", model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("aloayqcgwrtzju", model.privateLinkServiceConnectionState().description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateEndpointConnectionInner model = new PrivateEndpointConnectionInner() + .withPrivateEndpoint(new PrivateEndpointProperty().withId("xzvlvqhjkbegib")) + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionStateProperty().withStatus("mxiebw").withDescription("aloayqcgwrtzju")); + model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionInner.class); + Assertions.assertEquals("xzvlvqhjkbegib", model.privateEndpoint().id()); + Assertions.assertEquals("mxiebw", model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("aloayqcgwrtzju", model.privateLinkServiceConnectionState().description()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionListResultTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionListResultTests.java new file mode 100644 index 0000000000000..619cd1d03200c --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.PrivateEndpointConnectionListResult; + +public final class PrivateEndpointConnectionListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateEndpointConnectionListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"privateEndpoint\":{\"id\":\"f\"},\"privateLinkServiceConnectionState\":{\"status\":\"luu\",\"description\":\"dttouwaboekqvkel\",\"actionsRequired\":\"mvb\"},\"provisioningState\":\"yjsflhhcaalnji\"},\"id\":\"isxyawjoyaqcslyj\",\"name\":\"kiidzyex\",\"type\":\"nelixhnrztfo\"},{\"properties\":{\"privateEndpoint\":{\"id\":\"xknalaulppg\"},\"privateLinkServiceConnectionState\":{\"status\":\"tpnapnyiropuhpig\",\"description\":\"pgylg\",\"actionsRequired\":\"itxmedjvcslynqww\"},\"provisioningState\":\"wzz\"},\"id\":\"xgk\",\"name\":\"rmgucnap\",\"type\":\"t\"}],\"nextLink\":\"ellwptfdy\"}") + .toObject(PrivateEndpointConnectionListResult.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateEndpointConnectionListResult model = new PrivateEndpointConnectionListResult(); + model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionListResult.class); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionPropertiesTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionPropertiesTests.java new file mode 100644 index 0000000000000..1350913cfd7fc --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionPropertiesTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.PrivateEndpointConnectionProperties; +import com.azure.resourcemanager.postgresql.models.PrivateEndpointProperty; +import com.azure.resourcemanager.postgresql.models.PrivateLinkServiceConnectionStateProperty; +import org.junit.jupiter.api.Assertions; + +public final class PrivateEndpointConnectionPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateEndpointConnectionProperties model = BinaryData.fromString( + "{\"privateEndpoint\":{\"id\":\"cqibycnojv\"},\"privateLinkServiceConnectionState\":{\"status\":\"mefqsgzvahapjyzh\",\"description\":\"vgqzcjrvxd\",\"actionsRequired\":\"lmwlxkvugfhzo\"},\"provisioningState\":\"wjvzunluthnn\"}") + .toObject(PrivateEndpointConnectionProperties.class); + Assertions.assertEquals("cqibycnojv", model.privateEndpoint().id()); + Assertions.assertEquals("mefqsgzvahapjyzh", model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("vgqzcjrvxd", model.privateLinkServiceConnectionState().description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateEndpointConnectionProperties model = new PrivateEndpointConnectionProperties() + .withPrivateEndpoint(new PrivateEndpointProperty().withId("cqibycnojv")) + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionStateProperty().withStatus("mefqsgzvahapjyzh") + .withDescription("vgqzcjrvxd")); + model = BinaryData.fromObject(model).toObject(PrivateEndpointConnectionProperties.class); + Assertions.assertEquals("cqibycnojv", model.privateEndpoint().id()); + Assertions.assertEquals("mefqsgzvahapjyzh", model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("vgqzcjrvxd", model.privateLinkServiceConnectionState().description()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsCreateOrUpdateMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsCreateOrUpdateMockTests.java new file mode 100644 index 0000000000000..06fe7001a5c1c --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsCreateOrUpdateMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.PrivateEndpointConnection; +import com.azure.resourcemanager.postgresql.models.PrivateEndpointProperty; +import com.azure.resourcemanager.postgresql.models.PrivateLinkServiceConnectionStateProperty; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class PrivateEndpointConnectionsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"privateEndpoint\":{\"id\":\"jbabwidf\"},\"privateLinkServiceConnectionState\":{\"status\":\"sspuunnoxyhkx\",\"description\":\"qddrihpfhoqcaae\",\"actionsRequired\":\"aomdjvlpjxx\"},\"provisioningState\":\"Succeeded\"},\"id\":\"geivsiykzkdncj\",\"name\":\"xonbzoggculapz\",\"type\":\"y\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PrivateEndpointConnection response = manager.privateEndpointConnections() + .define("yhddvia") + .withExistingServer("bdgiogsjk", "nwqjnoba") + .withPrivateEndpoint(new PrivateEndpointProperty().withId("n")) + .withPrivateLinkServiceConnectionState( + new PrivateLinkServiceConnectionStateProperty().withStatus("tfpmvmemfnczdw") + .withDescription("vbalxlllc")) + .create(); + + Assertions.assertEquals("jbabwidf", response.privateEndpoint().id()); + Assertions.assertEquals("sspuunnoxyhkx", response.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("qddrihpfhoqcaae", response.privateLinkServiceConnectionState().description()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsDeleteMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsDeleteMockTests.java new file mode 100644 index 0000000000000..5b488630860c8 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsDeleteMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class PrivateEndpointConnectionsDeleteMockTests { + @Test + public void testDelete() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.privateEndpointConnections() + .delete("rxkpmloazuruoc", "goorbteo", "bfhjxakvvjgsl", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsGetWithResponseMockTests.java new file mode 100644 index 0000000000000..e9d3df163b343 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsGetWithResponseMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.PrivateEndpointConnection; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class PrivateEndpointConnectionsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"privateEndpoint\":{\"id\":\"bqactxtgzukx\"},\"privateLinkServiceConnectionState\":{\"status\":\"mmqtgqqqxhr\",\"description\":\"xrxc\",\"actionsRequired\":\"uisavokq\"},\"provisioningState\":\"fvazivjlfrqttba\"},\"id\":\"lkatnwxyiopidkqq\",\"name\":\"kuvscxkdm\",\"type\":\"igovi\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PrivateEndpointConnection response = manager.privateEndpointConnections() + .getWithResponse("fbkjubdyhgkfmi", "sgow", "fttsttk", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("bqactxtgzukx", response.privateEndpoint().id()); + Assertions.assertEquals("mmqtgqqqxhr", response.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("xrxc", response.privateLinkServiceConnectionState().description()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsListByServerMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsListByServerMockTests.java new file mode 100644 index 0000000000000..9e04fc27fdb1f --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointConnectionsListByServerMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.PrivateEndpointConnection; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class PrivateEndpointConnectionsListByServerMockTests { + @Test + public void testListByServer() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"privateEndpoint\":{\"id\":\"t\"},\"privateLinkServiceConnectionState\":{\"status\":\"kxn\",\"description\":\"edabgyvudtjue\",\"actionsRequired\":\"cihxuuwhcjyx\"},\"provisioningState\":\"ybvpay\"},\"id\":\"kkudzp\",\"name\":\"gwjplmag\",\"type\":\"tcyohpfkyrk\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.privateEndpointConnections().listByServer("r", "il", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("t", response.iterator().next().privateEndpoint().id()); + Assertions.assertEquals("kxn", response.iterator().next().privateLinkServiceConnectionState().status()); + Assertions.assertEquals("edabgyvudtjue", + response.iterator().next().privateLinkServiceConnectionState().description()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointPropertyTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointPropertyTests.java new file mode 100644 index 0000000000000..cef40b3c77224 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateEndpointPropertyTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.PrivateEndpointProperty; +import org.junit.jupiter.api.Assertions; + +public final class PrivateEndpointPropertyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateEndpointProperty model + = BinaryData.fromString("{\"id\":\"eqfpj\"}").toObject(PrivateEndpointProperty.class); + Assertions.assertEquals("eqfpj", model.id()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateEndpointProperty model = new PrivateEndpointProperty().withId("eqfpj"); + model = BinaryData.fromObject(model).toObject(PrivateEndpointProperty.class); + Assertions.assertEquals("eqfpj", model.id()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourceInnerTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourceInnerTests.java new file mode 100644 index 0000000000000..1eec54059d1b9 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourceInnerTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.PrivateLinkResourceInner; + +public final class PrivateLinkResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateLinkResourceInner model = BinaryData.fromString( + "{\"properties\":{\"groupId\":\"pybsrfbjfdtw\",\"requiredMembers\":[\"t\",\"tpvjzbexilzznfqq\",\"vwpm\",\"taruoujmkcj\"]},\"id\":\"wqytjrybnwjewgdr\",\"name\":\"ervnaenqpehi\",\"type\":\"doy\"}") + .toObject(PrivateLinkResourceInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateLinkResourceInner model = new PrivateLinkResourceInner(); + model = BinaryData.fromObject(model).toObject(PrivateLinkResourceInner.class); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourceListResultTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourceListResultTests.java new file mode 100644 index 0000000000000..8f17516da5744 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourceListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.PrivateLinkResourceListResult; + +public final class PrivateLinkResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateLinkResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"groupId\":\"uaceopzfqrhhu\",\"requiredMembers\":[\"ppcqeqxolz\",\"ahzxctobgbk\",\"moizpos\"]},\"id\":\"mgrcfbu\",\"name\":\"rmfqjhhkxbpvj\",\"type\":\"mjh\"},{\"properties\":{\"groupId\":\"yngudivk\",\"requiredMembers\":[\"wbxqzvszjfau\",\"j\"]},\"id\":\"dxxiv\",\"name\":\"tvtc\",\"type\":\"aqtdoqmcbx\"},{\"properties\":{\"groupId\":\"xyslqbh\",\"requiredMembers\":[\"obl\",\"tkblmpewww\",\"bkrvrnsvshqj\"]},\"id\":\"hxcr\",\"name\":\"bfovasrruvwbhsq\",\"type\":\"sub\"}],\"nextLink\":\"jbi\"}") + .toObject(PrivateLinkResourceListResult.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateLinkResourceListResult model = new PrivateLinkResourceListResult(); + model = BinaryData.fromObject(model).toObject(PrivateLinkResourceListResult.class); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcePropertiesTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcePropertiesTests.java new file mode 100644 index 0000000000000..92f23abcd3fa4 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcePropertiesTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.PrivateLinkResourceProperties; + +public final class PrivateLinkResourcePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateLinkResourceProperties model = BinaryData + .fromString("{\"groupId\":\"ifthnz\",\"requiredMembers\":[\"sl\",\"nayqi\",\"ynduha\",\"hqlkthumaqo\"]}") + .toObject(PrivateLinkResourceProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateLinkResourceProperties model = new PrivateLinkResourceProperties(); + model = BinaryData.fromObject(model).toObject(PrivateLinkResourceProperties.class); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcesGetWithResponseMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcesGetWithResponseMockTests.java new file mode 100644 index 0000000000000..15c5915be3be6 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcesGetWithResponseMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.PrivateLinkResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class PrivateLinkResourcesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"groupId\":\"ziycslevufuztck\",\"requiredMembers\":[\"jtqedcgzulwmm\"]},\"id\":\"qzz\",\"name\":\"rjvpglydzgkrvqee\",\"type\":\"toepryu\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PrivateLinkResource response = manager.privateLinkResources() + .getWithResponse("bkkd", "flvestmjlxrrilo", "apeewchpxlkt", com.azure.core.util.Context.NONE) + .getValue(); + + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcesListByServerMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcesListByServerMockTests.java new file mode 100644 index 0000000000000..04b2e79c3f3f1 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkResourcesListByServerMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.PrivateLinkResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class PrivateLinkResourcesListByServerMockTests { + @Test + public void testListByServer() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"groupId\":\"jlyjtlvofq\",\"requiredMembers\":[\"fcibyfmowuxrkj\",\"vdwxfzwi\",\"vwzjbhyz\"]},\"id\":\"xjrk\",\"name\":\"mbtrnegvmnvu\",\"type\":\"eqvldspast\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.privateLinkResources().listByServer("pgogtqxepny", "b", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkServiceConnectionStatePropertyTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkServiceConnectionStatePropertyTests.java new file mode 100644 index 0000000000000..7c5ad95354187 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/PrivateLinkServiceConnectionStatePropertyTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.PrivateLinkServiceConnectionStateProperty; +import org.junit.jupiter.api.Assertions; + +public final class PrivateLinkServiceConnectionStatePropertyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + PrivateLinkServiceConnectionStateProperty model = BinaryData + .fromString("{\"status\":\"rnxipei\",\"description\":\"pjzu\",\"actionsRequired\":\"jxdultskzbbtdzu\"}") + .toObject(PrivateLinkServiceConnectionStateProperty.class); + Assertions.assertEquals("rnxipei", model.status()); + Assertions.assertEquals("pjzu", model.description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + PrivateLinkServiceConnectionStateProperty model + = new PrivateLinkServiceConnectionStateProperty().withStatus("rnxipei").withDescription("pjzu"); + model = BinaryData.fromObject(model).toObject(PrivateLinkServiceConnectionStateProperty.class); + Assertions.assertEquals("rnxipei", model.status()); + Assertions.assertEquals("pjzu", model.description()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/RecoverableServerPropertiesTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/RecoverableServerPropertiesTests.java new file mode 100644 index 0000000000000..016794471a712 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/RecoverableServerPropertiesTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.RecoverableServerProperties; + +public final class RecoverableServerPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoverableServerProperties model = BinaryData.fromString( + "{\"lastAvailableBackupDateTime\":\"xnehmpvec\",\"serviceLevelObjective\":\"odebfqkkrbmpu\",\"edition\":\"riwflzlfb\",\"vCore\":599393599,\"hardwareGeneration\":\"zycispn\",\"version\":\"ahmgkbrp\"}") + .toObject(RecoverableServerProperties.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoverableServerProperties model = new RecoverableServerProperties(); + model = BinaryData.fromObject(model).toObject(RecoverableServerProperties.class); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/RecoverableServerResourceInnerTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/RecoverableServerResourceInnerTests.java new file mode 100644 index 0000000000000..24de1c74bb633 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/RecoverableServerResourceInnerTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.RecoverableServerResourceInner; + +public final class RecoverableServerResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + RecoverableServerResourceInner model = BinaryData.fromString( + "{\"properties\":{\"lastAvailableBackupDateTime\":\"rjcxerfuwu\",\"serviceLevelObjective\":\"txfvjrbirph\",\"edition\":\"pcyvahfnljkyqx\",\"vCore\":1640197955,\"hardwareGeneration\":\"j\",\"version\":\"idokgjlj\"},\"id\":\"oxgvclt\",\"name\":\"gsncghkjeszz\",\"type\":\"bijhtxfvgxbf\"}") + .toObject(RecoverableServerResourceInner.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + RecoverableServerResourceInner model = new RecoverableServerResourceInner(); + model = BinaryData.fromObject(model).toObject(RecoverableServerResourceInner.class); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/RecoverableServersGetWithResponseMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/RecoverableServersGetWithResponseMockTests.java new file mode 100644 index 0000000000000..069841a026a5a --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/RecoverableServersGetWithResponseMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.RecoverableServerResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class RecoverableServersGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"lastAvailableBackupDateTime\":\"mrtwna\",\"serviceLevelObjective\":\"slbi\",\"edition\":\"ojgcyzt\",\"vCore\":589391699,\"hardwareGeneration\":\"nbaeqphchqn\",\"version\":\"rpxeh\"},\"id\":\"wrykqgai\",\"name\":\"mvikl\",\"type\":\"ydv\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + RecoverableServerResource response = manager.recoverableServers() + .getWithResponse("rcizjxvyd", "ceacvlhvygdy", com.azure.core.util.Context.NONE) + .getValue(); + + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ReplicasListByServerMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ReplicasListByServerMockTests.java new file mode 100644 index 0000000000000..bbac545c29ea8 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ReplicasListByServerMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.GeoRedundantBackup; +import com.azure.resourcemanager.postgresql.models.IdentityType; +import com.azure.resourcemanager.postgresql.models.InfrastructureEncryption; +import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresql.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresql.models.Server; +import com.azure.resourcemanager.postgresql.models.ServerState; +import com.azure.resourcemanager.postgresql.models.ServerVersion; +import com.azure.resourcemanager.postgresql.models.SkuTier; +import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresql.models.StorageAutogrow; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ReplicasListByServerMockTests { + @Test + public void testListByServer() throws Exception { + String responseStr + = "{\"value\":[{\"identity\":{\"principalId\":\"0806cba2-a56d-4b9e-a6bc-d86d24aa2d75\",\"type\":\"SystemAssigned\",\"tenantId\":\"c19f5f93-fe74-450d-8b87-985b09b2436c\"},\"sku\":{\"name\":\"jkniodko\",\"tier\":\"MemoryOptimized\",\"capacity\":719607713,\"size\":\"jhemms\",\"family\":\"dkcrodt\"},\"properties\":{\"administratorLogin\":\"fw\",\"version\":\"9.6\",\"sslEnforcement\":\"Enabled\",\"minimalTlsVersion\":\"TLS1_1\",\"byokEnforcement\":\"jvefkdlfoakggkfp\",\"infrastructureEncryption\":\"Enabled\",\"userVisibleState\":\"Ready\",\"fullyQualifiedDomainName\":\"ulpqblylsyxkqjn\",\"earliestRestoreDate\":\"2021-02-22T12:01:41Z\",\"storageProfile\":{\"backupRetentionDays\":1312829950,\"geoRedundantBackup\":\"Disabled\",\"storageMB\":574368120,\"storageAutogrow\":\"Enabled\"},\"replicationRole\":\"zuempsbzkf\",\"masterServerId\":\"eyvpnqicvinvkj\",\"replicaCapacity\":611015935,\"publicNetworkAccess\":\"Disabled\",\"privateEndpointConnections\":[{\"id\":\"kzclewyh\",\"properties\":{\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"ztzp\"},\"provisioningState\":\"Approving\"}},{\"id\":\"ckw\",\"properties\":{\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"hxx\"},\"provisioningState\":\"Dropping\"}},{\"id\":\"a\",\"properties\":{\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"ztppriolxorjalto\"},\"provisioningState\":\"Rejecting\"}},{\"id\":\"wsobqwcsdbn\",\"properties\":{\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"ucqdpfuvglsb\"},\"provisioningState\":\"Failed\"}}]},\"location\":\"anvx\",\"tags\":{\"r\":\"vudutncor\"},\"id\":\"xqtvcofu\",\"name\":\"f\",\"type\":\"vkg\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.replicas().listByServer("zwl", "nwxuqlcvydyp", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("anvx", response.iterator().next().location()); + Assertions.assertEquals("vudutncor", response.iterator().next().tags().get("r")); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED, response.iterator().next().identity().type()); + Assertions.assertEquals("jkniodko", response.iterator().next().sku().name()); + Assertions.assertEquals(SkuTier.MEMORY_OPTIMIZED, response.iterator().next().sku().tier()); + Assertions.assertEquals(719607713, response.iterator().next().sku().capacity()); + Assertions.assertEquals("jhemms", response.iterator().next().sku().size()); + Assertions.assertEquals("dkcrodt", response.iterator().next().sku().family()); + Assertions.assertEquals("fw", response.iterator().next().administratorLogin()); + Assertions.assertEquals(ServerVersion.NINE_SIX, response.iterator().next().version()); + Assertions.assertEquals(SslEnforcementEnum.ENABLED, response.iterator().next().sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLS1_1, response.iterator().next().minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.ENABLED, + response.iterator().next().infrastructureEncryption()); + Assertions.assertEquals(ServerState.READY, response.iterator().next().userVisibleState()); + Assertions.assertEquals("ulpqblylsyxkqjn", response.iterator().next().fullyQualifiedDomainName()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-22T12:01:41Z"), + response.iterator().next().earliestRestoreDate()); + Assertions.assertEquals(1312829950, response.iterator().next().storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.DISABLED, + response.iterator().next().storageProfile().geoRedundantBackup()); + Assertions.assertEquals(574368120, response.iterator().next().storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.ENABLED, response.iterator().next().storageProfile().storageAutogrow()); + Assertions.assertEquals("zuempsbzkf", response.iterator().next().replicationRole()); + Assertions.assertEquals("eyvpnqicvinvkj", response.iterator().next().masterServerId()); + Assertions.assertEquals(611015935, response.iterator().next().replicaCapacity()); + Assertions.assertEquals(PublicNetworkAccessEnum.DISABLED, response.iterator().next().publicNetworkAccess()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ResourceIdentityTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ResourceIdentityTests.java new file mode 100644 index 0000000000000..1c99b37e1355e --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ResourceIdentityTests.java @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.IdentityType; +import com.azure.resourcemanager.postgresql.models.ResourceIdentity; +import org.junit.jupiter.api.Assertions; + +public final class ResourceIdentityTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ResourceIdentity model = BinaryData.fromString( + "{\"principalId\":\"2d38ac68-33de-4903-bcaf-9dd5f6cd01af\",\"type\":\"SystemAssigned\",\"tenantId\":\"cb9088a1-a0bb-48ce-a5ad-8a59445e9652\"}") + .toObject(ResourceIdentity.class); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED, model.type()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ResourceIdentity model = new ResourceIdentity().withType(IdentityType.SYSTEM_ASSIGNED); + model = BinaryData.fromObject(model).toObject(ResourceIdentity.class); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED, model.type()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorPropertiesTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorPropertiesTests.java new file mode 100644 index 0000000000000..dd0a3380f5e66 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorPropertiesTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.ServerAdministratorProperties; +import com.azure.resourcemanager.postgresql.models.AdministratorType; +import java.util.UUID; +import org.junit.jupiter.api.Assertions; + +public final class ServerAdministratorPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServerAdministratorProperties model = BinaryData.fromString( + "{\"administratorType\":\"ActiveDirectory\",\"login\":\"tmryw\",\"sid\":\"458b1f67-73bc-4c29-8b52-1fe424e3b5e3\",\"tenantId\":\"3e76ebba-8b1b-40af-bd2f-64e9a788e1ae\"}") + .toObject(ServerAdministratorProperties.class); + Assertions.assertEquals(AdministratorType.ACTIVE_DIRECTORY, model.administratorType()); + Assertions.assertEquals("tmryw", model.login()); + Assertions.assertEquals(UUID.fromString("458b1f67-73bc-4c29-8b52-1fe424e3b5e3"), model.sid()); + Assertions.assertEquals(UUID.fromString("3e76ebba-8b1b-40af-bd2f-64e9a788e1ae"), model.tenantId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServerAdministratorProperties model + = new ServerAdministratorProperties().withAdministratorType(AdministratorType.ACTIVE_DIRECTORY) + .withLogin("tmryw") + .withSid(UUID.fromString("458b1f67-73bc-4c29-8b52-1fe424e3b5e3")) + .withTenantId(UUID.fromString("3e76ebba-8b1b-40af-bd2f-64e9a788e1ae")); + model = BinaryData.fromObject(model).toObject(ServerAdministratorProperties.class); + Assertions.assertEquals(AdministratorType.ACTIVE_DIRECTORY, model.administratorType()); + Assertions.assertEquals("tmryw", model.login()); + Assertions.assertEquals(UUID.fromString("458b1f67-73bc-4c29-8b52-1fe424e3b5e3"), model.sid()); + Assertions.assertEquals(UUID.fromString("3e76ebba-8b1b-40af-bd2f-64e9a788e1ae"), model.tenantId()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorResourceInnerTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorResourceInnerTests.java new file mode 100644 index 0000000000000..8bd252ada53aa --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorResourceInnerTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.ServerAdministratorResourceInner; +import com.azure.resourcemanager.postgresql.models.AdministratorType; +import java.util.UUID; +import org.junit.jupiter.api.Assertions; + +public final class ServerAdministratorResourceInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServerAdministratorResourceInner model = BinaryData.fromString( + "{\"properties\":{\"administratorType\":\"ActiveDirectory\",\"login\":\"uxwgipwho\",\"sid\":\"01b73bc8-edf4-4df7-8ece-1f6de992ab7e\",\"tenantId\":\"92adec1c-6fc1-4fac-b8fc-2da50f52cc21\"},\"id\":\"ow\",\"name\":\"gshwankixz\",\"type\":\"injep\"}") + .toObject(ServerAdministratorResourceInner.class); + Assertions.assertEquals(AdministratorType.ACTIVE_DIRECTORY, model.administratorType()); + Assertions.assertEquals("uxwgipwho", model.login()); + Assertions.assertEquals(UUID.fromString("01b73bc8-edf4-4df7-8ece-1f6de992ab7e"), model.sid()); + Assertions.assertEquals(UUID.fromString("92adec1c-6fc1-4fac-b8fc-2da50f52cc21"), model.tenantId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServerAdministratorResourceInner model + = new ServerAdministratorResourceInner().withAdministratorType(AdministratorType.ACTIVE_DIRECTORY) + .withLogin("uxwgipwho") + .withSid(UUID.fromString("01b73bc8-edf4-4df7-8ece-1f6de992ab7e")) + .withTenantId(UUID.fromString("92adec1c-6fc1-4fac-b8fc-2da50f52cc21")); + model = BinaryData.fromObject(model).toObject(ServerAdministratorResourceInner.class); + Assertions.assertEquals(AdministratorType.ACTIVE_DIRECTORY, model.administratorType()); + Assertions.assertEquals("uxwgipwho", model.login()); + Assertions.assertEquals(UUID.fromString("01b73bc8-edf4-4df7-8ece-1f6de992ab7e"), model.sid()); + Assertions.assertEquals(UUID.fromString("92adec1c-6fc1-4fac-b8fc-2da50f52cc21"), model.tenantId()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorResourceListResultTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorResourceListResultTests.java new file mode 100644 index 0000000000000..14f361641a1be --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorResourceListResultTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.ServerAdministratorResourceInner; +import com.azure.resourcemanager.postgresql.models.AdministratorType; +import com.azure.resourcemanager.postgresql.models.ServerAdministratorResourceListResult; +import java.util.Arrays; +import java.util.UUID; +import org.junit.jupiter.api.Assertions; + +public final class ServerAdministratorResourceListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServerAdministratorResourceListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"administratorType\":\"ActiveDirectory\",\"login\":\"ftiyqzrnkcq\",\"sid\":\"e96ce7b9-bf24-4867-98a9-4bbd562bec43\",\"tenantId\":\"f4bee850-59f9-46e1-93da-976481147516\"},\"id\":\"yx\",\"name\":\"whzlsicohoq\",\"type\":\"nwvlryavwhheunmm\"},{\"properties\":{\"administratorType\":\"ActiveDirectory\",\"login\":\"yxzk\",\"sid\":\"7d031011-125e-4765-be90-fcfda8275f5e\",\"tenantId\":\"19c7c7c4-3d66-4eb1-9c8f-253fd0df4f44\"},\"id\":\"noc\",\"name\":\"koklya\",\"type\":\"uconuqszfkbey\"},{\"properties\":{\"administratorType\":\"ActiveDirectory\",\"login\":\"rmjmwvvjektc\",\"sid\":\"303b876b-a715-40cf-a082-2d6147a3394b\",\"tenantId\":\"a9acd422-f2cf-4a02-b85c-b68cd80b9e8f\"},\"id\":\"senhwlrs\",\"name\":\"frzpwvlqdqgb\",\"type\":\"qylihkaetckt\"},{\"properties\":{\"administratorType\":\"ActiveDirectory\",\"login\":\"ivfsnk\",\"sid\":\"5d2834fb-44f5-4bf1-b9c8-7a5b88a03352\",\"tenantId\":\"1fed4759-8e87-4678-a6fd-dd8410ffb214\"},\"id\":\"m\",\"name\":\"ctq\",\"type\":\"jf\"}]}") + .toObject(ServerAdministratorResourceListResult.class); + Assertions.assertEquals(AdministratorType.ACTIVE_DIRECTORY, model.value().get(0).administratorType()); + Assertions.assertEquals("ftiyqzrnkcq", model.value().get(0).login()); + Assertions.assertEquals(UUID.fromString("e96ce7b9-bf24-4867-98a9-4bbd562bec43"), model.value().get(0).sid()); + Assertions.assertEquals(UUID.fromString("f4bee850-59f9-46e1-93da-976481147516"), + model.value().get(0).tenantId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServerAdministratorResourceListResult model + = new ServerAdministratorResourceListResult().withValue(Arrays.asList( + new ServerAdministratorResourceInner().withAdministratorType(AdministratorType.ACTIVE_DIRECTORY) + .withLogin("ftiyqzrnkcq") + .withSid(UUID.fromString("e96ce7b9-bf24-4867-98a9-4bbd562bec43")) + .withTenantId(UUID.fromString("f4bee850-59f9-46e1-93da-976481147516")), + new ServerAdministratorResourceInner().withAdministratorType(AdministratorType.ACTIVE_DIRECTORY) + .withLogin("yxzk") + .withSid(UUID.fromString("7d031011-125e-4765-be90-fcfda8275f5e")) + .withTenantId(UUID.fromString("19c7c7c4-3d66-4eb1-9c8f-253fd0df4f44")), + new ServerAdministratorResourceInner().withAdministratorType(AdministratorType.ACTIVE_DIRECTORY) + .withLogin("rmjmwvvjektc") + .withSid(UUID.fromString("303b876b-a715-40cf-a082-2d6147a3394b")) + .withTenantId(UUID.fromString("a9acd422-f2cf-4a02-b85c-b68cd80b9e8f")), + new ServerAdministratorResourceInner().withAdministratorType(AdministratorType.ACTIVE_DIRECTORY) + .withLogin("ivfsnk") + .withSid(UUID.fromString("5d2834fb-44f5-4bf1-b9c8-7a5b88a03352")) + .withTenantId(UUID.fromString("1fed4759-8e87-4678-a6fd-dd8410ffb214")))); + model = BinaryData.fromObject(model).toObject(ServerAdministratorResourceListResult.class); + Assertions.assertEquals(AdministratorType.ACTIVE_DIRECTORY, model.value().get(0).administratorType()); + Assertions.assertEquals("ftiyqzrnkcq", model.value().get(0).login()); + Assertions.assertEquals(UUID.fromString("e96ce7b9-bf24-4867-98a9-4bbd562bec43"), model.value().get(0).sid()); + Assertions.assertEquals(UUID.fromString("f4bee850-59f9-46e1-93da-976481147516"), + model.value().get(0).tenantId()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsCreateOrUpdateMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsCreateOrUpdateMockTests.java new file mode 100644 index 0000000000000..7927003956ae7 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsCreateOrUpdateMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.fluent.models.ServerAdministratorResourceInner; +import com.azure.resourcemanager.postgresql.models.AdministratorType; +import com.azure.resourcemanager.postgresql.models.ServerAdministratorResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.UUID; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ServerAdministratorsCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"administratorType\":\"ActiveDirectory\",\"login\":\"zuhx\",\"sid\":\"17a8c830-8809-40df-9a6d-8bc604f578d6\",\"tenantId\":\"9d9bd4c3-f88e-47f3-bc9c-704e642cce39\"},\"id\":\"cpqjlihhyu\",\"name\":\"pskasdvlmfwdg\",\"type\":\"x\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ServerAdministratorResource response = manager.serverAdministrators() + .createOrUpdate("zzxscyhwzdgiruj", "zbomvzzbtdcqvpni", + new ServerAdministratorResourceInner().withAdministratorType(AdministratorType.ACTIVE_DIRECTORY) + .withLogin("viylwdshfssnrbgy") + .withSid(UUID.fromString("154b97cb-aecc-40dc-a754-feadde14d243")) + .withTenantId(UUID.fromString("fbcc8a59-b5cb-4220-84c0-5a8c59bdad4b")), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals(AdministratorType.ACTIVE_DIRECTORY, response.administratorType()); + Assertions.assertEquals("zuhx", response.login()); + Assertions.assertEquals(UUID.fromString("17a8c830-8809-40df-9a6d-8bc604f578d6"), response.sid()); + Assertions.assertEquals(UUID.fromString("9d9bd4c3-f88e-47f3-bc9c-704e642cce39"), response.tenantId()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsDeleteMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsDeleteMockTests.java new file mode 100644 index 0000000000000..2f23a2abcb683 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsDeleteMockTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ServerAdministratorsDeleteMockTests { + @Test + public void testDelete() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.serverAdministrators().delete("lucvpam", "sreuzvxurisjnh", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsGetWithResponseMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsGetWithResponseMockTests.java new file mode 100644 index 0000000000000..7df09f7d95de4 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsGetWithResponseMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.AdministratorType; +import com.azure.resourcemanager.postgresql.models.ServerAdministratorResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.UUID; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ServerAdministratorsGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"administratorType\":\"ActiveDirectory\",\"login\":\"ghhavgrvkffo\",\"sid\":\"4cdb1b73-1f25-4b9a-834d-c2148adb25be\",\"tenantId\":\"beb0c40a-ac9d-4265-9446-f6a2bdf94684\"},\"id\":\"jzhpjbibgjmfx\",\"name\":\"mv\",\"type\":\"cluyovwxnbkf\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ServerAdministratorResource response = manager.serverAdministrators() + .getWithResponse("rydxtqm", "eoxorggufhyao", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals(AdministratorType.ACTIVE_DIRECTORY, response.administratorType()); + Assertions.assertEquals("ghhavgrvkffo", response.login()); + Assertions.assertEquals(UUID.fromString("4cdb1b73-1f25-4b9a-834d-c2148adb25be"), response.sid()); + Assertions.assertEquals(UUID.fromString("beb0c40a-ac9d-4265-9446-f6a2bdf94684"), response.tenantId()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsListMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsListMockTests.java new file mode 100644 index 0000000000000..0a21bfeeb056e --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerAdministratorsListMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.AdministratorType; +import com.azure.resourcemanager.postgresql.models.ServerAdministratorResource; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.UUID; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ServerAdministratorsListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"administratorType\":\"ActiveDirectory\",\"login\":\"uutpwoqhih\",\"sid\":\"ffdba228-0212-46f0-83a7-6fd8698f3ce1\",\"tenantId\":\"ae867c79-8fb2-4182-afe0-ddc818c432c0\"},\"id\":\"jqgwzp\",\"name\":\"fqntcyp\",\"type\":\"xjvfoimwksl\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.serverAdministrators().list("ytxifqjzgxmrh", "blwpcesutrgj", com.azure.core.util.Context.NONE); + + Assertions.assertEquals(AdministratorType.ACTIVE_DIRECTORY, response.iterator().next().administratorType()); + Assertions.assertEquals("uutpwoqhih", response.iterator().next().login()); + Assertions.assertEquals(UUID.fromString("ffdba228-0212-46f0-83a7-6fd8698f3ce1"), + response.iterator().next().sid()); + Assertions.assertEquals(UUID.fromString("ae867c79-8fb2-4182-afe0-ddc818c432c0"), + response.iterator().next().tenantId()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerBasedPerformanceTiersListMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerBasedPerformanceTiersListMockTests.java new file mode 100644 index 0000000000000..59e3d1aebf779 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerBasedPerformanceTiersListMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.PerformanceTierProperties; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ServerBasedPerformanceTiersListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"id\":\"qfzgemjdftul\",\"maxBackupRetentionDays\":2130158442,\"minBackupRetentionDays\":997568890,\"maxStorageMB\":1745294880,\"minLargeStorageMB\":10785400,\"maxLargeStorageMB\":1206189386,\"minStorageMB\":574364549,\"serviceLevelObjectives\":[{\"id\":\"ejwcwwqiok\",\"edition\":\"sx\",\"vCore\":2133935833,\"hardwareGeneration\":\"sv\",\"maxBackupRetentionDays\":750225964,\"minBackupRetentionDays\":1136457795,\"maxStorageMB\":967300246,\"minStorageMB\":955806064}]}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.serverBasedPerformanceTiers() + .list("hbejdznxcvdsrhnj", "volvtn", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("qfzgemjdftul", response.iterator().next().id()); + Assertions.assertEquals(2130158442, response.iterator().next().maxBackupRetentionDays()); + Assertions.assertEquals(997568890, response.iterator().next().minBackupRetentionDays()); + Assertions.assertEquals(1745294880, response.iterator().next().maxStorageMB()); + Assertions.assertEquals(10785400, response.iterator().next().minLargeStorageMB()); + Assertions.assertEquals(1206189386, response.iterator().next().maxLargeStorageMB()); + Assertions.assertEquals(574364549, response.iterator().next().minStorageMB()); + Assertions.assertEquals("ejwcwwqiok", response.iterator().next().serviceLevelObjectives().get(0).id()); + Assertions.assertEquals("sx", response.iterator().next().serviceLevelObjectives().get(0).edition()); + Assertions.assertEquals(2133935833, response.iterator().next().serviceLevelObjectives().get(0).vCore()); + Assertions.assertEquals("sv", response.iterator().next().serviceLevelObjectives().get(0).hardwareGeneration()); + Assertions.assertEquals(750225964, + response.iterator().next().serviceLevelObjectives().get(0).maxBackupRetentionDays()); + Assertions.assertEquals(1136457795, + response.iterator().next().serviceLevelObjectives().get(0).minBackupRetentionDays()); + Assertions.assertEquals(967300246, response.iterator().next().serviceLevelObjectives().get(0).maxStorageMB()); + Assertions.assertEquals(955806064, response.iterator().next().serviceLevelObjectives().get(0).minStorageMB()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerForCreateTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerForCreateTests.java new file mode 100644 index 0000000000000..b610fbca8652e --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerForCreateTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.GeoRedundantBackup; +import com.azure.resourcemanager.postgresql.models.IdentityType; +import com.azure.resourcemanager.postgresql.models.InfrastructureEncryption; +import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresql.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresql.models.ResourceIdentity; +import com.azure.resourcemanager.postgresql.models.ServerForCreate; +import com.azure.resourcemanager.postgresql.models.ServerPropertiesForCreate; +import com.azure.resourcemanager.postgresql.models.ServerVersion; +import com.azure.resourcemanager.postgresql.models.Sku; +import com.azure.resourcemanager.postgresql.models.SkuTier; +import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresql.models.StorageAutogrow; +import com.azure.resourcemanager.postgresql.models.StorageProfile; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ServerForCreateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServerForCreate model = BinaryData.fromString( + "{\"identity\":{\"principalId\":\"42ca3871-bf2a-485e-94a6-4e198a8cdabb\",\"type\":\"SystemAssigned\",\"tenantId\":\"f7b1951b-c394-441f-bee2-03f38009ad0a\"},\"sku\":{\"name\":\"gjxpybczmehmt\",\"tier\":\"Basic\",\"capacity\":329045942,\"size\":\"h\",\"family\":\"pidgsybbejhphoyc\"},\"properties\":{\"createMode\":\"ServerPropertiesForCreate\",\"version\":\"10\",\"sslEnforcement\":\"Disabled\",\"minimalTlsVersion\":\"TLS1_2\",\"infrastructureEncryption\":\"Disabled\",\"publicNetworkAccess\":\"Enabled\",\"storageProfile\":{\"backupRetentionDays\":589802492,\"geoRedundantBackup\":\"Enabled\",\"storageMB\":1819090851,\"storageAutogrow\":\"Enabled\"}},\"location\":\"tbmufpo\",\"tags\":{\"qsoqijgkd\":\"izhwlrxy\"}}") + .toObject(ServerForCreate.class); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED, model.identity().type()); + Assertions.assertEquals("gjxpybczmehmt", model.sku().name()); + Assertions.assertEquals(SkuTier.BASIC, model.sku().tier()); + Assertions.assertEquals(329045942, model.sku().capacity()); + Assertions.assertEquals("h", model.sku().size()); + Assertions.assertEquals("pidgsybbejhphoyc", model.sku().family()); + Assertions.assertEquals(ServerVersion.ONE_ZERO, model.properties().version()); + Assertions.assertEquals(SslEnforcementEnum.DISABLED, model.properties().sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLS1_2, model.properties().minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.DISABLED, model.properties().infrastructureEncryption()); + Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, model.properties().publicNetworkAccess()); + Assertions.assertEquals(589802492, model.properties().storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.ENABLED, model.properties().storageProfile().geoRedundantBackup()); + Assertions.assertEquals(1819090851, model.properties().storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.ENABLED, model.properties().storageProfile().storageAutogrow()); + Assertions.assertEquals("tbmufpo", model.location()); + Assertions.assertEquals("izhwlrxy", model.tags().get("qsoqijgkd")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServerForCreate model + = new ServerForCreate().withIdentity(new ResourceIdentity().withType(IdentityType.SYSTEM_ASSIGNED)) + .withSku(new Sku().withName("gjxpybczmehmt") + .withTier(SkuTier.BASIC) + .withCapacity(329045942) + .withSize("h") + .withFamily("pidgsybbejhphoyc")) + .withProperties(new ServerPropertiesForCreate().withVersion(ServerVersion.ONE_ZERO) + .withSslEnforcement(SslEnforcementEnum.DISABLED) + .withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_2) + .withInfrastructureEncryption(InfrastructureEncryption.DISABLED) + .withPublicNetworkAccess(PublicNetworkAccessEnum.ENABLED) + .withStorageProfile(new StorageProfile().withBackupRetentionDays(589802492) + .withGeoRedundantBackup(GeoRedundantBackup.ENABLED) + .withStorageMB(1819090851) + .withStorageAutogrow(StorageAutogrow.ENABLED))) + .withLocation("tbmufpo") + .withTags(mapOf("qsoqijgkd", "izhwlrxy")); + model = BinaryData.fromObject(model).toObject(ServerForCreate.class); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED, model.identity().type()); + Assertions.assertEquals("gjxpybczmehmt", model.sku().name()); + Assertions.assertEquals(SkuTier.BASIC, model.sku().tier()); + Assertions.assertEquals(329045942, model.sku().capacity()); + Assertions.assertEquals("h", model.sku().size()); + Assertions.assertEquals("pidgsybbejhphoyc", model.sku().family()); + Assertions.assertEquals(ServerVersion.ONE_ZERO, model.properties().version()); + Assertions.assertEquals(SslEnforcementEnum.DISABLED, model.properties().sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLS1_2, model.properties().minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.DISABLED, model.properties().infrastructureEncryption()); + Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, model.properties().publicNetworkAccess()); + Assertions.assertEquals(589802492, model.properties().storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.ENABLED, model.properties().storageProfile().geoRedundantBackup()); + Assertions.assertEquals(1819090851, model.properties().storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.ENABLED, model.properties().storageProfile().storageAutogrow()); + Assertions.assertEquals("tbmufpo", model.location()); + Assertions.assertEquals("izhwlrxy", model.tags().get("qsoqijgkd")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerInnerTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerInnerTests.java new file mode 100644 index 0000000000000..9005b4d76dfaa --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerInnerTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.ServerInner; +import com.azure.resourcemanager.postgresql.models.GeoRedundantBackup; +import com.azure.resourcemanager.postgresql.models.IdentityType; +import com.azure.resourcemanager.postgresql.models.InfrastructureEncryption; +import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresql.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresql.models.ResourceIdentity; +import com.azure.resourcemanager.postgresql.models.ServerState; +import com.azure.resourcemanager.postgresql.models.ServerVersion; +import com.azure.resourcemanager.postgresql.models.Sku; +import com.azure.resourcemanager.postgresql.models.SkuTier; +import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresql.models.StorageAutogrow; +import com.azure.resourcemanager.postgresql.models.StorageProfile; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ServerInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServerInner model = BinaryData.fromString( + "{\"identity\":{\"principalId\":\"f94e2927-1a62-41b5-ac7d-464d3795627a\",\"type\":\"SystemAssigned\",\"tenantId\":\"7514310f-4b68-4cc2-98e7-b32dce102c43\"},\"sku\":{\"name\":\"ucmpoyfd\",\"tier\":\"Basic\",\"capacity\":934276292,\"size\":\"ygjofjdd\",\"family\":\"s\"},\"properties\":{\"administratorLogin\":\"upewnwreitjzy\",\"version\":\"11\",\"sslEnforcement\":\"Disabled\",\"minimalTlsVersion\":\"TLS1_1\",\"byokEnforcement\":\"ofcqhsm\",\"infrastructureEncryption\":\"Enabled\",\"userVisibleState\":\"Inaccessible\",\"fullyQualifiedDomainName\":\"mlxhekuksjtxukcd\",\"earliestRestoreDate\":\"2021-04-18T20:51:35Z\",\"storageProfile\":{\"backupRetentionDays\":1726077008,\"geoRedundantBackup\":\"Disabled\",\"storageMB\":1654422017,\"storageAutogrow\":\"Enabled\"},\"replicationRole\":\"xzdxtayrlhmwh\",\"masterServerId\":\"mrqobmtukknr\",\"replicaCapacity\":1077251222,\"publicNetworkAccess\":\"Enabled\",\"privateEndpointConnections\":[{\"id\":\"ijbpzvgnwzsymgl\",\"properties\":{\"privateEndpoint\":{\"id\":\"yzkohdbihanuf\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"bj\",\"actionsRequired\":\"None\"},\"provisioningState\":\"Failed\"}}]},\"location\":\"th\",\"tags\":{\"npqxuh\":\"abifpikxwczbys\"},\"id\":\"vyq\",\"name\":\"iwbybrkxvdumjg\",\"type\":\"tfwvukxgaudc\"}") + .toObject(ServerInner.class); + Assertions.assertEquals("th", model.location()); + Assertions.assertEquals("abifpikxwczbys", model.tags().get("npqxuh")); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED, model.identity().type()); + Assertions.assertEquals("ucmpoyfd", model.sku().name()); + Assertions.assertEquals(SkuTier.BASIC, model.sku().tier()); + Assertions.assertEquals(934276292, model.sku().capacity()); + Assertions.assertEquals("ygjofjdd", model.sku().size()); + Assertions.assertEquals("s", model.sku().family()); + Assertions.assertEquals("upewnwreitjzy", model.administratorLogin()); + Assertions.assertEquals(ServerVersion.ONE_ONE, model.version()); + Assertions.assertEquals(SslEnforcementEnum.DISABLED, model.sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLS1_1, model.minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.ENABLED, model.infrastructureEncryption()); + Assertions.assertEquals(ServerState.INACCESSIBLE, model.userVisibleState()); + Assertions.assertEquals("mlxhekuksjtxukcd", model.fullyQualifiedDomainName()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-18T20:51:35Z"), model.earliestRestoreDate()); + Assertions.assertEquals(1726077008, model.storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.DISABLED, model.storageProfile().geoRedundantBackup()); + Assertions.assertEquals(1654422017, model.storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.ENABLED, model.storageProfile().storageAutogrow()); + Assertions.assertEquals("xzdxtayrlhmwh", model.replicationRole()); + Assertions.assertEquals("mrqobmtukknr", model.masterServerId()); + Assertions.assertEquals(1077251222, model.replicaCapacity()); + Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, model.publicNetworkAccess()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServerInner model = new ServerInner().withLocation("th") + .withTags(mapOf("npqxuh", "abifpikxwczbys")) + .withIdentity(new ResourceIdentity().withType(IdentityType.SYSTEM_ASSIGNED)) + .withSku(new Sku().withName("ucmpoyfd") + .withTier(SkuTier.BASIC) + .withCapacity(934276292) + .withSize("ygjofjdd") + .withFamily("s")) + .withAdministratorLogin("upewnwreitjzy") + .withVersion(ServerVersion.ONE_ONE) + .withSslEnforcement(SslEnforcementEnum.DISABLED) + .withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_1) + .withInfrastructureEncryption(InfrastructureEncryption.ENABLED) + .withUserVisibleState(ServerState.INACCESSIBLE) + .withFullyQualifiedDomainName("mlxhekuksjtxukcd") + .withEarliestRestoreDate(OffsetDateTime.parse("2021-04-18T20:51:35Z")) + .withStorageProfile(new StorageProfile().withBackupRetentionDays(1726077008) + .withGeoRedundantBackup(GeoRedundantBackup.DISABLED) + .withStorageMB(1654422017) + .withStorageAutogrow(StorageAutogrow.ENABLED)) + .withReplicationRole("xzdxtayrlhmwh") + .withMasterServerId("mrqobmtukknr") + .withReplicaCapacity(1077251222) + .withPublicNetworkAccess(PublicNetworkAccessEnum.ENABLED); + model = BinaryData.fromObject(model).toObject(ServerInner.class); + Assertions.assertEquals("th", model.location()); + Assertions.assertEquals("abifpikxwczbys", model.tags().get("npqxuh")); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED, model.identity().type()); + Assertions.assertEquals("ucmpoyfd", model.sku().name()); + Assertions.assertEquals(SkuTier.BASIC, model.sku().tier()); + Assertions.assertEquals(934276292, model.sku().capacity()); + Assertions.assertEquals("ygjofjdd", model.sku().size()); + Assertions.assertEquals("s", model.sku().family()); + Assertions.assertEquals("upewnwreitjzy", model.administratorLogin()); + Assertions.assertEquals(ServerVersion.ONE_ONE, model.version()); + Assertions.assertEquals(SslEnforcementEnum.DISABLED, model.sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLS1_1, model.minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.ENABLED, model.infrastructureEncryption()); + Assertions.assertEquals(ServerState.INACCESSIBLE, model.userVisibleState()); + Assertions.assertEquals("mlxhekuksjtxukcd", model.fullyQualifiedDomainName()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-18T20:51:35Z"), model.earliestRestoreDate()); + Assertions.assertEquals(1726077008, model.storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.DISABLED, model.storageProfile().geoRedundantBackup()); + Assertions.assertEquals(1654422017, model.storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.ENABLED, model.storageProfile().storageAutogrow()); + Assertions.assertEquals("xzdxtayrlhmwh", model.replicationRole()); + Assertions.assertEquals("mrqobmtukknr", model.masterServerId()); + Assertions.assertEquals(1077251222, model.replicaCapacity()); + Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, model.publicNetworkAccess()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerKeysDeleteMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerKeysDeleteMockTests.java new file mode 100644 index 0000000000000..a24e2009a2014 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerKeysDeleteMockTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ServerKeysDeleteMockTests { + @Test + public void testDelete() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.serverKeys().delete("clnpkci", "yzriykhy", "wf", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerListResultTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerListResultTests.java new file mode 100644 index 0000000000000..160d92ff7f625 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerListResultTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.ServerInner; +import com.azure.resourcemanager.postgresql.models.GeoRedundantBackup; +import com.azure.resourcemanager.postgresql.models.IdentityType; +import com.azure.resourcemanager.postgresql.models.InfrastructureEncryption; +import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresql.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresql.models.ResourceIdentity; +import com.azure.resourcemanager.postgresql.models.ServerListResult; +import com.azure.resourcemanager.postgresql.models.ServerState; +import com.azure.resourcemanager.postgresql.models.ServerVersion; +import com.azure.resourcemanager.postgresql.models.Sku; +import com.azure.resourcemanager.postgresql.models.SkuTier; +import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresql.models.StorageAutogrow; +import com.azure.resourcemanager.postgresql.models.StorageProfile; +import java.time.OffsetDateTime; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class ServerListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServerListResult model = BinaryData.fromString( + "{\"value\":[{\"identity\":{\"principalId\":\"2577697c-0eb6-45c6-b334-4ea45540c364\",\"type\":\"SystemAssigned\",\"tenantId\":\"34efcf9a-fa85-463d-8712-4c3cf76a462f\"},\"sku\":{\"name\":\"aeqjhqjbasvms\",\"tier\":\"Basic\",\"capacity\":2084272233,\"size\":\"gsntnbybkzgcwr\",\"family\":\"lxxwrljdouskc\"},\"properties\":{\"administratorLogin\":\"ocrcjdk\",\"version\":\"11\",\"sslEnforcement\":\"Disabled\",\"minimalTlsVersion\":\"TLSEnforcementDisabled\",\"byokEnforcement\":\"biksq\",\"infrastructureEncryption\":\"Enabled\",\"userVisibleState\":\"Disabled\",\"fullyQualifiedDomainName\":\"inqpjwnzll\",\"earliestRestoreDate\":\"2020-12-23T02:21:43Z\",\"storageProfile\":{\"backupRetentionDays\":450622751,\"geoRedundantBackup\":\"Disabled\",\"storageMB\":1530688943,\"storageAutogrow\":\"Disabled\"},\"replicationRole\":\"abkyqduujitcjcz\",\"masterServerId\":\"evndh\",\"replicaCapacity\":968287955,\"publicNetworkAccess\":\"Enabled\",\"privateEndpointConnections\":[{\"id\":\"dsbdkvwrwjf\",\"properties\":{}},{\"id\":\"nhutjeltmrldhugj\",\"properties\":{}},{\"id\":\"atqxho\",\"properties\":{}}]},\"location\":\"geablgphuticndvk\",\"tags\":{\"k\":\"wyiftyhxhur\",\"kjfkg\":\"tyxolniwpwc\",\"plwckbas\":\"awxklr\"},\"id\":\"ypnddhsgcb\",\"name\":\"cph\",\"type\":\"jkot\"},{\"identity\":{\"principalId\":\"6b521fd4-9e7f-4773-a933-bfcb5bee870a\",\"type\":\"SystemAssigned\",\"tenantId\":\"6959f769-3d82-4f8d-8a75-b783d8234784\"},\"sku\":{\"name\":\"zndlikwy\",\"tier\":\"Basic\",\"capacity\":1308251370,\"size\":\"bmadgak\",\"family\":\"s\"},\"properties\":{\"administratorLogin\":\"bzqqedqytbciq\",\"version\":\"9.5\",\"sslEnforcement\":\"Disabled\",\"minimalTlsVersion\":\"TLS1_1\",\"byokEnforcement\":\"kzsmodm\",\"infrastructureEncryption\":\"Enabled\",\"userVisibleState\":\"Disabled\",\"fullyQualifiedDomainName\":\"b\",\"earliestRestoreDate\":\"2021-03-24T00:19:46Z\",\"storageProfile\":{\"backupRetentionDays\":2110455897,\"geoRedundantBackup\":\"Enabled\",\"storageMB\":1519721589,\"storageAutogrow\":\"Enabled\"},\"replicationRole\":\"spwgcuertumkdosv\",\"masterServerId\":\"hbmdgbbjfdd\",\"replicaCapacity\":1359237516,\"publicNetworkAccess\":\"Enabled\",\"privateEndpointConnections\":[{\"id\":\"pbhtqqrolfpfpsa\",\"properties\":{}},{\"id\":\"qux\",\"properties\":{}},{\"id\":\"yjgzjaoyfhrtxiln\",\"properties\":{}}]},\"location\":\"kujysvlejuvfq\",\"tags\":{\"jvtbvpyss\":\"lyxwjkcprbnwbx\",\"wzwbnguitn\":\"dnrujqguhmuouqfp\",\"x\":\"uizga\",\"hr\":\"fizuckyf\"},\"id\":\"idf\",\"name\":\"zwdzuh\",\"type\":\"ymwisdkft\"}]}") + .toObject(ServerListResult.class); + Assertions.assertEquals("geablgphuticndvk", model.value().get(0).location()); + Assertions.assertEquals("wyiftyhxhur", model.value().get(0).tags().get("k")); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED, model.value().get(0).identity().type()); + Assertions.assertEquals("aeqjhqjbasvms", model.value().get(0).sku().name()); + Assertions.assertEquals(SkuTier.BASIC, model.value().get(0).sku().tier()); + Assertions.assertEquals(2084272233, model.value().get(0).sku().capacity()); + Assertions.assertEquals("gsntnbybkzgcwr", model.value().get(0).sku().size()); + Assertions.assertEquals("lxxwrljdouskc", model.value().get(0).sku().family()); + Assertions.assertEquals("ocrcjdk", model.value().get(0).administratorLogin()); + Assertions.assertEquals(ServerVersion.ONE_ONE, model.value().get(0).version()); + Assertions.assertEquals(SslEnforcementEnum.DISABLED, model.value().get(0).sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLSENFORCEMENT_DISABLED, + model.value().get(0).minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.ENABLED, model.value().get(0).infrastructureEncryption()); + Assertions.assertEquals(ServerState.DISABLED, model.value().get(0).userVisibleState()); + Assertions.assertEquals("inqpjwnzll", model.value().get(0).fullyQualifiedDomainName()); + Assertions.assertEquals(OffsetDateTime.parse("2020-12-23T02:21:43Z"), + model.value().get(0).earliestRestoreDate()); + Assertions.assertEquals(450622751, model.value().get(0).storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.DISABLED, + model.value().get(0).storageProfile().geoRedundantBackup()); + Assertions.assertEquals(1530688943, model.value().get(0).storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.DISABLED, model.value().get(0).storageProfile().storageAutogrow()); + Assertions.assertEquals("abkyqduujitcjcz", model.value().get(0).replicationRole()); + Assertions.assertEquals("evndh", model.value().get(0).masterServerId()); + Assertions.assertEquals(968287955, model.value().get(0).replicaCapacity()); + Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, model.value().get(0).publicNetworkAccess()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServerListResult model = new ServerListResult().withValue(Arrays.asList( + new ServerInner().withLocation("geablgphuticndvk") + .withTags(mapOf("k", "wyiftyhxhur", "kjfkg", "tyxolniwpwc", "plwckbas", "awxklr")) + .withIdentity(new ResourceIdentity().withType(IdentityType.SYSTEM_ASSIGNED)) + .withSku(new Sku().withName("aeqjhqjbasvms") + .withTier(SkuTier.BASIC) + .withCapacity(2084272233) + .withSize("gsntnbybkzgcwr") + .withFamily("lxxwrljdouskc")) + .withAdministratorLogin("ocrcjdk") + .withVersion(ServerVersion.ONE_ONE) + .withSslEnforcement(SslEnforcementEnum.DISABLED) + .withMinimalTlsVersion(MinimalTlsVersionEnum.TLSENFORCEMENT_DISABLED) + .withInfrastructureEncryption(InfrastructureEncryption.ENABLED) + .withUserVisibleState(ServerState.DISABLED) + .withFullyQualifiedDomainName("inqpjwnzll") + .withEarliestRestoreDate(OffsetDateTime.parse("2020-12-23T02:21:43Z")) + .withStorageProfile(new StorageProfile().withBackupRetentionDays(450622751) + .withGeoRedundantBackup(GeoRedundantBackup.DISABLED) + .withStorageMB(1530688943) + .withStorageAutogrow(StorageAutogrow.DISABLED)) + .withReplicationRole("abkyqduujitcjcz") + .withMasterServerId("evndh") + .withReplicaCapacity(968287955) + .withPublicNetworkAccess(PublicNetworkAccessEnum.ENABLED), + new ServerInner().withLocation("kujysvlejuvfq") + .withTags(mapOf("jvtbvpyss", "lyxwjkcprbnwbx", "wzwbnguitn", "dnrujqguhmuouqfp", "x", "uizga", "hr", + "fizuckyf")) + .withIdentity(new ResourceIdentity().withType(IdentityType.SYSTEM_ASSIGNED)) + .withSku(new Sku().withName("zndlikwy") + .withTier(SkuTier.BASIC) + .withCapacity(1308251370) + .withSize("bmadgak") + .withFamily("s")) + .withAdministratorLogin("bzqqedqytbciq") + .withVersion(ServerVersion.NINE_FIVE) + .withSslEnforcement(SslEnforcementEnum.DISABLED) + .withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_1) + .withInfrastructureEncryption(InfrastructureEncryption.ENABLED) + .withUserVisibleState(ServerState.DISABLED) + .withFullyQualifiedDomainName("b") + .withEarliestRestoreDate(OffsetDateTime.parse("2021-03-24T00:19:46Z")) + .withStorageProfile(new StorageProfile().withBackupRetentionDays(2110455897) + .withGeoRedundantBackup(GeoRedundantBackup.ENABLED) + .withStorageMB(1519721589) + .withStorageAutogrow(StorageAutogrow.ENABLED)) + .withReplicationRole("spwgcuertumkdosv") + .withMasterServerId("hbmdgbbjfdd") + .withReplicaCapacity(1359237516) + .withPublicNetworkAccess(PublicNetworkAccessEnum.ENABLED))); + model = BinaryData.fromObject(model).toObject(ServerListResult.class); + Assertions.assertEquals("geablgphuticndvk", model.value().get(0).location()); + Assertions.assertEquals("wyiftyhxhur", model.value().get(0).tags().get("k")); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED, model.value().get(0).identity().type()); + Assertions.assertEquals("aeqjhqjbasvms", model.value().get(0).sku().name()); + Assertions.assertEquals(SkuTier.BASIC, model.value().get(0).sku().tier()); + Assertions.assertEquals(2084272233, model.value().get(0).sku().capacity()); + Assertions.assertEquals("gsntnbybkzgcwr", model.value().get(0).sku().size()); + Assertions.assertEquals("lxxwrljdouskc", model.value().get(0).sku().family()); + Assertions.assertEquals("ocrcjdk", model.value().get(0).administratorLogin()); + Assertions.assertEquals(ServerVersion.ONE_ONE, model.value().get(0).version()); + Assertions.assertEquals(SslEnforcementEnum.DISABLED, model.value().get(0).sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLSENFORCEMENT_DISABLED, + model.value().get(0).minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.ENABLED, model.value().get(0).infrastructureEncryption()); + Assertions.assertEquals(ServerState.DISABLED, model.value().get(0).userVisibleState()); + Assertions.assertEquals("inqpjwnzll", model.value().get(0).fullyQualifiedDomainName()); + Assertions.assertEquals(OffsetDateTime.parse("2020-12-23T02:21:43Z"), + model.value().get(0).earliestRestoreDate()); + Assertions.assertEquals(450622751, model.value().get(0).storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.DISABLED, + model.value().get(0).storageProfile().geoRedundantBackup()); + Assertions.assertEquals(1530688943, model.value().get(0).storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.DISABLED, model.value().get(0).storageProfile().storageAutogrow()); + Assertions.assertEquals("abkyqduujitcjcz", model.value().get(0).replicationRole()); + Assertions.assertEquals("evndh", model.value().get(0).masterServerId()); + Assertions.assertEquals(968287955, model.value().get(0).replicaCapacity()); + Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, model.value().get(0).publicNetworkAccess()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerParametersListUpdateConfigurationsMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerParametersListUpdateConfigurationsMockTests.java new file mode 100644 index 0000000000000..e18130ed9aa27 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerParametersListUpdateConfigurationsMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationListResultInner; +import com.azure.resourcemanager.postgresql.models.ConfigurationListResult; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.Arrays; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ServerParametersListUpdateConfigurationsMockTests { + @Test + public void testListUpdateConfigurations() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"value\":\"wiithtywub\",\"description\":\"bihwqknfdnt\",\"defaultValue\":\"chrdgoihxumwcto\",\"dataType\":\"zj\",\"allowedValues\":\"udfdlwgg\",\"source\":\"sb\"},\"id\":\"tov\",\"name\":\"tgseinqfiufxqkn\",\"type\":\"irgne\"},{\"properties\":{\"value\":\"wqmsniffcdmqn\",\"description\":\"jlpijnkrx\",\"defaultValue\":\"ddhcratizzr\",\"dataType\":\"asxifto\",\"allowedValues\":\"yzhftwesgogczh\",\"source\":\"nxkrlgnyhmossxkk\"},\"id\":\"thrrgh\",\"name\":\"jbdhqxvc\",\"type\":\"gf\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + ConfigurationListResult response = manager.serverParameters() + .listUpdateConfigurations("itvgbmhrixkwm", "ijejvegrhbpn", + new ConfigurationListResultInner() + .withValue(Arrays.asList(new ConfigurationInner().withValue("ccbdre").withSource("ppyostronzmyhgf"), + new ConfigurationInner().withValue("ikkx").withSource("ejjoqkagfhsxtta"), + new ConfigurationInner().withValue("ou").withSource("akpjpqqmtedlt"), + new ConfigurationInner().withValue("cwxqu").withSource("o"))), + com.azure.core.util.Context.NONE); + + Assertions.assertEquals("wiithtywub", response.value().get(0).value()); + Assertions.assertEquals("sb", response.value().get(0).source()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPrivateEndpointConnectionPropertiesTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPrivateEndpointConnectionPropertiesTests.java new file mode 100644 index 0000000000000..06755e89489b2 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPrivateEndpointConnectionPropertiesTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.PrivateEndpointProperty; +import com.azure.resourcemanager.postgresql.models.PrivateLinkServiceConnectionStateStatus; +import com.azure.resourcemanager.postgresql.models.ServerPrivateEndpointConnectionProperties; +import com.azure.resourcemanager.postgresql.models.ServerPrivateLinkServiceConnectionStateProperty; +import org.junit.jupiter.api.Assertions; + +public final class ServerPrivateEndpointConnectionPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServerPrivateEndpointConnectionProperties model = BinaryData.fromString( + "{\"privateEndpoint\":{\"id\":\"v\"},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"rwzoxxjtfelluwf\",\"actionsRequired\":\"None\"},\"provisioningState\":\"Rejecting\"}") + .toObject(ServerPrivateEndpointConnectionProperties.class); + Assertions.assertEquals("v", model.privateEndpoint().id()); + Assertions.assertEquals(PrivateLinkServiceConnectionStateStatus.PENDING, + model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("rwzoxxjtfelluwf", model.privateLinkServiceConnectionState().description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServerPrivateEndpointConnectionProperties model = new ServerPrivateEndpointConnectionProperties() + .withPrivateEndpoint(new PrivateEndpointProperty().withId("v")) + .withPrivateLinkServiceConnectionState(new ServerPrivateLinkServiceConnectionStateProperty() + .withStatus(PrivateLinkServiceConnectionStateStatus.PENDING) + .withDescription("rwzoxxjtfelluwf")); + model = BinaryData.fromObject(model).toObject(ServerPrivateEndpointConnectionProperties.class); + Assertions.assertEquals("v", model.privateEndpoint().id()); + Assertions.assertEquals(PrivateLinkServiceConnectionStateStatus.PENDING, + model.privateLinkServiceConnectionState().status()); + Assertions.assertEquals("rwzoxxjtfelluwf", model.privateLinkServiceConnectionState().description()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPrivateEndpointConnectionTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPrivateEndpointConnectionTests.java new file mode 100644 index 0000000000000..f87f3ab6feb92 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPrivateEndpointConnectionTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.ServerPrivateEndpointConnection; + +public final class ServerPrivateEndpointConnectionTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServerPrivateEndpointConnection model = BinaryData.fromString( + "{\"id\":\"msbzjhcrz\",\"properties\":{\"privateEndpoint\":{\"id\":\"hlxaolthqtr\"},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"bpf\",\"actionsRequired\":\"None\"},\"provisioningState\":\"Rejecting\"}}") + .toObject(ServerPrivateEndpointConnection.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServerPrivateEndpointConnection model = new ServerPrivateEndpointConnection(); + model = BinaryData.fromObject(model).toObject(ServerPrivateEndpointConnection.class); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPrivateLinkServiceConnectionStatePropertyTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPrivateLinkServiceConnectionStatePropertyTests.java new file mode 100644 index 0000000000000..8c74fb7569c58 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPrivateLinkServiceConnectionStatePropertyTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.PrivateLinkServiceConnectionStateStatus; +import com.azure.resourcemanager.postgresql.models.ServerPrivateLinkServiceConnectionStateProperty; +import org.junit.jupiter.api.Assertions; + +public final class ServerPrivateLinkServiceConnectionStatePropertyTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServerPrivateLinkServiceConnectionStateProperty model = BinaryData + .fromString( + "{\"status\":\"Disconnected\",\"description\":\"lxofpdvhpfxxypin\",\"actionsRequired\":\"None\"}") + .toObject(ServerPrivateLinkServiceConnectionStateProperty.class); + Assertions.assertEquals(PrivateLinkServiceConnectionStateStatus.DISCONNECTED, model.status()); + Assertions.assertEquals("lxofpdvhpfxxypin", model.description()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServerPrivateLinkServiceConnectionStateProperty model = new ServerPrivateLinkServiceConnectionStateProperty() + .withStatus(PrivateLinkServiceConnectionStateStatus.DISCONNECTED) + .withDescription("lxofpdvhpfxxypin"); + model = BinaryData.fromObject(model).toObject(ServerPrivateLinkServiceConnectionStateProperty.class); + Assertions.assertEquals(PrivateLinkServiceConnectionStateStatus.DISCONNECTED, model.status()); + Assertions.assertEquals("lxofpdvhpfxxypin", model.description()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesForCreateTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesForCreateTests.java new file mode 100644 index 0000000000000..3b62b78076296 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesForCreateTests.java @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.GeoRedundantBackup; +import com.azure.resourcemanager.postgresql.models.InfrastructureEncryption; +import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresql.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresql.models.ServerPropertiesForCreate; +import com.azure.resourcemanager.postgresql.models.ServerVersion; +import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresql.models.StorageAutogrow; +import com.azure.resourcemanager.postgresql.models.StorageProfile; +import org.junit.jupiter.api.Assertions; + +public final class ServerPropertiesForCreateTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServerPropertiesForCreate model = BinaryData.fromString( + "{\"createMode\":\"ServerPropertiesForCreate\",\"version\":\"11\",\"sslEnforcement\":\"Enabled\",\"minimalTlsVersion\":\"TLS1_2\",\"infrastructureEncryption\":\"Disabled\",\"publicNetworkAccess\":\"Enabled\",\"storageProfile\":{\"backupRetentionDays\":1495226068,\"geoRedundantBackup\":\"Disabled\",\"storageMB\":1521405587,\"storageAutogrow\":\"Disabled\"}}") + .toObject(ServerPropertiesForCreate.class); + Assertions.assertEquals(ServerVersion.ONE_ONE, model.version()); + Assertions.assertEquals(SslEnforcementEnum.ENABLED, model.sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLS1_2, model.minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.DISABLED, model.infrastructureEncryption()); + Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, model.publicNetworkAccess()); + Assertions.assertEquals(1495226068, model.storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.DISABLED, model.storageProfile().geoRedundantBackup()); + Assertions.assertEquals(1521405587, model.storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.DISABLED, model.storageProfile().storageAutogrow()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServerPropertiesForCreate model = new ServerPropertiesForCreate().withVersion(ServerVersion.ONE_ONE) + .withSslEnforcement(SslEnforcementEnum.ENABLED) + .withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_2) + .withInfrastructureEncryption(InfrastructureEncryption.DISABLED) + .withPublicNetworkAccess(PublicNetworkAccessEnum.ENABLED) + .withStorageProfile(new StorageProfile().withBackupRetentionDays(1495226068) + .withGeoRedundantBackup(GeoRedundantBackup.DISABLED) + .withStorageMB(1521405587) + .withStorageAutogrow(StorageAutogrow.DISABLED)); + model = BinaryData.fromObject(model).toObject(ServerPropertiesForCreate.class); + Assertions.assertEquals(ServerVersion.ONE_ONE, model.version()); + Assertions.assertEquals(SslEnforcementEnum.ENABLED, model.sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLS1_2, model.minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.DISABLED, model.infrastructureEncryption()); + Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, model.publicNetworkAccess()); + Assertions.assertEquals(1495226068, model.storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.DISABLED, model.storageProfile().geoRedundantBackup()); + Assertions.assertEquals(1521405587, model.storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.DISABLED, model.storageProfile().storageAutogrow()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesForGeoRestoreTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesForGeoRestoreTests.java new file mode 100644 index 0000000000000..89dea229c89fe --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesForGeoRestoreTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.GeoRedundantBackup; +import com.azure.resourcemanager.postgresql.models.InfrastructureEncryption; +import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresql.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresql.models.ServerPropertiesForGeoRestore; +import com.azure.resourcemanager.postgresql.models.ServerVersion; +import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresql.models.StorageAutogrow; +import com.azure.resourcemanager.postgresql.models.StorageProfile; +import org.junit.jupiter.api.Assertions; + +public final class ServerPropertiesForGeoRestoreTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServerPropertiesForGeoRestore model = BinaryData.fromString( + "{\"createMode\":\"GeoRestore\",\"sourceServerId\":\"ud\",\"version\":\"9.5\",\"sslEnforcement\":\"Enabled\",\"minimalTlsVersion\":\"TLSEnforcementDisabled\",\"infrastructureEncryption\":\"Disabled\",\"publicNetworkAccess\":\"Enabled\",\"storageProfile\":{\"backupRetentionDays\":857733914,\"geoRedundantBackup\":\"Disabled\",\"storageMB\":712184183,\"storageAutogrow\":\"Disabled\"}}") + .toObject(ServerPropertiesForGeoRestore.class); + Assertions.assertEquals(ServerVersion.NINE_FIVE, model.version()); + Assertions.assertEquals(SslEnforcementEnum.ENABLED, model.sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLSENFORCEMENT_DISABLED, model.minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.DISABLED, model.infrastructureEncryption()); + Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, model.publicNetworkAccess()); + Assertions.assertEquals(857733914, model.storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.DISABLED, model.storageProfile().geoRedundantBackup()); + Assertions.assertEquals(712184183, model.storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.DISABLED, model.storageProfile().storageAutogrow()); + Assertions.assertEquals("ud", model.sourceServerId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServerPropertiesForGeoRestore model = new ServerPropertiesForGeoRestore().withVersion(ServerVersion.NINE_FIVE) + .withSslEnforcement(SslEnforcementEnum.ENABLED) + .withMinimalTlsVersion(MinimalTlsVersionEnum.TLSENFORCEMENT_DISABLED) + .withInfrastructureEncryption(InfrastructureEncryption.DISABLED) + .withPublicNetworkAccess(PublicNetworkAccessEnum.ENABLED) + .withStorageProfile(new StorageProfile().withBackupRetentionDays(857733914) + .withGeoRedundantBackup(GeoRedundantBackup.DISABLED) + .withStorageMB(712184183) + .withStorageAutogrow(StorageAutogrow.DISABLED)) + .withSourceServerId("ud"); + model = BinaryData.fromObject(model).toObject(ServerPropertiesForGeoRestore.class); + Assertions.assertEquals(ServerVersion.NINE_FIVE, model.version()); + Assertions.assertEquals(SslEnforcementEnum.ENABLED, model.sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLSENFORCEMENT_DISABLED, model.minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.DISABLED, model.infrastructureEncryption()); + Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, model.publicNetworkAccess()); + Assertions.assertEquals(857733914, model.storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.DISABLED, model.storageProfile().geoRedundantBackup()); + Assertions.assertEquals(712184183, model.storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.DISABLED, model.storageProfile().storageAutogrow()); + Assertions.assertEquals("ud", model.sourceServerId()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesForReplicaTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesForReplicaTests.java new file mode 100644 index 0000000000000..9c34756d2ee24 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesForReplicaTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.GeoRedundantBackup; +import com.azure.resourcemanager.postgresql.models.InfrastructureEncryption; +import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresql.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresql.models.ServerPropertiesForReplica; +import com.azure.resourcemanager.postgresql.models.ServerVersion; +import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresql.models.StorageAutogrow; +import com.azure.resourcemanager.postgresql.models.StorageProfile; +import org.junit.jupiter.api.Assertions; + +public final class ServerPropertiesForReplicaTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServerPropertiesForReplica model = BinaryData.fromString( + "{\"createMode\":\"Replica\",\"sourceServerId\":\"xsrz\",\"version\":\"10.0\",\"sslEnforcement\":\"Disabled\",\"minimalTlsVersion\":\"TLS1_2\",\"infrastructureEncryption\":\"Enabled\",\"publicNetworkAccess\":\"Enabled\",\"storageProfile\":{\"backupRetentionDays\":1008975068,\"geoRedundantBackup\":\"Disabled\",\"storageMB\":2060062752,\"storageAutogrow\":\"Disabled\"}}") + .toObject(ServerPropertiesForReplica.class); + Assertions.assertEquals(ServerVersion.ONE_ZERO_ZERO, model.version()); + Assertions.assertEquals(SslEnforcementEnum.DISABLED, model.sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLS1_2, model.minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.ENABLED, model.infrastructureEncryption()); + Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, model.publicNetworkAccess()); + Assertions.assertEquals(1008975068, model.storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.DISABLED, model.storageProfile().geoRedundantBackup()); + Assertions.assertEquals(2060062752, model.storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.DISABLED, model.storageProfile().storageAutogrow()); + Assertions.assertEquals("xsrz", model.sourceServerId()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServerPropertiesForReplica model = new ServerPropertiesForReplica().withVersion(ServerVersion.ONE_ZERO_ZERO) + .withSslEnforcement(SslEnforcementEnum.DISABLED) + .withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_2) + .withInfrastructureEncryption(InfrastructureEncryption.ENABLED) + .withPublicNetworkAccess(PublicNetworkAccessEnum.ENABLED) + .withStorageProfile(new StorageProfile().withBackupRetentionDays(1008975068) + .withGeoRedundantBackup(GeoRedundantBackup.DISABLED) + .withStorageMB(2060062752) + .withStorageAutogrow(StorageAutogrow.DISABLED)) + .withSourceServerId("xsrz"); + model = BinaryData.fromObject(model).toObject(ServerPropertiesForReplica.class); + Assertions.assertEquals(ServerVersion.ONE_ZERO_ZERO, model.version()); + Assertions.assertEquals(SslEnforcementEnum.DISABLED, model.sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLS1_2, model.minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.ENABLED, model.infrastructureEncryption()); + Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, model.publicNetworkAccess()); + Assertions.assertEquals(1008975068, model.storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.DISABLED, model.storageProfile().geoRedundantBackup()); + Assertions.assertEquals(2060062752, model.storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.DISABLED, model.storageProfile().storageAutogrow()); + Assertions.assertEquals("xsrz", model.sourceServerId()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesForRestoreTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesForRestoreTests.java new file mode 100644 index 0000000000000..32bbff31814c0 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesForRestoreTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.GeoRedundantBackup; +import com.azure.resourcemanager.postgresql.models.InfrastructureEncryption; +import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresql.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresql.models.ServerPropertiesForRestore; +import com.azure.resourcemanager.postgresql.models.ServerVersion; +import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresql.models.StorageAutogrow; +import com.azure.resourcemanager.postgresql.models.StorageProfile; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class ServerPropertiesForRestoreTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServerPropertiesForRestore model = BinaryData.fromString( + "{\"createMode\":\"PointInTimeRestore\",\"sourceServerId\":\"d\",\"restorePointInTime\":\"2021-07-14T12:06:58Z\",\"version\":\"9.5\",\"sslEnforcement\":\"Enabled\",\"minimalTlsVersion\":\"TLS1_2\",\"infrastructureEncryption\":\"Enabled\",\"publicNetworkAccess\":\"Enabled\",\"storageProfile\":{\"backupRetentionDays\":1712782654,\"geoRedundantBackup\":\"Disabled\",\"storageMB\":953664851,\"storageAutogrow\":\"Enabled\"}}") + .toObject(ServerPropertiesForRestore.class); + Assertions.assertEquals(ServerVersion.NINE_FIVE, model.version()); + Assertions.assertEquals(SslEnforcementEnum.ENABLED, model.sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLS1_2, model.minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.ENABLED, model.infrastructureEncryption()); + Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, model.publicNetworkAccess()); + Assertions.assertEquals(1712782654, model.storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.DISABLED, model.storageProfile().geoRedundantBackup()); + Assertions.assertEquals(953664851, model.storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.ENABLED, model.storageProfile().storageAutogrow()); + Assertions.assertEquals("d", model.sourceServerId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-14T12:06:58Z"), model.restorePointInTime()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServerPropertiesForRestore model = new ServerPropertiesForRestore().withVersion(ServerVersion.NINE_FIVE) + .withSslEnforcement(SslEnforcementEnum.ENABLED) + .withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_2) + .withInfrastructureEncryption(InfrastructureEncryption.ENABLED) + .withPublicNetworkAccess(PublicNetworkAccessEnum.ENABLED) + .withStorageProfile(new StorageProfile().withBackupRetentionDays(1712782654) + .withGeoRedundantBackup(GeoRedundantBackup.DISABLED) + .withStorageMB(953664851) + .withStorageAutogrow(StorageAutogrow.ENABLED)) + .withSourceServerId("d") + .withRestorePointInTime(OffsetDateTime.parse("2021-07-14T12:06:58Z")); + model = BinaryData.fromObject(model).toObject(ServerPropertiesForRestore.class); + Assertions.assertEquals(ServerVersion.NINE_FIVE, model.version()); + Assertions.assertEquals(SslEnforcementEnum.ENABLED, model.sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLS1_2, model.minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.ENABLED, model.infrastructureEncryption()); + Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, model.publicNetworkAccess()); + Assertions.assertEquals(1712782654, model.storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.DISABLED, model.storageProfile().geoRedundantBackup()); + Assertions.assertEquals(953664851, model.storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.ENABLED, model.storageProfile().storageAutogrow()); + Assertions.assertEquals("d", model.sourceServerId()); + Assertions.assertEquals(OffsetDateTime.parse("2021-07-14T12:06:58Z"), model.restorePointInTime()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesTests.java new file mode 100644 index 0000000000000..38cfbe507a3e6 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServerPropertiesTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.ServerProperties; +import com.azure.resourcemanager.postgresql.models.GeoRedundantBackup; +import com.azure.resourcemanager.postgresql.models.InfrastructureEncryption; +import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresql.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresql.models.ServerState; +import com.azure.resourcemanager.postgresql.models.ServerVersion; +import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresql.models.StorageAutogrow; +import com.azure.resourcemanager.postgresql.models.StorageProfile; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; + +public final class ServerPropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + ServerProperties model = BinaryData.fromString( + "{\"administratorLogin\":\"nhsjcnyej\",\"version\":\"10.2\",\"sslEnforcement\":\"Disabled\",\"minimalTlsVersion\":\"TLS1_2\",\"byokEnforcement\":\"pczwlo\",\"infrastructureEncryption\":\"Disabled\",\"userVisibleState\":\"Dropping\",\"fullyQualifiedDomainName\":\"kvnipjoxz\",\"earliestRestoreDate\":\"2021-09-07T17:28:25Z\",\"storageProfile\":{\"backupRetentionDays\":519746852,\"geoRedundantBackup\":\"Enabled\",\"storageMB\":178199431,\"storageAutogrow\":\"Disabled\"},\"replicationRole\":\"ilzyd\",\"masterServerId\":\"o\",\"replicaCapacity\":1254785420,\"publicNetworkAccess\":\"Disabled\",\"privateEndpointConnections\":[{\"id\":\"npmqnjaqwixjspro\",\"properties\":{\"privateEndpoint\":{\"id\":\"utegjvwmfdats\"},\"privateLinkServiceConnectionState\":{\"status\":\"Disconnected\",\"description\":\"vpjhulsuuv\",\"actionsRequired\":\"None\"},\"provisioningState\":\"Approving\"}},{\"id\":\"rwfndiod\",\"properties\":{\"privateEndpoint\":{\"id\":\"w\"},\"privateLinkServiceConnectionState\":{\"status\":\"Disconnected\",\"description\":\"pvwryoqpsoacc\",\"actionsRequired\":\"None\"},\"provisioningState\":\"Approving\"}},{\"id\":\"j\",\"properties\":{\"privateEndpoint\":{\"id\":\"cr\"},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"dfdosygexp\",\"actionsRequired\":\"None\"},\"provisioningState\":\"Approving\"}}]}") + .toObject(ServerProperties.class); + Assertions.assertEquals("nhsjcnyej", model.administratorLogin()); + Assertions.assertEquals(ServerVersion.ONE_ZERO_TWO, model.version()); + Assertions.assertEquals(SslEnforcementEnum.DISABLED, model.sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLS1_2, model.minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.DISABLED, model.infrastructureEncryption()); + Assertions.assertEquals(ServerState.DROPPING, model.userVisibleState()); + Assertions.assertEquals("kvnipjoxz", model.fullyQualifiedDomainName()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-07T17:28:25Z"), model.earliestRestoreDate()); + Assertions.assertEquals(519746852, model.storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.ENABLED, model.storageProfile().geoRedundantBackup()); + Assertions.assertEquals(178199431, model.storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.DISABLED, model.storageProfile().storageAutogrow()); + Assertions.assertEquals("ilzyd", model.replicationRole()); + Assertions.assertEquals("o", model.masterServerId()); + Assertions.assertEquals(1254785420, model.replicaCapacity()); + Assertions.assertEquals(PublicNetworkAccessEnum.DISABLED, model.publicNetworkAccess()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + ServerProperties model = new ServerProperties().withAdministratorLogin("nhsjcnyej") + .withVersion(ServerVersion.ONE_ZERO_TWO) + .withSslEnforcement(SslEnforcementEnum.DISABLED) + .withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_2) + .withInfrastructureEncryption(InfrastructureEncryption.DISABLED) + .withUserVisibleState(ServerState.DROPPING) + .withFullyQualifiedDomainName("kvnipjoxz") + .withEarliestRestoreDate(OffsetDateTime.parse("2021-09-07T17:28:25Z")) + .withStorageProfile(new StorageProfile().withBackupRetentionDays(519746852) + .withGeoRedundantBackup(GeoRedundantBackup.ENABLED) + .withStorageMB(178199431) + .withStorageAutogrow(StorageAutogrow.DISABLED)) + .withReplicationRole("ilzyd") + .withMasterServerId("o") + .withReplicaCapacity(1254785420) + .withPublicNetworkAccess(PublicNetworkAccessEnum.DISABLED); + model = BinaryData.fromObject(model).toObject(ServerProperties.class); + Assertions.assertEquals("nhsjcnyej", model.administratorLogin()); + Assertions.assertEquals(ServerVersion.ONE_ZERO_TWO, model.version()); + Assertions.assertEquals(SslEnforcementEnum.DISABLED, model.sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLS1_2, model.minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.DISABLED, model.infrastructureEncryption()); + Assertions.assertEquals(ServerState.DROPPING, model.userVisibleState()); + Assertions.assertEquals("kvnipjoxz", model.fullyQualifiedDomainName()); + Assertions.assertEquals(OffsetDateTime.parse("2021-09-07T17:28:25Z"), model.earliestRestoreDate()); + Assertions.assertEquals(519746852, model.storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.ENABLED, model.storageProfile().geoRedundantBackup()); + Assertions.assertEquals(178199431, model.storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.DISABLED, model.storageProfile().storageAutogrow()); + Assertions.assertEquals("ilzyd", model.replicationRole()); + Assertions.assertEquals("o", model.masterServerId()); + Assertions.assertEquals(1254785420, model.replicaCapacity()); + Assertions.assertEquals(PublicNetworkAccessEnum.DISABLED, model.publicNetworkAccess()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersCreateMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersCreateMockTests.java new file mode 100644 index 0000000000000..555f11b9b4c65 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersCreateMockTests.java @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.GeoRedundantBackup; +import com.azure.resourcemanager.postgresql.models.IdentityType; +import com.azure.resourcemanager.postgresql.models.InfrastructureEncryption; +import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresql.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresql.models.ResourceIdentity; +import com.azure.resourcemanager.postgresql.models.Server; +import com.azure.resourcemanager.postgresql.models.ServerPropertiesForCreate; +import com.azure.resourcemanager.postgresql.models.ServerState; +import com.azure.resourcemanager.postgresql.models.ServerVersion; +import com.azure.resourcemanager.postgresql.models.Sku; +import com.azure.resourcemanager.postgresql.models.SkuTier; +import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresql.models.StorageAutogrow; +import com.azure.resourcemanager.postgresql.models.StorageProfile; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ServersCreateMockTests { + @Test + public void testCreate() throws Exception { + String responseStr + = "{\"identity\":{\"principalId\":\"94d240b7-4ddc-4fc4-9055-90723dcff387\",\"type\":\"SystemAssigned\",\"tenantId\":\"a16e2166-8876-40b4-b360-ceed93e9da33\"},\"sku\":{\"name\":\"elsfeaen\",\"tier\":\"GeneralPurpose\",\"capacity\":1448389214,\"size\":\"kl\",\"family\":\"xbjhwuaanozjosph\"},\"properties\":{\"administratorLogin\":\"l\",\"version\":\"11\",\"sslEnforcement\":\"Enabled\",\"minimalTlsVersion\":\"TLSEnforcementDisabled\",\"byokEnforcement\":\"rvimjwosytxitcsk\",\"infrastructureEncryption\":\"Enabled\",\"userVisibleState\":\"Dropping\",\"fullyQualifiedDomainName\":\"miekkezzikhlyfjh\",\"earliestRestoreDate\":\"2021-02-19T20:13:34Z\",\"storageProfile\":{\"backupRetentionDays\":1794228240,\"geoRedundantBackup\":\"Enabled\",\"storageMB\":1059730193,\"storageAutogrow\":\"Enabled\"},\"replicationRole\":\"eqidbqfatpx\",\"masterServerId\":\"rxcyjmoad\",\"replicaCapacity\":59301648,\"publicNetworkAccess\":\"Enabled\",\"privateEndpointConnections\":[{\"id\":\"dmjsjqb\",\"properties\":{\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"xrwlyc\"},\"provisioningState\":\"Approving\"}},{\"id\":\"p\",\"properties\":{\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{\"status\":\"Disconnected\",\"description\":\"mareqnajxqugj\"},\"provisioningState\":\"Dropping\"}},{\"id\":\"ubeddg\",\"properties\":{\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"qmzqalkrmnjijpx\"},\"provisioningState\":\"Failed\"}}]},\"location\":\"qudf\",\"tags\":{\"yffimrzrtuzqogs\":\"xbaaabjyv\",\"mewzsyyc\":\"xnevfdnwn\",\"judpfrxt\":\"uzsoi\",\"paxh\":\"thzvaytdwkqbrqu\"},\"id\":\"xiilivpdtiirqt\",\"name\":\"qoaxoruzfgs\",\"type\":\"uyfxrxxleptramxj\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Server response = manager.servers() + .define("rhyrnxxmueed") + .withRegion("dblx") + .withExistingResourceGroup("ivgvvcna") + .withProperties(new ServerPropertiesForCreate().withVersion(ServerVersion.ONE_ONE) + .withSslEnforcement(SslEnforcementEnum.ENABLED) + .withMinimalTlsVersion(MinimalTlsVersionEnum.TLS1_0) + .withInfrastructureEncryption(InfrastructureEncryption.DISABLED) + .withPublicNetworkAccess(PublicNetworkAccessEnum.DISABLED) + .withStorageProfile(new StorageProfile().withBackupRetentionDays(128514806) + .withGeoRedundantBackup(GeoRedundantBackup.DISABLED) + .withStorageMB(1528938748) + .withStorageAutogrow(StorageAutogrow.ENABLED))) + .withTags(mapOf("j", "mfnjh", "oqreyfkzikfjawn", "wmszkk", "vxwc", "a")) + .withIdentity(new ResourceIdentity().withType(IdentityType.SYSTEM_ASSIGNED)) + .withSku(new Sku().withName("kwqqtchealmf") + .withTier(SkuTier.GENERAL_PURPOSE) + .withCapacity(895344141) + .withSize("gdv") + .withFamily("gpiohgwxrtfudxe")) + .create(); + + Assertions.assertEquals("qudf", response.location()); + Assertions.assertEquals("xbaaabjyv", response.tags().get("yffimrzrtuzqogs")); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED, response.identity().type()); + Assertions.assertEquals("elsfeaen", response.sku().name()); + Assertions.assertEquals(SkuTier.GENERAL_PURPOSE, response.sku().tier()); + Assertions.assertEquals(1448389214, response.sku().capacity()); + Assertions.assertEquals("kl", response.sku().size()); + Assertions.assertEquals("xbjhwuaanozjosph", response.sku().family()); + Assertions.assertEquals("l", response.administratorLogin()); + Assertions.assertEquals(ServerVersion.ONE_ONE, response.version()); + Assertions.assertEquals(SslEnforcementEnum.ENABLED, response.sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLSENFORCEMENT_DISABLED, response.minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.ENABLED, response.infrastructureEncryption()); + Assertions.assertEquals(ServerState.DROPPING, response.userVisibleState()); + Assertions.assertEquals("miekkezzikhlyfjh", response.fullyQualifiedDomainName()); + Assertions.assertEquals(OffsetDateTime.parse("2021-02-19T20:13:34Z"), response.earliestRestoreDate()); + Assertions.assertEquals(1794228240, response.storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.ENABLED, response.storageProfile().geoRedundantBackup()); + Assertions.assertEquals(1059730193, response.storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.ENABLED, response.storageProfile().storageAutogrow()); + Assertions.assertEquals("eqidbqfatpx", response.replicationRole()); + Assertions.assertEquals("rxcyjmoad", response.masterServerId()); + Assertions.assertEquals(59301648, response.replicaCapacity()); + Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, response.publicNetworkAccess()); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersDeleteMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersDeleteMockTests.java new file mode 100644 index 0000000000000..9b51fcd6b49cf --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersDeleteMockTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ServersDeleteMockTests { + @Test + public void testDelete() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.servers().delete("gtdsslswt", "weriofzpyqsem", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersGetByResourceGroupWithResponseMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersGetByResourceGroupWithResponseMockTests.java new file mode 100644 index 0000000000000..58bd645ada787 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersGetByResourceGroupWithResponseMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.GeoRedundantBackup; +import com.azure.resourcemanager.postgresql.models.IdentityType; +import com.azure.resourcemanager.postgresql.models.InfrastructureEncryption; +import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresql.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresql.models.Server; +import com.azure.resourcemanager.postgresql.models.ServerState; +import com.azure.resourcemanager.postgresql.models.ServerVersion; +import com.azure.resourcemanager.postgresql.models.SkuTier; +import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresql.models.StorageAutogrow; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ServersGetByResourceGroupWithResponseMockTests { + @Test + public void testGetByResourceGroupWithResponse() throws Exception { + String responseStr + = "{\"identity\":{\"principalId\":\"4700037e-66f1-4aec-a5e8-293087df736d\",\"type\":\"SystemAssigned\",\"tenantId\":\"45b93bf7-4c27-4fe7-b499-c6b78355c732\"},\"sku\":{\"name\":\"sldnkwwtppjflcxo\",\"tier\":\"Basic\",\"capacity\":584568005,\"size\":\"z\",\"family\":\"sikvmkqzeqqkdlt\"},\"properties\":{\"administratorLogin\":\"mhhv\",\"version\":\"10\",\"sslEnforcement\":\"Disabled\",\"minimalTlsVersion\":\"TLS1_2\",\"byokEnforcement\":\"wobdagxtibqdx\",\"infrastructureEncryption\":\"Disabled\",\"userVisibleState\":\"Inaccessible\",\"fullyQualifiedDomainName\":\"ogqxndlkzgxhuri\",\"earliestRestoreDate\":\"2021-08-01T11:38:37Z\",\"storageProfile\":{\"backupRetentionDays\":1784018500,\"geoRedundantBackup\":\"Enabled\",\"storageMB\":2086660215,\"storageAutogrow\":\"Disabled\"},\"replicationRole\":\"xmubyyntwlrbq\",\"masterServerId\":\"oievseotgqrlltm\",\"replicaCapacity\":1887219641,\"publicNetworkAccess\":\"Enabled\",\"privateEndpointConnections\":[{\"id\":\"zxb\",\"properties\":{\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{\"status\":\"Disconnected\",\"description\":\"efuzmuvpbttd\"},\"provisioningState\":\"Rejecting\"}},{\"id\":\"p\",\"properties\":{\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"nzbtbhj\"},\"provisioningState\":\"Dropping\"}},{\"id\":\"fgohdneuelfphs\",\"properties\":{\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"zfikd\"},\"provisioningState\":\"Rejecting\"}}]},\"location\":\"quuvxzxcl\",\"tags\":{\"hcohfwdsjnk\":\"hhqzonosgg\",\"swacffgdkzz\":\"ljuti\",\"ppfufl\":\"wkfvhqcrailvp\",\"gafcnihgwqapnedg\":\"wdmhdlxyjrxs\"},\"id\":\"bcvkcvqvpkeq\",\"name\":\"cvdrhvoodsot\",\"type\":\"obzdopcjwvnhdl\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + Server response = manager.servers() + .getByResourceGroupWithResponse("abnetshh", "zhedplvwiw", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("quuvxzxcl", response.location()); + Assertions.assertEquals("hhqzonosgg", response.tags().get("hcohfwdsjnk")); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED, response.identity().type()); + Assertions.assertEquals("sldnkwwtppjflcxo", response.sku().name()); + Assertions.assertEquals(SkuTier.BASIC, response.sku().tier()); + Assertions.assertEquals(584568005, response.sku().capacity()); + Assertions.assertEquals("z", response.sku().size()); + Assertions.assertEquals("sikvmkqzeqqkdlt", response.sku().family()); + Assertions.assertEquals("mhhv", response.administratorLogin()); + Assertions.assertEquals(ServerVersion.ONE_ZERO, response.version()); + Assertions.assertEquals(SslEnforcementEnum.DISABLED, response.sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLS1_2, response.minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.DISABLED, response.infrastructureEncryption()); + Assertions.assertEquals(ServerState.INACCESSIBLE, response.userVisibleState()); + Assertions.assertEquals("ogqxndlkzgxhuri", response.fullyQualifiedDomainName()); + Assertions.assertEquals(OffsetDateTime.parse("2021-08-01T11:38:37Z"), response.earliestRestoreDate()); + Assertions.assertEquals(1784018500, response.storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.ENABLED, response.storageProfile().geoRedundantBackup()); + Assertions.assertEquals(2086660215, response.storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.DISABLED, response.storageProfile().storageAutogrow()); + Assertions.assertEquals("xmubyyntwlrbq", response.replicationRole()); + Assertions.assertEquals("oievseotgqrlltm", response.masterServerId()); + Assertions.assertEquals(1887219641, response.replicaCapacity()); + Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, response.publicNetworkAccess()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersListByResourceGroupMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersListByResourceGroupMockTests.java new file mode 100644 index 0000000000000..07ef7009f74d2 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersListByResourceGroupMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.GeoRedundantBackup; +import com.azure.resourcemanager.postgresql.models.IdentityType; +import com.azure.resourcemanager.postgresql.models.InfrastructureEncryption; +import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresql.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresql.models.Server; +import com.azure.resourcemanager.postgresql.models.ServerState; +import com.azure.resourcemanager.postgresql.models.ServerVersion; +import com.azure.resourcemanager.postgresql.models.SkuTier; +import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresql.models.StorageAutogrow; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ServersListByResourceGroupMockTests { + @Test + public void testListByResourceGroup() throws Exception { + String responseStr + = "{\"value\":[{\"identity\":{\"principalId\":\"284ef273-4b75-4f20-b442-d2211ff6d403\",\"type\":\"SystemAssigned\",\"tenantId\":\"a72fef93-b3cd-4eb9-b448-acfdfbc43f06\"},\"sku\":{\"name\":\"egrpkhj\",\"tier\":\"GeneralPurpose\",\"capacity\":1641060352,\"size\":\"luicpdggkzzlvmbm\",\"family\":\"xmodf\"},\"properties\":{\"administratorLogin\":\"fy\",\"version\":\"10\",\"sslEnforcement\":\"Enabled\",\"minimalTlsVersion\":\"TLS1_1\",\"byokEnforcement\":\"yhrfouyftaakcpw\",\"infrastructureEncryption\":\"Disabled\",\"userVisibleState\":\"Disabled\",\"fullyQualifiedDomainName\":\"mnubexkpzksmond\",\"earliestRestoreDate\":\"2021-04-01T23:21:50Z\",\"storageProfile\":{\"backupRetentionDays\":1083170526,\"geoRedundantBackup\":\"Disabled\",\"storageMB\":326974416,\"storageAutogrow\":\"Disabled\"},\"replicationRole\":\"pkwhojvpa\",\"masterServerId\":\"gxysmocmbqfqvm\",\"replicaCapacity\":1181340997,\"publicNetworkAccess\":\"Enabled\",\"privateEndpointConnections\":[{\"id\":\"helxprglya\",\"properties\":{\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"cbcuejrjxgciqi\"},\"provisioningState\":\"Dropping\"}},{\"id\":\"sxsdqrhzoymibm\",\"properties\":{\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"ahwfluszdtmhrk\"},\"provisioningState\":\"Failed\"}},{\"id\":\"yvoqa\",\"properties\":{\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{\"status\":\"Rejected\",\"description\":\"pbtg\"},\"provisioningState\":\"Rejecting\"}}]},\"location\":\"wo\",\"tags\":{\"tkcnqxwb\":\"ashrt\",\"sipqii\":\"okulpiujwa\"},\"id\":\"byuqerpqlp\",\"name\":\"wcciuqgbdbu\",\"type\":\"auvfbtkuwhhmhyk\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.servers().listByResourceGroup("wmgxcxrsl", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("wo", response.iterator().next().location()); + Assertions.assertEquals("ashrt", response.iterator().next().tags().get("tkcnqxwb")); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED, response.iterator().next().identity().type()); + Assertions.assertEquals("egrpkhj", response.iterator().next().sku().name()); + Assertions.assertEquals(SkuTier.GENERAL_PURPOSE, response.iterator().next().sku().tier()); + Assertions.assertEquals(1641060352, response.iterator().next().sku().capacity()); + Assertions.assertEquals("luicpdggkzzlvmbm", response.iterator().next().sku().size()); + Assertions.assertEquals("xmodf", response.iterator().next().sku().family()); + Assertions.assertEquals("fy", response.iterator().next().administratorLogin()); + Assertions.assertEquals(ServerVersion.ONE_ZERO, response.iterator().next().version()); + Assertions.assertEquals(SslEnforcementEnum.ENABLED, response.iterator().next().sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLS1_1, response.iterator().next().minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.DISABLED, + response.iterator().next().infrastructureEncryption()); + Assertions.assertEquals(ServerState.DISABLED, response.iterator().next().userVisibleState()); + Assertions.assertEquals("mnubexkpzksmond", response.iterator().next().fullyQualifiedDomainName()); + Assertions.assertEquals(OffsetDateTime.parse("2021-04-01T23:21:50Z"), + response.iterator().next().earliestRestoreDate()); + Assertions.assertEquals(1083170526, response.iterator().next().storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.DISABLED, + response.iterator().next().storageProfile().geoRedundantBackup()); + Assertions.assertEquals(326974416, response.iterator().next().storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.DISABLED, + response.iterator().next().storageProfile().storageAutogrow()); + Assertions.assertEquals("pkwhojvpa", response.iterator().next().replicationRole()); + Assertions.assertEquals("gxysmocmbqfqvm", response.iterator().next().masterServerId()); + Assertions.assertEquals(1181340997, response.iterator().next().replicaCapacity()); + Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, response.iterator().next().publicNetworkAccess()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersListMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersListMockTests.java new file mode 100644 index 0000000000000..dc24556df1079 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersListMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.GeoRedundantBackup; +import com.azure.resourcemanager.postgresql.models.IdentityType; +import com.azure.resourcemanager.postgresql.models.InfrastructureEncryption; +import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresql.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresql.models.Server; +import com.azure.resourcemanager.postgresql.models.ServerState; +import com.azure.resourcemanager.postgresql.models.ServerVersion; +import com.azure.resourcemanager.postgresql.models.SkuTier; +import com.azure.resourcemanager.postgresql.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresql.models.StorageAutogrow; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ServersListMockTests { + @Test + public void testList() throws Exception { + String responseStr + = "{\"value\":[{\"identity\":{\"principalId\":\"b2d96fc6-b04b-4342-8218-0e07ad7e78cf\",\"type\":\"SystemAssigned\",\"tenantId\":\"4d061145-a079-4a69-a4f0-6a6aab85bf33\"},\"sku\":{\"name\":\"nd\",\"tier\":\"MemoryOptimized\",\"capacity\":906567669,\"size\":\"o\",\"family\":\"kcdyhbpk\"},\"properties\":{\"administratorLogin\":\"dreqnovvqf\",\"version\":\"9.6\",\"sslEnforcement\":\"Enabled\",\"minimalTlsVersion\":\"TLS1_1\",\"byokEnforcement\":\"uwsyrsndsytgadg\",\"infrastructureEncryption\":\"Disabled\",\"userVisibleState\":\"Disabled\",\"fullyQualifiedDomainName\":\"neqn\",\"earliestRestoreDate\":\"2021-12-02T13:04:58Z\",\"storageProfile\":{\"backupRetentionDays\":1854977873,\"geoRedundantBackup\":\"Enabled\",\"storageMB\":1564647724,\"storageAutogrow\":\"Enabled\"},\"replicationRole\":\"kacewiipfp\",\"masterServerId\":\"ji\",\"replicaCapacity\":1113434704,\"publicNetworkAccess\":\"Enabled\",\"privateEndpointConnections\":[{\"id\":\"qkvpuvksgplsakn\",\"properties\":{\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"n\"},\"provisioningState\":\"Dropping\"}},{\"id\":\"uopxodlqiyntor\",\"properties\":{\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{\"status\":\"Pending\",\"description\":\"osjswsr\"},\"provisioningState\":\"Dropping\"}},{\"id\":\"zrpzb\",\"properties\":{\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{\"status\":\"Disconnected\",\"description\":\"qzqioxiysuiizy\"},\"provisioningState\":\"Approving\"}},{\"id\":\"yatrwy\",\"properties\":{\"privateEndpoint\":{},\"privateLinkServiceConnectionState\":{\"status\":\"Approved\",\"description\":\"zyh\"},\"provisioningState\":\"Approving\"}}]},\"location\":\"smypyynpc\",\"tags\":{\"nsorgjhxbldt\":\"mnzgmwznmabi\",\"kotl\":\"wwrlkdmtncv\",\"gsyocogj\":\"xdy\",\"kvci\":\"tdtbnnhadooc\"},\"id\":\"hnvpamqgxq\",\"name\":\"u\",\"type\":\"zikywgg\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response = manager.servers().list(com.azure.core.util.Context.NONE); + + Assertions.assertEquals("smypyynpc", response.iterator().next().location()); + Assertions.assertEquals("mnzgmwznmabi", response.iterator().next().tags().get("nsorgjhxbldt")); + Assertions.assertEquals(IdentityType.SYSTEM_ASSIGNED, response.iterator().next().identity().type()); + Assertions.assertEquals("nd", response.iterator().next().sku().name()); + Assertions.assertEquals(SkuTier.MEMORY_OPTIMIZED, response.iterator().next().sku().tier()); + Assertions.assertEquals(906567669, response.iterator().next().sku().capacity()); + Assertions.assertEquals("o", response.iterator().next().sku().size()); + Assertions.assertEquals("kcdyhbpk", response.iterator().next().sku().family()); + Assertions.assertEquals("dreqnovvqf", response.iterator().next().administratorLogin()); + Assertions.assertEquals(ServerVersion.NINE_SIX, response.iterator().next().version()); + Assertions.assertEquals(SslEnforcementEnum.ENABLED, response.iterator().next().sslEnforcement()); + Assertions.assertEquals(MinimalTlsVersionEnum.TLS1_1, response.iterator().next().minimalTlsVersion()); + Assertions.assertEquals(InfrastructureEncryption.DISABLED, + response.iterator().next().infrastructureEncryption()); + Assertions.assertEquals(ServerState.DISABLED, response.iterator().next().userVisibleState()); + Assertions.assertEquals("neqn", response.iterator().next().fullyQualifiedDomainName()); + Assertions.assertEquals(OffsetDateTime.parse("2021-12-02T13:04:58Z"), + response.iterator().next().earliestRestoreDate()); + Assertions.assertEquals(1854977873, response.iterator().next().storageProfile().backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.ENABLED, + response.iterator().next().storageProfile().geoRedundantBackup()); + Assertions.assertEquals(1564647724, response.iterator().next().storageProfile().storageMB()); + Assertions.assertEquals(StorageAutogrow.ENABLED, response.iterator().next().storageProfile().storageAutogrow()); + Assertions.assertEquals("kacewiipfp", response.iterator().next().replicationRole()); + Assertions.assertEquals("ji", response.iterator().next().masterServerId()); + Assertions.assertEquals(1113434704, response.iterator().next().replicaCapacity()); + Assertions.assertEquals(PublicNetworkAccessEnum.ENABLED, response.iterator().next().publicNetworkAccess()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersRestartMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersRestartMockTests.java new file mode 100644 index 0000000000000..60158694c3224 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/ServersRestartMockTests.java @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class ServersRestartMockTests { + @Test + public void testRestart() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.servers().restart("kallatmel", "uipiccjzk", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/SkuTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/SkuTests.java new file mode 100644 index 0000000000000..3eeea3ed214fd --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/SkuTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.Sku; +import com.azure.resourcemanager.postgresql.models.SkuTier; +import org.junit.jupiter.api.Assertions; + +public final class SkuTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + Sku model = BinaryData.fromString( + "{\"name\":\"lobcufpdznrbtcq\",\"tier\":\"Basic\",\"capacity\":1110459096,\"size\":\"hqgnufooojywif\",\"family\":\"esaagdfm\"}") + .toObject(Sku.class); + Assertions.assertEquals("lobcufpdznrbtcq", model.name()); + Assertions.assertEquals(SkuTier.BASIC, model.tier()); + Assertions.assertEquals(1110459096, model.capacity()); + Assertions.assertEquals("hqgnufooojywif", model.size()); + Assertions.assertEquals("esaagdfm", model.family()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + Sku model = new Sku().withName("lobcufpdznrbtcq") + .withTier(SkuTier.BASIC) + .withCapacity(1110459096) + .withSize("hqgnufooojywif") + .withFamily("esaagdfm"); + model = BinaryData.fromObject(model).toObject(Sku.class); + Assertions.assertEquals("lobcufpdznrbtcq", model.name()); + Assertions.assertEquals(SkuTier.BASIC, model.tier()); + Assertions.assertEquals(1110459096, model.capacity()); + Assertions.assertEquals("hqgnufooojywif", model.size()); + Assertions.assertEquals("esaagdfm", model.family()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/StorageProfileTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/StorageProfileTests.java new file mode 100644 index 0000000000000..44862e2b93870 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/StorageProfileTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.GeoRedundantBackup; +import com.azure.resourcemanager.postgresql.models.StorageAutogrow; +import com.azure.resourcemanager.postgresql.models.StorageProfile; +import org.junit.jupiter.api.Assertions; + +public final class StorageProfileTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + StorageProfile model = BinaryData.fromString( + "{\"backupRetentionDays\":345246122,\"geoRedundantBackup\":\"Enabled\",\"storageMB\":365003669,\"storageAutogrow\":\"Disabled\"}") + .toObject(StorageProfile.class); + Assertions.assertEquals(345246122, model.backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.ENABLED, model.geoRedundantBackup()); + Assertions.assertEquals(365003669, model.storageMB()); + Assertions.assertEquals(StorageAutogrow.DISABLED, model.storageAutogrow()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + StorageProfile model = new StorageProfile().withBackupRetentionDays(345246122) + .withGeoRedundantBackup(GeoRedundantBackup.ENABLED) + .withStorageMB(365003669) + .withStorageAutogrow(StorageAutogrow.DISABLED); + model = BinaryData.fromObject(model).toObject(StorageProfile.class); + Assertions.assertEquals(345246122, model.backupRetentionDays()); + Assertions.assertEquals(GeoRedundantBackup.ENABLED, model.geoRedundantBackup()); + Assertions.assertEquals(365003669, model.storageMB()); + Assertions.assertEquals(StorageAutogrow.DISABLED, model.storageAutogrow()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/TagsObjectTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/TagsObjectTests.java new file mode 100644 index 0000000000000..aef8abe4261f0 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/TagsObjectTests.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.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.TagsObject; +import java.util.HashMap; +import java.util.Map; +import org.junit.jupiter.api.Assertions; + +public final class TagsObjectTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + TagsObject model = BinaryData.fromString("{\"tags\":{\"wozuhkf\":\"ekg\"}}").toObject(TagsObject.class); + Assertions.assertEquals("ekg", model.tags().get("wozuhkf")); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + TagsObject model = new TagsObject().withTags(mapOf("wozuhkf", "ekg")); + model = BinaryData.fromObject(model).toObject(TagsObject.class); + Assertions.assertEquals("ekg", model.tags().get("wozuhkf")); + } + + // Use "Map.of" if available + @SuppressWarnings("unchecked") + private static Map mapOf(Object... inputs) { + Map map = new HashMap<>(); + for (int i = 0; i < inputs.length; i += 2) { + String key = (String) inputs[i]; + T value = (T) inputs[i + 1]; + map.put(key, value); + } + return map; + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRuleInnerTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRuleInnerTests.java new file mode 100644 index 0000000000000..8db6e07a15e9e --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRuleInnerTests.java @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.VirtualNetworkRuleInner; +import org.junit.jupiter.api.Assertions; + +public final class VirtualNetworkRuleInnerTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualNetworkRuleInner model = BinaryData.fromString( + "{\"properties\":{\"virtualNetworkSubnetId\":\"ysh\",\"ignoreMissingVnetServiceEndpoint\":false,\"state\":\"Initializing\"},\"id\":\"bl\",\"name\":\"j\",\"type\":\"pbtoqcjmkl\"}") + .toObject(VirtualNetworkRuleInner.class); + Assertions.assertEquals("ysh", model.virtualNetworkSubnetId()); + Assertions.assertEquals(false, model.ignoreMissingVnetServiceEndpoint()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualNetworkRuleInner model = new VirtualNetworkRuleInner().withVirtualNetworkSubnetId("ysh") + .withIgnoreMissingVnetServiceEndpoint(false); + model = BinaryData.fromObject(model).toObject(VirtualNetworkRuleInner.class); + Assertions.assertEquals("ysh", model.virtualNetworkSubnetId()); + Assertions.assertEquals(false, model.ignoreMissingVnetServiceEndpoint()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRuleListResultTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRuleListResultTests.java new file mode 100644 index 0000000000000..9b4133d8e733c --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRuleListResultTests.java @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.models.VirtualNetworkRuleListResult; + +public final class VirtualNetworkRuleListResultTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualNetworkRuleListResult model = BinaryData.fromString( + "{\"value\":[{\"properties\":{\"virtualNetworkSubnetId\":\"jzyulpk\",\"ignoreMissingVnetServiceEndpoint\":true,\"state\":\"Initializing\"},\"id\":\"lkhbz\",\"name\":\"fepgzgq\",\"type\":\"xzlocxscp\"},{\"properties\":{\"virtualNetworkSubnetId\":\"erhhbcsglumm\",\"ignoreMissingVnetServiceEndpoint\":true,\"state\":\"Unknown\"},\"id\":\"odxobnbdxkqpxok\",\"name\":\"jionpimexgstxgc\",\"type\":\"odgmaajrmvdjwz\"},{\"properties\":{\"virtualNetworkSubnetId\":\"ovmclwhijcoejct\",\"ignoreMissingVnetServiceEndpoint\":true,\"state\":\"Initializing\"},\"id\":\"qsycbkbfkgu\",\"name\":\"dkexxppofm\",\"type\":\"axcfjpgddtocjjx\"},{\"properties\":{\"virtualNetworkSubnetId\":\"pmouexhdz\",\"ignoreMissingVnetServiceEndpoint\":false,\"state\":\"Deleting\"},\"id\":\"ojnxqbzvdd\",\"name\":\"t\",\"type\":\"ndei\"}],\"nextLink\":\"twnpzaoqvuhrhcf\"}") + .toObject(VirtualNetworkRuleListResult.class); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualNetworkRuleListResult model = new VirtualNetworkRuleListResult(); + model = BinaryData.fromObject(model).toObject(VirtualNetworkRuleListResult.class); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulePropertiesTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulePropertiesTests.java new file mode 100644 index 0000000000000..71eacda1c80c2 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulePropertiesTests.java @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresql.generated; + +import com.azure.core.util.BinaryData; +import com.azure.resourcemanager.postgresql.fluent.models.VirtualNetworkRuleProperties; +import org.junit.jupiter.api.Assertions; + +public final class VirtualNetworkRulePropertiesTests { + @org.junit.jupiter.api.Test + public void testDeserialize() throws Exception { + VirtualNetworkRuleProperties model = BinaryData + .fromString( + "{\"virtualNetworkSubnetId\":\"a\",\"ignoreMissingVnetServiceEndpoint\":true,\"state\":\"Unknown\"}") + .toObject(VirtualNetworkRuleProperties.class); + Assertions.assertEquals("a", model.virtualNetworkSubnetId()); + Assertions.assertEquals(true, model.ignoreMissingVnetServiceEndpoint()); + } + + @org.junit.jupiter.api.Test + public void testSerialize() throws Exception { + VirtualNetworkRuleProperties model = new VirtualNetworkRuleProperties().withVirtualNetworkSubnetId("a") + .withIgnoreMissingVnetServiceEndpoint(true); + model = BinaryData.fromObject(model).toObject(VirtualNetworkRuleProperties.class); + Assertions.assertEquals("a", model.virtualNetworkSubnetId()); + Assertions.assertEquals(true, model.ignoreMissingVnetServiceEndpoint()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesCreateOrUpdateMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesCreateOrUpdateMockTests.java new file mode 100644 index 0000000000000..c776e737e749b --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesCreateOrUpdateMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.VirtualNetworkRule; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class VirtualNetworkRulesCreateOrUpdateMockTests { + @Test + public void testCreateOrUpdate() throws Exception { + String responseStr + = "{\"properties\":{\"virtualNetworkSubnetId\":\"iby\",\"ignoreMissingVnetServiceEndpoint\":false,\"state\":\"Initializing\"},\"id\":\"h\",\"name\":\"hfwpracstwit\",\"type\":\"khevxccedc\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + VirtualNetworkRule response = manager.virtualNetworkRules() + .define("lusiy") + .withExistingServer("mkttlstvlzywem", "zrncsdt") + .withVirtualNetworkSubnetId("sfgytguslfead") + .withIgnoreMissingVnetServiceEndpoint(false) + .create(); + + Assertions.assertEquals("iby", response.virtualNetworkSubnetId()); + Assertions.assertEquals(false, response.ignoreMissingVnetServiceEndpoint()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesDeleteMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesDeleteMockTests.java new file mode 100644 index 0000000000000..79c72a8561edc --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesDeleteMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class VirtualNetworkRulesDeleteMockTests { + @Test + public void testDelete() throws Exception { + String responseStr = "{}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + manager.virtualNetworkRules() + .delete("equi", "hxicslfaoqz", "iyylhalnswhccsp", com.azure.core.util.Context.NONE); + + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesGetWithResponseMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesGetWithResponseMockTests.java new file mode 100644 index 0000000000000..c0bd1cdd2ca90 --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesGetWithResponseMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.VirtualNetworkRule; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class VirtualNetworkRulesGetWithResponseMockTests { + @Test + public void testGetWithResponse() throws Exception { + String responseStr + = "{\"properties\":{\"virtualNetworkSubnetId\":\"kopbminrf\",\"ignoreMissingVnetServiceEndpoint\":true,\"state\":\"Initializing\"},\"id\":\"hhziuief\",\"name\":\"zbhd\",\"type\":\"smlmzqhoftrm\"}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + VirtualNetworkRule response = manager.virtualNetworkRules() + .getWithResponse("wr", "grtwae", "u", com.azure.core.util.Context.NONE) + .getValue(); + + Assertions.assertEquals("kopbminrf", response.virtualNetworkSubnetId()); + Assertions.assertEquals(true, response.ignoreMissingVnetServiceEndpoint()); + } +} diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesListByServerMockTests.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesListByServerMockTests.java new file mode 100644 index 0000000000000..7c447c091750c --- /dev/null +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/test/java/com/azure/resourcemanager/postgresql/generated/VirtualNetworkRulesListByServerMockTests.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.postgresql.generated; + +import com.azure.core.credential.AccessToken; +import com.azure.core.http.HttpClient; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.management.AzureEnvironment; +import com.azure.core.management.profile.AzureProfile; +import com.azure.core.test.http.MockHttpResponse; +import com.azure.resourcemanager.postgresql.PostgreSqlManager; +import com.azure.resourcemanager.postgresql.models.VirtualNetworkRule; +import java.nio.charset.StandardCharsets; +import java.time.OffsetDateTime; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import reactor.core.publisher.Mono; + +public final class VirtualNetworkRulesListByServerMockTests { + @Test + public void testListByServer() throws Exception { + String responseStr + = "{\"value\":[{\"properties\":{\"virtualNetworkSubnetId\":\"wem\",\"ignoreMissingVnetServiceEndpoint\":false,\"state\":\"Unknown\"},\"id\":\"brgz\",\"name\":\"wmsweypqwd\",\"type\":\"ggicccnxqhue\"}]}"; + + HttpClient httpClient + = response -> Mono.just(new MockHttpResponse(response, 200, responseStr.getBytes(StandardCharsets.UTF_8))); + PostgreSqlManager manager = PostgreSqlManager.configure() + .withHttpClient(httpClient) + .authenticate(tokenRequestContext -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX)), + new AzureProfile("", "", AzureEnvironment.AZURE)); + + PagedIterable response + = manager.virtualNetworkRules().listByServer("kaivwit", "scywuggwoluhc", com.azure.core.util.Context.NONE); + + Assertions.assertEquals("wem", response.iterator().next().virtualNetworkSubnetId()); + Assertions.assertEquals(false, response.iterator().next().ignoreMissingVnetServiceEndpoint()); + } +}