diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/CHANGELOG.md b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/CHANGELOG.md index 6852f67370af..112abaa44e03 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/CHANGELOG.md +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/CHANGELOG.md @@ -1,7 +1,8 @@ # Release History -## 1.0.0-beta.2 (Unreleased) +## 1.0.0-beta.1 (2021-07-16) +- 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). ## 1.0.0-beta.1 (2021-07-12) diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/README.md b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/README.md index dc75e165ed66..8db62ef654f8 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/README.md +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/README.md @@ -2,7 +2,7 @@ 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-flexibleserver-2021-06. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt). +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). ## We'd love to hear your feedback @@ -32,7 +32,7 @@ Various documentation is available to help you get started com.azure.resourcemanager azure-resourcemanager-postgresqlflexibleserver - 1.0.0-beta.1 + 1.0.0-beta.2 ``` [//]: # ({x-version-update-end}) @@ -74,7 +74,6 @@ See [API design][design] for general introduction on design and key concepts on ## Examples -[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/SAMPLE.md) ## Troubleshooting diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/pom.xml b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/pom.xml index f9f5b3076d91..f1f93d4f5e8f 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/pom.xml +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/pom.xml @@ -13,7 +13,7 @@ jar Microsoft Azure SDK for PostgreSql Management - This package contains Microsoft Azure SDK for PostgreSql Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. 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-flexibleserver-2021-06. + This package contains Microsoft Azure SDK for PostgreSql Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. 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. https://github.com/Azure/azure-sdk-for-java diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/PostgreSqlManager.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/PostgreSqlManager.java index 8b4b8070da4a..6444d407064c 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/PostgreSqlManager.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/PostgreSqlManager.java @@ -25,21 +25,39 @@ import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ConfigurationsImpl; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.DatabasesImpl; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.FirewallRulesImpl; -import com.azure.resourcemanager.postgresqlflexibleserver.implementation.GetPrivateDnsZoneSuffixesImpl; -import com.azure.resourcemanager.postgresqlflexibleserver.implementation.LocationBasedCapabilitiesImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.LocationBasedPerformanceTiersImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.LogFilesImpl; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.OperationsImpl; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.PostgreSqlManagementClientBuilder; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.PrivateEndpointConnectionsImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.PrivateLinkResourcesImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.RecoverableServersImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ReplicasImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ServerAdministratorsImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ServerBasedPerformanceTiersImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ServerKeysImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ServerParametersImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ServerSecurityAlertPoliciesImpl; import com.azure.resourcemanager.postgresqlflexibleserver.implementation.ServersImpl; -import com.azure.resourcemanager.postgresqlflexibleserver.implementation.VirtualNetworkSubnetUsagesImpl; +import com.azure.resourcemanager.postgresqlflexibleserver.implementation.VirtualNetworkRulesImpl; import com.azure.resourcemanager.postgresqlflexibleserver.models.CheckNameAvailabilities; import com.azure.resourcemanager.postgresqlflexibleserver.models.Configurations; import com.azure.resourcemanager.postgresqlflexibleserver.models.Databases; import com.azure.resourcemanager.postgresqlflexibleserver.models.FirewallRules; -import com.azure.resourcemanager.postgresqlflexibleserver.models.GetPrivateDnsZoneSuffixes; -import com.azure.resourcemanager.postgresqlflexibleserver.models.LocationBasedCapabilities; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LocationBasedPerformanceTiers; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogFiles; import com.azure.resourcemanager.postgresqlflexibleserver.models.Operations; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateEndpointConnections; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateLinkResources; +import com.azure.resourcemanager.postgresqlflexibleserver.models.RecoverableServers; +import com.azure.resourcemanager.postgresqlflexibleserver.models.Replicas; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerAdministrators; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerBasedPerformanceTiers; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerKeys; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerParameters; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerSecurityAlertPolicies; import com.azure.resourcemanager.postgresqlflexibleserver.models.Servers; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsages; +import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkRules; import java.time.Duration; import java.time.temporal.ChronoUnit; import java.util.ArrayList; @@ -54,21 +72,39 @@ public final class PostgreSqlManager { private Servers servers; + private Replicas replicas; + private FirewallRules firewallRules; + private VirtualNetworkRules virtualNetworkRules; + + private Databases databases; + private Configurations configurations; - private CheckNameAvailabilities checkNameAvailabilities; + private ServerParameters serverParameters; + + private LogFiles logFiles; + + private ServerAdministrators serverAdministrators; + + private RecoverableServers recoverableServers; - private LocationBasedCapabilities locationBasedCapabilities; + private ServerBasedPerformanceTiers serverBasedPerformanceTiers; - private VirtualNetworkSubnetUsages virtualNetworkSubnetUsages; + private LocationBasedPerformanceTiers locationBasedPerformanceTiers; + + private CheckNameAvailabilities checkNameAvailabilities; private Operations operations; - private Databases databases; + private ServerSecurityAlertPolicies serverSecurityAlertPolicies; + + private PrivateEndpointConnections privateEndpointConnections; - private GetPrivateDnsZoneSuffixes getPrivateDnsZoneSuffixes; + private PrivateLinkResources privateLinkResources; + + private ServerKeys serverKeys; private final PostgreSqlManagementClient clientObject; @@ -253,6 +289,14 @@ public Servers servers() { return servers; } + /** @return Resource collection API of Replicas. */ + public Replicas replicas() { + if (this.replicas == null) { + this.replicas = new ReplicasImpl(clientObject.getReplicas(), this); + } + return replicas; + } + /** @return Resource collection API of FirewallRules. */ public FirewallRules firewallRules() { if (this.firewallRules == null) { @@ -261,6 +305,22 @@ public FirewallRules firewallRules() { return firewallRules; } + /** @return Resource collection API of VirtualNetworkRules. */ + public VirtualNetworkRules virtualNetworkRules() { + if (this.virtualNetworkRules == null) { + this.virtualNetworkRules = new VirtualNetworkRulesImpl(clientObject.getVirtualNetworkRules(), this); + } + return virtualNetworkRules; + } + + /** @return Resource collection API of Databases. */ + public Databases databases() { + if (this.databases == null) { + this.databases = new DatabasesImpl(clientObject.getDatabases(), this); + } + return databases; + } + /** @return Resource collection API of Configurations. */ public Configurations configurations() { if (this.configurations == null) { @@ -269,6 +329,56 @@ public Configurations configurations() { return configurations; } + /** @return Resource collection API of ServerParameters. */ + public ServerParameters serverParameters() { + if (this.serverParameters == null) { + this.serverParameters = new ServerParametersImpl(clientObject.getServerParameters(), this); + } + return serverParameters; + } + + /** @return Resource collection API of LogFiles. */ + public LogFiles logFiles() { + if (this.logFiles == null) { + this.logFiles = new LogFilesImpl(clientObject.getLogFiles(), this); + } + return logFiles; + } + + /** @return Resource collection API of ServerAdministrators. */ + public ServerAdministrators serverAdministrators() { + if (this.serverAdministrators == null) { + this.serverAdministrators = new ServerAdministratorsImpl(clientObject.getServerAdministrators(), this); + } + return serverAdministrators; + } + + /** @return Resource collection API of RecoverableServers. */ + public RecoverableServers recoverableServers() { + if (this.recoverableServers == null) { + this.recoverableServers = new RecoverableServersImpl(clientObject.getRecoverableServers(), this); + } + return recoverableServers; + } + + /** @return Resource collection API of ServerBasedPerformanceTiers. */ + public ServerBasedPerformanceTiers serverBasedPerformanceTiers() { + if (this.serverBasedPerformanceTiers == null) { + this.serverBasedPerformanceTiers = + new ServerBasedPerformanceTiersImpl(clientObject.getServerBasedPerformanceTiers(), this); + } + return serverBasedPerformanceTiers; + } + + /** @return Resource collection API of LocationBasedPerformanceTiers. */ + public LocationBasedPerformanceTiers locationBasedPerformanceTiers() { + if (this.locationBasedPerformanceTiers == null) { + this.locationBasedPerformanceTiers = + new LocationBasedPerformanceTiersImpl(clientObject.getLocationBasedPerformanceTiers(), this); + } + return locationBasedPerformanceTiers; + } + /** @return Resource collection API of CheckNameAvailabilities. */ public CheckNameAvailabilities checkNameAvailabilities() { if (this.checkNameAvailabilities == null) { @@ -278,47 +388,46 @@ public CheckNameAvailabilities checkNameAvailabilities() { return checkNameAvailabilities; } - /** @return Resource collection API of LocationBasedCapabilities. */ - public LocationBasedCapabilities locationBasedCapabilities() { - if (this.locationBasedCapabilities == null) { - this.locationBasedCapabilities = - new LocationBasedCapabilitiesImpl(clientObject.getLocationBasedCapabilities(), this); + /** @return Resource collection API of Operations. */ + public Operations operations() { + if (this.operations == null) { + this.operations = new OperationsImpl(clientObject.getOperations(), this); } - return locationBasedCapabilities; + return operations; } - /** @return Resource collection API of VirtualNetworkSubnetUsages. */ - public VirtualNetworkSubnetUsages virtualNetworkSubnetUsages() { - if (this.virtualNetworkSubnetUsages == null) { - this.virtualNetworkSubnetUsages = - new VirtualNetworkSubnetUsagesImpl(clientObject.getVirtualNetworkSubnetUsages(), this); + /** @return Resource collection API of ServerSecurityAlertPolicies. */ + public ServerSecurityAlertPolicies serverSecurityAlertPolicies() { + if (this.serverSecurityAlertPolicies == null) { + this.serverSecurityAlertPolicies = + new ServerSecurityAlertPoliciesImpl(clientObject.getServerSecurityAlertPolicies(), this); } - return virtualNetworkSubnetUsages; + return serverSecurityAlertPolicies; } - /** @return Resource collection API of Operations. */ - public Operations operations() { - if (this.operations == null) { - this.operations = new OperationsImpl(clientObject.getOperations(), this); + /** @return Resource collection API of PrivateEndpointConnections. */ + public PrivateEndpointConnections privateEndpointConnections() { + if (this.privateEndpointConnections == null) { + this.privateEndpointConnections = + new PrivateEndpointConnectionsImpl(clientObject.getPrivateEndpointConnections(), this); } - return operations; + return privateEndpointConnections; } - /** @return Resource collection API of Databases. */ - public Databases databases() { - if (this.databases == null) { - this.databases = new DatabasesImpl(clientObject.getDatabases(), this); + /** @return Resource collection API of PrivateLinkResources. */ + public PrivateLinkResources privateLinkResources() { + if (this.privateLinkResources == null) { + this.privateLinkResources = new PrivateLinkResourcesImpl(clientObject.getPrivateLinkResources(), this); } - return databases; + return privateLinkResources; } - /** @return Resource collection API of GetPrivateDnsZoneSuffixes. */ - public GetPrivateDnsZoneSuffixes getPrivateDnsZoneSuffixes() { - if (this.getPrivateDnsZoneSuffixes == null) { - this.getPrivateDnsZoneSuffixes = - new GetPrivateDnsZoneSuffixesImpl(clientObject.getGetPrivateDnsZoneSuffixes(), this); + /** @return Resource collection API of ServerKeys. */ + public ServerKeys serverKeys() { + if (this.serverKeys == null) { + this.serverKeys = new ServerKeysImpl(clientObject.getServerKeys(), this); } - return getPrivateDnsZoneSuffixes; + return serverKeys; } /** diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ConfigurationsClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ConfigurationsClient.java index d9116c9daacb..5a5ca47c644c 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ConfigurationsClient.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ConfigurationsClient.java @@ -15,63 +15,6 @@ /** An instance of this class provides access to all the operations defined in ConfigurationsClient. */ public interface ConfigurationsClient { - /** - * List all the configurations in a given server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of server configurations. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByServer(String resourceGroupName, String serverName); - - /** - * List all the configurations in a given server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of server configurations. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable listByServer(String resourceGroupName, String serverName, Context context); - - /** - * Gets information about a configuration of server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName The name of the server configuration. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about a configuration of server. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - ConfigurationInner get(String resourceGroupName, String serverName, String configurationName); - - /** - * Gets information about a configuration of server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName The name of the server configuration. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return information about a configuration of server. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response getWithResponse( - String resourceGroupName, String serverName, String configurationName, Context context); - /** * Updates a configuration of a server. * @@ -85,7 +28,7 @@ Response getWithResponse( * @return represents a Configuration. */ @ServiceMethod(returns = ReturnType.SINGLE) - SyncPoller, ConfigurationInner> beginUpdate( + SyncPoller, ConfigurationInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters); /** @@ -102,7 +45,7 @@ SyncPoller, ConfigurationInner> beginUpdate( * @return represents a Configuration. */ @ServiceMethod(returns = ReturnType.SINGLE) - SyncPoller, ConfigurationInner> beginUpdate( + SyncPoller, ConfigurationInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String configurationName, @@ -122,7 +65,7 @@ SyncPoller, ConfigurationInner> beginUpdate( * @return represents a Configuration. */ @ServiceMethod(returns = ReturnType.SINGLE) - ConfigurationInner update( + ConfigurationInner createOrUpdate( String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters); /** @@ -139,7 +82,7 @@ ConfigurationInner update( * @return represents a Configuration. */ @ServiceMethod(returns = ReturnType.SINGLE) - ConfigurationInner update( + ConfigurationInner createOrUpdate( String resourceGroupName, String serverName, String configurationName, @@ -147,76 +90,59 @@ ConfigurationInner update( Context context); /** - * Updates a configuration of a 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. - * @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. + * @return information about a configuration of server. */ @ServiceMethod(returns = ReturnType.SINGLE) - SyncPoller, ConfigurationInner> beginPut( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters); + ConfigurationInner get(String resourceGroupName, String serverName, String configurationName); /** - * Updates a configuration of a 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. - * @param parameters The required parameters for updating a server configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. + * @return information about a configuration of server. */ @ServiceMethod(returns = ReturnType.SINGLE) - SyncPoller, ConfigurationInner> beginPut( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context); + Response getWithResponse( + String resourceGroupName, String serverName, String configurationName, Context context); /** - * Updates a configuration of a server. + * 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 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. + * @return a list of server configurations. */ - @ServiceMethod(returns = ReturnType.SINGLE) - ConfigurationInner put( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); /** - * Updates a configuration of a server. + * 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 configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. + * @return a list of server configurations. */ - @ServiceMethod(returns = ReturnType.SINGLE) - ConfigurationInner put( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context); + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/DatabasesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/DatabasesClient.java index 13dd29b7b868..92da2c060e38 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/DatabasesClient.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/DatabasesClient.java @@ -28,7 +28,7 @@ public interface DatabasesClient { * @return represents a Database. */ @ServiceMethod(returns = ReturnType.SINGLE) - SyncPoller, DatabaseInner> beginCreate( + SyncPoller, DatabaseInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters); /** @@ -45,7 +45,7 @@ SyncPoller, DatabaseInner> beginCreate( * @return represents a Database. */ @ServiceMethod(returns = ReturnType.SINGLE) - SyncPoller, DatabaseInner> beginCreate( + SyncPoller, DatabaseInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context); /** @@ -61,7 +61,8 @@ SyncPoller, DatabaseInner> beginCreate( * @return represents a Database. */ @ServiceMethod(returns = ReturnType.SINGLE) - DatabaseInner create(String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters); + DatabaseInner createOrUpdate( + String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters); /** * Creates a new database or updates an existing database. @@ -77,7 +78,7 @@ SyncPoller, DatabaseInner> beginCreate( * @return represents a Database. */ @ServiceMethod(returns = ReturnType.SINGLE) - DatabaseInner create( + DatabaseInner createOrUpdate( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context); /** diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/FirewallRulesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/FirewallRulesClient.java index 0bd3c2f8e63f..ec2257f0d26b 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/FirewallRulesClient.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/FirewallRulesClient.java @@ -90,7 +90,7 @@ FirewallRuleInner createOrUpdate( Context context); /** - * Deletes a PostgreSQL server firewall rule. + * 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. @@ -105,7 +105,7 @@ SyncPoller, Void> beginDelete( String resourceGroupName, String serverName, String firewallRuleName); /** - * Deletes a PostgreSQL server firewall rule. + * 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. @@ -121,7 +121,7 @@ SyncPoller, Void> beginDelete( String resourceGroupName, String serverName, String firewallRuleName, Context context); /** - * Deletes a PostgreSQL server firewall rule. + * 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. @@ -134,7 +134,7 @@ SyncPoller, Void> beginDelete( void delete(String resourceGroupName, String serverName, String firewallRuleName); /** - * Deletes a PostgreSQL server firewall rule. + * 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. @@ -148,7 +148,7 @@ SyncPoller, Void> beginDelete( void delete(String resourceGroupName, String serverName, String firewallRuleName, Context context); /** - * List all the firewall rules in a given server. + * 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. @@ -156,13 +156,13 @@ SyncPoller, Void> beginDelete( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown 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. + * @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. + * 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. @@ -171,14 +171,14 @@ SyncPoller, Void> beginDelete( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown 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. + * @return information about a server firewall rule. */ @ServiceMethod(returns = ReturnType.SINGLE) Response getWithResponse( String resourceGroupName, String serverName, String firewallRuleName, Context context); /** - * List all the firewall rules in a given PostgreSQL server. + * 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. @@ -191,7 +191,7 @@ Response getWithResponse( PagedIterable listByServer(String resourceGroupName, String serverName); /** - * List all the firewall rules in a given PostgreSQL server. + * 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. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LocationBasedCapabilitiesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LocationBasedPerformanceTiersClient.java similarity index 70% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LocationBasedCapabilitiesClient.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LocationBasedPerformanceTiersClient.java index ca68879783b3..c3cccee9e255 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LocationBasedCapabilitiesClient.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LocationBasedPerformanceTiersClient.java @@ -8,32 +8,32 @@ import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; -/** An instance of this class provides access to all the operations defined in LocationBasedCapabilitiesClient. */ -public interface LocationBasedCapabilitiesClient { +/** An instance of this class provides access to all the operations defined in LocationBasedPerformanceTiersClient. */ +public interface LocationBasedPerformanceTiersClient { /** - * Get capabilities at specified location in a given subscription. + * 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 capabilities at specified location in a given subscription. + * @return a list of performance tiers. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable execute(String locationName); + PagedIterable list(String locationName); /** - * Get capabilities at specified location in a given subscription. + * 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 capabilities at specified location in a given subscription. + * @return a list of performance tiers. */ @ServiceMethod(returns = ReturnType.COLLECTION) - PagedIterable execute(String locationName, Context context); + PagedIterable list(String locationName, Context context); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LogFilesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LogFilesClient.java new file mode 100644 index 000000000000..7a30a8f468a6 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/LogFilesClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner; + +/** An instance of this class provides access to all the operations defined in LogFilesClient. */ +public interface LogFilesClient { + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PostgreSqlManagementClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PostgreSqlManagementClient.java index 3ab21cdb3288..fe659f97fb27 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PostgreSqlManagementClient.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PostgreSqlManagementClient.java @@ -23,13 +23,6 @@ public interface PostgreSqlManagementClient { */ String getEndpoint(); - /** - * Gets Api Version. - * - * @return the apiVersion value. - */ - String getApiVersion(); - /** * Gets The HTTP pipeline to send requests through. * @@ -51,6 +44,13 @@ public interface PostgreSqlManagementClient { */ ServersClient getServers(); + /** + * Gets the ReplicasClient object to access its operations. + * + * @return the ReplicasClient object. + */ + ReplicasClient getReplicas(); + /** * Gets the FirewallRulesClient object to access its operations. * @@ -58,6 +58,20 @@ public interface PostgreSqlManagementClient { */ 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. * @@ -66,25 +80,53 @@ public interface PostgreSqlManagementClient { ConfigurationsClient getConfigurations(); /** - * Gets the CheckNameAvailabilitiesClient object to access its operations. + * Gets the ServerParametersClient object to access its operations. * - * @return the CheckNameAvailabilitiesClient object. + * @return the ServerParametersClient object. */ - CheckNameAvailabilitiesClient getCheckNameAvailabilities(); + ServerParametersClient getServerParameters(); + + /** + * Gets the LogFilesClient object to access its operations. + * + * @return the LogFilesClient object. + */ + LogFilesClient getLogFiles(); /** - * Gets the LocationBasedCapabilitiesClient object to access its operations. + * Gets the ServerAdministratorsClient object to access its operations. * - * @return the LocationBasedCapabilitiesClient object. + * @return the ServerAdministratorsClient object. */ - LocationBasedCapabilitiesClient getLocationBasedCapabilities(); + ServerAdministratorsClient getServerAdministrators(); /** - * Gets the VirtualNetworkSubnetUsagesClient object to access its operations. + * Gets the RecoverableServersClient object to access its operations. * - * @return the VirtualNetworkSubnetUsagesClient object. + * @return the RecoverableServersClient object. */ - VirtualNetworkSubnetUsagesClient getVirtualNetworkSubnetUsages(); + 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. @@ -94,16 +136,30 @@ public interface PostgreSqlManagementClient { OperationsClient getOperations(); /** - * Gets the DatabasesClient object to access its operations. + * Gets the ServerSecurityAlertPoliciesClient object to access its operations. * - * @return the DatabasesClient object. + * @return the ServerSecurityAlertPoliciesClient object. */ - DatabasesClient getDatabases(); + 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 GetPrivateDnsZoneSuffixesClient object to access its operations. + * Gets the ServerKeysClient object to access its operations. * - * @return the GetPrivateDnsZoneSuffixesClient object. + * @return the ServerKeysClient object. */ - GetPrivateDnsZoneSuffixesClient getGetPrivateDnsZoneSuffixes(); + ServerKeysClient getServerKeys(); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PrivateEndpointConnectionsClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PrivateEndpointConnectionsClient.java new file mode 100644 index 000000000000..4f7304e2e3d1 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PrivateEndpointConnectionsClient.java @@ -0,0 +1,289 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.TagsObject; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public interface PrivateEndpointConnectionsClient { + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner get( + String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters); + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> beginUpdateTags( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters); + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, PrivateEndpointConnectionInner> beginUpdateTags( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context); + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner updateTags( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters); + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateEndpointConnectionInner updateTags( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PrivateLinkResourcesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PrivateLinkResourcesClient.java new file mode 100644 index 000000000000..cc0a748a7f05 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/PrivateLinkResourcesClient.java @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateLinkResourceInner; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public interface PrivateLinkResourcesClient { + /** + * Gets the private link resources for 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. + */ + @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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + PrivateLinkResourceInner get(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/GetPrivateDnsZoneSuffixesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/RecoverableServersClient.java similarity index 55% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/GetPrivateDnsZoneSuffixesClient.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/RecoverableServersClient.java index 16bb5ad1c086..de991120b57c 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/GetPrivateDnsZoneSuffixesClient.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/RecoverableServersClient.java @@ -8,28 +8,35 @@ import com.azure.core.annotation.ServiceMethod; import com.azure.core.http.rest.Response; import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.RecoverableServerResourceInner; -/** An instance of this class provides access to all the operations defined in GetPrivateDnsZoneSuffixesClient. */ -public interface GetPrivateDnsZoneSuffixesClient { +/** An instance of this class provides access to all the operations defined in RecoverableServersClient. */ +public interface RecoverableServersClient { /** - * Get private DNS zone suffix in the cloud. + * 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 private DNS zone suffix in the cloud. + * @return a recoverable PostgreSQL Server. */ @ServiceMethod(returns = ReturnType.SINGLE) - String execute(); + RecoverableServerResourceInner get(String resourceGroupName, String serverName); /** - * Get private DNS zone suffix in the cloud. + * 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 private DNS zone suffix in the cloud. + * @return a recoverable PostgreSQL Server. */ @ServiceMethod(returns = ReturnType.SINGLE) - Response executeWithResponse(Context context); + Response getWithResponse( + String resourceGroupName, String serverName, Context context); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ReplicasClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ReplicasClient.java new file mode 100644 index 000000000000..f2554e6973a4 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ReplicasClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerInner; + +/** An instance of this class provides access to all the operations defined in ReplicasClient. */ +public interface ReplicasClient { + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerAdministratorsClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerAdministratorsClient.java new file mode 100644 index 000000000000..3befd8a93693 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerAdministratorsClient.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerAdministratorResourceInner; + +/** 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAdministratorResourceInner get(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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) + Response getWithResponse( + String resourceGroupName, String serverName, Context context); + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerAdministratorResourceInner> beginCreateOrUpdate( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerAdministratorResourceInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, Context context); + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAdministratorResourceInner createOrUpdate( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerAdministratorResourceInner createOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, 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 the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, Context context); + + /** + * 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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerBasedPerformanceTiersClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerBasedPerformanceTiersClient.java new file mode 100644 index 000000000000..b33e100945a3 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerBasedPerformanceTiersClient.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; + +/** An instance of this class provides access to all the operations defined in ServerBasedPerformanceTiersClient. */ +public interface ServerBasedPerformanceTiersClient { + /** + * List all the performance tiers for a 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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable list(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerKeysClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerKeysClient.java new file mode 100644 index 000000000000..878d603cac4d --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerKeysClient.java @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerKeyInner; + +/** 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. + */ + @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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerKeyInner get(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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) + Response getWithResponse( + String resourceGroupName, String serverName, String keyName, Context context); + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @param parameters The requested PostgreSQL Server key resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a PostgreSQL Server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerKeyInner> beginCreateOrUpdate( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters, Context context); + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerKeyInner createOrUpdate( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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 createOrUpdate( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters, Context context); + + /** + * 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String serverName, String keyName, String resourceGroupName, Context context); + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String serverName, String keyName, String resourceGroupName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerParametersClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerParametersClient.java new file mode 100644 index 000000000000..4d1a11b6aa96 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerParametersClient.java @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationListResultInner; + +/** An instance of this class provides access to all the operations defined in ServerParametersClient. */ +public interface ServerParametersClient { + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ConfigurationListResultInner> beginListUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value); + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ConfigurationListResultInner> beginListUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context); + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfigurationListResultInner listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value); + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ConfigurationListResultInner listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerSecurityAlertPoliciesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerSecurityAlertPoliciesClient.java new file mode 100644 index 000000000000..46c85c5a6ddf --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServerSecurityAlertPoliciesClient.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.postgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SecurityAlertPolicyName; + +/** An instance of this class provides access to all the operations defined in ServerSecurityAlertPoliciesClient. */ +public interface ServerSecurityAlertPoliciesClient { + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerSecurityAlertPolicyInner get( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName); + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters); + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context); + + /** + * 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. + */ + @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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer( + String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServersClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServersClient.java index f414c42e8dba..529a782aecb8 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServersClient.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/ServersClient.java @@ -12,13 +12,13 @@ import com.azure.core.util.Context; import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.RestartParameter; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerForUpdate; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerForCreate; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerUpdateParameters; /** An instance of this class provides access to all the operations defined in ServersClient. */ public interface ServersClient { /** - * Creates a new server. + * 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. @@ -30,10 +30,10 @@ public interface ServersClient { */ @ServiceMethod(returns = ReturnType.SINGLE) SyncPoller, ServerInner> beginCreate( - String resourceGroupName, String serverName, ServerInner parameters); + String resourceGroupName, String serverName, ServerForCreate parameters); /** - * Creates a new server. + * 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. @@ -46,10 +46,10 @@ SyncPoller, ServerInner> beginCreate( */ @ServiceMethod(returns = ReturnType.SINGLE) SyncPoller, ServerInner> beginCreate( - String resourceGroupName, String serverName, ServerInner parameters, Context context); + String resourceGroupName, String serverName, ServerForCreate parameters, Context context); /** - * Creates a new server. + * 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. @@ -60,10 +60,10 @@ SyncPoller, ServerInner> beginCreate( * @return represents a server. */ @ServiceMethod(returns = ReturnType.SINGLE) - ServerInner create(String resourceGroupName, String serverName, ServerInner parameters); + ServerInner create(String resourceGroupName, String serverName, ServerForCreate parameters); /** - * Creates a new server. + * 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. @@ -75,7 +75,7 @@ SyncPoller, ServerInner> beginCreate( * @return represents a server. */ @ServiceMethod(returns = ReturnType.SINGLE) - ServerInner create(String resourceGroupName, String serverName, ServerInner parameters, Context context); + ServerInner create(String resourceGroupName, String serverName, ServerForCreate parameters, Context context); /** * Updates an existing server. The request body can contain one to many of the properties present in the normal @@ -91,7 +91,7 @@ SyncPoller, ServerInner> beginCreate( */ @ServiceMethod(returns = ReturnType.SINGLE) SyncPoller, ServerInner> beginUpdate( - String resourceGroupName, String serverName, ServerForUpdate parameters); + 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 @@ -108,7 +108,7 @@ SyncPoller, ServerInner> beginUpdate( */ @ServiceMethod(returns = ReturnType.SINGLE) SyncPoller, ServerInner> beginUpdate( - String resourceGroupName, String serverName, ServerForUpdate parameters, Context context); + String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context); /** * Updates an existing server. The request body can contain one to many of the properties present in the normal @@ -123,7 +123,7 @@ SyncPoller, ServerInner> beginUpdate( * @return represents a server. */ @ServiceMethod(returns = ReturnType.SINGLE) - ServerInner update(String resourceGroupName, String serverName, ServerForUpdate parameters); + ServerInner update(String resourceGroupName, String serverName, ServerUpdateParameters parameters); /** * Updates an existing server. The request body can contain one to many of the properties present in the normal @@ -139,7 +139,7 @@ SyncPoller, ServerInner> beginUpdate( * @return represents a server. */ @ServiceMethod(returns = ReturnType.SINGLE) - ServerInner update(String resourceGroupName, String serverName, ServerForUpdate parameters, Context context); + ServerInner update(String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context); /** * Deletes a server. @@ -272,22 +272,19 @@ SyncPoller, ServerInner> beginUpdate( * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The parameters for restarting 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 completion. */ @ServiceMethod(returns = ReturnType.SINGLE) - SyncPoller, Void> beginRestart( - String resourceGroupName, String serverName, RestartParameter parameters); + 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 parameters The parameters for restarting 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. @@ -295,21 +292,7 @@ SyncPoller, Void> beginRestart( * @return the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) - SyncPoller, Void> beginRestart( - String resourceGroupName, String serverName, RestartParameter parameters, 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. - * @param parameters The parameters for restarting 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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void restart(String resourceGroupName, String serverName, RestartParameter parameters); + SyncPoller, Void> beginRestart(String resourceGroupName, String serverName, Context context); /** * Restarts a server. @@ -328,116 +311,11 @@ SyncPoller, Void> beginRestart( * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The parameters for restarting a server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void restart(String resourceGroupName, String serverName, RestartParameter parameters, Context context); - - /** - * Starts a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SyncPoller, Void> beginStart(String resourceGroupName, String serverName); - - /** - * Starts a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SyncPoller, Void> beginStart(String resourceGroupName, String serverName, Context context); - - /** - * Starts a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void start(String resourceGroupName, String serverName); - - /** - * Starts a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void start(String resourceGroupName, String serverName, Context context); - - /** - * Stops a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SyncPoller, Void> beginStop(String resourceGroupName, String serverName); - - /** - * Stops a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - SyncPoller, Void> beginStop(String resourceGroupName, String serverName, Context context); - - /** - * Stops a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - void stop(String resourceGroupName, String serverName); - - /** - * Stops a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ @ServiceMethod(returns = ReturnType.SINGLE) - void stop(String resourceGroupName, String serverName, Context context); + void restart(String resourceGroupName, String serverName, Context context); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/VirtualNetworkRulesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/VirtualNetworkRulesClient.java new file mode 100644 index 000000000000..de3179ea0cb5 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/VirtualNetworkRulesClient.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent; + +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkRuleInner; + +/** An instance of this class provides access to all the operations defined in VirtualNetworkRulesClient. */ +public interface VirtualNetworkRulesClient { + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkRuleInner get(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters); + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context); + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, String serverName, String virtualNetworkRuleName, VirtualNetworkRuleInner parameters); + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/VirtualNetworkSubnetUsagesClient.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/VirtualNetworkSubnetUsagesClient.java deleted file mode 100644 index 36279e65b3a7..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/VirtualNetworkSubnetUsagesClient.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.fluent; - -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; - -/** An instance of this class provides access to all the operations defined in VirtualNetworkSubnetUsagesClient. */ -public interface VirtualNetworkSubnetUsagesClient { - /** - * Get virtual network subnet usage for a given vNet resource id. - * - * @param locationName The name of the location. - * @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 virtual network subnet usage for a given vNet resource id. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - VirtualNetworkSubnetUsageResultInner execute(String locationName, VirtualNetworkSubnetUsageParameter parameters); - - /** - * Get virtual network subnet usage for a given vNet resource id. - * - * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating a server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return virtual network subnet usage for a given vNet resource id. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - Response executeWithResponse( - String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context); -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/CapabilityPropertiesInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/CapabilityPropertiesInner.java deleted file mode 100644 index eb94b8598405..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/CapabilityPropertiesInner.java +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.models.FlexibleServerEditionCapability; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HyperscaleNodeEditionCapability; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** Location capabilities. */ -@Immutable -public final class CapabilityPropertiesInner { - @JsonIgnore private final ClientLogger logger = new ClientLogger(CapabilityPropertiesInner.class); - - /* - * zone name - */ - @JsonProperty(value = "zone", access = JsonProperty.Access.WRITE_ONLY) - private String zone; - - /* - * A value indicating whether a new server in this region can have - * geo-backups to paired region. - */ - @JsonProperty(value = "geoBackupSupported", access = JsonProperty.Access.WRITE_ONLY) - private Boolean geoBackupSupported; - - /* - * A value indicating whether a new server in this region can support multi - * zone HA. - */ - @JsonProperty(value = "zoneRedundantHaSupported", access = JsonProperty.Access.WRITE_ONLY) - private Boolean zoneRedundantHaSupported; - - /* - * A value indicating whether a new server in this region can have - * geo-backups to paired region. - */ - @JsonProperty(value = "zoneRedundantHaAndGeoBackupSupported", access = JsonProperty.Access.WRITE_ONLY) - private Boolean zoneRedundantHaAndGeoBackupSupported; - - /* - * The supportedFlexibleServerEditions property. - */ - @JsonProperty(value = "supportedFlexibleServerEditions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedFlexibleServerEditions; - - /* - * The supportedHyperscaleNodeEditions property. - */ - @JsonProperty(value = "supportedHyperscaleNodeEditions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedHyperscaleNodeEditions; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** - * Get the zone property: zone name. - * - * @return the zone value. - */ - public String zone() { - return this.zone; - } - - /** - * Get the geoBackupSupported property: A value indicating whether a new server in this region can have geo-backups - * to paired region. - * - * @return the geoBackupSupported value. - */ - public Boolean geoBackupSupported() { - return this.geoBackupSupported; - } - - /** - * Get the zoneRedundantHaSupported property: A value indicating whether a new server in this region can support - * multi zone HA. - * - * @return the zoneRedundantHaSupported value. - */ - public Boolean zoneRedundantHaSupported() { - return this.zoneRedundantHaSupported; - } - - /** - * Get the zoneRedundantHaAndGeoBackupSupported property: A value indicating whether a new server in this region can - * have geo-backups to paired region. - * - * @return the zoneRedundantHaAndGeoBackupSupported value. - */ - public Boolean zoneRedundantHaAndGeoBackupSupported() { - return this.zoneRedundantHaAndGeoBackupSupported; - } - - /** - * Get the supportedFlexibleServerEditions property: The supportedFlexibleServerEditions property. - * - * @return the supportedFlexibleServerEditions value. - */ - public List supportedFlexibleServerEditions() { - return this.supportedFlexibleServerEditions; - } - - /** - * Get the supportedHyperscaleNodeEditions property: The supportedHyperscaleNodeEditions property. - * - * @return the supportedHyperscaleNodeEditions value. - */ - public List supportedHyperscaleNodeEditions() { - return this.supportedHyperscaleNodeEditions; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (supportedFlexibleServerEditions() != null) { - supportedFlexibleServerEditions().forEach(e -> e.validate()); - } - if (supportedHyperscaleNodeEditions() != null) { - supportedHyperscaleNodeEditions().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ConfigurationInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ConfigurationInner.java index a793c5892b11..4bcb3d8e5ce5 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ConfigurationInner.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ConfigurationInner.java @@ -7,9 +7,7 @@ import com.azure.core.annotation.Fluent; import com.azure.core.annotation.JsonFlatten; import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ConfigurationDataType; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -19,12 +17,6 @@ public class ConfigurationInner extends ProxyResource { @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigurationInner.class); - /* - * The system metadata relating to this resource. - */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) - private SystemData systemData; - /* * Value of the configuration. */ @@ -47,7 +39,7 @@ public class ConfigurationInner extends ProxyResource { * Data type of the configuration. */ @JsonProperty(value = "properties.dataType", access = JsonProperty.Access.WRITE_ONLY) - private ConfigurationDataType dataType; + private String dataType; /* * Allowed values of the configuration. @@ -61,15 +53,6 @@ public class ConfigurationInner extends ProxyResource { @JsonProperty(value = "properties.source") private String source; - /** - * Get the systemData property: The system metadata relating to this resource. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - /** * Get the value property: Value of the configuration. * @@ -113,7 +96,7 @@ public String defaultValue() { * * @return the dataType value. */ - public ConfigurationDataType dataType() { + public String dataType() { return this.dataType; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ConfigurationListResultInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ConfigurationListResultInner.java new file mode 100644 index 000000000000..90814fb508fe --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ConfigurationListResultInner.java @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of server configurations. */ +@Fluent +public final class ConfigurationListResultInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigurationListResultInner.class); + + /* + * The list of server configurations. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of server configurations. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of server configurations. + * + * @param value the value value to set. + * @return the ConfigurationListResultInner object itself. + */ + public ConfigurationListResultInner withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/DatabaseInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/DatabaseInner.java index 1080849b5c54..79579f7815f7 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/DatabaseInner.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/DatabaseInner.java @@ -7,7 +7,6 @@ import com.azure.core.annotation.Fluent; import com.azure.core.annotation.JsonFlatten; import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -18,12 +17,6 @@ public class DatabaseInner extends ProxyResource { @JsonIgnore private final ClientLogger logger = new ClientLogger(DatabaseInner.class); - /* - * The system metadata relating to this resource. - */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) - private SystemData systemData; - /* * The charset of the database. */ @@ -36,15 +29,6 @@ public class DatabaseInner extends ProxyResource { @JsonProperty(value = "properties.collation") private String collation; - /** - * Get the systemData property: The system metadata relating to this resource. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - /** * Get the charset property: The charset of the database. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/FirewallRuleInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/FirewallRuleInner.java index 66b41812cf67..95ade13d1a91 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/FirewallRuleInner.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/FirewallRuleInner.java @@ -7,7 +7,6 @@ import com.azure.core.annotation.Fluent; import com.azure.core.annotation.JsonFlatten; import com.azure.core.management.ProxyResource; -import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; @@ -18,12 +17,6 @@ public class FirewallRuleInner extends ProxyResource { @JsonIgnore private final ClientLogger logger = new ClientLogger(FirewallRuleInner.class); - /* - * The system metadata relating to this resource. - */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) - private SystemData systemData; - /* * The start IP address of the server firewall rule. Must be IPv4 format. */ @@ -36,15 +29,6 @@ public class FirewallRuleInner extends ProxyResource { @JsonProperty(value = "properties.endIpAddress", required = true) private String endIpAddress; - /** - * Get the systemData property: The system metadata relating to this resource. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - /** * Get the startIpAddress property: The start IP address of the server firewall rule. Must be IPv4 format. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LogFileInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LogFileInner.java new file mode 100644 index 000000000000..68428b2068ac --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/LogFileInner.java @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** Represents a log file. */ +@JsonFlatten +@Fluent +public class LogFileInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogFileInner.class); + + /* + * Size of the log file. + */ + @JsonProperty(value = "properties.sizeInKB") + private Long sizeInKB; + + /* + * Creation timestamp of the log file. + */ + @JsonProperty(value = "properties.createdTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime createdTime; + + /* + * Last modified timestamp of the log file. + */ + @JsonProperty(value = "properties.lastModifiedTime", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime lastModifiedTime; + + /* + * Type of the log file. + */ + @JsonProperty(value = "properties.type") + private String typePropertiesType; + + /* + * The url to download the log file from. + */ + @JsonProperty(value = "properties.url") + private String url; + + /** + * Get the sizeInKB property: Size of the log file. + * + * @return the sizeInKB value. + */ + public Long sizeInKB() { + return this.sizeInKB; + } + + /** + * Set the sizeInKB property: Size of the log file. + * + * @param sizeInKB the sizeInKB value to set. + * @return the LogFileInner object itself. + */ + public LogFileInner withSizeInKB(Long sizeInKB) { + this.sizeInKB = sizeInKB; + return this; + } + + /** + * Get the createdTime property: Creation timestamp of the log file. + * + * @return the createdTime value. + */ + public OffsetDateTime createdTime() { + return this.createdTime; + } + + /** + * Get the lastModifiedTime property: Last modified timestamp of the log file. + * + * @return the lastModifiedTime value. + */ + public OffsetDateTime lastModifiedTime() { + return this.lastModifiedTime; + } + + /** + * Get the typePropertiesType property: Type of the log file. + * + * @return the typePropertiesType value. + */ + public String typePropertiesType() { + return this.typePropertiesType; + } + + /** + * Set the typePropertiesType property: Type of the log file. + * + * @param typePropertiesType the typePropertiesType value to set. + * @return the LogFileInner object itself. + */ + public LogFileInner withTypePropertiesType(String typePropertiesType) { + this.typePropertiesType = typePropertiesType; + return this; + } + + /** + * Get the url property: The url to download the log file from. + * + * @return the url value. + */ + public String url() { + return this.url; + } + + /** + * Set the url property: The url to download the log file from. + * + * @param url the url value to set. + * @return the LogFileInner object itself. + */ + public LogFileInner withUrl(String url) { + this.url = url; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/NameAvailabilityInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/NameAvailabilityInner.java index 3cd7e88f34d8..b900582206b7 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/NameAvailabilityInner.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/NameAvailabilityInner.java @@ -27,16 +27,10 @@ public final class NameAvailabilityInner { private Boolean nameAvailable; /* - * name of the PostgreSQL server. + * Reason for name being unavailable. */ - @JsonProperty(value = "name") - private String name; - - /* - * type of the server - */ - @JsonProperty(value = "type") - private String type; + @JsonProperty(value = "reason") + private String reason; /** * Get the message property: Error Message. @@ -79,42 +73,22 @@ public NameAvailabilityInner withNameAvailable(Boolean nameAvailable) { } /** - * Get the name property: name of the PostgreSQL server. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Set the name property: name of the PostgreSQL server. - * - * @param name the name value to set. - * @return the NameAvailabilityInner object itself. - */ - public NameAvailabilityInner withName(String name) { - this.name = name; - return this; - } - - /** - * Get the type property: type of the server. + * Get the reason property: Reason for name being unavailable. * - * @return the type value. + * @return the reason value. */ - public String type() { - return this.type; + public String reason() { + return this.reason; } /** - * Set the type property: type of the server. + * Set the reason property: Reason for name being unavailable. * - * @param type the type value to set. + * @param reason the reason value to set. * @return the NameAvailabilityInner object itself. */ - public NameAvailabilityInner withType(String type) { - this.type = type; + public NameAvailabilityInner withReason(String reason) { + this.reason = reason; return this; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/OperationListResultInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/OperationListResultInner.java index 6f38a5cc24bf..fa2b2016e9e4 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/OperationListResultInner.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/OperationListResultInner.java @@ -17,20 +17,13 @@ public final class OperationListResultInner { @JsonIgnore private final ClientLogger logger = new ClientLogger(OperationListResultInner.class); /* - * Collection of available operation details + * The list of resource provider operations. */ @JsonProperty(value = "value") private List value; - /* - * URL client should use to fetch the next page (per server side paging). - * It's null for now, added for future use. - */ - @JsonProperty(value = "nextLink") - private String nextLink; - /** - * Get the value property: Collection of available operation details. + * Get the value property: The list of resource provider operations. * * @return the value value. */ @@ -39,7 +32,7 @@ public List value() { } /** - * Set the value property: Collection of available operation details. + * Set the value property: The list of resource provider operations. * * @param value the value value to set. * @return the OperationListResultInner object itself. @@ -49,28 +42,6 @@ public OperationListResultInner withValue(List value) { return this; } - /** - * Get the nextLink property: URL client should use to fetch the next page (per server side paging). It's null for - * now, added for future use. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Set the nextLink property: URL client should use to fetch the next page (per server side paging). It's null for - * now, added for future use. - * - * @param nextLink the nextLink value to set. - * @return the OperationListResultInner object itself. - */ - public OperationListResultInner withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - /** * Validates the instance. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PerformanceTierPropertiesInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PerformanceTierPropertiesInner.java new file mode 100644 index 000000000000..f1b578653e5d --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PerformanceTierPropertiesInner.java @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PerformanceTierServiceLevelObjectives; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Performance tier properties. */ +@Fluent +public final class PerformanceTierPropertiesInner { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PerformanceTierPropertiesInner.class); + + /* + * ID of the performance tier. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Maximum Backup retention in days for the performance tier edition + */ + @JsonProperty(value = "maxBackupRetentionDays") + private Integer maxBackupRetentionDays; + + /* + * Minimum Backup retention in days for the performance tier edition + */ + @JsonProperty(value = "minBackupRetentionDays") + private Integer minBackupRetentionDays; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "maxStorageMB") + private Integer maxStorageMB; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "minLargeStorageMB") + private Integer minLargeStorageMB; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "maxLargeStorageMB") + private Integer maxLargeStorageMB; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "minStorageMB") + private Integer minStorageMB; + + /* + * Service level objectives associated with the performance tier + */ + @JsonProperty(value = "serviceLevelObjectives") + private List serviceLevelObjectives; + + /** + * Get the id property: ID of the performance tier. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: ID of the performance tier. + * + * @param id the id value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withId(String id) { + this.id = id; + return this; + } + + /** + * Get the maxBackupRetentionDays property: Maximum Backup retention in days for the performance tier edition. + * + * @return the maxBackupRetentionDays value. + */ + public Integer maxBackupRetentionDays() { + return this.maxBackupRetentionDays; + } + + /** + * Set the maxBackupRetentionDays property: Maximum Backup retention in days for the performance tier edition. + * + * @param maxBackupRetentionDays the maxBackupRetentionDays value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withMaxBackupRetentionDays(Integer maxBackupRetentionDays) { + this.maxBackupRetentionDays = maxBackupRetentionDays; + return this; + } + + /** + * Get the minBackupRetentionDays property: Minimum Backup retention in days for the performance tier edition. + * + * @return the minBackupRetentionDays value. + */ + public Integer minBackupRetentionDays() { + return this.minBackupRetentionDays; + } + + /** + * Set the minBackupRetentionDays property: Minimum Backup retention in days for the performance tier edition. + * + * @param minBackupRetentionDays the minBackupRetentionDays value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withMinBackupRetentionDays(Integer minBackupRetentionDays) { + this.minBackupRetentionDays = minBackupRetentionDays; + return this; + } + + /** + * Get the maxStorageMB property: Max storage allowed for a server. + * + * @return the maxStorageMB value. + */ + public Integer maxStorageMB() { + return this.maxStorageMB; + } + + /** + * Set the maxStorageMB property: Max storage allowed for a server. + * + * @param maxStorageMB the maxStorageMB value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withMaxStorageMB(Integer maxStorageMB) { + this.maxStorageMB = maxStorageMB; + return this; + } + + /** + * Get the minLargeStorageMB property: Max storage allowed for a server. + * + * @return the minLargeStorageMB value. + */ + public Integer minLargeStorageMB() { + return this.minLargeStorageMB; + } + + /** + * Set the minLargeStorageMB property: Max storage allowed for a server. + * + * @param minLargeStorageMB the minLargeStorageMB value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withMinLargeStorageMB(Integer minLargeStorageMB) { + this.minLargeStorageMB = minLargeStorageMB; + return this; + } + + /** + * Get the maxLargeStorageMB property: Max storage allowed for a server. + * + * @return the maxLargeStorageMB value. + */ + public Integer maxLargeStorageMB() { + return this.maxLargeStorageMB; + } + + /** + * Set the maxLargeStorageMB property: Max storage allowed for a server. + * + * @param maxLargeStorageMB the maxLargeStorageMB value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withMaxLargeStorageMB(Integer maxLargeStorageMB) { + this.maxLargeStorageMB = maxLargeStorageMB; + return this; + } + + /** + * Get the minStorageMB property: Max storage allowed for a server. + * + * @return the minStorageMB value. + */ + public Integer minStorageMB() { + return this.minStorageMB; + } + + /** + * Set the minStorageMB property: Max storage allowed for a server. + * + * @param minStorageMB the minStorageMB value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withMinStorageMB(Integer minStorageMB) { + this.minStorageMB = minStorageMB; + return this; + } + + /** + * Get the serviceLevelObjectives property: Service level objectives associated with the performance tier. + * + * @return the serviceLevelObjectives value. + */ + public List serviceLevelObjectives() { + return this.serviceLevelObjectives; + } + + /** + * Set the serviceLevelObjectives property: Service level objectives associated with the performance tier. + * + * @param serviceLevelObjectives the serviceLevelObjectives value to set. + * @return the PerformanceTierPropertiesInner object itself. + */ + public PerformanceTierPropertiesInner withServiceLevelObjectives( + List serviceLevelObjectives) { + this.serviceLevelObjectives = serviceLevelObjectives; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (serviceLevelObjectives() != null) { + serviceLevelObjectives().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PrivateEndpointConnectionInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PrivateEndpointConnectionInner.java new file mode 100644 index 000000000000..3f50a46adf47 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PrivateEndpointConnectionInner.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateEndpointProperty; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateLinkServiceConnectionStateProperty; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection. */ +@JsonFlatten +@Fluent +public class PrivateEndpointConnectionInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionInner.class); + + /* + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "properties.privateEndpoint") + private PrivateEndpointProperty privateEndpoint; + + /* + * Connection state of the private endpoint connection. + */ + @JsonProperty(value = "properties.privateLinkServiceConnectionState") + private PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /* + * State of the private endpoint connection. + */ + @JsonProperty(value = "properties.provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private String provisioningState; + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the PrivateEndpointConnectionInner object itself. + */ + public PrivateEndpointConnectionInner withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + public String provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/VirtualNetworkSubnetUsageResultInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PrivateLinkResourceInner.java similarity index 51% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/VirtualNetworkSubnetUsageResultInner.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PrivateLinkResourceInner.java index 17d0e45dc47c..033a016b2fbd 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/VirtualNetworkSubnetUsageResultInner.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/PrivateLinkResourceInner.java @@ -5,30 +5,30 @@ package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; import com.azure.core.annotation.Immutable; +import com.azure.core.management.ProxyResource; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.models.DelegatedSubnetUsage; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateLinkResourceProperties; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; -/** Virtual network subnet usage data. */ +/** A private link resource. */ @Immutable -public final class VirtualNetworkSubnetUsageResultInner { - @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkSubnetUsageResultInner.class); +public final class PrivateLinkResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceInner.class); /* - * The delegatedSubnetsUsage property. + * The private link resource group id. */ - @JsonProperty(value = "delegatedSubnetsUsage", access = JsonProperty.Access.WRITE_ONLY) - private List delegatedSubnetsUsage; + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private PrivateLinkResourceProperties properties; /** - * Get the delegatedSubnetsUsage property: The delegatedSubnetsUsage property. + * Get the properties property: The private link resource group id. * - * @return the delegatedSubnetsUsage value. + * @return the properties value. */ - public List delegatedSubnetsUsage() { - return this.delegatedSubnetsUsage; + public PrivateLinkResourceProperties properties() { + return this.properties; } /** @@ -37,8 +37,8 @@ public List delegatedSubnetsUsage() { * @throws IllegalArgumentException thrown if the instance is not valid. */ public void validate() { - if (delegatedSubnetsUsage() != null) { - delegatedSubnetsUsage().forEach(e -> e.validate()); + if (properties() != null) { + properties().validate(); } } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/RecoverableServerResourceInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/RecoverableServerResourceInner.java new file mode 100644 index 000000000000..9ecf97bd92a3 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/RecoverableServerResourceInner.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A recoverable server resource. */ +@JsonFlatten +@Immutable +public class RecoverableServerResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecoverableServerResourceInner.class); + + /* + * The last available backup date time. + */ + @JsonProperty(value = "properties.lastAvailableBackupDateTime", access = JsonProperty.Access.WRITE_ONLY) + private String lastAvailableBackupDateTime; + + /* + * The service level objective + */ + @JsonProperty(value = "properties.serviceLevelObjective", access = JsonProperty.Access.WRITE_ONLY) + private String serviceLevelObjective; + + /* + * Edition of the performance tier. + */ + @JsonProperty(value = "properties.edition", access = JsonProperty.Access.WRITE_ONLY) + private String edition; + + /* + * vCore associated with the service level objective + */ + @JsonProperty(value = "properties.vCore", access = JsonProperty.Access.WRITE_ONLY) + private Integer vCore; + + /* + * Hardware generation associated with the service level objective + */ + @JsonProperty(value = "properties.hardwareGeneration", access = JsonProperty.Access.WRITE_ONLY) + private String hardwareGeneration; + + /* + * The PostgreSQL version + */ + @JsonProperty(value = "properties.version", access = JsonProperty.Access.WRITE_ONLY) + private String version; + + /** + * Get the lastAvailableBackupDateTime property: The last available backup date time. + * + * @return the lastAvailableBackupDateTime value. + */ + public String lastAvailableBackupDateTime() { + return this.lastAvailableBackupDateTime; + } + + /** + * Get the serviceLevelObjective property: The service level objective. + * + * @return the serviceLevelObjective value. + */ + public String serviceLevelObjective() { + return this.serviceLevelObjective; + } + + /** + * Get the edition property: Edition of the performance tier. + * + * @return the edition value. + */ + public String edition() { + return this.edition; + } + + /** + * Get the vCore property: vCore associated with the service level objective. + * + * @return the vCore value. + */ + public Integer vCore() { + return this.vCore; + } + + /** + * Get the hardwareGeneration property: Hardware generation associated with the service level objective. + * + * @return the hardwareGeneration value. + */ + public String hardwareGeneration() { + return this.hardwareGeneration; + } + + /** + * Get the version property: The PostgreSQL version. + * + * @return the version value. + */ + public String version() { + return this.version; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerAdministratorResourceInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerAdministratorResourceInner.java new file mode 100644 index 000000000000..2ffbd94a8549 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerAdministratorResourceInner.java @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.models.AdministratorType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; + +/** Represents a and external administrator to be created. */ +@JsonFlatten +@Fluent +public class ServerAdministratorResourceInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerAdministratorResourceInner.class); + + /* + * The type of administrator. + */ + @JsonProperty(value = "properties.administratorType") + private AdministratorType administratorType; + + /* + * The server administrator login account name. + */ + @JsonProperty(value = "properties.login") + private String login; + + /* + * The server administrator Sid (Secure ID). + */ + @JsonProperty(value = "properties.sid") + private UUID sid; + + /* + * The server Active Directory Administrator tenant id. + */ + @JsonProperty(value = "properties.tenantId") + private UUID tenantId; + + /** + * Get the administratorType property: The type of administrator. + * + * @return the administratorType value. + */ + public AdministratorType administratorType() { + return this.administratorType; + } + + /** + * Set the administratorType property: The type of administrator. + * + * @param administratorType the administratorType value to set. + * @return the ServerAdministratorResourceInner object itself. + */ + public ServerAdministratorResourceInner withAdministratorType(AdministratorType administratorType) { + this.administratorType = administratorType; + return this; + } + + /** + * Get the login property: The server administrator login account name. + * + * @return the login value. + */ + public String login() { + return this.login; + } + + /** + * Set the login property: The server administrator login account name. + * + * @param login the login value to set. + * @return the ServerAdministratorResourceInner object itself. + */ + public ServerAdministratorResourceInner withLogin(String login) { + this.login = login; + return this; + } + + /** + * Get the sid property: The server administrator Sid (Secure ID). + * + * @return the sid value. + */ + public UUID sid() { + return this.sid; + } + + /** + * Set the sid property: The server administrator Sid (Secure ID). + * + * @param sid the sid value to set. + * @return the ServerAdministratorResourceInner object itself. + */ + public ServerAdministratorResourceInner withSid(UUID sid) { + this.sid = sid; + return this; + } + + /** + * Get the tenantId property: The server Active Directory Administrator tenant id. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + + /** + * Set the tenantId property: The server Active Directory Administrator tenant id. + * + * @param tenantId the tenantId value to set. + * @return the ServerAdministratorResourceInner object itself. + */ + public ServerAdministratorResourceInner withTenantId(UUID tenantId) { + this.tenantId = tenantId; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerInner.java index b5b2373b59c6..92936947cd7b 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerInner.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerInner.java @@ -7,21 +7,21 @@ import com.azure.core.annotation.Fluent; import com.azure.core.annotation.JsonFlatten; import com.azure.core.management.Resource; -import com.azure.core.management.SystemData; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailability; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Identity; -import com.azure.resourcemanager.postgresqlflexibleserver.models.MaintenanceWindow; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Network; +import com.azure.resourcemanager.postgresqlflexibleserver.models.InfrastructureEncryption; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ResourceIdentity; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerPrivateEndpointConnection; import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerState; import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerVersion; import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageProfile; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.time.OffsetDateTime; +import java.util.List; import java.util.Map; /** Represents a server. */ @@ -34,7 +34,7 @@ public class ServerInner extends Resource { * The Azure Active Directory identity of the server. */ @JsonProperty(value = "identity") - private Identity identity; + private ResourceIdentity identity; /* * The SKU (pricing tier) of the server. @@ -42,12 +42,6 @@ public class ServerInner extends Resource { @JsonProperty(value = "sku") private Sku sku; - /* - * The system metadata relating to this resource. - */ - @JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY) - private SystemData systemData; - /* * The administrator's login name of a server. Can only be specified when * the server is being created (and is required for creation). @@ -56,103 +50,97 @@ public class ServerInner extends Resource { private String administratorLogin; /* - * The administrator login password (required for server creation). - */ - @JsonProperty(value = "properties.administratorLoginPassword") - private String administratorLoginPassword; - - /* - * PostgreSQL Server version. + * Server version. */ @JsonProperty(value = "properties.version") private ServerVersion version; /* - * The minor version of the server. + * Enable ssl enforcement or not when connect to server. */ - @JsonProperty(value = "properties.minorVersion", access = JsonProperty.Access.WRITE_ONLY) - private String minorVersion; + @JsonProperty(value = "properties.sslEnforcement") + private SslEnforcementEnum sslEnforcement; /* - * A state of a server that is visible to user. + * Enforce a minimal Tls version for the server. */ - @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) - private ServerState state; + @JsonProperty(value = "properties.minimalTlsVersion") + private MinimalTlsVersionEnum minimalTlsVersion; /* - * The fully qualified domain name of a server. + * Status showing whether the server data encryption is enabled with + * customer-managed keys. */ - @JsonProperty(value = "properties.fullyQualifiedDomainName", access = JsonProperty.Access.WRITE_ONLY) - private String fullyQualifiedDomainName; + @JsonProperty(value = "properties.byokEnforcement", access = JsonProperty.Access.WRITE_ONLY) + private String byokEnforcement; /* - * Storage properties of a server. + * Status showing whether the server enabled infrastructure encryption. */ - @JsonProperty(value = "properties.storage") - private Storage storage; + @JsonProperty(value = "properties.infrastructureEncryption") + private InfrastructureEncryption infrastructureEncryption; /* - * Backup properties of a server. + * A state of a server that is visible to user. */ - @JsonProperty(value = "properties.backup") - private Backup backup; + @JsonProperty(value = "properties.userVisibleState") + private ServerState userVisibleState; /* - * Network properties of a server. + * The fully qualified domain name of a server. */ - @JsonProperty(value = "properties.network") - private Network network; + @JsonProperty(value = "properties.fullyQualifiedDomainName") + private String fullyQualifiedDomainName; /* - * High availability properties of a server. + * Earliest restore point creation time (ISO8601 format) */ - @JsonProperty(value = "properties.highAvailability") - private HighAvailability highAvailability; + @JsonProperty(value = "properties.earliestRestoreDate") + private OffsetDateTime earliestRestoreDate; /* - * Maintenance window properties of a server. + * Storage profile of a server. */ - @JsonProperty(value = "properties.maintenanceWindow") - private MaintenanceWindow maintenanceWindow; + @JsonProperty(value = "properties.storageProfile") + private StorageProfile storageProfile; /* - * The source server resource ID to restore from. It's required when - * 'createMode' is 'PointInTimeRestore'. + * The replication role of the server. */ - @JsonProperty(value = "properties.sourceServerResourceId") - private String sourceServerResourceId; + @JsonProperty(value = "properties.replicationRole") + private String replicationRole; /* - * Restore point creation time (ISO8601 format), specifying the time to - * restore from. It's required when 'createMode' is 'PointInTimeRestore'. + * The master server id of a replica server. */ - @JsonProperty(value = "properties.pointInTimeUTC") - private OffsetDateTime pointInTimeUtc; + @JsonProperty(value = "properties.masterServerId") + private String masterServerId; /* - * availability zone information of the server. + * The maximum number of replicas that a master server can have. */ - @JsonProperty(value = "properties.availabilityZone") - private String availabilityZone; + @JsonProperty(value = "properties.replicaCapacity") + private Integer replicaCapacity; /* - * The mode to create a new PostgreSQL server. + * Whether or not public network access is allowed for this server. Value + * is optional but if passed in, must be 'Enabled' or 'Disabled' */ - @JsonProperty(value = "properties.createMode") - private CreateMode createMode; + @JsonProperty(value = "properties.publicNetworkAccess") + private PublicNetworkAccessEnum publicNetworkAccess; /* - * Application-specific metadata in the form of key-value pairs. + * List of private endpoint connections on a server */ - @JsonProperty(value = "properties.tags") - private Map tagsPropertiesTags; + @JsonProperty(value = "properties.privateEndpointConnections", access = JsonProperty.Access.WRITE_ONLY) + private List privateEndpointConnections; /** * Get the identity property: The Azure Active Directory identity of the server. * * @return the identity value. */ - public Identity identity() { + public ResourceIdentity identity() { return this.identity; } @@ -162,7 +150,7 @@ public Identity identity() { * @param identity the identity value to set. * @return the ServerInner object itself. */ - public ServerInner withIdentity(Identity identity) { + public ServerInner withIdentity(ResourceIdentity identity) { this.identity = identity; return this; } @@ -187,15 +175,6 @@ public ServerInner withSku(Sku sku) { return this; } - /** - * Get the systemData property: The system metadata relating to this resource. - * - * @return the systemData value. - */ - public SystemData systemData() { - return this.systemData; - } - /** * 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). @@ -219,274 +198,264 @@ public ServerInner withAdministratorLogin(String administratorLogin) { } /** - * Get the administratorLoginPassword property: The administrator login password (required for server creation). + * Get the version property: Server version. * - * @return the administratorLoginPassword value. + * @return the version value. */ - public String administratorLoginPassword() { - return this.administratorLoginPassword; + public ServerVersion version() { + return this.version; } /** - * Set the administratorLoginPassword property: The administrator login password (required for server creation). + * Set the version property: Server version. * - * @param administratorLoginPassword the administratorLoginPassword value to set. + * @param version the version value to set. * @return the ServerInner object itself. */ - public ServerInner withAdministratorLoginPassword(String administratorLoginPassword) { - this.administratorLoginPassword = administratorLoginPassword; + public ServerInner withVersion(ServerVersion version) { + this.version = version; return this; } /** - * Get the version property: PostgreSQL Server version. + * Get the sslEnforcement property: Enable ssl enforcement or not when connect to server. * - * @return the version value. + * @return the sslEnforcement value. */ - public ServerVersion version() { - return this.version; + public SslEnforcementEnum sslEnforcement() { + return this.sslEnforcement; } /** - * Set the version property: PostgreSQL Server version. + * Set the sslEnforcement property: Enable ssl enforcement or not when connect to server. * - * @param version the version value to set. + * @param sslEnforcement the sslEnforcement value to set. * @return the ServerInner object itself. */ - public ServerInner withVersion(ServerVersion version) { - this.version = version; + public ServerInner withSslEnforcement(SslEnforcementEnum sslEnforcement) { + this.sslEnforcement = sslEnforcement; return this; } /** - * Get the minorVersion property: The minor version of the server. + * Get the minimalTlsVersion property: Enforce a minimal Tls version for the server. * - * @return the minorVersion value. + * @return the minimalTlsVersion value. */ - public String minorVersion() { - return this.minorVersion; + public MinimalTlsVersionEnum minimalTlsVersion() { + return this.minimalTlsVersion; } /** - * Get the state property: A state of a server that is visible to user. + * Set the minimalTlsVersion property: Enforce a minimal Tls version for the server. * - * @return the state value. + * @param minimalTlsVersion the minimalTlsVersion value to set. + * @return the ServerInner object itself. */ - public ServerState state() { - return this.state; + public ServerInner withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; + return this; } /** - * Get the fullyQualifiedDomainName property: The fully qualified domain name of a server. + * Get the byokEnforcement property: Status showing whether the server data encryption is enabled with + * customer-managed keys. * - * @return the fullyQualifiedDomainName value. + * @return the byokEnforcement value. */ - public String fullyQualifiedDomainName() { - return this.fullyQualifiedDomainName; + public String byokEnforcement() { + return this.byokEnforcement; } /** - * Get the storage property: Storage properties of a server. + * Get the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. * - * @return the storage value. + * @return the infrastructureEncryption value. */ - public Storage storage() { - return this.storage; + public InfrastructureEncryption infrastructureEncryption() { + return this.infrastructureEncryption; } /** - * Set the storage property: Storage properties of a server. + * Set the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. * - * @param storage the storage value to set. + * @param infrastructureEncryption the infrastructureEncryption value to set. * @return the ServerInner object itself. */ - public ServerInner withStorage(Storage storage) { - this.storage = storage; + public ServerInner withInfrastructureEncryption(InfrastructureEncryption infrastructureEncryption) { + this.infrastructureEncryption = infrastructureEncryption; return this; } /** - * Get the backup property: Backup properties of a server. + * Get the userVisibleState property: A state of a server that is visible to user. * - * @return the backup value. + * @return the userVisibleState value. */ - public Backup backup() { - return this.backup; + public ServerState userVisibleState() { + return this.userVisibleState; } /** - * Set the backup property: Backup properties of a server. + * Set the userVisibleState property: A state of a server that is visible to user. * - * @param backup the backup value to set. + * @param userVisibleState the userVisibleState value to set. * @return the ServerInner object itself. */ - public ServerInner withBackup(Backup backup) { - this.backup = backup; + public ServerInner withUserVisibleState(ServerState userVisibleState) { + this.userVisibleState = userVisibleState; return this; } /** - * Get the network property: Network properties of a server. + * Get the fullyQualifiedDomainName property: The fully qualified domain name of a server. * - * @return the network value. + * @return the fullyQualifiedDomainName value. */ - public Network network() { - return this.network; + public String fullyQualifiedDomainName() { + return this.fullyQualifiedDomainName; } /** - * Set the network property: Network properties of a server. + * Set the fullyQualifiedDomainName property: The fully qualified domain name of a server. * - * @param network the network value to set. + * @param fullyQualifiedDomainName the fullyQualifiedDomainName value to set. * @return the ServerInner object itself. */ - public ServerInner withNetwork(Network network) { - this.network = network; + public ServerInner withFullyQualifiedDomainName(String fullyQualifiedDomainName) { + this.fullyQualifiedDomainName = fullyQualifiedDomainName; return this; } /** - * Get the highAvailability property: High availability properties of a server. + * Get the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). * - * @return the highAvailability value. + * @return the earliestRestoreDate value. */ - public HighAvailability highAvailability() { - return this.highAvailability; + public OffsetDateTime earliestRestoreDate() { + return this.earliestRestoreDate; } /** - * Set the highAvailability property: High availability properties of a server. + * Set the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). * - * @param highAvailability the highAvailability value to set. + * @param earliestRestoreDate the earliestRestoreDate value to set. * @return the ServerInner object itself. */ - public ServerInner withHighAvailability(HighAvailability highAvailability) { - this.highAvailability = highAvailability; + public ServerInner withEarliestRestoreDate(OffsetDateTime earliestRestoreDate) { + this.earliestRestoreDate = earliestRestoreDate; return this; } /** - * Get the maintenanceWindow property: Maintenance window properties of a server. + * Get the storageProfile property: Storage profile of a server. * - * @return the maintenanceWindow value. + * @return the storageProfile value. */ - public MaintenanceWindow maintenanceWindow() { - return this.maintenanceWindow; + public StorageProfile storageProfile() { + return this.storageProfile; } /** - * Set the maintenanceWindow property: Maintenance window properties of a server. + * Set the storageProfile property: Storage profile of a server. * - * @param maintenanceWindow the maintenanceWindow value to set. + * @param storageProfile the storageProfile value to set. * @return the ServerInner object itself. */ - public ServerInner withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { - this.maintenanceWindow = maintenanceWindow; + public ServerInner withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; return this; } /** - * Get the sourceServerResourceId property: The source server resource ID to restore from. It's required when - * 'createMode' is 'PointInTimeRestore'. + * Get the replicationRole property: The replication role of the server. * - * @return the sourceServerResourceId value. + * @return the replicationRole value. */ - public String sourceServerResourceId() { - return this.sourceServerResourceId; + public String replicationRole() { + return this.replicationRole; } /** - * Set the sourceServerResourceId property: The source server resource ID to restore from. It's required when - * 'createMode' is 'PointInTimeRestore'. + * Set the replicationRole property: The replication role of the server. * - * @param sourceServerResourceId the sourceServerResourceId value to set. + * @param replicationRole the replicationRole value to set. * @return the ServerInner object itself. */ - public ServerInner withSourceServerResourceId(String sourceServerResourceId) { - this.sourceServerResourceId = sourceServerResourceId; + public ServerInner withReplicationRole(String replicationRole) { + this.replicationRole = replicationRole; return this; } /** - * Get the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time to restore - * from. It's required when 'createMode' is 'PointInTimeRestore'. + * Get the masterServerId property: The master server id of a replica server. * - * @return the pointInTimeUtc value. + * @return the masterServerId value. */ - public OffsetDateTime pointInTimeUtc() { - return this.pointInTimeUtc; + public String masterServerId() { + return this.masterServerId; } /** - * Set the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time to restore - * from. It's required when 'createMode' is 'PointInTimeRestore'. + * Set the masterServerId property: The master server id of a replica server. * - * @param pointInTimeUtc the pointInTimeUtc value to set. + * @param masterServerId the masterServerId value to set. * @return the ServerInner object itself. */ - public ServerInner withPointInTimeUtc(OffsetDateTime pointInTimeUtc) { - this.pointInTimeUtc = pointInTimeUtc; + public ServerInner withMasterServerId(String masterServerId) { + this.masterServerId = masterServerId; return this; } /** - * Get the availabilityZone property: availability zone information of the server. + * Get the replicaCapacity property: The maximum number of replicas that a master server can have. * - * @return the availabilityZone value. + * @return the replicaCapacity value. */ - public String availabilityZone() { - return this.availabilityZone; + public Integer replicaCapacity() { + return this.replicaCapacity; } /** - * Set the availabilityZone property: availability zone information of the server. + * Set the replicaCapacity property: The maximum number of replicas that a master server can have. * - * @param availabilityZone the availabilityZone value to set. + * @param replicaCapacity the replicaCapacity value to set. * @return the ServerInner object itself. */ - public ServerInner withAvailabilityZone(String availabilityZone) { - this.availabilityZone = availabilityZone; + public ServerInner withReplicaCapacity(Integer replicaCapacity) { + this.replicaCapacity = replicaCapacity; return this; } /** - * Get the createMode property: The mode to create a new PostgreSQL server. + * 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 createMode value. + * @return the publicNetworkAccess value. */ - public CreateMode createMode() { - return this.createMode; + public PublicNetworkAccessEnum publicNetworkAccess() { + return this.publicNetworkAccess; } /** - * Set the createMode property: The mode to create a new PostgreSQL server. + * 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 createMode the createMode value to set. + * @param publicNetworkAccess the publicNetworkAccess value to set. * @return the ServerInner object itself. */ - public ServerInner withCreateMode(CreateMode createMode) { - this.createMode = createMode; + public ServerInner withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; return this; } /** - * Get the tagsPropertiesTags property: Application-specific metadata in the form of key-value pairs. - * - * @return the tagsPropertiesTags value. - */ - public Map tagsPropertiesTags() { - return this.tagsPropertiesTags; - } - - /** - * Set the tagsPropertiesTags property: Application-specific metadata in the form of key-value pairs. + * Get the privateEndpointConnections property: List of private endpoint connections on a server. * - * @param tagsPropertiesTags the tagsPropertiesTags value to set. - * @return the ServerInner object itself. + * @return the privateEndpointConnections value. */ - public ServerInner withTagsPropertiesTags(Map tagsPropertiesTags) { - this.tagsPropertiesTags = tagsPropertiesTags; - return this; + public List privateEndpointConnections() { + return this.privateEndpointConnections; } /** {@inheritDoc} */ @@ -515,20 +484,11 @@ public void validate() { if (sku() != null) { sku().validate(); } - if (storage() != null) { - storage().validate(); - } - if (backup() != null) { - backup().validate(); - } - if (network() != null) { - network().validate(); - } - if (highAvailability() != null) { - highAvailability().validate(); + if (storageProfile() != null) { + storageProfile().validate(); } - if (maintenanceWindow() != null) { - maintenanceWindow().validate(); + if (privateEndpointConnections() != null) { + privateEndpointConnections().forEach(e -> e.validate()); } } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerKeyInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerKeyInner.java new file mode 100644 index 000000000000..924f0496e857 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerKeyInner.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.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerKeyType; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.OffsetDateTime; + +/** A PostgreSQL Server key. */ +@JsonFlatten +@Fluent +public 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; + + /* + * The key type like 'AzureKeyVault'. + */ + @JsonProperty(value = "properties.serverKeyType") + private ServerKeyType serverKeyType; + + /* + * The URI of the key. + */ + @JsonProperty(value = "properties.uri") + private String uri; + + /* + * The key creation date. + */ + @JsonProperty(value = "properties.creationDate", access = JsonProperty.Access.WRITE_ONLY) + private OffsetDateTime creationDate; + + /** + * Get the kind property: Kind of encryption protector used to protect the key. + * + * @return the kind value. + */ + public String kind() { + return this.kind; + } + + /** + * Get the serverKeyType property: The key type like 'AzureKeyVault'. + * + * @return the serverKeyType value. + */ + public ServerKeyType serverKeyType() { + return this.serverKeyType; + } + + /** + * Set the serverKeyType property: The key type like 'AzureKeyVault'. + * + * @param serverKeyType the serverKeyType value to set. + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withServerKeyType(ServerKeyType serverKeyType) { + this.serverKeyType = serverKeyType; + return this; + } + + /** + * Get the uri property: The URI of the key. + * + * @return the uri value. + */ + public String uri() { + return this.uri; + } + + /** + * Set the uri property: The URI of the key. + * + * @param uri the uri value to set. + * @return the ServerKeyInner object itself. + */ + public ServerKeyInner withUri(String uri) { + this.uri = uri; + return this; + } + + /** + * Get the creationDate property: The key creation date. + * + * @return the creationDate value. + */ + public OffsetDateTime creationDate() { + return this.creationDate; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerSecurityAlertPolicyInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerSecurityAlertPolicyInner.java new file mode 100644 index 000000000000..cc3958ea5da8 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/ServerSecurityAlertPolicyInner.java @@ -0,0 +1,221 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerSecurityAlertPolicyState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A server security alert policy. */ +@JsonFlatten +@Fluent +public class ServerSecurityAlertPolicyInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerSecurityAlertPolicyInner.class); + + /* + * Specifies the state of the policy, whether it is enabled or disabled. + */ + @JsonProperty(value = "properties.state") + private ServerSecurityAlertPolicyState state; + + /* + * Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly + */ + @JsonProperty(value = "properties.disabledAlerts") + private List disabledAlerts; + + /* + * Specifies an array of e-mail addresses to which the alert is sent. + */ + @JsonProperty(value = "properties.emailAddresses") + private List emailAddresses; + + /* + * Specifies that the alert is sent to the account administrators. + */ + @JsonProperty(value = "properties.emailAccountAdmins") + private Boolean emailAccountAdmins; + + /* + * Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold + * all Threat Detection audit logs. + */ + @JsonProperty(value = "properties.storageEndpoint") + private String storageEndpoint; + + /* + * Specifies the identifier key of the Threat Detection audit storage + * account. + */ + @JsonProperty(value = "properties.storageAccountAccessKey") + private String storageAccountAccessKey; + + /* + * Specifies the number of days to keep in the Threat Detection audit logs. + */ + @JsonProperty(value = "properties.retentionDays") + private Integer retentionDays; + + /** + * Get the state property: Specifies the state of the policy, whether it is enabled or disabled. + * + * @return the state value. + */ + public ServerSecurityAlertPolicyState state() { + return this.state; + } + + /** + * Set the state property: Specifies the state of the policy, whether it is enabled or disabled. + * + * @param state the state value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withState(ServerSecurityAlertPolicyState state) { + this.state = state; + return this; + } + + /** + * Get the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly. + * + * @return the disabledAlerts value. + */ + public List disabledAlerts() { + return this.disabledAlerts; + } + + /** + * Set the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly. + * + * @param disabledAlerts the disabledAlerts value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withDisabledAlerts(List disabledAlerts) { + this.disabledAlerts = disabledAlerts; + return this; + } + + /** + * Get the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + public List emailAddresses() { + return this.emailAddresses; + } + + /** + * Set the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @param emailAddresses the emailAddresses value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withEmailAddresses(List emailAddresses) { + this.emailAddresses = emailAddresses; + return this; + } + + /** + * Get the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + public Boolean emailAccountAdmins() { + return this.emailAccountAdmins; + } + + /** + * Set the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @param emailAccountAdmins the emailAccountAdmins value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.emailAccountAdmins = emailAccountAdmins; + return this; + } + + /** + * Get the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @return the storageEndpoint value. + */ + public String storageEndpoint() { + return this.storageEndpoint; + } + + /** + * Set the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @param storageEndpoint the storageEndpoint value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withStorageEndpoint(String storageEndpoint) { + this.storageEndpoint = storageEndpoint; + return this; + } + + /** + * Get the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + public String storageAccountAccessKey() { + return this.storageAccountAccessKey; + } + + /** + * Set the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @param storageAccountAccessKey the storageAccountAccessKey value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withStorageAccountAccessKey(String storageAccountAccessKey) { + this.storageAccountAccessKey = storageAccountAccessKey; + return this; + } + + /** + * Get the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + public Integer retentionDays() { + return this.retentionDays; + } + + /** + * Set the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @param retentionDays the retentionDays value to set. + * @return the ServerSecurityAlertPolicyInner object itself. + */ + public ServerSecurityAlertPolicyInner withRetentionDays(Integer retentionDays) { + this.retentionDays = retentionDays; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/VirtualNetworkRuleInner.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/VirtualNetworkRuleInner.java new file mode 100644 index 000000000000..06a33901b019 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/fluent/models/VirtualNetworkRuleInner.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.fluent.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.management.ProxyResource; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkRuleState; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A virtual network rule. */ +@JsonFlatten +@Fluent +public class VirtualNetworkRuleInner extends ProxyResource { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkRuleInner.class); + + /* + * The ARM resource id of the virtual network subnet. + */ + @JsonProperty(value = "properties.virtualNetworkSubnetId") + private String virtualNetworkSubnetId; + + /* + * Create firewall rule before the virtual network has vnet service + * endpoint enabled. + */ + @JsonProperty(value = "properties.ignoreMissingVnetServiceEndpoint") + private Boolean ignoreMissingVnetServiceEndpoint; + + /* + * Virtual Network Rule State + */ + @JsonProperty(value = "properties.state", access = JsonProperty.Access.WRITE_ONLY) + private VirtualNetworkRuleState state; + + /** + * Get the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @return the virtualNetworkSubnetId value. + */ + public String virtualNetworkSubnetId() { + return this.virtualNetworkSubnetId; + } + + /** + * Set the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @param virtualNetworkSubnetId the virtualNetworkSubnetId value to set. + * @return the VirtualNetworkRuleInner object itself. + */ + public VirtualNetworkRuleInner withVirtualNetworkSubnetId(String virtualNetworkSubnetId) { + this.virtualNetworkSubnetId = virtualNetworkSubnetId; + return this; + } + + /** + * Get the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @return the ignoreMissingVnetServiceEndpoint value. + */ + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.ignoreMissingVnetServiceEndpoint; + } + + /** + * Set the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @param ignoreMissingVnetServiceEndpoint the ignoreMissingVnetServiceEndpoint value to set. + * @return the VirtualNetworkRuleInner object itself. + */ + public VirtualNetworkRuleInner withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.ignoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; + return this; + } + + /** + * Get the state property: Virtual Network Rule State. + * + * @return the state value. + */ + public VirtualNetworkRuleState state() { + return this.state; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CapabilityPropertiesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CapabilityPropertiesImpl.java deleted file mode 100644 index 8e96f0d33c83..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CapabilityPropertiesImpl.java +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.implementation; - -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CapabilityProperties; -import com.azure.resourcemanager.postgresqlflexibleserver.models.FlexibleServerEditionCapability; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HyperscaleNodeEditionCapability; -import java.util.Collections; -import java.util.List; - -public final class CapabilityPropertiesImpl implements CapabilityProperties { - private CapabilityPropertiesInner innerObject; - - private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; - - CapabilityPropertiesImpl( - CapabilityPropertiesInner innerObject, - com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - - public String zone() { - return this.innerModel().zone(); - } - - public Boolean geoBackupSupported() { - return this.innerModel().geoBackupSupported(); - } - - public Boolean zoneRedundantHaSupported() { - return this.innerModel().zoneRedundantHaSupported(); - } - - public Boolean zoneRedundantHaAndGeoBackupSupported() { - return this.innerModel().zoneRedundantHaAndGeoBackupSupported(); - } - - public List supportedFlexibleServerEditions() { - List inner = this.innerModel().supportedFlexibleServerEditions(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } - } - - public List supportedHyperscaleNodeEditions() { - List inner = this.innerModel().supportedHyperscaleNodeEditions(); - if (inner != null) { - return Collections.unmodifiableList(inner); - } else { - return Collections.emptyList(); - } - } - - public String status() { - return this.innerModel().status(); - } - - public CapabilityPropertiesInner innerModel() { - return this.innerObject; - } - - private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CheckNameAvailabilitiesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CheckNameAvailabilitiesClientImpl.java index a0d2dc43fd2c..5b6cd5f57d15 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CheckNameAvailabilitiesClientImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/CheckNameAvailabilitiesClientImpl.java @@ -58,7 +58,7 @@ public final class CheckNameAvailabilitiesClientImpl implements CheckNameAvailab @ServiceInterface(name = "PostgreSqlManagement") private interface CheckNameAvailabilitiesService { @Headers({"Content-Type: application/json"}) - @Post("/subscriptions/{subscriptionId}/providers/Microsoft.DBForPostgreSql/checkNameAvailability") + @Post("/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/checkNameAvailability") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> execute( @@ -101,6 +101,7 @@ private Mono> executeWithResponseAsync( } else { nameAvailabilityRequest.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -108,7 +109,7 @@ private Mono> executeWithResponseAsync( service .execute( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), nameAvailabilityRequest, accept, @@ -148,12 +149,13 @@ private Mono> executeWithResponseAsync( } else { nameAvailabilityRequest.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .execute( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), nameAvailabilityRequest, accept, diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationImpl.java index 8ce9221d4cee..268a7c2884d3 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationImpl.java @@ -4,11 +4,9 @@ package com.azure.resourcemanager.postgresqlflexibleserver.implementation; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationInner; import com.azure.resourcemanager.postgresqlflexibleserver.models.Configuration; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ConfigurationDataType; public final class ConfigurationImpl implements Configuration, Configuration.Definition, Configuration.Update { private ConfigurationInner innerObject; @@ -27,10 +25,6 @@ public String type() { return this.innerModel().type(); } - public SystemData systemData() { - return this.innerModel().systemData(); - } - public String value() { return this.innerModel().value(); } @@ -43,7 +37,7 @@ public String defaultValue() { return this.innerModel().defaultValue(); } - public ConfigurationDataType dataType() { + public String dataType() { return this.innerModel().dataType(); } @@ -69,7 +63,7 @@ private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager man private String configurationName; - public ConfigurationImpl withExistingFlexibleServer(String resourceGroupName, String serverName) { + public ConfigurationImpl withExistingServer(String resourceGroupName, String serverName) { this.resourceGroupName = resourceGroupName; this.serverName = serverName; return this; @@ -80,7 +74,7 @@ public Configuration create() { serviceManager .serviceClient() .getConfigurations() - .put(resourceGroupName, serverName, configurationName, this.innerModel(), Context.NONE); + .createOrUpdate(resourceGroupName, serverName, configurationName, this.innerModel(), Context.NONE); return this; } @@ -89,7 +83,7 @@ public Configuration create(Context context) { serviceManager .serviceClient() .getConfigurations() - .put(resourceGroupName, serverName, configurationName, this.innerModel(), context); + .createOrUpdate(resourceGroupName, serverName, configurationName, this.innerModel(), context); return this; } @@ -109,7 +103,7 @@ public Configuration apply() { serviceManager .serviceClient() .getConfigurations() - .update(resourceGroupName, serverName, configurationName, this.innerModel(), Context.NONE); + .createOrUpdate(resourceGroupName, serverName, configurationName, this.innerModel(), Context.NONE); return this; } @@ -118,7 +112,7 @@ public Configuration apply(Context context) { serviceManager .serviceClient() .getConfigurations() - .update(resourceGroupName, serverName, configurationName, this.innerModel(), context); + .createOrUpdate(resourceGroupName, serverName, configurationName, this.innerModel(), context); return this; } @@ -128,7 +122,7 @@ public Configuration apply(Context context) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.serverName = Utils.getValueFromIdByName(innerObject.id(), "flexibleServers"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); this.configurationName = Utils.getValueFromIdByName(innerObject.id(), "configurations"); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkSubnetUsageResultImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationListResultImpl.java similarity index 55% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkSubnetUsageResultImpl.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationListResultImpl.java index e1dd51913272..732b8eb6a1b1 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkSubnetUsageResultImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationListResultImpl.java @@ -4,34 +4,41 @@ package com.azure.resourcemanager.postgresqlflexibleserver.implementation; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.DelegatedSubnetUsage; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsageResult; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationInner; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationListResultInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.Configuration; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ConfigurationListResult; import java.util.Collections; import java.util.List; +import java.util.stream.Collectors; -public final class VirtualNetworkSubnetUsageResultImpl implements VirtualNetworkSubnetUsageResult { - private VirtualNetworkSubnetUsageResultInner innerObject; +public final class ConfigurationListResultImpl implements ConfigurationListResult { + private ConfigurationListResultInner innerObject; private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; - VirtualNetworkSubnetUsageResultImpl( - VirtualNetworkSubnetUsageResultInner innerObject, + ConfigurationListResultImpl( + ConfigurationListResultInner innerObject, com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } - public List delegatedSubnetsUsage() { - List inner = this.innerModel().delegatedSubnetsUsage(); + public List value() { + List inner = this.innerModel().value(); if (inner != null) { - return Collections.unmodifiableList(inner); + return Collections + .unmodifiableList( + inner + .stream() + .map(inner1 -> new ConfigurationImpl(inner1, this.manager())) + .collect(Collectors.toList())); } else { return Collections.emptyList(); } } - public VirtualNetworkSubnetUsageResultInner innerModel() { + public ConfigurationListResultInner innerModel() { return this.innerObject; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationsClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationsClientImpl.java index 44f68aff773e..5b91d4a7b89d 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationsClientImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationsClientImpl.java @@ -11,7 +11,6 @@ import com.azure.core.annotation.Headers; import com.azure.core.annotation.Host; import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Patch; import com.azure.core.annotation.PathParam; import com.azure.core.annotation.Put; import com.azure.core.annotation.QueryParam; @@ -34,7 +33,7 @@ import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ConfigurationsClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ConfigurationListResult; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationListResultInner; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -68,24 +67,26 @@ public final class ConfigurationsClientImpl implements ConfigurationsClient { @ServiceInterface(name = "PostgreSqlManagement") private interface ConfigurationsService { @Headers({"Content-Type: application/json"}) - @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}/configurations") - @ExpectedResponses({200}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/configurations/{configurationName}") + @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByServer( + Mono>> createOrUpdate( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName, + @PathParam("configurationName") String configurationName, + @BodyParam("application/json") ConfigurationInner parameters, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}/configurations/{configurationName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/configurations/{configurationName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -99,63 +100,36 @@ Mono> get( Context context); @Headers({"Content-Type: application/json"}) - @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}/configurations/{configurationName}") - @ExpectedResponses({200, 202}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> update( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("serverName") String serverName, - @PathParam("configurationName") String configurationName, - @BodyParam("application/json") ConfigurationInner parameters, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}/configurations/{configurationName}") - @ExpectedResponses({200, 202}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/configurations") + @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> put( + Mono> listByServer( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName, - @PathParam("configurationName") String configurationName, - @BodyParam("application/json") ConfigurationInner parameters, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByServerNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * List all the configurations in a given 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. + * @param parameters The required parameters for updating a server configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of server configurations. + * @return represents a Configuration. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByServerSinglePageAsync( - String resourceGroupName, String serverName) { + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -175,45 +149,54 @@ private Mono> listByServerSinglePageAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( context -> service - .listByServer( + .createOrUpdate( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, + configurationName, + parameters, accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * List all the configurations in a given 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. + * @param parameters The required parameters for updating a server configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of server configurations. + * @return represents a Configuration. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByServerSinglePageAsync( - String resourceGroupName, String serverName, Context context) { + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationInner parameters, + Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -233,94 +216,209 @@ private Mono> listByServerSinglePageAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + if (configurationName == null) { + return Mono + .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .listByServer( + .createOrUpdate( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, + configurationName, + parameters, accept, - context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + context); } /** - * List all the configurations in a given 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. + * @param parameters The required parameters for updating a server configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of server configurations. + * @return represents a Configuration. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { - return new PagedFlux<>( - () -> listByServerSinglePageAsync(resourceGroupName, serverName), - nextLink -> listByServerNextSinglePageAsync(nextLink)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ConfigurationInner> beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, configurationName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ConfigurationInner.class, ConfigurationInner.class, Context.NONE); } /** - * List all the configurations in a given 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. + * @param parameters The required parameters for updating a server configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of server configurations. + * @return represents a Configuration. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux listByServerAsync( - String resourceGroupName, String serverName, Context context) { - return new PagedFlux<>( - () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), - nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ConfigurationInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, configurationName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ConfigurationInner.class, ConfigurationInner.class, context); } /** - * List all the configurations in a given 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. + * @param parameters The required parameters for updating a server configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of server configurations. + * @return represents a Configuration. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByServer(String resourceGroupName, String serverName) { - return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ConfigurationInner> beginCreateOrUpdate( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters).getSyncPoller(); } /** - * List all the configurations in a given 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. + * @param parameters The required parameters for updating a server configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of server configurations. + * @return represents a Configuration. */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable listByServer( - String resourceGroupName, String serverName, Context context) { - return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ConfigurationInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationInner createOrUpdate( + String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters).block(); + } + + /** + * Updates a configuration of a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param configurationName The name of the server configuration. + * @param parameters The required parameters for updating a server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return represents a Configuration. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationInner createOrUpdate( + String resourceGroupName, + String serverName, + String configurationName, + ConfigurationInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, configurationName, parameters, context).block(); } /** @@ -360,6 +458,7 @@ private Mono> getWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -367,7 +466,7 @@ private Mono> getWithResponseAsync( service .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -415,12 +514,13 @@ private Mono> getWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -488,20 +588,18 @@ public Response getWithResponse( } /** - * Updates a configuration of a server. + * 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 configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. + * @return a list of server configurations. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> updateWithResponseAsync( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -521,356 +619,41 @@ private Mono>> updateWithResponseAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } - if (configurationName == null) { - return Mono - .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( context -> service - .update( + .listByServer( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, - configurationName, - parameters, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Updates a configuration of a server. + * 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 configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> updateWithResponseAsync( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (serverName == null) { - return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); - } - if (configurationName == null) { - return Mono - .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .update( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serverName, - configurationName, - parameters, - accept, - context); - } - - /** - * Updates a configuration of a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PollerFlux, ConfigurationInner> beginUpdateAsync( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { - Mono>> mono = - updateWithResponseAsync(resourceGroupName, serverName, configurationName, parameters); - return this - .client - .getLroResult( - mono, this.client.getHttpPipeline(), ConfigurationInner.class, ConfigurationInner.class, Context.NONE); - } - - /** - * Updates a configuration of a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PollerFlux, ConfigurationInner> beginUpdateAsync( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context) { - context = this.client.mergeContext(context); - Mono>> mono = - updateWithResponseAsync(resourceGroupName, serverName, configurationName, parameters, context); - return this - .client - .getLroResult( - mono, this.client.getHttpPipeline(), ConfigurationInner.class, ConfigurationInner.class, context); - } - - /** - * Updates a configuration of a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SyncPoller, ConfigurationInner> beginUpdate( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { - return beginUpdateAsync(resourceGroupName, serverName, configurationName, parameters).getSyncPoller(); - } - - /** - * Updates a configuration of a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SyncPoller, ConfigurationInner> beginUpdate( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context) { - return beginUpdateAsync(resourceGroupName, serverName, configurationName, parameters, context).getSyncPoller(); - } - - /** - * Updates a configuration of a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { - return beginUpdateAsync(resourceGroupName, serverName, configurationName, parameters) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Updates a configuration of a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context) { - return beginUpdateAsync(resourceGroupName, serverName, configurationName, parameters, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Updates a configuration of a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ConfigurationInner update( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { - return updateAsync(resourceGroupName, serverName, configurationName, parameters).block(); - } - - /** - * Updates a configuration of a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ConfigurationInner update( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context) { - return updateAsync(resourceGroupName, serverName, configurationName, parameters, context).block(); - } - - /** - * Updates a configuration of a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> putWithResponseAsync( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (serverName == null) { - return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); - } - if (configurationName == null) { - return Mono - .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .put( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serverName, - configurationName, - parameters, - accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Updates a configuration of a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. + * @return a list of server configurations. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> putWithResponseAsync( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context) { + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -890,277 +673,85 @@ private Mono>> putWithResponseAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } - if (configurationName == null) { - return Mono - .error(new IllegalArgumentException("Parameter configurationName is required and cannot be null.")); - } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .put( + .listByServer( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, - configurationName, - parameters, accept, - context); - } - - /** - * Updates a configuration of a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PollerFlux, ConfigurationInner> beginPutAsync( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { - Mono>> mono = - putWithResponseAsync(resourceGroupName, serverName, configurationName, parameters); - return this - .client - .getLroResult( - mono, this.client.getHttpPipeline(), ConfigurationInner.class, ConfigurationInner.class, Context.NONE); - } - - /** - * Updates a configuration of a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PollerFlux, ConfigurationInner> beginPutAsync( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context) { - context = this.client.mergeContext(context); - Mono>> mono = - putWithResponseAsync(resourceGroupName, serverName, configurationName, parameters, context); - return this - .client - .getLroResult( - mono, this.client.getHttpPipeline(), ConfigurationInner.class, ConfigurationInner.class, context); - } - - /** - * Updates a configuration of a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SyncPoller, ConfigurationInner> beginPut( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { - return beginPutAsync(resourceGroupName, serverName, configurationName, parameters).getSyncPoller(); - } - - /** - * Updates a configuration of a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SyncPoller, ConfigurationInner> beginPut( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context) { - return beginPutAsync(resourceGroupName, serverName, configurationName, parameters, context).getSyncPoller(); + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); } /** - * Updates a configuration of a server. + * 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 configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. + * @return a list of server configurations. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono putAsync( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { - return beginPutAsync(resourceGroupName, serverName, configurationName, parameters) - .last() - .flatMap(this.client::getLroFinalResultOrError); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); } /** - * Updates a configuration of a server. + * 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 configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. + * @return a list of server configurations. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono putAsync( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context) { - return beginPutAsync(resourceGroupName, serverName, configurationName, parameters, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); } /** - * Updates a configuration of a server. + * 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 configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. + * @return a list of server configurations. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ConfigurationInner put( - String resourceGroupName, String serverName, String configurationName, ConfigurationInner parameters) { - return putAsync(resourceGroupName, serverName, configurationName, parameters).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); } /** - * Updates a configuration of a server. + * 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 configurationName The name of the server configuration. - * @param parameters The required parameters for updating a server configuration. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a Configuration. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public ConfigurationInner put( - String resourceGroupName, - String serverName, - String configurationName, - ConfigurationInner parameters, - Context context) { - return putAsync(resourceGroupName, serverName, configurationName, parameters, context).block(); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. * @return a list of server configurations. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByServerNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of server configurations. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByServerNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationsImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationsImpl.java index d8aa4ce2d74a..6b20fdc3b914 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationsImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ConfigurationsImpl.java @@ -29,17 +29,6 @@ public ConfigurationsImpl( this.serviceManager = serviceManager; } - public PagedIterable listByServer(String resourceGroupName, String serverName) { - PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); - return Utils.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())); - } - public Configuration get(String resourceGroupName, String serverName, String configurationName) { ConfigurationInner inner = this.serviceClient().get(resourceGroupName, serverName, configurationName); if (inner != null) { @@ -64,6 +53,17 @@ public Response getWithResponse( } } + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.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())); + } + public Configuration getById(String id) { String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); if (resourceGroupName == null) { @@ -73,13 +73,12 @@ public Configuration getById(String id) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw logger .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } String configurationName = Utils.getValueFromIdByName(id, "configurations"); if (configurationName == null) { @@ -101,13 +100,12 @@ public Response getByIdWithResponse(String id, Context context) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw logger .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } String configurationName = Utils.getValueFromIdByName(id, "configurations"); if (configurationName == null) { diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabaseImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabaseImpl.java index 884c03f4565a..c7158f3a8cc0 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabaseImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabaseImpl.java @@ -4,23 +4,15 @@ package com.azure.resourcemanager.postgresqlflexibleserver.implementation; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.DatabaseInner; import com.azure.resourcemanager.postgresqlflexibleserver.models.Database; -public final class DatabaseImpl implements Database, Database.Definition { +public final class DatabaseImpl implements Database, Database.Definition, Database.Update { private DatabaseInner innerObject; private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; - DatabaseImpl( - DatabaseInner innerObject, - com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { - this.innerObject = innerObject; - this.serviceManager = serviceManager; - } - public String id() { return this.innerModel().id(); } @@ -33,10 +25,6 @@ public String type() { return this.innerModel().type(); } - public SystemData systemData() { - return this.innerModel().systemData(); - } - public String charset() { return this.innerModel().charset(); } @@ -59,7 +47,7 @@ private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager man private String databaseName; - public DatabaseImpl withExistingFlexibleServer(String resourceGroupName, String serverName) { + public DatabaseImpl withExistingServer(String resourceGroupName, String serverName) { this.resourceGroupName = resourceGroupName; this.serverName = serverName; return this; @@ -70,7 +58,7 @@ public Database create() { serviceManager .serviceClient() .getDatabases() - .create(resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE); + .createOrUpdate(resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE); return this; } @@ -79,7 +67,7 @@ public Database create(Context context) { serviceManager .serviceClient() .getDatabases() - .create(resourceGroupName, serverName, databaseName, this.innerModel(), context); + .createOrUpdate(resourceGroupName, serverName, databaseName, this.innerModel(), context); return this; } @@ -89,6 +77,38 @@ public Database create(Context context) { this.databaseName = name; } + public DatabaseImpl update() { + return this; + } + + public Database apply() { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .createOrUpdate(resourceGroupName, serverName, databaseName, this.innerModel(), Context.NONE); + return this; + } + + public Database apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getDatabases() + .createOrUpdate(resourceGroupName, serverName, databaseName, this.innerModel(), context); + return this; + } + + DatabaseImpl( + DatabaseInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.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"); + } + public Database refresh() { this.innerObject = serviceManager diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabasesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabasesClientImpl.java index e08f436fe1a1..d6bbdd344157 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabasesClientImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabasesClientImpl.java @@ -69,11 +69,11 @@ public final class DatabasesClientImpl implements DatabasesClient { private interface DatabasesService { @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}/databases/{databaseName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/databases/{databaseName}") @ExpectedResponses({200, 201, 202}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> create( + Mono>> createOrUpdate( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @@ -86,8 +86,8 @@ Mono>> create( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}/databases/{databaseName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/databases/{databaseName}") @ExpectedResponses({200, 202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -102,8 +102,8 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}/databases/{databaseName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/databases/{databaseName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -118,8 +118,8 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}/databases") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/databases") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByServer( @@ -130,16 +130,6 @@ Mono> listByServer( @PathParam("serverName") String serverName, @HeaderParam("Accept") String accept, Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByServerNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); } /** @@ -155,7 +145,7 @@ Mono> listByServerNext( * @return represents a Database. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createWithResponseAsync( + private Mono>> createOrUpdateWithResponseAsync( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { if (this.client.getEndpoint() == null) { return Mono @@ -184,14 +174,15 @@ private Mono>> createWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( context -> service - .create( + .createOrUpdate( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -216,7 +207,7 @@ private Mono>> createWithResponseAsync( * @return represents a Database. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> createWithResponseAsync( + private Mono>> createOrUpdateWithResponseAsync( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { if (this.client.getEndpoint() == null) { return Mono @@ -245,12 +236,13 @@ private Mono>> createWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .create( + .createOrUpdate( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -273,10 +265,10 @@ private Mono>> createWithResponseAsync( * @return represents a Database. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PollerFlux, DatabaseInner> beginCreateAsync( + private PollerFlux, DatabaseInner> beginCreateOrUpdateAsync( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { Mono>> mono = - createWithResponseAsync(resourceGroupName, serverName, databaseName, parameters); + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters); return this .client .getLroResult( @@ -297,11 +289,11 @@ private PollerFlux, DatabaseInner> beginCreateAsync( * @return represents a Database. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PollerFlux, DatabaseInner> beginCreateAsync( + private PollerFlux, DatabaseInner> beginCreateOrUpdateAsync( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { context = this.client.mergeContext(context); Mono>> mono = - createWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context); + createOrUpdateWithResponseAsync(resourceGroupName, serverName, databaseName, parameters, context); return this .client .getLroResult( @@ -321,9 +313,9 @@ private PollerFlux, DatabaseInner> beginCreateAsync( * @return represents a Database. */ @ServiceMethod(returns = ReturnType.SINGLE) - public SyncPoller, DatabaseInner> beginCreate( + public SyncPoller, DatabaseInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { - return beginCreateAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller(); + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).getSyncPoller(); } /** @@ -340,9 +332,10 @@ public SyncPoller, DatabaseInner> beginCreate( * @return represents a Database. */ @ServiceMethod(returns = ReturnType.SINGLE) - public SyncPoller, DatabaseInner> beginCreate( + public SyncPoller, DatabaseInner> beginCreateOrUpdate( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { - return beginCreateAsync(resourceGroupName, serverName, databaseName, parameters, context).getSyncPoller(); + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context) + .getSyncPoller(); } /** @@ -358,9 +351,9 @@ public SyncPoller, DatabaseInner> beginCreate( * @return represents a Database. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync( + private Mono createOrUpdateAsync( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { - return beginCreateAsync(resourceGroupName, serverName, databaseName, parameters) + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters) .last() .flatMap(this.client::getLroFinalResultOrError); } @@ -379,9 +372,9 @@ private Mono createAsync( * @return represents a Database. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync( + private Mono createOrUpdateAsync( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { - return beginCreateAsync(resourceGroupName, serverName, databaseName, parameters, context) + return beginCreateOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context) .last() .flatMap(this.client::getLroFinalResultOrError); } @@ -399,9 +392,9 @@ private Mono createAsync( * @return represents a Database. */ @ServiceMethod(returns = ReturnType.SINGLE) - public DatabaseInner create( + public DatabaseInner createOrUpdate( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters) { - return createAsync(resourceGroupName, serverName, databaseName, parameters).block(); + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters).block(); } /** @@ -418,9 +411,9 @@ public DatabaseInner create( * @return represents a Database. */ @ServiceMethod(returns = ReturnType.SINGLE) - public DatabaseInner create( + public DatabaseInner createOrUpdate( String resourceGroupName, String serverName, String databaseName, DatabaseInner parameters, Context context) { - return createAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); + return createOrUpdateAsync(resourceGroupName, serverName, databaseName, parameters, context).block(); } /** @@ -459,6 +452,7 @@ private Mono>> deleteWithResponseAsync( if (databaseName == null) { return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -466,7 +460,7 @@ private Mono>> deleteWithResponseAsync( service .delete( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -513,12 +507,13 @@ private Mono>> deleteWithResponseAsync( if (databaseName == null) { return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .delete( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -709,6 +704,7 @@ private Mono> getWithResponseAsync( if (databaseName == null) { return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -716,7 +712,7 @@ private Mono> getWithResponseAsync( service .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -763,12 +759,13 @@ private Mono> getWithResponseAsync( if (databaseName == null) { return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -867,6 +864,7 @@ private Mono> listByServerSinglePageAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -874,7 +872,7 @@ private Mono> listByServerSinglePageAsync( service .listByServer( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -883,12 +881,7 @@ private Mono> listByServerSinglePageAsync( .>map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -925,12 +918,13 @@ private Mono> listByServerSinglePageAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .listByServer( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -939,12 +933,7 @@ private Mono> listByServerSinglePageAsync( .map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); } /** @@ -959,9 +948,7 @@ private Mono> listByServerSinglePageAsync( */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { - return new PagedFlux<>( - () -> listByServerSinglePageAsync(resourceGroupName, serverName), - nextLink -> listByServerNextSinglePageAsync(nextLink)); + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); } /** @@ -977,9 +964,7 @@ private PagedFlux listByServerAsync(String resourceGroupName, Str */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { - return new PagedFlux<>( - () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), - nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); } /** @@ -1012,75 +997,4 @@ public PagedIterable listByServer(String resourceGroupName, Strin public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a List of databases. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByServerNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a List of databases. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByServerNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); - } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabasesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabasesImpl.java index 3f10147665bb..379733e21ab0 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabasesImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/DatabasesImpl.java @@ -80,13 +80,12 @@ public Database getById(String id) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw logger .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } String databaseName = Utils.getValueFromIdByName(id, "databases"); if (databaseName == null) { @@ -107,13 +106,12 @@ public Response getByIdWithResponse(String id, Context context) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw logger .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } String databaseName = Utils.getValueFromIdByName(id, "databases"); if (databaseName == null) { @@ -134,13 +132,12 @@ public void deleteById(String id) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw logger .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } String databaseName = Utils.getValueFromIdByName(id, "databases"); if (databaseName == null) { @@ -161,13 +158,12 @@ public void deleteByIdWithResponse(String id, Context context) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw logger .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } String databaseName = Utils.getValueFromIdByName(id, "databases"); if (databaseName == null) { diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRuleImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRuleImpl.java index 9ba449c88def..7596b4fbe3b3 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRuleImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRuleImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.postgresqlflexibleserver.implementation; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.FirewallRuleInner; import com.azure.resourcemanager.postgresqlflexibleserver.models.FirewallRule; @@ -26,10 +25,6 @@ public String type() { return this.innerModel().type(); } - public SystemData systemData() { - return this.innerModel().systemData(); - } - public String startIpAddress() { return this.innerModel().startIpAddress(); } @@ -52,7 +47,7 @@ private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager man private String firewallRuleName; - public FirewallRuleImpl withExistingFlexibleServer(String resourceGroupName, String serverName) { + public FirewallRuleImpl withExistingServer(String resourceGroupName, String serverName) { this.resourceGroupName = resourceGroupName; this.serverName = serverName; return this; @@ -110,7 +105,7 @@ public FirewallRule apply(Context context) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.serverName = Utils.getValueFromIdByName(innerObject.id(), "flexibleServers"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); this.firewallRuleName = Utils.getValueFromIdByName(innerObject.id(), "firewallRules"); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRulesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRulesClientImpl.java index d3ca8173c05b..d92fe936d6c6 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRulesClientImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRulesClientImpl.java @@ -69,8 +69,8 @@ public final class FirewallRulesClientImpl implements FirewallRulesClient { private interface FirewallRulesService { @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}/firewallRules/{firewallRuleName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/firewallRules/{firewallRuleName}") @ExpectedResponses({200, 201, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> createOrUpdate( @@ -86,8 +86,8 @@ Mono>> createOrUpdate( @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}/firewallRules/{firewallRuleName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/firewallRules/{firewallRuleName}") @ExpectedResponses({200, 202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -102,8 +102,8 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}/firewallRules/{firewallRuleName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/firewallRules/{firewallRuleName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> get( @@ -118,8 +118,8 @@ Mono> get( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}/firewallRules") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/firewallRules") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByServer( @@ -130,16 +130,6 @@ Mono> listByServer( @PathParam("serverName") String serverName, @HeaderParam("Accept") String accept, Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByServerNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); } /** @@ -185,6 +175,7 @@ private Mono>> createOrUpdateWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -192,7 +183,7 @@ private Mono>> createOrUpdateWithResponseAsync( service .createOrUpdate( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -251,12 +242,13 @@ private Mono>> createOrUpdateWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .createOrUpdate( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -447,7 +439,7 @@ public FirewallRuleInner createOrUpdate( } /** - * Deletes a PostgreSQL server firewall rule. + * 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. @@ -483,6 +475,7 @@ private Mono>> deleteWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -490,7 +483,7 @@ private Mono>> deleteWithResponseAsync( service .delete( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -501,7 +494,7 @@ private Mono>> deleteWithResponseAsync( } /** - * Deletes a PostgreSQL server firewall rule. + * 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. @@ -538,12 +531,13 @@ private Mono>> deleteWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .delete( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -553,7 +547,7 @@ private Mono>> deleteWithResponseAsync( } /** - * Deletes a PostgreSQL server firewall rule. + * 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. @@ -574,7 +568,7 @@ private PollerFlux, Void> beginDeleteAsync( } /** - * Deletes a PostgreSQL server firewall rule. + * 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. @@ -597,7 +591,7 @@ private PollerFlux, Void> beginDeleteAsync( } /** - * Deletes a PostgreSQL server firewall rule. + * 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. @@ -614,7 +608,7 @@ public SyncPoller, Void> beginDelete( } /** - * Deletes a PostgreSQL server firewall rule. + * 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. @@ -632,7 +626,7 @@ public SyncPoller, Void> beginDelete( } /** - * Deletes a PostgreSQL server firewall rule. + * 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. @@ -650,7 +644,7 @@ private Mono deleteAsync(String resourceGroupName, String serverName, Stri } /** - * Deletes a PostgreSQL server firewall rule. + * 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. @@ -670,7 +664,7 @@ private Mono deleteAsync( } /** - * Deletes a PostgreSQL server firewall rule. + * 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. @@ -685,7 +679,7 @@ public void delete(String resourceGroupName, String serverName, String firewallR } /** - * Deletes a PostgreSQL server firewall rule. + * 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. @@ -701,7 +695,7 @@ public void delete(String resourceGroupName, String serverName, String firewallR } /** - * List all the firewall rules in a given server. + * 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. @@ -709,7 +703,7 @@ public void delete(String resourceGroupName, String serverName, String firewallR * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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. + * @return information about a server firewall rule. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync( @@ -737,6 +731,7 @@ private Mono> getWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -744,7 +739,7 @@ private Mono> getWithResponseAsync( service .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -755,7 +750,7 @@ private Mono> getWithResponseAsync( } /** - * List all the firewall rules in a given server. + * 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. @@ -764,7 +759,7 @@ private Mono> getWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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. + * @return information about a server firewall rule. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono> getWithResponseAsync( @@ -792,12 +787,13 @@ private Mono> getWithResponseAsync( return Mono .error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .get( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -807,7 +803,7 @@ private Mono> getWithResponseAsync( } /** - * List all the firewall rules in a given server. + * 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. @@ -815,7 +811,7 @@ private Mono> getWithResponseAsync( * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown 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. + * @return information about a server firewall rule. */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono getAsync(String resourceGroupName, String serverName, String firewallRuleName) { @@ -831,7 +827,7 @@ private Mono getAsync(String resourceGroupName, String server } /** - * List all the firewall rules in a given server. + * 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. @@ -839,7 +835,7 @@ private Mono getAsync(String resourceGroupName, String 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 firewall rule. + * @return information about a server firewall rule. */ @ServiceMethod(returns = ReturnType.SINGLE) public FirewallRuleInner get(String resourceGroupName, String serverName, String firewallRuleName) { @@ -847,7 +843,7 @@ public FirewallRuleInner get(String resourceGroupName, String serverName, String } /** - * List all the firewall rules in a given server. + * 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. @@ -856,7 +852,7 @@ public FirewallRuleInner get(String resourceGroupName, 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 represents a server firewall rule. + * @return information about a server firewall rule. */ @ServiceMethod(returns = ReturnType.SINGLE) public Response getWithResponse( @@ -865,7 +861,7 @@ public Response getWithResponse( } /** - * List all the firewall rules in a given PostgreSQL server. + * 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. @@ -896,6 +892,7 @@ private Mono> listByServerSinglePageAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -903,7 +900,7 @@ private Mono> listByServerSinglePageAsync( service .listByServer( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -912,17 +909,12 @@ private Mono> listByServerSinglePageAsync( .>map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * List all the firewall rules in a given PostgreSQL server. + * 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. @@ -954,12 +946,13 @@ private Mono> listByServerSinglePageAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .listByServer( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -968,16 +961,11 @@ private Mono> listByServerSinglePageAsync( .map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); } /** - * List all the firewall rules in a given PostgreSQL server. + * 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. @@ -988,13 +976,11 @@ private Mono> listByServerSinglePageAsync( */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { - return new PagedFlux<>( - () -> listByServerSinglePageAsync(resourceGroupName, serverName), - nextLink -> listByServerNextSinglePageAsync(nextLink)); + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); } /** - * List all the firewall rules in a given PostgreSQL server. + * 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. @@ -1007,13 +993,11 @@ private PagedFlux listByServerAsync(String resourceGroupName, @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByServerAsync( String resourceGroupName, String serverName, Context context) { - return new PagedFlux<>( - () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), - nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); } /** - * List all the firewall rules in a given PostgreSQL server. + * 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. @@ -1028,7 +1012,7 @@ public PagedIterable listByServer(String resourceGroupName, S } /** - * List all the firewall rules in a given PostgreSQL server. + * 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. @@ -1042,75 +1026,4 @@ public PagedIterable listByServer(String resourceGroupName, S public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of firewall rules. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByServerNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of firewall rules. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByServerNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); - } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRulesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRulesImpl.java index 16cc0410c719..61b51fcedfe8 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRulesImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/FirewallRulesImpl.java @@ -81,13 +81,12 @@ public FirewallRule getById(String id) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw logger .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); if (firewallRuleName == null) { @@ -108,13 +107,12 @@ public Response getByIdWithResponse(String id, Context context) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw logger .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); if (firewallRuleName == null) { @@ -135,13 +133,12 @@ public void deleteById(String id) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw logger .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); if (firewallRuleName == null) { @@ -162,13 +159,12 @@ public void deleteByIdWithResponse(String id, Context context) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw logger .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } String firewallRuleName = Utils.getValueFromIdByName(id, "firewallRules"); if (firewallRuleName == null) { diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesClientImpl.java deleted file mode 100644 index 84f6ba1750bd..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesClientImpl.java +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.Post; -import com.azure.core.annotation.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.GetPrivateDnsZoneSuffixesClient; -import reactor.core.publisher.Mono; - -/** An instance of this class provides access to all the operations defined in GetPrivateDnsZoneSuffixesClient. */ -public final class GetPrivateDnsZoneSuffixesClientImpl implements GetPrivateDnsZoneSuffixesClient { - private final ClientLogger logger = new ClientLogger(GetPrivateDnsZoneSuffixesClientImpl.class); - - /** The proxy service used to perform REST calls. */ - private final GetPrivateDnsZoneSuffixesService service; - - /** The service client containing this operation class. */ - private final PostgreSqlManagementClientImpl client; - - /** - * Initializes an instance of GetPrivateDnsZoneSuffixesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - GetPrivateDnsZoneSuffixesClientImpl(PostgreSqlManagementClientImpl client) { - this.service = - RestProxy - .create( - GetPrivateDnsZoneSuffixesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for PostgreSqlManagementClientGetPrivateDnsZoneSuffixes to be used by the - * proxy service to perform REST calls. - */ - @Host("{$host}") - @ServiceInterface(name = "PostgreSqlManagement") - private interface GetPrivateDnsZoneSuffixesService { - @Headers({"Content-Type: application/json"}) - @Post("/providers/Microsoft.DBForPostgreSql/getPrivateDnsZoneSuffix") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> execute( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @HeaderParam("Accept") String accept, - Context context); - } - - /** - * Get private DNS zone suffix in the cloud. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return private DNS zone suffix in the cloud. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeWithResponseAsync() { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.execute(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get private DNS zone suffix in the cloud. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return private DNS zone suffix in the cloud. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeWithResponseAsync(Context context) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service.execute(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); - } - - /** - * Get private DNS zone suffix in the cloud. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return private DNS zone suffix in the cloud. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono executeAsync() { - return executeWithResponseAsync() - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); - } - - /** - * Get private DNS zone suffix in the cloud. - * - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return private DNS zone suffix in the cloud. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public String execute() { - return executeAsync().block(); - } - - /** - * Get private DNS zone suffix in the cloud. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return private DNS zone suffix in the cloud. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response executeWithResponse(Context context) { - return executeWithResponseAsync(context).block(); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesImpl.java deleted file mode 100644 index ff2a86e26350..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/GetPrivateDnsZoneSuffixesImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.implementation; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.GetPrivateDnsZoneSuffixesClient; -import com.azure.resourcemanager.postgresqlflexibleserver.models.GetPrivateDnsZoneSuffixes; -import com.fasterxml.jackson.annotation.JsonIgnore; - -public final class GetPrivateDnsZoneSuffixesImpl implements GetPrivateDnsZoneSuffixes { - @JsonIgnore private final ClientLogger logger = new ClientLogger(GetPrivateDnsZoneSuffixesImpl.class); - - private final GetPrivateDnsZoneSuffixesClient innerClient; - - private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; - - public GetPrivateDnsZoneSuffixesImpl( - GetPrivateDnsZoneSuffixesClient innerClient, - com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { - this.innerClient = innerClient; - this.serviceManager = serviceManager; - } - - public String execute() { - return this.serviceClient().execute(); - } - - public Response executeWithResponse(Context context) { - return this.serviceClient().executeWithResponse(context); - } - - private GetPrivateDnsZoneSuffixesClient serviceClient() { - return this.innerClient; - } - - private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { - return this.serviceManager; - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesClientImpl.java deleted file mode 100644 index 29a153943ce2..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesClientImpl.java +++ /dev/null @@ -1,319 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.implementation; - -import com.azure.core.annotation.ExpectedResponses; -import com.azure.core.annotation.Get; -import com.azure.core.annotation.HeaderParam; -import com.azure.core.annotation.Headers; -import com.azure.core.annotation.Host; -import com.azure.core.annotation.HostParam; -import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.QueryParam; -import com.azure.core.annotation.ReturnType; -import com.azure.core.annotation.ServiceInterface; -import com.azure.core.annotation.ServiceMethod; -import com.azure.core.annotation.UnexpectedResponseExceptionType; -import com.azure.core.http.rest.PagedFlux; -import com.azure.core.http.rest.PagedIterable; -import com.azure.core.http.rest.PagedResponse; -import com.azure.core.http.rest.PagedResponseBase; -import com.azure.core.http.rest.Response; -import com.azure.core.http.rest.RestProxy; -import com.azure.core.management.exception.ManagementException; -import com.azure.core.util.Context; -import com.azure.core.util.FluxUtil; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LocationBasedCapabilitiesClient; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CapabilitiesListResult; -import reactor.core.publisher.Mono; - -/** An instance of this class provides access to all the operations defined in LocationBasedCapabilitiesClient. */ -public final class LocationBasedCapabilitiesClientImpl implements LocationBasedCapabilitiesClient { - private final ClientLogger logger = new ClientLogger(LocationBasedCapabilitiesClientImpl.class); - - /** The proxy service used to perform REST calls. */ - private final LocationBasedCapabilitiesService service; - - /** The service client containing this operation class. */ - private final PostgreSqlManagementClientImpl client; - - /** - * Initializes an instance of LocationBasedCapabilitiesClientImpl. - * - * @param client the instance of the service client containing this operation class. - */ - LocationBasedCapabilitiesClientImpl(PostgreSqlManagementClientImpl client) { - this.service = - RestProxy - .create( - LocationBasedCapabilitiesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); - this.client = client; - } - - /** - * The interface defining all the services for PostgreSqlManagementClientLocationBasedCapabilities to be used by the - * proxy service to perform REST calls. - */ - @Host("{$host}") - @ServiceInterface(name = "PostgreSqlManagement") - private interface LocationBasedCapabilitiesService { - @Headers({"Content-Type: application/json"}) - @Get( - "/subscriptions/{subscriptionId}/providers/Microsoft.DBForPostgreSql/locations/{locationName}/capabilities") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> execute( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("locationName") String locationName, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> executeNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - } - - /** - * Get capabilities 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 capabilities at specified location in a given subscription. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeSinglePageAsync(String locationName) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (locationName == null) { - return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .execute( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - locationName, - accept, - context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get capabilities 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 capabilities at specified location in a given subscription. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeSinglePageAsync( - String locationName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (locationName == null) { - return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .execute( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - locationName, - accept, - context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); - } - - /** - * Get capabilities 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 capabilities at specified location in a given subscription. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux executeAsync(String locationName) { - return new PagedFlux<>( - () -> executeSinglePageAsync(locationName), nextLink -> executeNextSinglePageAsync(nextLink)); - } - - /** - * Get capabilities 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 capabilities at specified location in a given subscription. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - private PagedFlux executeAsync(String locationName, Context context) { - return new PagedFlux<>( - () -> executeSinglePageAsync(locationName, context), - nextLink -> executeNextSinglePageAsync(nextLink, context)); - } - - /** - * Get capabilities 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 capabilities at specified location in a given subscription. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable execute(String locationName) { - return new PagedIterable<>(executeAsync(locationName)); - } - - /** - * Get capabilities 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 capabilities at specified location in a given subscription. - */ - @ServiceMethod(returns = ReturnType.COLLECTION) - public PagedIterable execute(String locationName, Context context) { - return new PagedIterable<>(executeAsync(locationName, context)); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return location capability. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.executeNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return location capability. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeNextSinglePageAsync( - String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .executeNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkSubnetUsagesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedPerformanceTiersClientImpl.java similarity index 58% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkSubnetUsagesClientImpl.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedPerformanceTiersClientImpl.java index 611402147275..b5d66560fbbd 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkSubnetUsagesClientImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedPerformanceTiersClientImpl.java @@ -4,89 +4,91 @@ package com.azure.resourcemanager.postgresqlflexibleserver.implementation; -import com.azure.core.annotation.BodyParam; import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; import com.azure.core.annotation.HeaderParam; import com.azure.core.annotation.Headers; import com.azure.core.annotation.Host; import com.azure.core.annotation.HostParam; import com.azure.core.annotation.PathParam; -import com.azure.core.annotation.Post; import com.azure.core.annotation.QueryParam; import com.azure.core.annotation.ReturnType; import com.azure.core.annotation.ServiceInterface; import com.azure.core.annotation.ServiceMethod; import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; import com.azure.core.http.rest.Response; import com.azure.core.http.rest.RestProxy; import com.azure.core.management.exception.ManagementException; import com.azure.core.util.Context; import com.azure.core.util.FluxUtil; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.VirtualNetworkSubnetUsagesClient; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LocationBasedPerformanceTiersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PerformanceTierListResult; import reactor.core.publisher.Mono; -/** An instance of this class provides access to all the operations defined in VirtualNetworkSubnetUsagesClient. */ -public final class VirtualNetworkSubnetUsagesClientImpl implements VirtualNetworkSubnetUsagesClient { - private final ClientLogger logger = new ClientLogger(VirtualNetworkSubnetUsagesClientImpl.class); +/** An instance of this class provides access to all the operations defined in LocationBasedPerformanceTiersClient. */ +public final class LocationBasedPerformanceTiersClientImpl implements LocationBasedPerformanceTiersClient { + private final ClientLogger logger = new ClientLogger(LocationBasedPerformanceTiersClientImpl.class); /** The proxy service used to perform REST calls. */ - private final VirtualNetworkSubnetUsagesService service; + private final LocationBasedPerformanceTiersService service; /** The service client containing this operation class. */ private final PostgreSqlManagementClientImpl client; /** - * Initializes an instance of VirtualNetworkSubnetUsagesClientImpl. + * Initializes an instance of LocationBasedPerformanceTiersClientImpl. * * @param client the instance of the service client containing this operation class. */ - VirtualNetworkSubnetUsagesClientImpl(PostgreSqlManagementClientImpl client) { + LocationBasedPerformanceTiersClientImpl(PostgreSqlManagementClientImpl client) { this.service = RestProxy .create( - VirtualNetworkSubnetUsagesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + LocationBasedPerformanceTiersService.class, + client.getHttpPipeline(), + client.getSerializerAdapter()); this.client = client; } /** - * The interface defining all the services for PostgreSqlManagementClientVirtualNetworkSubnetUsages to be used by + * The interface defining all the services for PostgreSqlManagementClientLocationBasedPerformanceTiers to be used by * the proxy service to perform REST calls. */ @Host("{$host}") @ServiceInterface(name = "PostgreSqlManagement") - private interface VirtualNetworkSubnetUsagesService { + private interface LocationBasedPerformanceTiersService { @Headers({"Content-Type: application/json"}) - @Post( - "/subscriptions/{subscriptionId}/providers/Microsoft.DBForPostgreSql/locations/{locationName}" - + "/checkVirtualNetworkSubnetUsage") + @Get( + "/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/locations/{locationName}" + + "/performanceTiers") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) - Mono> execute( + Mono> list( @HostParam("$host") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("subscriptionId") String subscriptionId, @PathParam("locationName") String locationName, - @BodyParam("application/json") VirtualNetworkSubnetUsageParameter parameters, @HeaderParam("Accept") String accept, Context context); } /** - * Get virtual network subnet usage for a given vNet resource id. + * List all the performance tiers at specified location in a given subscription. * * @param locationName The name of the location. - * @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 virtual network subnet usage for a given vNet resource id. + * @return a list of performance tiers. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeWithResponseAsync( - String locationName, VirtualNetworkSubnetUsageParameter parameters) { + private Mono> listSinglePageAsync(String locationName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -102,41 +104,39 @@ private Mono> executeWithResponse if (locationName == null) { return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( context -> service - .execute( + .list( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), locationName, - parameters, accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** - * Get virtual network subnet usage for a given vNet resource id. + * List all the performance tiers at specified location in a given subscription. * * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating a server. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return virtual network subnet usage for a given vNet resource id. + * @return a list of performance tiers. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> executeWithResponseAsync( - String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context) { + private Mono> listSinglePageAsync( + String locationName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -152,78 +152,72 @@ private Mono> executeWithResponse if (locationName == null) { return Mono.error(new IllegalArgumentException("Parameter locationName is required and cannot be null.")); } - if (parameters == null) { - return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); - } else { - parameters.validate(); - } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .execute( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - locationName, - parameters, - accept, - context); + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), locationName, accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); } /** - * Get virtual network subnet usage for a given vNet resource id. + * List all the performance tiers at specified location in a given subscription. * * @param locationName The name of the location. - * @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 virtual network subnet usage for a given vNet resource id. + * @return a list of performance tiers. */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono executeAsync( - String locationName, VirtualNetworkSubnetUsageParameter parameters) { - return executeWithResponseAsync(locationName, parameters) - .flatMap( - (Response res) -> { - if (res.getValue() != null) { - return Mono.just(res.getValue()); - } else { - return Mono.empty(); - } - }); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String locationName) { + return new PagedFlux<>(() -> listSinglePageAsync(locationName)); } /** - * Get virtual network subnet usage for a given vNet resource id. + * List all the performance tiers at specified location in a given subscription. * * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating a server. + * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return virtual network subnet usage for a given vNet resource id. + * @return a list of performance tiers. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public VirtualNetworkSubnetUsageResultInner execute( - String locationName, VirtualNetworkSubnetUsageParameter parameters) { - return executeAsync(locationName, parameters).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String locationName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(locationName, context)); } /** - * Get virtual network subnet usage for a given vNet resource id. + * List all the performance tiers at specified location in a given subscription. + * + * @param locationName The name of the location. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of performance tiers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String locationName) { + return new PagedIterable<>(listAsync(locationName)); + } + + /** + * List all the performance tiers at specified location in a given subscription. * * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating a server. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return virtual network subnet usage for a given vNet resource id. + * @return a list of performance tiers. */ - @ServiceMethod(returns = ReturnType.SINGLE) - public Response executeWithResponse( - String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context) { - return executeWithResponseAsync(locationName, parameters, context).block(); + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String locationName, Context context) { + return new PagedIterable<>(listAsync(locationName, context)); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedPerformanceTiersImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedPerformanceTiersImpl.java new file mode 100644 index 000000000000..2bbd73d87d27 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedPerformanceTiersImpl.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LocationBasedPerformanceTiersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LocationBasedPerformanceTiers; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PerformanceTierProperties; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class LocationBasedPerformanceTiersImpl implements LocationBasedPerformanceTiers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LocationBasedPerformanceTiersImpl.class); + + private final LocationBasedPerformanceTiersClient innerClient; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public LocationBasedPerformanceTiersImpl( + LocationBasedPerformanceTiersClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String locationName) { + PagedIterable inner = this.serviceClient().list(locationName); + return Utils.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())); + } + + private LocationBasedPerformanceTiersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFileImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFileImpl.java new file mode 100644 index 000000000000..55aae3ced93a --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFileImpl.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogFile; +import java.time.OffsetDateTime; + +public final class LogFileImpl implements LogFile { + private LogFileInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + LogFileImpl( + LogFileInner innerObject, com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public Long sizeInKB() { + return this.innerModel().sizeInKB(); + } + + public OffsetDateTime createdTime() { + return this.innerModel().createdTime(); + } + + public OffsetDateTime lastModifiedTime() { + return this.innerModel().lastModifiedTime(); + } + + public String typePropertiesType() { + return this.innerModel().typePropertiesType(); + } + + public String url() { + return this.innerModel().url(); + } + + public LogFileInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFilesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFilesClientImpl.java new file mode 100644 index 000000000000..70809faf4a69 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFilesClientImpl.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LogFilesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogFileListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in LogFilesClient. */ +public final class LogFilesClientImpl implements LogFilesClient { + private final ClientLogger logger = new ClientLogger(LogFilesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final LogFilesService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of LogFilesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + LogFilesClientImpl(PostgreSqlManagementClientImpl client) { + this.service = RestProxy.create(LogFilesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientLogFiles to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + private interface LogFilesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/logFiles") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync(String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFilesImpl.java similarity index 54% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesImpl.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFilesImpl.java index 842deaa69f84..11822b1193d7 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LocationBasedCapabilitiesImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/LogFilesImpl.java @@ -7,37 +7,37 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LocationBasedCapabilitiesClient; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CapabilityProperties; -import com.azure.resourcemanager.postgresqlflexibleserver.models.LocationBasedCapabilities; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LogFilesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogFile; +import com.azure.resourcemanager.postgresqlflexibleserver.models.LogFiles; import com.fasterxml.jackson.annotation.JsonIgnore; -public final class LocationBasedCapabilitiesImpl implements LocationBasedCapabilities { - @JsonIgnore private final ClientLogger logger = new ClientLogger(LocationBasedCapabilitiesImpl.class); +public final class LogFilesImpl implements LogFiles { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogFilesImpl.class); - private final LocationBasedCapabilitiesClient innerClient; + private final LogFilesClient innerClient; private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; - public LocationBasedCapabilitiesImpl( - LocationBasedCapabilitiesClient innerClient, + public LogFilesImpl( + LogFilesClient innerClient, com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } - public PagedIterable execute(String locationName) { - PagedIterable inner = this.serviceClient().execute(locationName); - return Utils.mapPage(inner, inner1 -> new CapabilityPropertiesImpl(inner1, this.manager())); + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.mapPage(inner, inner1 -> new LogFileImpl(inner1, this.manager())); } - public PagedIterable execute(String locationName, Context context) { - PagedIterable inner = this.serviceClient().execute(locationName, context); - return Utils.mapPage(inner, inner1 -> new CapabilityPropertiesImpl(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())); } - private LocationBasedCapabilitiesClient serviceClient() { + private LogFilesClient serviceClient() { return this.innerClient; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/NameAvailabilityImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/NameAvailabilityImpl.java index 9b1cd062bde4..a51f23545ac3 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/NameAvailabilityImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/NameAvailabilityImpl.java @@ -27,12 +27,8 @@ public Boolean nameAvailable() { return this.innerModel().nameAvailable(); } - public String name() { - return this.innerModel().name(); - } - - public String type() { - return this.innerModel().type(); + public String reason() { + return this.innerModel().reason(); } public NameAvailabilityInner innerModel() { diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationListResultImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationListResultImpl.java index 772c2f4469f7..2673de87cf9d 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationListResultImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationListResultImpl.java @@ -31,10 +31,6 @@ public List value() { } } - public String nextLink() { - return this.innerModel().nextLink(); - } - public OperationListResultInner innerModel() { return this.innerObject; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationsClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationsClientImpl.java index eca01f2a95b7..5fec0c112287 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationsClientImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/OperationsClientImpl.java @@ -54,7 +54,7 @@ public final class OperationsClientImpl implements OperationsClient { @ServiceInterface(name = "PostgreSqlManagement") private interface OperationsService { @Headers({"Content-Type: application/json"}) - @Get("/providers/Microsoft.DBForPostgreSql/operations") + @Get("/providers/Microsoft.DBforPostgreSQL/operations") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( @@ -79,10 +79,10 @@ private Mono> listWithResponseAsync() { new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil - .withContext( - context -> service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context)) + .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -103,9 +103,10 @@ private Mono> listWithResponseAsync(Context c new IllegalArgumentException( "Parameter this.client.getEndpoint() is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); - return service.list(this.client.getEndpoint(), this.client.getApiVersion(), accept, context); + return service.list(this.client.getEndpoint(), apiVersion, accept, context); } /** diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PerformanceTierPropertiesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PerformanceTierPropertiesImpl.java new file mode 100644 index 000000000000..6490cea55fd8 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PerformanceTierPropertiesImpl.java @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PerformanceTierProperties; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PerformanceTierServiceLevelObjectives; +import java.util.Collections; +import java.util.List; + +public final class PerformanceTierPropertiesImpl implements PerformanceTierProperties { + private PerformanceTierPropertiesInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + PerformanceTierPropertiesImpl( + PerformanceTierPropertiesInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public Integer maxBackupRetentionDays() { + return this.innerModel().maxBackupRetentionDays(); + } + + public Integer minBackupRetentionDays() { + return this.innerModel().minBackupRetentionDays(); + } + + public Integer maxStorageMB() { + return this.innerModel().maxStorageMB(); + } + + public Integer minLargeStorageMB() { + return this.innerModel().minLargeStorageMB(); + } + + public Integer maxLargeStorageMB() { + return this.innerModel().maxLargeStorageMB(); + } + + public Integer minStorageMB() { + return this.innerModel().minStorageMB(); + } + + public List serviceLevelObjectives() { + List inner = this.innerModel().serviceLevelObjectives(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public PerformanceTierPropertiesInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PostgreSqlManagementClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PostgreSqlManagementClientImpl.java index d204ecc2f2bb..180a3be809e3 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PostgreSqlManagementClientImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PostgreSqlManagementClientImpl.java @@ -25,12 +25,21 @@ import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ConfigurationsClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.DatabasesClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.FirewallRulesClient; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.GetPrivateDnsZoneSuffixesClient; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LocationBasedCapabilitiesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LocationBasedPerformanceTiersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.LogFilesClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.OperationsClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.PostgreSqlManagementClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.RecoverableServersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ReplicasClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerAdministratorsClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerBasedPerformanceTiersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerKeysClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerParametersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerSecurityAlertPoliciesClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServersClient; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.VirtualNetworkSubnetUsagesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.VirtualNetworkRulesClient; import java.io.IOException; import java.lang.reflect.Type; import java.nio.ByteBuffer; @@ -70,18 +79,6 @@ public String getEndpoint() { return this.endpoint; } - /** Api Version. */ - private final String apiVersion; - - /** - * Gets Api Version. - * - * @return the apiVersion value. - */ - public String getApiVersion() { - return this.apiVersion; - } - /** The HTTP pipeline to send requests through. */ private final HttpPipeline httpPipeline; @@ -130,6 +127,18 @@ public ServersClient getServers() { return this.servers; } + /** The ReplicasClient object to access its operations. */ + private final ReplicasClient replicas; + + /** + * Gets the ReplicasClient object to access its operations. + * + * @return the ReplicasClient object. + */ + public ReplicasClient getReplicas() { + return this.replicas; + } + /** The FirewallRulesClient object to access its operations. */ private final FirewallRulesClient firewallRules; @@ -142,6 +151,30 @@ public FirewallRulesClient getFirewallRules() { return this.firewallRules; } + /** The VirtualNetworkRulesClient object to access its operations. */ + private final VirtualNetworkRulesClient virtualNetworkRules; + + /** + * Gets the VirtualNetworkRulesClient object to access its operations. + * + * @return the VirtualNetworkRulesClient object. + */ + public VirtualNetworkRulesClient getVirtualNetworkRules() { + return this.virtualNetworkRules; + } + + /** The DatabasesClient object to access its operations. */ + private final DatabasesClient databases; + + /** + * Gets the DatabasesClient object to access its operations. + * + * @return the DatabasesClient object. + */ + public DatabasesClient getDatabases() { + return this.databases; + } + /** The ConfigurationsClient object to access its operations. */ private final ConfigurationsClient configurations; @@ -154,40 +187,88 @@ public ConfigurationsClient getConfigurations() { return this.configurations; } - /** The CheckNameAvailabilitiesClient object to access its operations. */ - private final CheckNameAvailabilitiesClient checkNameAvailabilities; + /** The ServerParametersClient object to access its operations. */ + private final ServerParametersClient serverParameters; /** - * Gets the CheckNameAvailabilitiesClient object to access its operations. + * Gets the ServerParametersClient object to access its operations. * - * @return the CheckNameAvailabilitiesClient object. + * @return the ServerParametersClient object. */ - public CheckNameAvailabilitiesClient getCheckNameAvailabilities() { - return this.checkNameAvailabilities; + public ServerParametersClient getServerParameters() { + return this.serverParameters; + } + + /** The LogFilesClient object to access its operations. */ + private final LogFilesClient logFiles; + + /** + * Gets the LogFilesClient object to access its operations. + * + * @return the LogFilesClient object. + */ + public LogFilesClient getLogFiles() { + return this.logFiles; + } + + /** The 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. */ + private final RecoverableServersClient recoverableServers; + + /** + * Gets the RecoverableServersClient object to access its operations. + * + * @return the RecoverableServersClient object. + */ + public RecoverableServersClient getRecoverableServers() { + return this.recoverableServers; } - /** The LocationBasedCapabilitiesClient object to access its operations. */ - private final LocationBasedCapabilitiesClient locationBasedCapabilities; + /** The ServerBasedPerformanceTiersClient object to access its operations. */ + private final ServerBasedPerformanceTiersClient serverBasedPerformanceTiers; /** - * Gets the LocationBasedCapabilitiesClient object to access its operations. + * Gets the ServerBasedPerformanceTiersClient object to access its operations. * - * @return the LocationBasedCapabilitiesClient object. + * @return the ServerBasedPerformanceTiersClient object. */ - public LocationBasedCapabilitiesClient getLocationBasedCapabilities() { - return this.locationBasedCapabilities; + public ServerBasedPerformanceTiersClient getServerBasedPerformanceTiers() { + return this.serverBasedPerformanceTiers; } - /** The VirtualNetworkSubnetUsagesClient object to access its operations. */ - private final VirtualNetworkSubnetUsagesClient virtualNetworkSubnetUsages; + /** The LocationBasedPerformanceTiersClient object to access its operations. */ + private final LocationBasedPerformanceTiersClient locationBasedPerformanceTiers; /** - * Gets the VirtualNetworkSubnetUsagesClient object to access its operations. + * Gets the LocationBasedPerformanceTiersClient object to access its operations. * - * @return the VirtualNetworkSubnetUsagesClient object. + * @return the LocationBasedPerformanceTiersClient object. */ - public VirtualNetworkSubnetUsagesClient getVirtualNetworkSubnetUsages() { - return this.virtualNetworkSubnetUsages; + public LocationBasedPerformanceTiersClient getLocationBasedPerformanceTiers() { + return this.locationBasedPerformanceTiers; + } + + /** The CheckNameAvailabilitiesClient object to access its operations. */ + private final CheckNameAvailabilitiesClient checkNameAvailabilities; + + /** + * Gets the CheckNameAvailabilitiesClient object to access its operations. + * + * @return the CheckNameAvailabilitiesClient object. + */ + public CheckNameAvailabilitiesClient getCheckNameAvailabilities() { + return this.checkNameAvailabilities; } /** The OperationsClient object to access its operations. */ @@ -202,28 +283,52 @@ public OperationsClient getOperations() { return this.operations; } - /** The DatabasesClient object to access its operations. */ - private final DatabasesClient databases; + /** The ServerSecurityAlertPoliciesClient object to access its operations. */ + private final ServerSecurityAlertPoliciesClient serverSecurityAlertPolicies; /** - * Gets the DatabasesClient object to access its operations. + * Gets the ServerSecurityAlertPoliciesClient object to access its operations. * - * @return the DatabasesClient object. + * @return the ServerSecurityAlertPoliciesClient object. */ - public DatabasesClient getDatabases() { - return this.databases; + public ServerSecurityAlertPoliciesClient getServerSecurityAlertPolicies() { + return this.serverSecurityAlertPolicies; } - /** The GetPrivateDnsZoneSuffixesClient object to access its operations. */ - private final GetPrivateDnsZoneSuffixesClient getPrivateDnsZoneSuffixes; + /** The PrivateEndpointConnectionsClient object to access its operations. */ + private final PrivateEndpointConnectionsClient privateEndpointConnections; /** - * Gets the GetPrivateDnsZoneSuffixesClient object to access its operations. + * Gets the PrivateEndpointConnectionsClient object to access its operations. * - * @return the GetPrivateDnsZoneSuffixesClient object. + * @return the PrivateEndpointConnectionsClient object. */ - public GetPrivateDnsZoneSuffixesClient getGetPrivateDnsZoneSuffixes() { - return this.getPrivateDnsZoneSuffixes; + public PrivateEndpointConnectionsClient getPrivateEndpointConnections() { + return this.privateEndpointConnections; + } + + /** The PrivateLinkResourcesClient object to access its operations. */ + private final PrivateLinkResourcesClient privateLinkResources; + + /** + * Gets the PrivateLinkResourcesClient object to access its operations. + * + * @return the PrivateLinkResourcesClient object. + */ + public PrivateLinkResourcesClient getPrivateLinkResources() { + return this.privateLinkResources; + } + + /** The 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() { + return this.serverKeys; } /** @@ -248,16 +353,24 @@ public GetPrivateDnsZoneSuffixesClient getGetPrivateDnsZoneSuffixes() { this.defaultPollInterval = defaultPollInterval; this.subscriptionId = subscriptionId; this.endpoint = endpoint; - this.apiVersion = "2021-06-01"; this.servers = new ServersClientImpl(this); + this.replicas = new ReplicasClientImpl(this); this.firewallRules = new FirewallRulesClientImpl(this); + this.virtualNetworkRules = new VirtualNetworkRulesClientImpl(this); + this.databases = new DatabasesClientImpl(this); this.configurations = new ConfigurationsClientImpl(this); + this.serverParameters = new ServerParametersClientImpl(this); + this.logFiles = new LogFilesClientImpl(this); + this.serverAdministrators = new ServerAdministratorsClientImpl(this); + this.recoverableServers = new RecoverableServersClientImpl(this); + this.serverBasedPerformanceTiers = new ServerBasedPerformanceTiersClientImpl(this); + this.locationBasedPerformanceTiers = new LocationBasedPerformanceTiersClientImpl(this); this.checkNameAvailabilities = new CheckNameAvailabilitiesClientImpl(this); - this.locationBasedCapabilities = new LocationBasedCapabilitiesClientImpl(this); - this.virtualNetworkSubnetUsages = new VirtualNetworkSubnetUsagesClientImpl(this); this.operations = new OperationsClientImpl(this); - this.databases = new DatabasesClientImpl(this); - this.getPrivateDnsZoneSuffixes = new GetPrivateDnsZoneSuffixesClientImpl(this); + this.serverSecurityAlertPolicies = new ServerSecurityAlertPoliciesClientImpl(this); + this.privateEndpointConnections = new PrivateEndpointConnectionsClientImpl(this); + this.privateLinkResources = new PrivateLinkResourcesClientImpl(this); + this.serverKeys = new ServerKeysClientImpl(this); } /** diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateEndpointConnectionImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateEndpointConnectionImpl.java new file mode 100644 index 000000000000..52bff4969c79 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateEndpointConnectionImpl.java @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateEndpointConnection; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateEndpointProperty; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateLinkServiceConnectionStateProperty; +import com.azure.resourcemanager.postgresqlflexibleserver.models.TagsObject; +import java.util.Map; + +public final class PrivateEndpointConnectionImpl + implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { + private PrivateEndpointConnectionInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateEndpointProperty privateEndpoint() { + return this.innerModel().privateEndpoint(); + } + + public PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.innerModel().privateLinkServiceConnectionState(); + } + + public String provisioningState() { + return this.innerModel().provisioningState(); + } + + public PrivateEndpointConnectionInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String privateEndpointConnectionName; + + private TagsObject updateParameters; + + public PrivateEndpointConnectionImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public PrivateEndpointConnection create() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, serverName, privateEndpointConnectionName, this.innerModel(), Context.NONE); + return this; + } + + public PrivateEndpointConnection create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .createOrUpdate( + resourceGroupName, serverName, privateEndpointConnectionName, this.innerModel(), context); + return this; + } + + PrivateEndpointConnectionImpl( + String name, com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = new PrivateEndpointConnectionInner(); + this.serviceManager = serviceManager; + this.privateEndpointConnectionName = name; + } + + public PrivateEndpointConnectionImpl update() { + this.updateParameters = new TagsObject(); + return this; + } + + public PrivateEndpointConnection apply() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .updateTags( + resourceGroupName, serverName, privateEndpointConnectionName, updateParameters, Context.NONE); + return this; + } + + public PrivateEndpointConnection apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .updateTags(resourceGroupName, serverName, privateEndpointConnectionName, updateParameters, context); + return this; + } + + PrivateEndpointConnectionImpl( + PrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.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"); + } + + public PrivateEndpointConnection refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, Context.NONE) + .getValue(); + return this; + } + + public PrivateEndpointConnection refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getPrivateEndpointConnections() + .getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, context) + .getValue(); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.innerModel().withPrivateEndpoint(privateEndpoint); + return this; + } + + public PrivateEndpointConnectionImpl withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.innerModel().withPrivateLinkServiceConnectionState(privateLinkServiceConnectionState); + return this; + } + + public PrivateEndpointConnectionImpl withTags(Map tags) { + this.updateParameters.withTags(tags); + return this; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateEndpointConnectionsClientImpl.java new file mode 100644 index 000000000000..277809c4a107 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateEndpointConnectionsClientImpl.java @@ -0,0 +1,1513 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.Patch; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateEndpointConnectionListResult; +import com.azure.resourcemanager.postgresqlflexibleserver.models.TagsObject; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateEndpointConnectionsClient. */ +public final class PrivateEndpointConnectionsClientImpl implements PrivateEndpointConnectionsClient { + private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PrivateEndpointConnectionsService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of PrivateEndpointConnectionsClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateEndpointConnectionsClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy + .create( + PrivateEndpointConnectionsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientPrivateEndpointConnections to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + private interface PrivateEndpointConnectionsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") PrivateEndpointConnectionInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Patch( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/privateEndpointConnections/{privateEndpointConnectionName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> updateTags( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("privateEndpointConnectionName") String privateEndpointConnectionName, + @BodyParam("application/json") TagsObject parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/privateEndpointConnections") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return getWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner get( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return getAsync(resourceGroupName, serverName, privateEndpointConnectionName).block(); + } + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, context).block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + Context.NONE); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, privateEndpointConnectionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .getSyncPoller(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return beginCreateOrUpdateAsync( + resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters).block(); + } + + /** + * Approve or reject a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters A private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner createOrUpdate( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + PrivateEndpointConnectionInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName, context).getSyncPoller(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, privateEndpointConnectionName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + deleteAsync(resourceGroupName, serverName, privateEndpointConnectionName).block(); + } + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + deleteAsync(resourceGroupName, serverName, privateEndpointConnectionName, context).block(); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateTagsWithResponseAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .updateTags( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> updateTagsWithResponseAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (privateEndpointConnectionName == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter privateEndpointConnectionName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .updateTags( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + privateEndpointConnectionName, + parameters, + accept, + context); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> beginUpdateTagsAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters) { + Mono>> mono = + updateTagsWithResponseAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + Context.NONE); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, PrivateEndpointConnectionInner> beginUpdateTagsAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + updateTagsWithResponseAsync( + resourceGroupName, serverName, privateEndpointConnectionName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + PrivateEndpointConnectionInner.class, + PrivateEndpointConnectionInner.class, + context); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> beginUpdateTags( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters) { + return beginUpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) + .getSyncPoller(); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, PrivateEndpointConnectionInner> beginUpdateTags( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context) { + return beginUpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .getSyncPoller(); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateTagsAsync( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters) { + return beginUpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono updateTagsAsync( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context) { + return beginUpdateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner updateTags( + String resourceGroupName, String serverName, String privateEndpointConnectionName, TagsObject parameters) { + return updateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters).block(); + } + + /** + * Updates private endpoint connection with the specified tags. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param parameters Parameters supplied to the Update private endpoint connection Tags operation. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public PrivateEndpointConnectionInner updateTags( + String resourceGroupName, + String serverName, + String privateEndpointConnectionName, + TagsObject parameters, + Context context) { + return updateTagsAsync(resourceGroupName, serverName, privateEndpointConnectionName, parameters, context) + .block(); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private endpoint connections. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateEndpointConnectionsImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateEndpointConnectionsImpl.java new file mode 100644 index 000000000000..23bc97e5ebee --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateEndpointConnectionsImpl.java @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.PrivateEndpointConnectionsClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateEndpointConnectionInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateEndpointConnection; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateEndpointConnections; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConnections { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionsImpl.class); + + private final PrivateEndpointConnectionsClient innerClient; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public PrivateEndpointConnectionsImpl( + PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PrivateEndpointConnection get( + String resourceGroupName, String serverName, String privateEndpointConnectionName) { + PrivateEndpointConnectionInner inner = + this.serviceClient().get(resourceGroupName, serverName, privateEndpointConnectionName); + if (inner != null) { + return new PrivateEndpointConnectionImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateEndpointConnectionImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName) { + this.serviceClient().delete(resourceGroupName, serverName, privateEndpointConnectionName); + } + + public void delete( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, privateEndpointConnectionName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.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())); + } + + public PrivateEndpointConnection getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this + .getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, Context.NONE) + .getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, privateEndpointConnectionName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, serverName, privateEndpointConnectionName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String privateEndpointConnectionName = Utils.getValueFromIdByName(id, "privateEndpointConnections"); + if (privateEndpointConnectionName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'privateEndpointConnections'.", + id))); + } + this.delete(resourceGroupName, serverName, privateEndpointConnectionName, context); + } + + private PrivateEndpointConnectionsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } + + public PrivateEndpointConnectionImpl define(String name) { + return new PrivateEndpointConnectionImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateLinkResourceImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateLinkResourceImpl.java new file mode 100644 index 000000000000..bc427a2f007a --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateLinkResourceImpl.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.postgresqlflexibleserver.implementation; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateLinkResource; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateLinkResourceProperties; + +public final class PrivateLinkResourceImpl implements PrivateLinkResource { + private PrivateLinkResourceInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + PrivateLinkResourceImpl( + PrivateLinkResourceInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public PrivateLinkResourceProperties properties() { + return this.innerModel().properties(); + } + + public PrivateLinkResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateLinkResourcesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateLinkResourcesClientImpl.java new file mode 100644 index 000000000000..30016f0f7d40 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateLinkResourcesClientImpl.java @@ -0,0 +1,522 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateLinkResourceListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in PrivateLinkResourcesClient. */ +public final class PrivateLinkResourcesClientImpl implements PrivateLinkResourcesClient { + private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final PrivateLinkResourcesService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of PrivateLinkResourcesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + PrivateLinkResourcesClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy + .create(PrivateLinkResourcesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientPrivateLinkResources to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + private interface PrivateLinkResourcesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/privateLinkResources") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/privateLinkResources/{groupName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("groupName") String groupName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets the private link resources for 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets the private link resources for 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets the private link resources for 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets the private link resources for 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, 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 ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Gets a private link resource for 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 ManagementException 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) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String groupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + groupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String groupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (groupName == null) { + return Mono.error(new IllegalArgumentException("Parameter groupName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2018-06-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + groupName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Gets a private link resource for 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 ManagementException 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) + private Mono getAsync(String resourceGroupName, String serverName, String groupName) { + return getWithResponseAsync(resourceGroupName, serverName, groupName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a private link resource for 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 ManagementException 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) + public PrivateLinkResourceInner get(String resourceGroupName, String serverName, String groupName) { + return getAsync(resourceGroupName, serverName, groupName).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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, groupName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of private link resources. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateLinkResourcesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateLinkResourcesImpl.java new file mode 100644 index 000000000000..29a382dbbbca --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/PrivateLinkResourcesImpl.java @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.PrivateLinkResourcesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateLinkResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateLinkResource; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PrivateLinkResources; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class PrivateLinkResourcesImpl implements PrivateLinkResources { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourcesImpl.class); + + private final PrivateLinkResourcesClient innerClient; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public PrivateLinkResourcesImpl( + PrivateLinkResourcesClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.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; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, groupName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new PrivateLinkResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + private PrivateLinkResourcesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/RecoverableServerResourceImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/RecoverableServerResourceImpl.java new file mode 100644 index 000000000000..dad4170fa079 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/RecoverableServerResourceImpl.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.postgresqlflexibleserver.implementation; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.RecoverableServerResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.RecoverableServerResource; + +public final class RecoverableServerResourceImpl implements RecoverableServerResource { + private RecoverableServerResourceInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + RecoverableServerResourceImpl( + RecoverableServerResourceInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String lastAvailableBackupDateTime() { + return this.innerModel().lastAvailableBackupDateTime(); + } + + public String serviceLevelObjective() { + return this.innerModel().serviceLevelObjective(); + } + + public String edition() { + return this.innerModel().edition(); + } + + public Integer vCore() { + return this.innerModel().vCore(); + } + + public String hardwareGeneration() { + return this.innerModel().hardwareGeneration(); + } + + public String version() { + return this.innerModel().version(); + } + + public RecoverableServerResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/RecoverableServersClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/RecoverableServersClientImpl.java new file mode 100644 index 000000000000..0ff60ca1f3ca --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/RecoverableServersClientImpl.java @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.RecoverableServersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.RecoverableServerResourceInner; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in RecoverableServersClient. */ +public final class RecoverableServersClientImpl implements RecoverableServersClient { + private final ClientLogger logger = new ClientLogger(RecoverableServersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final RecoverableServersService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of RecoverableServersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + RecoverableServersClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy.create(RecoverableServersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientRecoverableServers to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + private interface RecoverableServersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/recoverableServers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a recoverable 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 recoverable PostgreSQL Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context); + } + + /** + * Gets a recoverable 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 recoverable PostgreSQL Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName) { + return getWithResponseAsync(resourceGroupName, serverName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a recoverable 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 recoverable PostgreSQL Server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public RecoverableServerResourceInner get(String resourceGroupName, String serverName) { + return getAsync(resourceGroupName, serverName).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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, context).block(); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkSubnetUsagesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/RecoverableServersImpl.java similarity index 54% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkSubnetUsagesImpl.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/RecoverableServersImpl.java index 591f4589f95a..2f949725213a 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkSubnetUsagesImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/RecoverableServersImpl.java @@ -8,52 +8,51 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.VirtualNetworkSubnetUsagesClient; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsageParameter; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsageResult; -import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkSubnetUsages; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.RecoverableServersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.RecoverableServerResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.RecoverableServerResource; +import com.azure.resourcemanager.postgresqlflexibleserver.models.RecoverableServers; import com.fasterxml.jackson.annotation.JsonIgnore; -public final class VirtualNetworkSubnetUsagesImpl implements VirtualNetworkSubnetUsages { - @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkSubnetUsagesImpl.class); +public final class RecoverableServersImpl implements RecoverableServers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(RecoverableServersImpl.class); - private final VirtualNetworkSubnetUsagesClient innerClient; + private final RecoverableServersClient innerClient; private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; - public VirtualNetworkSubnetUsagesImpl( - VirtualNetworkSubnetUsagesClient innerClient, + public RecoverableServersImpl( + RecoverableServersClient innerClient, com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } - public VirtualNetworkSubnetUsageResult execute(String locationName, VirtualNetworkSubnetUsageParameter parameters) { - VirtualNetworkSubnetUsageResultInner inner = this.serviceClient().execute(locationName, parameters); + public RecoverableServerResource get(String resourceGroupName, String serverName) { + RecoverableServerResourceInner inner = this.serviceClient().get(resourceGroupName, serverName); if (inner != null) { - return new VirtualNetworkSubnetUsageResultImpl(inner, this.manager()); + return new RecoverableServerResourceImpl(inner, this.manager()); } else { return null; } } - public Response executeWithResponse( - String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context) { - Response inner = - this.serviceClient().executeWithResponse(locationName, parameters, context); + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, context); if (inner != null) { return new SimpleResponse<>( inner.getRequest(), inner.getStatusCode(), inner.getHeaders(), - new VirtualNetworkSubnetUsageResultImpl(inner.getValue(), this.manager())); + new RecoverableServerResourceImpl(inner.getValue(), this.manager())); } else { return null; } } - private VirtualNetworkSubnetUsagesClient serviceClient() { + private RecoverableServersClient serviceClient() { return this.innerClient; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ReplicasClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ReplicasClientImpl.java new file mode 100644 index 000000000000..349fcf6d5273 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ReplicasClientImpl.java @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ReplicasClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ReplicasClient. */ +public final class ReplicasClientImpl implements ReplicasClient { + private final ClientLogger logger = new ClientLogger(ReplicasClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ReplicasService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of ReplicasClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ReplicasClientImpl(PostgreSqlManagementClientImpl client) { + this.service = RestProxy.create(ReplicasService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientReplicas to be used by the proxy service to + * perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + private interface ReplicasService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/replicas") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync(String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName)); + } + + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listByServerSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ReplicasImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ReplicasImpl.java new file mode 100644 index 000000000000..ecd7ba1bafdc --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ReplicasImpl.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.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ReplicasClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.Replicas; +import com.azure.resourcemanager.postgresqlflexibleserver.models.Server; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ReplicasImpl implements Replicas { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ReplicasImpl.class); + + private final ReplicasClient innerClient; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public ReplicasImpl( + ReplicasClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.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())); + } + + private ReplicasClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerAdministratorResourceImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerAdministratorResourceImpl.java new file mode 100644 index 000000000000..19c4ec637ffe --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerAdministratorResourceImpl.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerAdministratorResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.AdministratorType; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerAdministratorResource; +import java.util.UUID; + +public final class ServerAdministratorResourceImpl implements ServerAdministratorResource { + private ServerAdministratorResourceInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + ServerAdministratorResourceImpl( + ServerAdministratorResourceInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = innerObject; + this.serviceManager = serviceManager; + } + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public AdministratorType administratorType() { + return this.innerModel().administratorType(); + } + + public String login() { + return this.innerModel().login(); + } + + public UUID sid() { + return this.innerModel().sid(); + } + + public UUID tenantId() { + return this.innerModel().tenantId(); + } + + public ServerAdministratorResourceInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerAdministratorsClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerAdministratorsClientImpl.java new file mode 100644 index 000000000000..37959ab12089 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerAdministratorsClientImpl.java @@ -0,0 +1,965 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerAdministratorsClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerAdministratorResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerAdministratorResourceListResult; +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. */ +public final class ServerAdministratorsClientImpl implements ServerAdministratorsClient { + private final ClientLogger logger = new ClientLogger(ServerAdministratorsClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerAdministratorsService service; + + /** 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) { + this.service = + RestProxy + .create(ServerAdministratorsService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientServerAdministrators to be used by the + * proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + private interface ServerAdministratorsService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/administrators/activeDirectory") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/administrators/activeDirectory") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @BodyParam("application/json") ServerAdministratorResourceInner properties, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @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, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/administrators") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context); + } + + /** + * Gets 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync(String resourceGroupName, String serverName) { + return getWithResponseAsync(resourceGroupName, serverName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAdministratorResourceInner get(String resourceGroupName, String serverName) { + return getAsync(resourceGroupName, serverName).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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, context).block(); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private 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.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + properties, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (properties == null) { + return Mono.error(new IllegalArgumentException("Parameter properties is required and cannot be null.")); + } else { + properties.validate(); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + properties, + accept, + context); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerAdministratorResourceInner> + beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, properties); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerAdministratorResourceInner.class, + ServerAdministratorResourceInner.class, + Context.NONE); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerAdministratorResourceInner> + beginCreateOrUpdateAsync( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, properties, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerAdministratorResourceInner.class, + ServerAdministratorResourceInner.class, + context); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerAdministratorResourceInner> + beginCreateOrUpdate(String resourceGroupName, String serverName, ServerAdministratorResourceInner properties) { + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerAdministratorResourceInner> + beginCreateOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, Context context) { + return 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, properties) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, properties, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAdministratorResourceInner createOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties) { + return createOrUpdateAsync(resourceGroupName, serverName, properties).block(); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerAdministratorResourceInner createOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, properties, context).block(); + } + + /** + * 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync(String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context); + } + + /** + * Deletes 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync(String resourceGroupName, String serverName) { + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = deleteWithResponseAsync(resourceGroupName, serverName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String resourceGroupName, String serverName) { + return 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, Context context) { + return 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. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName) { + return beginDeleteAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName) { + deleteAsync(resourceGroupName, serverName).block(); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, Context context) { + deleteAsync(resourceGroupName, serverName, context).block(); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serverName, 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serverName) { + return new PagedIterable<>(listAsync(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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerAdministratorsImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerAdministratorsImpl.java new file mode 100644 index 000000000000..f0503369ed2e --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerAdministratorsImpl.java @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerAdministratorsClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerAdministratorResourceInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerAdministratorResource; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerAdministrators; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerAdministratorsImpl implements ServerAdministrators { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerAdministratorsImpl.class); + + private final ServerAdministratorsClient innerClient; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public ServerAdministratorsImpl( + ServerAdministratorsClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = 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 = + this.serviceClient().getWithResponse(resourceGroupName, serverName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerAdministratorResourceImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public ServerAdministratorResource createOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties) { + ServerAdministratorResourceInner inner = + this.serviceClient().createOrUpdate(resourceGroupName, serverName, properties); + if (inner != null) { + return new ServerAdministratorResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public ServerAdministratorResource createOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, Context context) { + ServerAdministratorResourceInner inner = + this.serviceClient().createOrUpdate(resourceGroupName, serverName, properties, context); + if (inner != null) { + return new ServerAdministratorResourceImpl(inner, this.manager()); + } else { + return null; + } + } + + public void deleteByResourceGroup(String resourceGroupName, String serverName) { + this.serviceClient().delete(resourceGroupName, serverName); + } + + public void delete(String resourceGroupName, String serverName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, context); + } + + public PagedIterable list(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().list(resourceGroupName, serverName); + return Utils.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())); + } + + private ServerAdministratorsClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerBasedPerformanceTiersClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerBasedPerformanceTiersClientImpl.java new file mode 100644 index 000000000000..15c686bb5e17 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerBasedPerformanceTiersClientImpl.java @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerBasedPerformanceTiersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PerformanceTierListResult; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerBasedPerformanceTiersClient. */ +public final class ServerBasedPerformanceTiersClientImpl implements ServerBasedPerformanceTiersClient { + private final ClientLogger logger = new ClientLogger(ServerBasedPerformanceTiersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerBasedPerformanceTiersService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of ServerBasedPerformanceTiersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerBasedPerformanceTiersClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerBasedPerformanceTiersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientServerBasedPerformanceTiers to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + private interface ServerBasedPerformanceTiersService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/performanceTiers") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * List all the performance tiers for a 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); + } + + /** + * List all the performance tiers for a 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>(() -> listSinglePageAsync(resourceGroupName, serverName, context)); + } + + /** + * List all the performance tiers for a 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serverName) { + return new PagedIterable<>(listAsync(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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, serverName, context)); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerBasedPerformanceTiersImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerBasedPerformanceTiersImpl.java new file mode 100644 index 000000000000..e9503ae6a87e --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerBasedPerformanceTiersImpl.java @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerBasedPerformanceTiersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PerformanceTierProperties; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerBasedPerformanceTiers; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerBasedPerformanceTiersImpl implements ServerBasedPerformanceTiers { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerBasedPerformanceTiersImpl.class); + + private final ServerBasedPerformanceTiersClient innerClient; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public ServerBasedPerformanceTiersImpl( + ServerBasedPerformanceTiersClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, serverName); + return Utils.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())); + } + + private ServerBasedPerformanceTiersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerImpl.java index 35b7228de5e9..919952e286f7 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerImpl.java @@ -5,25 +5,25 @@ package com.azure.resourcemanager.postgresqlflexibleserver.implementation; import com.azure.core.management.Region; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Backup; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateMode; -import com.azure.resourcemanager.postgresqlflexibleserver.models.CreateModeForUpdate; -import com.azure.resourcemanager.postgresqlflexibleserver.models.HighAvailability; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Identity; -import com.azure.resourcemanager.postgresqlflexibleserver.models.MaintenanceWindow; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Network; -import com.azure.resourcemanager.postgresqlflexibleserver.models.RestartParameter; +import com.azure.resourcemanager.postgresqlflexibleserver.models.InfrastructureEncryption; +import com.azure.resourcemanager.postgresqlflexibleserver.models.MinimalTlsVersionEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.PublicNetworkAccessEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ResourceIdentity; import com.azure.resourcemanager.postgresqlflexibleserver.models.Server; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerForUpdate; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerForCreate; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerPrivateEndpointConnection; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerPropertiesForCreate; import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerState; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerUpdateParameters; import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerVersion; import com.azure.resourcemanager.postgresqlflexibleserver.models.Sku; -import com.azure.resourcemanager.postgresqlflexibleserver.models.Storage; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SslEnforcementEnum; +import com.azure.resourcemanager.postgresqlflexibleserver.models.StorageProfile; import java.time.OffsetDateTime; import java.util.Collections; +import java.util.List; import java.util.Map; public final class ServerImpl implements Server, Server.Definition, Server.Update { @@ -56,7 +56,7 @@ public Map tags() { } } - public Identity identity() { + public ResourceIdentity identity() { return this.innerModel().identity(); } @@ -64,76 +64,68 @@ public Sku sku() { return this.innerModel().sku(); } - public SystemData systemData() { - return this.innerModel().systemData(); - } - public String administratorLogin() { return this.innerModel().administratorLogin(); } - public String administratorLoginPassword() { - return this.innerModel().administratorLoginPassword(); - } - public ServerVersion version() { return this.innerModel().version(); } - public String minorVersion() { - return this.innerModel().minorVersion(); + public SslEnforcementEnum sslEnforcement() { + return this.innerModel().sslEnforcement(); } - public ServerState state() { - return this.innerModel().state(); + public MinimalTlsVersionEnum minimalTlsVersion() { + return this.innerModel().minimalTlsVersion(); } - public String fullyQualifiedDomainName() { - return this.innerModel().fullyQualifiedDomainName(); + public String byokEnforcement() { + return this.innerModel().byokEnforcement(); } - public Storage storage() { - return this.innerModel().storage(); + public InfrastructureEncryption infrastructureEncryption() { + return this.innerModel().infrastructureEncryption(); } - public Backup backup() { - return this.innerModel().backup(); + public ServerState userVisibleState() { + return this.innerModel().userVisibleState(); } - public Network network() { - return this.innerModel().network(); + public String fullyQualifiedDomainName() { + return this.innerModel().fullyQualifiedDomainName(); } - public HighAvailability highAvailability() { - return this.innerModel().highAvailability(); + public OffsetDateTime earliestRestoreDate() { + return this.innerModel().earliestRestoreDate(); } - public MaintenanceWindow maintenanceWindow() { - return this.innerModel().maintenanceWindow(); + public StorageProfile storageProfile() { + return this.innerModel().storageProfile(); } - public String sourceServerResourceId() { - return this.innerModel().sourceServerResourceId(); + public String replicationRole() { + return this.innerModel().replicationRole(); } - public OffsetDateTime pointInTimeUtc() { - return this.innerModel().pointInTimeUtc(); + public String masterServerId() { + return this.innerModel().masterServerId(); } - public String availabilityZone() { - return this.innerModel().availabilityZone(); + public Integer replicaCapacity() { + return this.innerModel().replicaCapacity(); } - public CreateMode createMode() { - return this.innerModel().createMode(); + public PublicNetworkAccessEnum publicNetworkAccess() { + return this.innerModel().publicNetworkAccess(); } - public Map tagsPropertiesTags() { - Map inner = this.innerModel().tagsPropertiesTags(); + public List privateEndpointConnections() { + List inner = this.innerModel().privateEndpointConnections(); if (inner != null) { - return Collections.unmodifiableMap(inner); + return Collections.unmodifiableList(inner); } else { - return Collections.emptyMap(); + return Collections.emptyList(); } } @@ -157,7 +149,9 @@ private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager man private String serverName; - private ServerForUpdate updateParameters; + private ServerForCreate createParameters; + + private ServerUpdateParameters updateParameters; public ServerImpl withExistingResourceGroup(String resourceGroupName) { this.resourceGroupName = resourceGroupName; @@ -169,7 +163,7 @@ public Server create() { serviceManager .serviceClient() .getServers() - .create(resourceGroupName, serverName, this.innerModel(), Context.NONE); + .create(resourceGroupName, serverName, createParameters, Context.NONE); return this; } @@ -178,7 +172,7 @@ public Server create(Context context) { serviceManager .serviceClient() .getServers() - .create(resourceGroupName, serverName, this.innerModel(), context); + .create(resourceGroupName, serverName, createParameters, context); return this; } @@ -186,10 +180,11 @@ public Server create(Context context) { this.innerObject = new ServerInner(); this.serviceManager = serviceManager; this.serverName = name; + this.createParameters = new ServerForCreate(); } public ServerImpl update() { - this.updateParameters = new ServerForUpdate(); + this.updateParameters = new ServerUpdateParameters(); return this; } @@ -216,7 +211,7 @@ public Server apply(Context context) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); - this.serverName = Utils.getValueFromIdByName(innerObject.id(), "flexibleServers"); + this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); } public Server refresh() { @@ -239,156 +234,91 @@ public Server refresh(Context context) { return this; } - public void restart(RestartParameter parameters) { - serviceManager.servers().restart(resourceGroupName, serverName, parameters); - } - public void restart() { serviceManager.servers().restart(resourceGroupName, serverName); } - public void restart(RestartParameter parameters, Context context) { - serviceManager.servers().restart(resourceGroupName, serverName, parameters, context); - } - - public void start() { - serviceManager.servers().start(resourceGroupName, serverName); - } - - public void start(Context context) { - serviceManager.servers().start(resourceGroupName, serverName, context); - } - - public void stop() { - serviceManager.servers().stop(resourceGroupName, serverName); - } - - public void stop(Context context) { - serviceManager.servers().stop(resourceGroupName, serverName, context); + public void restart(Context context) { + serviceManager.servers().restart(resourceGroupName, serverName, context); } public ServerImpl withRegion(Region location) { - this.innerModel().withLocation(location.toString()); + this.createParameters.withLocation(location.toString()); return this; } public ServerImpl withRegion(String location) { - this.innerModel().withLocation(location); + this.createParameters.withLocation(location); return this; } - public ServerImpl withTags(Map tags) { - if (isInCreateMode()) { - this.innerModel().withTags(tags); - return this; - } else { - this.updateParameters.withTags(tags); - return this; - } - } - - public ServerImpl withIdentity(Identity identity) { - this.innerModel().withIdentity(identity); + public ServerImpl withProperties(ServerPropertiesForCreate properties) { + this.createParameters.withProperties(properties); return this; } - public ServerImpl withSku(Sku sku) { - if (isInCreateMode()) { - this.innerModel().withSku(sku); - return this; - } else { - this.updateParameters.withSku(sku); - return this; - } - } - - public ServerImpl withAdministratorLogin(String administratorLogin) { - this.innerModel().withAdministratorLogin(administratorLogin); - return this; - } - - public ServerImpl withAdministratorLoginPassword(String administratorLoginPassword) { - if (isInCreateMode()) { - this.innerModel().withAdministratorLoginPassword(administratorLoginPassword); - return this; - } else { - this.updateParameters.withAdministratorLoginPassword(administratorLoginPassword); - return this; - } - } - - public ServerImpl withVersion(ServerVersion version) { - this.innerModel().withVersion(version); - return this; - } - - public ServerImpl withStorage(Storage storage) { + public ServerImpl withTags(Map tags) { if (isInCreateMode()) { - this.innerModel().withStorage(storage); + this.createParameters.withTags(tags); return this; } else { - this.updateParameters.withStorage(storage); + this.updateParameters.withTags(tags); return this; } } - public ServerImpl withBackup(Backup backup) { + public ServerImpl withIdentity(ResourceIdentity identity) { if (isInCreateMode()) { - this.innerModel().withBackup(backup); + this.createParameters.withIdentity(identity); return this; } else { - this.updateParameters.withBackup(backup); + this.updateParameters.withIdentity(identity); return this; } } - public ServerImpl withNetwork(Network network) { - this.innerModel().withNetwork(network); - return this; - } - - public ServerImpl withHighAvailability(HighAvailability highAvailability) { + public ServerImpl withSku(Sku sku) { if (isInCreateMode()) { - this.innerModel().withHighAvailability(highAvailability); + this.createParameters.withSku(sku); return this; } else { - this.updateParameters.withHighAvailability(highAvailability); + this.updateParameters.withSku(sku); return this; } } - public ServerImpl withSourceServerResourceId(String sourceServerResourceId) { - this.innerModel().withSourceServerResourceId(sourceServerResourceId); + public ServerImpl withStorageProfile(StorageProfile storageProfile) { + this.updateParameters.withStorageProfile(storageProfile); return this; } - public ServerImpl withPointInTimeUtc(OffsetDateTime pointInTimeUtc) { - this.innerModel().withPointInTimeUtc(pointInTimeUtc); + public ServerImpl withAdministratorLoginPassword(String administratorLoginPassword) { + this.updateParameters.withAdministratorLoginPassword(administratorLoginPassword); return this; } - public ServerImpl withAvailabilityZone(String availabilityZone) { - this.innerModel().withAvailabilityZone(availabilityZone); + public ServerImpl withVersion(ServerVersion version) { + this.updateParameters.withVersion(version); return this; } - public ServerImpl withCreateMode(CreateMode createMode) { - this.innerModel().withCreateMode(createMode); + public ServerImpl withSslEnforcement(SslEnforcementEnum sslEnforcement) { + this.updateParameters.withSslEnforcement(sslEnforcement); return this; } - public ServerImpl withTagsPropertiesTags(Map tagsPropertiesTags) { - this.innerModel().withTagsPropertiesTags(tagsPropertiesTags); + public ServerImpl withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + this.updateParameters.withMinimalTlsVersion(minimalTlsVersion); return this; } - public ServerImpl withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { - this.updateParameters.withMaintenanceWindow(maintenanceWindow); + public ServerImpl withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + this.updateParameters.withPublicNetworkAccess(publicNetworkAccess); return this; } - public ServerImpl withCreateMode(CreateModeForUpdate createMode) { - this.updateParameters.withCreateMode(createMode); + public ServerImpl withReplicationRole(String replicationRole) { + this.updateParameters.withReplicationRole(replicationRole); return this; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerKeyImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerKeyImpl.java new file mode 100644 index 000000000000..df9553312a4d --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerKeyImpl.java @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerKeyInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerKey; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerKeyType; +import java.time.OffsetDateTime; + +public final class ServerKeyImpl implements ServerKey, ServerKey.Definition, ServerKey.Update { + private ServerKeyInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String kind() { + return this.innerModel().kind(); + } + + public ServerKeyType serverKeyType() { + return this.innerModel().serverKeyType(); + } + + public String uri() { + return this.innerModel().uri(); + } + + public OffsetDateTime creationDate() { + return this.innerModel().creationDate(); + } + + public ServerKeyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } + + private String serverName; + + private String keyName; + + private String resourceGroupName; + + public ServerKeyImpl withExistingServer(String serverName, String resourceGroupName) { + this.serverName = serverName; + this.resourceGroupName = resourceGroupName; + return this; + } + + public ServerKey create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .createOrUpdate(serverName, keyName, resourceGroupName, this.innerModel(), Context.NONE); + return this; + } + + public ServerKey create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .createOrUpdate(serverName, keyName, resourceGroupName, this.innerModel(), context); + return this; + } + + ServerKeyImpl(String name, com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = new ServerKeyInner(); + this.serviceManager = serviceManager; + this.keyName = name; + } + + public ServerKeyImpl update() { + return this; + } + + public ServerKey apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .createOrUpdate(serverName, keyName, resourceGroupName, this.innerModel(), Context.NONE); + return this; + } + + public ServerKey apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .createOrUpdate(serverName, keyName, resourceGroupName, this.innerModel(), context); + return this; + } + + ServerKeyImpl( + ServerKeyInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.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"); + } + + public ServerKey refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .getWithResponse(resourceGroupName, serverName, keyName, Context.NONE) + .getValue(); + return this; + } + + public ServerKey refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerKeys() + .getWithResponse(resourceGroupName, serverName, keyName, context) + .getValue(); + return this; + } + + public ServerKeyImpl withServerKeyType(ServerKeyType serverKeyType) { + this.innerModel().withServerKeyType(serverKeyType); + return this; + } + + public ServerKeyImpl withUri(String uri) { + this.innerModel().withUri(uri); + return this; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerKeysClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerKeysClientImpl.java new file mode 100644 index 000000000000..07ddc3ec1163 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerKeysClientImpl.java @@ -0,0 +1,1091 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerKeysClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerKeyInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerKeyListResult; +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. */ +public final class ServerKeysClientImpl implements ServerKeysClient { + private final ClientLogger logger = new ClientLogger(ServerKeysClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerKeysService service; + + /** 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) { + this.service = + RestProxy.create(ServerKeysService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientServerKeys to be used by the proxy service + * to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + private interface ServerKeysService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/keys") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> list( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/keys/{keyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("keyName") String keyName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/keys/{keyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("serverName") String serverName, + @PathParam("keyName") String keyName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @BodyParam("application/json") ServerKeyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @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, + @PathParam("serverName") String serverName, + @PathParam("keyName") String keyName, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync(String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .list( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listAsync(String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listNextSinglePageAsync(nextLink, context)); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serverName) { + return new PagedIterable<>(listAsync(resourceGroupName, 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 ManagementException thrown if 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable list(String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listAsync(resourceGroupName, serverName, 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 ManagementException 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) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String keyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + keyName, + apiVersion, + this.client.getSubscriptionId(), + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String keyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + keyName, + apiVersion, + this.client.getSubscriptionId(), + accept, + 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 ManagementException 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) + 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(); + } + }); + } + + /** + * 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 ManagementException 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) + public ServerKeyInner get(String resourceGroupName, String serverName, String keyName) { + return getAsync(resourceGroupName, serverName, keyName).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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String keyName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, keyName, context).block(); + } + + /** + * 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 ManagementException 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) + private Mono>> createOrUpdateWithResponseAsync( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + serverName, + keyName, + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) + private Mono>> createOrUpdateWithResponseAsync( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + serverName, + keyName, + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + parameters, + accept, + context); + } + + /** + * 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 ManagementException 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) + private PollerFlux, ServerKeyInner> beginCreateOrUpdateAsync( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(serverName, keyName, resourceGroupName, parameters); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerKeyInner.class, ServerKeyInner.class, Context.NONE); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) + private PollerFlux, ServerKeyInner> beginCreateOrUpdateAsync( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(serverName, keyName, resourceGroupName, parameters, context); + return this + .client + .getLroResult( + mono, this.client.getHttpPipeline(), ServerKeyInner.class, ServerKeyInner.class, context); + } + + /** + * 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 ManagementException 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) + public SyncPoller, ServerKeyInner> beginCreateOrUpdate( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters) { + return 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. + * @param parameters The requested PostgreSQL Server key resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a PostgreSQL Server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerKeyInner> beginCreateOrUpdate( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters, Context context) { + return 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. + * @param parameters The requested PostgreSQL Server key resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a PostgreSQL Server key. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters) { + return beginCreateOrUpdateAsync(serverName, keyName, resourceGroupName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) + private Mono createOrUpdateAsync( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters, Context context) { + return beginCreateOrUpdateAsync(serverName, keyName, resourceGroupName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * 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 ManagementException 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) + public ServerKeyInner createOrUpdate( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters) { + return createOrUpdateAsync(serverName, keyName, resourceGroupName, parameters).block(); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException 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) + public ServerKeyInner createOrUpdate( + String serverName, String keyName, String resourceGroupName, ServerKeyInner parameters, Context context) { + return createOrUpdateAsync(serverName, keyName, resourceGroupName, parameters, context).block(); + } + + /** + * 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String serverName, String keyName, String resourceGroupName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + serverName, + keyName, + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String serverName, String keyName, String resourceGroupName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (keyName == null) { + return Mono.error(new IllegalArgumentException("Parameter keyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + final String apiVersion = "2020-01-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + serverName, + keyName, + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + accept, + context); + } + + /** + * 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private 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, Context.NONE); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String serverName, String keyName, String resourceGroupName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(serverName, keyName, resourceGroupName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * 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 completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete(String serverName, String keyName, String resourceGroupName) { + return 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String serverName, String keyName, String resourceGroupName, Context context) { + return 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String serverName, String keyName, String resourceGroupName, Context context) { + return beginDeleteAsync(serverName, keyName, resourceGroupName, context) + .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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String serverName, String keyName, String resourceGroupName) { + deleteAsync(serverName, keyName, resourceGroupName).block(); + } + + /** + * 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String serverName, String keyName, String resourceGroupName, Context context) { + deleteAsync(serverName, keyName, resourceGroupName, context).block(); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgreSQL Server keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of PostgreSQL Server keys. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listNextSinglePageAsync(String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerKeysImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerKeysImpl.java new file mode 100644 index 000000000000..ef6778cd2af3 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerKeysImpl.java @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerKeysClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerKeyInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerKey; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerKeys; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerKeysImpl implements ServerKeys { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerKeysImpl.class); + + private final ServerKeysClient innerClient; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public ServerKeysImpl( + ServerKeysClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public PagedIterable list(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().list(resourceGroupName, serverName); + return Utils.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; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String keyName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, keyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerKeyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String serverName, String keyName, String resourceGroupName) { + this.serviceClient().delete(serverName, keyName, resourceGroupName); + } + + public void delete(String serverName, String keyName, String resourceGroupName, Context context) { + this.serviceClient().delete(serverName, keyName, resourceGroupName, context); + } + + public ServerKey getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + 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"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String keyName = Utils.getValueFromIdByName(id, "keys"); + if (keyName == null) { + 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"); + if (serverName == null) { + 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"); + if (keyName == null) { + 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"); + if (resourceGroupName == null) { + 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"); + if (serverName == null) { + 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"); + if (keyName == null) { + 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"); + if (resourceGroupName == null) { + 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); + } + + private ServerKeysClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } + + public ServerKeyImpl define(String name) { + return new ServerKeyImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerParametersClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerParametersClientImpl.java new file mode 100644 index 000000000000..c1134f0ecec4 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerParametersClientImpl.java @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Post; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerParametersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationListResultInner; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerParametersClient. */ +public final class ServerParametersClientImpl implements ServerParametersClient { + private final ClientLogger logger = new ClientLogger(ServerParametersClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerParametersService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of ServerParametersClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerParametersClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy.create(ServerParametersService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientServerParameters to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + private interface ServerParametersService { + @Headers({"Content-Type: application/json"}) + @Post( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/updateConfigurations") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> listUpdateConfigurations( + @HostParam("$host") String endpoint, + @QueryParam("api-version") String apiVersion, + @PathParam("subscriptionId") String subscriptionId, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @BodyParam("application/json") ConfigurationListResultInner value, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listUpdateConfigurationsWithResponseAsync( + String resourceGroupName, String serverName, ConfigurationListResultInner value) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (value == null) { + return Mono.error(new IllegalArgumentException("Parameter value is required and cannot be null.")); + } else { + value.validate(); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listUpdateConfigurations( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + value, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> listUpdateConfigurationsWithResponseAsync( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (value == null) { + return Mono.error(new IllegalArgumentException("Parameter value is required and cannot be null.")); + } else { + value.validate(); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listUpdateConfigurations( + this.client.getEndpoint(), + apiVersion, + this.client.getSubscriptionId(), + resourceGroupName, + serverName, + value, + accept, + context); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ConfigurationListResultInner> + beginListUpdateConfigurationsAsync( + String resourceGroupName, String serverName, ConfigurationListResultInner value) { + Mono>> mono = + listUpdateConfigurationsWithResponseAsync(resourceGroupName, serverName, value); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ConfigurationListResultInner.class, + ConfigurationListResultInner.class, + Context.NONE); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ConfigurationListResultInner> + beginListUpdateConfigurationsAsync( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + listUpdateConfigurationsWithResponseAsync(resourceGroupName, serverName, value, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ConfigurationListResultInner.class, + ConfigurationListResultInner.class, + context); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ConfigurationListResultInner> + beginListUpdateConfigurations(String resourceGroupName, String serverName, ConfigurationListResultInner value) { + return beginListUpdateConfigurationsAsync(resourceGroupName, serverName, value).getSyncPoller(); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ConfigurationListResultInner> + beginListUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context) { + return beginListUpdateConfigurationsAsync(resourceGroupName, serverName, value, context).getSyncPoller(); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listUpdateConfigurationsAsync( + String resourceGroupName, String serverName, ConfigurationListResultInner value) { + return beginListUpdateConfigurationsAsync(resourceGroupName, serverName, value) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono listUpdateConfigurationsAsync( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context) { + return beginListUpdateConfigurationsAsync(resourceGroupName, serverName, value, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationListResultInner listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value) { + return listUpdateConfigurationsAsync(resourceGroupName, serverName, value).block(); + } + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ConfigurationListResultInner listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context) { + return listUpdateConfigurationsAsync(resourceGroupName, serverName, value, context).block(); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerParametersImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerParametersImpl.java new file mode 100644 index 000000000000..b0c5be9f1c90 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerParametersImpl.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.postgresqlflexibleserver.implementation; + +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerParametersClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationListResultInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ConfigurationListResult; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerParameters; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerParametersImpl implements ServerParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerParametersImpl.class); + + private final ServerParametersClient innerClient; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public ServerParametersImpl( + ServerParametersClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ConfigurationListResult listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value) { + ConfigurationListResultInner inner = + this.serviceClient().listUpdateConfigurations(resourceGroupName, serverName, value); + if (inner != null) { + return new ConfigurationListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + public ConfigurationListResult listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context) { + ConfigurationListResultInner inner = + this.serviceClient().listUpdateConfigurations(resourceGroupName, serverName, value, context); + if (inner != null) { + return new ConfigurationListResultImpl(inner, this.manager()); + } else { + return null; + } + } + + private ServerParametersClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerSecurityAlertPoliciesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerSecurityAlertPoliciesClientImpl.java new file mode 100644 index 000000000000..ada14e63cfac --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerSecurityAlertPoliciesClientImpl.java @@ -0,0 +1,889 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerSecurityAlertPolicyListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in ServerSecurityAlertPoliciesClient. */ +public final class ServerSecurityAlertPoliciesClientImpl implements ServerSecurityAlertPoliciesClient { + private final ClientLogger logger = new ClientLogger(ServerSecurityAlertPoliciesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final ServerSecurityAlertPoliciesService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of ServerSecurityAlertPoliciesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + ServerSecurityAlertPoliciesClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy + .create( + ServerSecurityAlertPoliciesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientServerSecurityAlertPolicies to be used by + * the proxy service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + private interface ServerSecurityAlertPoliciesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/securityAlertPolicies/{securityAlertPolicyName}") + @ExpectedResponses({200, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("securityAlertPolicyName") SecurityAlertPolicyName securityAlertPolicyName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @BodyParam("application/json") ServerSecurityAlertPolicyInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/securityAlertPolicies") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName) { + return getWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerSecurityAlertPolicyInner get( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName) { + return getAsync(resourceGroupName, serverName, securityAlertPolicyName).block(); + } + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName, context).block(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (securityAlertPolicyName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter securityAlertPolicyName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + securityAlertPolicyName, + this.client.getSubscriptionId(), + apiVersion, + parameters, + accept, + context); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerSecurityAlertPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerSecurityAlertPolicyInner.class, + ServerSecurityAlertPolicyInner.class, + Context.NONE); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, ServerSecurityAlertPolicyInner> + beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync( + resourceGroupName, serverName, securityAlertPolicyName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + ServerSecurityAlertPolicyInner.class, + ServerSecurityAlertPolicyInner.class, + context); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, ServerSecurityAlertPolicyInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters).block(); + } + + /** + * Creates or updates a threat detection policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the threat detection policy. + * @param parameters The server security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server security alert policy. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public ServerSecurityAlertPolicyInner createOrUpdate( + String resourceGroupName, + String serverName, + SecurityAlertPolicyName securityAlertPolicyName, + ServerSecurityAlertPolicyInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, securityAlertPolicyName, parameters, context).block(); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, 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 ManagementException 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. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's security alert policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of the server's security alert policies. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerSecurityAlertPoliciesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerSecurityAlertPoliciesImpl.java new file mode 100644 index 000000000000..dcbfa03fb8ff --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerSecurityAlertPoliciesImpl.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServerSecurityAlertPoliciesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerSecurityAlertPolicies; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerSecurityAlertPolicy; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class ServerSecurityAlertPoliciesImpl implements ServerSecurityAlertPolicies { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerSecurityAlertPoliciesImpl.class); + + private final ServerSecurityAlertPoliciesClient innerClient; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public ServerSecurityAlertPoliciesImpl( + ServerSecurityAlertPoliciesClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public ServerSecurityAlertPolicy get( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName) { + ServerSecurityAlertPolicyInner inner = + this.serviceClient().get(resourceGroupName, serverName, securityAlertPolicyName); + if (inner != null) { + return new ServerSecurityAlertPolicyImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new ServerSecurityAlertPolicyImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = + this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.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())); + } + + public ServerSecurityAlertPolicy getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(Utils.getValueFromIdByName(id, "securityAlertPolicies")); + if (securityAlertPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + SecurityAlertPolicyName securityAlertPolicyName = + SecurityAlertPolicyName.fromString(Utils.getValueFromIdByName(id, "securityAlertPolicies")); + if (securityAlertPolicyName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'securityAlertPolicies'.", + id))); + } + return this.getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, context); + } + + private ServerSecurityAlertPoliciesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } + + public ServerSecurityAlertPolicyImpl define(SecurityAlertPolicyName name) { + return new ServerSecurityAlertPolicyImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerSecurityAlertPolicyImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerSecurityAlertPolicyImpl.java new file mode 100644 index 000000000000..f164dc377bd6 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServerSecurityAlertPolicyImpl.java @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerSecurityAlertPolicyInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.SecurityAlertPolicyName; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerSecurityAlertPolicy; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerSecurityAlertPolicyState; +import java.util.Collections; +import java.util.List; + +public final class ServerSecurityAlertPolicyImpl + implements ServerSecurityAlertPolicy, ServerSecurityAlertPolicy.Definition, ServerSecurityAlertPolicy.Update { + private ServerSecurityAlertPolicyInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public ServerSecurityAlertPolicyState state() { + return this.innerModel().state(); + } + + public List disabledAlerts() { + List inner = this.innerModel().disabledAlerts(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public List emailAddresses() { + List inner = this.innerModel().emailAddresses(); + if (inner != null) { + return Collections.unmodifiableList(inner); + } else { + return Collections.emptyList(); + } + } + + public Boolean emailAccountAdmins() { + return this.innerModel().emailAccountAdmins(); + } + + public String storageEndpoint() { + return this.innerModel().storageEndpoint(); + } + + public String storageAccountAccessKey() { + return this.innerModel().storageAccountAccessKey(); + } + + public Integer retentionDays() { + return this.innerModel().retentionDays(); + } + + public ServerSecurityAlertPolicyInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private SecurityAlertPolicyName securityAlertPolicyName; + + public ServerSecurityAlertPolicyImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public ServerSecurityAlertPolicy create() { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate( + resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public ServerSecurityAlertPolicy create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate(resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), context); + return this; + } + + ServerSecurityAlertPolicyImpl( + SecurityAlertPolicyName name, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = new ServerSecurityAlertPolicyInner(); + this.serviceManager = serviceManager; + this.securityAlertPolicyName = name; + } + + public ServerSecurityAlertPolicyImpl update() { + return this; + } + + public ServerSecurityAlertPolicy apply() { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate( + resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), Context.NONE); + return this; + } + + public ServerSecurityAlertPolicy apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .createOrUpdate(resourceGroupName, serverName, securityAlertPolicyName, this.innerModel(), context); + return this; + } + + ServerSecurityAlertPolicyImpl( + ServerSecurityAlertPolicyInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.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")); + } + + public ServerSecurityAlertPolicy refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, Context.NONE) + .getValue(); + return this; + } + + public ServerSecurityAlertPolicy refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getServerSecurityAlertPolicies() + .getWithResponse(resourceGroupName, serverName, securityAlertPolicyName, context) + .getValue(); + return this; + } + + public ServerSecurityAlertPolicyImpl withState(ServerSecurityAlertPolicyState state) { + this.innerModel().withState(state); + return this; + } + + public ServerSecurityAlertPolicyImpl withDisabledAlerts(List disabledAlerts) { + this.innerModel().withDisabledAlerts(disabledAlerts); + return this; + } + + public ServerSecurityAlertPolicyImpl withEmailAddresses(List emailAddresses) { + this.innerModel().withEmailAddresses(emailAddresses); + return this; + } + + public ServerSecurityAlertPolicyImpl withEmailAccountAdmins(Boolean emailAccountAdmins) { + this.innerModel().withEmailAccountAdmins(emailAccountAdmins); + return this; + } + + public ServerSecurityAlertPolicyImpl withStorageEndpoint(String storageEndpoint) { + this.innerModel().withStorageEndpoint(storageEndpoint); + return this; + } + + public ServerSecurityAlertPolicyImpl withStorageAccountAccessKey(String storageAccountAccessKey) { + this.innerModel().withStorageAccountAccessKey(storageAccountAccessKey); + return this; + } + + public ServerSecurityAlertPolicyImpl withRetentionDays(Integer retentionDays) { + this.innerModel().withRetentionDays(retentionDays); + return this; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServersClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServersClientImpl.java index f6804ed84d15..6edbd8a3f359 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServersClientImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServersClientImpl.java @@ -36,9 +36,9 @@ import com.azure.core.util.polling.SyncPoller; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServersClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.RestartParameter; -import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerForUpdate; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerForCreate; import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerListResult; +import com.azure.resourcemanager.postgresqlflexibleserver.models.ServerUpdateParameters; import java.nio.ByteBuffer; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -72,8 +72,8 @@ public final class ServersClientImpl implements ServersClient { private interface ServersService { @Headers({"Content-Type: application/json"}) @Put( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}") @ExpectedResponses({200, 201, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> create( @@ -82,14 +82,14 @@ Mono>> create( @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName, - @BodyParam("application/json") ServerInner parameters, + @BodyParam("application/json") ServerForCreate parameters, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Patch( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> update( @@ -98,14 +98,14 @@ Mono>> update( @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName, - @BodyParam("application/json") ServerForUpdate parameters, + @BodyParam("application/json") ServerUpdateParameters parameters, @HeaderParam("Accept") String accept, Context context); @Headers({"Content-Type: application/json"}) @Delete( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}") @ExpectedResponses({200, 202, 204}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> delete( @@ -119,8 +119,8 @@ Mono>> delete( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> getByResourceGroup( @@ -134,8 +134,8 @@ Mono> getByResourceGroup( @Headers({"Content-Type: application/json"}) @Get( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> listByResourceGroup( @@ -147,7 +147,7 @@ Mono> listByResourceGroup( Context context); @Headers({"Content-Type: application/json"}) - @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DBForPostgreSql/flexibleServers") + @Get("/subscriptions/{subscriptionId}/providers/Microsoft.DBforPostgreSQL/servers") @ExpectedResponses({200}) @UnexpectedResponseExceptionType(ManagementException.class) Mono> list( @@ -159,8 +159,8 @@ Mono> list( @Headers({"Content-Type: application/json"}) @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}/restart") + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/restart") @ExpectedResponses({200, 202}) @UnexpectedResponseExceptionType(ManagementException.class) Mono>> restart( @@ -169,63 +169,12 @@ Mono>> restart( @PathParam("subscriptionId") String subscriptionId, @PathParam("resourceGroupName") String resourceGroupName, @PathParam("serverName") String serverName, - @BodyParam("application/json") RestartParameter parameters, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}/start") - @ExpectedResponses({200, 202}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> start( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("serverName") String serverName, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Post( - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSql" - + "/flexibleServers/{serverName}/stop") - @ExpectedResponses({200, 202}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono>> stop( - @HostParam("$host") String endpoint, - @QueryParam("api-version") String apiVersion, - @PathParam("subscriptionId") String subscriptionId, - @PathParam("resourceGroupName") String resourceGroupName, - @PathParam("serverName") String serverName, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listByResourceGroupNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, - @HeaderParam("Accept") String accept, - Context context); - - @Headers({"Content-Type: application/json"}) - @Get("{nextLink}") - @ExpectedResponses({200}) - @UnexpectedResponseExceptionType(ManagementException.class) - Mono> listNext( - @PathParam(value = "nextLink", encoded = true) String nextLink, - @HostParam("$host") String endpoint, @HeaderParam("Accept") String accept, Context context); } /** - * Creates a new server. + * 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. @@ -237,7 +186,7 @@ Mono> listNext( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> createWithResponseAsync( - String resourceGroupName, String serverName, ServerInner parameters) { + String resourceGroupName, String serverName, ServerForCreate parameters) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -262,6 +211,7 @@ private Mono>> createWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -269,7 +219,7 @@ private Mono>> createWithResponseAsync( service .create( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -280,7 +230,7 @@ private Mono>> createWithResponseAsync( } /** - * Creates a new server. + * 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. @@ -293,7 +243,7 @@ private Mono>> createWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> createWithResponseAsync( - String resourceGroupName, String serverName, ServerInner parameters, Context context) { + String resourceGroupName, String serverName, ServerForCreate parameters, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -318,12 +268,13 @@ private Mono>> createWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .create( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -333,7 +284,7 @@ private Mono>> createWithResponseAsync( } /** - * Creates a new server. + * 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. @@ -345,7 +296,7 @@ private Mono>> createWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux, ServerInner> beginCreateAsync( - String resourceGroupName, String serverName, ServerInner parameters) { + String resourceGroupName, String serverName, ServerForCreate parameters) { Mono>> mono = createWithResponseAsync(resourceGroupName, serverName, parameters); return this .client @@ -354,7 +305,7 @@ private PollerFlux, ServerInner> beginCreateAsync( } /** - * Creates a new server. + * 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. @@ -367,7 +318,7 @@ private PollerFlux, ServerInner> beginCreateAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux, ServerInner> beginCreateAsync( - String resourceGroupName, String serverName, ServerInner parameters, Context context) { + String resourceGroupName, String serverName, ServerForCreate parameters, Context context) { context = this.client.mergeContext(context); Mono>> mono = createWithResponseAsync(resourceGroupName, serverName, parameters, context); @@ -378,7 +329,7 @@ private PollerFlux, ServerInner> beginCreateAsync( } /** - * Creates a new server. + * 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. @@ -390,12 +341,12 @@ private PollerFlux, ServerInner> beginCreateAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller, ServerInner> beginCreate( - String resourceGroupName, String serverName, ServerInner parameters) { + String resourceGroupName, String serverName, ServerForCreate parameters) { return beginCreateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); } /** - * Creates a new server. + * 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. @@ -408,12 +359,12 @@ public SyncPoller, ServerInner> beginCreate( */ @ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller, ServerInner> beginCreate( - String resourceGroupName, String serverName, ServerInner parameters, Context context) { + String resourceGroupName, String serverName, ServerForCreate parameters, Context context) { return beginCreateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); } /** - * Creates a new server. + * 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. @@ -424,14 +375,14 @@ public SyncPoller, ServerInner> beginCreate( * @return represents a server. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono createAsync(String resourceGroupName, String serverName, ServerInner parameters) { + private Mono createAsync(String resourceGroupName, String serverName, ServerForCreate parameters) { return beginCreateAsync(resourceGroupName, serverName, parameters) .last() .flatMap(this.client::getLroFinalResultOrError); } /** - * Creates a new server. + * 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. @@ -444,14 +395,14 @@ private Mono createAsync(String resourceGroupName, String serverNam */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono createAsync( - String resourceGroupName, String serverName, ServerInner parameters, Context context) { + String resourceGroupName, String serverName, ServerForCreate parameters, Context context) { return beginCreateAsync(resourceGroupName, serverName, parameters, context) .last() .flatMap(this.client::getLroFinalResultOrError); } /** - * Creates a new server. + * 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. @@ -462,12 +413,12 @@ private Mono createAsync( * @return represents a server. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ServerInner create(String resourceGroupName, String serverName, ServerInner parameters) { + public ServerInner create(String resourceGroupName, String serverName, ServerForCreate parameters) { return createAsync(resourceGroupName, serverName, parameters).block(); } /** - * Creates a new server. + * 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. @@ -479,7 +430,8 @@ public ServerInner create(String resourceGroupName, String serverName, ServerInn * @return represents a server. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ServerInner create(String resourceGroupName, String serverName, ServerInner parameters, Context context) { + public ServerInner create( + String resourceGroupName, String serverName, ServerForCreate parameters, Context context) { return createAsync(resourceGroupName, serverName, parameters, context).block(); } @@ -497,7 +449,7 @@ public ServerInner create(String resourceGroupName, String serverName, ServerInn */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> updateWithResponseAsync( - String resourceGroupName, String serverName, ServerForUpdate parameters) { + String resourceGroupName, String serverName, ServerUpdateParameters parameters) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -522,6 +474,7 @@ private Mono>> updateWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -529,7 +482,7 @@ private Mono>> updateWithResponseAsync( service .update( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -554,7 +507,7 @@ private Mono>> updateWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> updateWithResponseAsync( - String resourceGroupName, String serverName, ServerForUpdate parameters, Context context) { + String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -579,12 +532,13 @@ private Mono>> updateWithResponseAsync( } else { parameters.validate(); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .update( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -607,7 +561,7 @@ private Mono>> updateWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux, ServerInner> beginUpdateAsync( - String resourceGroupName, String serverName, ServerForUpdate parameters) { + String resourceGroupName, String serverName, ServerUpdateParameters parameters) { Mono>> mono = updateWithResponseAsync(resourceGroupName, serverName, parameters); return this .client @@ -630,7 +584,7 @@ private PollerFlux, ServerInner> beginUpdateAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux, ServerInner> beginUpdateAsync( - String resourceGroupName, String serverName, ServerForUpdate parameters, Context context) { + String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context) { context = this.client.mergeContext(context); Mono>> mono = updateWithResponseAsync(resourceGroupName, serverName, parameters, context); @@ -654,7 +608,7 @@ private PollerFlux, ServerInner> beginUpdateAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller, ServerInner> beginUpdate( - String resourceGroupName, String serverName, ServerForUpdate parameters) { + String resourceGroupName, String serverName, ServerUpdateParameters parameters) { return beginUpdateAsync(resourceGroupName, serverName, parameters).getSyncPoller(); } @@ -673,7 +627,7 @@ public SyncPoller, ServerInner> beginUpdate( */ @ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller, ServerInner> beginUpdate( - String resourceGroupName, String serverName, ServerForUpdate parameters, Context context) { + String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context) { return beginUpdateAsync(resourceGroupName, serverName, parameters, context).getSyncPoller(); } @@ -690,7 +644,8 @@ public SyncPoller, ServerInner> beginUpdate( * @return represents a server. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono updateAsync(String resourceGroupName, String serverName, ServerForUpdate parameters) { + private Mono updateAsync( + String resourceGroupName, String serverName, ServerUpdateParameters parameters) { return beginUpdateAsync(resourceGroupName, serverName, parameters) .last() .flatMap(this.client::getLroFinalResultOrError); @@ -711,7 +666,7 @@ private Mono updateAsync(String resourceGroupName, String serverNam */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono updateAsync( - String resourceGroupName, String serverName, ServerForUpdate parameters, Context context) { + String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context) { return beginUpdateAsync(resourceGroupName, serverName, parameters, context) .last() .flatMap(this.client::getLroFinalResultOrError); @@ -730,7 +685,7 @@ private Mono updateAsync( * @return represents a server. */ @ServiceMethod(returns = ReturnType.SINGLE) - public ServerInner update(String resourceGroupName, String serverName, ServerForUpdate parameters) { + public ServerInner update(String resourceGroupName, String serverName, ServerUpdateParameters parameters) { return updateAsync(resourceGroupName, serverName, parameters).block(); } @@ -749,7 +704,7 @@ public ServerInner update(String resourceGroupName, String serverName, ServerFor */ @ServiceMethod(returns = ReturnType.SINGLE) public ServerInner update( - String resourceGroupName, String serverName, ServerForUpdate parameters, Context context) { + String resourceGroupName, String serverName, ServerUpdateParameters parameters, Context context) { return updateAsync(resourceGroupName, serverName, parameters, context).block(); } @@ -784,6 +739,7 @@ private Mono>> deleteWithResponseAsync(String resource if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -791,7 +747,7 @@ private Mono>> deleteWithResponseAsync(String resource service .delete( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -833,12 +789,13 @@ private Mono>> deleteWithResponseAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .delete( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -1011,6 +968,7 @@ private Mono> getByResourceGroupWithResponseAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -1018,7 +976,7 @@ private Mono> getByResourceGroupWithResponseAsync( service .getByResourceGroup( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -1060,12 +1018,13 @@ private Mono> getByResourceGroupWithResponseAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .getByResourceGroup( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, @@ -1155,6 +1114,7 @@ private Mono> listByResourceGroupSinglePageAsync(Stri return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -1162,7 +1122,7 @@ private Mono> listByResourceGroupSinglePageAsync(Stri service .listByResourceGroup( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, accept, @@ -1170,12 +1130,7 @@ private Mono> listByResourceGroupSinglePageAsync(Stri .>map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -1208,12 +1163,13 @@ private Mono> listByResourceGroupSinglePageAsync( return Mono .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .listByResourceGroup( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, accept, @@ -1221,12 +1177,7 @@ private Mono> listByResourceGroupSinglePageAsync( .map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); } /** @@ -1240,9 +1191,7 @@ private Mono> listByResourceGroupSinglePageAsync( */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName) { - return new PagedFlux<>( - () -> listByResourceGroupSinglePageAsync(resourceGroupName), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink)); + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName)); } /** @@ -1257,9 +1206,7 @@ private PagedFlux listByResourceGroupAsync(String resourceGroupName */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listByResourceGroupAsync(String resourceGroupName, Context context) { - return new PagedFlux<>( - () -> listByResourceGroupSinglePageAsync(resourceGroupName, context), - nextLink -> listByResourceGroupNextSinglePageAsync(nextLink, context)); + return new PagedFlux<>(() -> listByResourceGroupSinglePageAsync(resourceGroupName, context)); } /** @@ -1312,26 +1259,17 @@ private Mono> listSinglePageAsync() { new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( context -> service - .list( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - accept, - context)) + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context)) .>map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } @@ -1358,24 +1296,15 @@ private Mono> listSinglePageAsync(Context context) { new IllegalArgumentException( "Parameter this.client.getSubscriptionId() is required and cannot be null.")); } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service - .list( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - accept, - context) + .list(this.client.getEndpoint(), apiVersion, this.client.getSubscriptionId(), accept, context) .map( res -> new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)); } /** @@ -1387,7 +1316,7 @@ private Mono> listSinglePageAsync(Context context) { */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync() { - return new PagedFlux<>(() -> listSinglePageAsync(), nextLink -> listNextSinglePageAsync(nextLink)); + return new PagedFlux<>(() -> listSinglePageAsync()); } /** @@ -1401,8 +1330,7 @@ private PagedFlux listAsync() { */ @ServiceMethod(returns = ReturnType.COLLECTION) private PagedFlux listAsync(Context context) { - return new PagedFlux<>( - () -> listSinglePageAsync(context), nextLink -> listNextSinglePageAsync(nextLink, context)); + return new PagedFlux<>(() -> listSinglePageAsync(context)); } /** @@ -1436,15 +1364,13 @@ public PagedIterable list(Context context) { * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The parameters for restarting 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 the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> restartWithResponseAsync( - String resourceGroupName, String serverName, RestartParameter parameters) { + private Mono>> restartWithResponseAsync(String resourceGroupName, String serverName) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -1464,9 +1390,7 @@ private Mono>> restartWithResponseAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } - if (parameters != null) { - parameters.validate(); - } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; return FluxUtil .withContext( @@ -1474,11 +1398,10 @@ private Mono>> restartWithResponseAsync( service .restart( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, - parameters, accept, context)) .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); @@ -1489,7 +1412,6 @@ private Mono>> restartWithResponseAsync( * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The parameters for restarting a server. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1498,7 +1420,7 @@ private Mono>> restartWithResponseAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono>> restartWithResponseAsync( - String resourceGroupName, String serverName, RestartParameter parameters, Context context) { + String resourceGroupName, String serverName, Context context) { if (this.client.getEndpoint() == null) { return Mono .error( @@ -1518,19 +1440,16 @@ private Mono>> restartWithResponseAsync( if (serverName == null) { return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); } - if (parameters != null) { - parameters.validate(); - } + final String apiVersion = "2017-12-01"; final String accept = "application/json"; context = this.client.mergeContext(context); return service .restart( this.client.getEndpoint(), - this.client.getApiVersion(), + apiVersion, this.client.getSubscriptionId(), resourceGroupName, serverName, - parameters, accept, context); } @@ -1540,16 +1459,14 @@ private Mono>> restartWithResponseAsync( * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The parameters for restarting 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 the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) - private PollerFlux, Void> beginRestartAsync( - String resourceGroupName, String serverName, RestartParameter parameters) { - Mono>> mono = restartWithResponseAsync(resourceGroupName, serverName, parameters); + private PollerFlux, Void> beginRestartAsync(String resourceGroupName, String serverName) { + Mono>> mono = restartWithResponseAsync(resourceGroupName, serverName); return this .client .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); @@ -1560,7 +1477,6 @@ private PollerFlux, Void> beginRestartAsync( * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The parameters for restarting a server. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1569,10 +1485,9 @@ private PollerFlux, Void> beginRestartAsync( */ @ServiceMethod(returns = ReturnType.SINGLE) private PollerFlux, Void> beginRestartAsync( - String resourceGroupName, String serverName, RestartParameter parameters, Context context) { + String resourceGroupName, String serverName, Context context) { context = this.client.mergeContext(context); - Mono>> mono = - restartWithResponseAsync(resourceGroupName, serverName, parameters, context); + Mono>> mono = restartWithResponseAsync(resourceGroupName, serverName, context); return this .client .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); @@ -1583,16 +1498,14 @@ private PollerFlux, Void> beginRestartAsync( * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The parameters for restarting 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 the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) - public SyncPoller, Void> beginRestart( - String resourceGroupName, String serverName, RestartParameter parameters) { - return beginRestartAsync(resourceGroupName, serverName, parameters).getSyncPoller(); + public SyncPoller, Void> beginRestart(String resourceGroupName, String serverName) { + return beginRestartAsync(resourceGroupName, serverName).getSyncPoller(); } /** @@ -1600,7 +1513,6 @@ public SyncPoller, Void> beginRestart( * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The parameters for restarting a server. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1609,26 +1521,8 @@ public SyncPoller, Void> beginRestart( */ @ServiceMethod(returns = ReturnType.SINGLE) public SyncPoller, Void> beginRestart( - String resourceGroupName, String serverName, RestartParameter parameters, Context context) { - return beginRestartAsync(resourceGroupName, serverName, parameters, 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. - * @param parameters The parameters for restarting 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 the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono restartAsync(String resourceGroupName, String serverName, RestartParameter parameters) { - return beginRestartAsync(resourceGroupName, serverName, parameters) - .last() - .flatMap(this.client::getLroFinalResultOrError); + String resourceGroupName, String serverName, Context context) { + return beginRestartAsync(resourceGroupName, serverName, context).getSyncPoller(); } /** @@ -1643,10 +1537,7 @@ private Mono restartAsync(String resourceGroupName, String serverName, Res */ @ServiceMethod(returns = ReturnType.SINGLE) private Mono restartAsync(String resourceGroupName, String serverName) { - final RestartParameter parameters = null; - return beginRestartAsync(resourceGroupName, serverName, parameters) - .last() - .flatMap(this.client::getLroFinalResultOrError); + return beginRestartAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); } /** @@ -1654,7 +1545,6 @@ private Mono restartAsync(String resourceGroupName, String serverName) { * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The parameters for restarting a server. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. @@ -1662,28 +1552,12 @@ private Mono restartAsync(String resourceGroupName, String serverName) { * @return the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono restartAsync( - String resourceGroupName, String serverName, RestartParameter parameters, Context context) { - return beginRestartAsync(resourceGroupName, serverName, parameters, context) + private Mono restartAsync(String resourceGroupName, String serverName, Context context) { + return beginRestartAsync(resourceGroupName, serverName, context) .last() .flatMap(this.client::getLroFinalResultOrError); } - /** - * Restarts a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param parameters The parameters for restarting 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. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void restart(String resourceGroupName, String serverName, RestartParameter parameters) { - restartAsync(resourceGroupName, serverName, parameters).block(); - } - /** * Restarts a server. * @@ -1695,8 +1569,7 @@ public void restart(String resourceGroupName, String serverName, RestartParamete */ @ServiceMethod(returns = ReturnType.SINGLE) public void restart(String resourceGroupName, String serverName) { - final RestartParameter parameters = null; - restartAsync(resourceGroupName, serverName, parameters).block(); + restartAsync(resourceGroupName, serverName).block(); } /** @@ -1704,607 +1577,13 @@ public void restart(String resourceGroupName, String serverName) { * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The parameters for restarting a server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void restart(String resourceGroupName, String serverName, RestartParameter parameters, Context context) { - restartAsync(resourceGroupName, serverName, parameters, context).block(); - } - - /** - * Starts a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> startWithResponseAsync(String resourceGroupName, String serverName) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (serverName == null) { - return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .start( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serverName, - accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Starts a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> startWithResponseAsync( - String resourceGroupName, String serverName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (serverName == null) { - return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .start( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serverName, - accept, - context); - } - - /** - * Starts a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PollerFlux, Void> beginStartAsync(String resourceGroupName, String serverName) { - Mono>> mono = startWithResponseAsync(resourceGroupName, serverName); - return this - .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); - } - - /** - * Starts a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PollerFlux, Void> beginStartAsync( - String resourceGroupName, String serverName, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = startWithResponseAsync(resourceGroupName, serverName, context); - return this - .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); - } - - /** - * Starts a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SyncPoller, Void> beginStart(String resourceGroupName, String serverName) { - return beginStartAsync(resourceGroupName, serverName).getSyncPoller(); - } - - /** - * Starts a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SyncPoller, Void> beginStart(String resourceGroupName, String serverName, Context context) { - return beginStartAsync(resourceGroupName, serverName, context).getSyncPoller(); - } - - /** - * Starts a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. */ @ServiceMethod(returns = ReturnType.SINGLE) - private Mono startAsync(String resourceGroupName, String serverName) { - return beginStartAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Starts a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono startAsync(String resourceGroupName, String serverName, Context context) { - return beginStartAsync(resourceGroupName, serverName, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Starts a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void start(String resourceGroupName, String serverName) { - startAsync(resourceGroupName, serverName).block(); - } - - /** - * Starts a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void start(String resourceGroupName, String serverName, Context context) { - startAsync(resourceGroupName, serverName, context).block(); - } - - /** - * Stops a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> stopWithResponseAsync(String resourceGroupName, String serverName) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (serverName == null) { - return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> - service - .stop( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serverName, - accept, - context)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Stops a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono>> stopWithResponseAsync( - String resourceGroupName, String serverName, Context context) { - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - if (this.client.getSubscriptionId() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getSubscriptionId() is required and cannot be null.")); - } - if (resourceGroupName == null) { - return Mono - .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); - } - if (serverName == null) { - return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .stop( - this.client.getEndpoint(), - this.client.getApiVersion(), - this.client.getSubscriptionId(), - resourceGroupName, - serverName, - accept, - context); - } - - /** - * Stops a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PollerFlux, Void> beginStopAsync(String resourceGroupName, String serverName) { - Mono>> mono = stopWithResponseAsync(resourceGroupName, serverName); - return this - .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); - } - - /** - * Stops a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private PollerFlux, Void> beginStopAsync( - String resourceGroupName, String serverName, Context context) { - context = this.client.mergeContext(context); - Mono>> mono = stopWithResponseAsync(resourceGroupName, serverName, context); - return this - .client - .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); - } - - /** - * Stops a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SyncPoller, Void> beginStop(String resourceGroupName, String serverName) { - return beginStopAsync(resourceGroupName, serverName).getSyncPoller(); - } - - /** - * Stops a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public SyncPoller, Void> beginStop(String resourceGroupName, String serverName, Context context) { - return beginStopAsync(resourceGroupName, serverName, context).getSyncPoller(); - } - - /** - * Stops a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono stopAsync(String resourceGroupName, String serverName) { - return beginStopAsync(resourceGroupName, serverName).last().flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Stops a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return the completion. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono stopAsync(String resourceGroupName, String serverName, Context context) { - return beginStopAsync(resourceGroupName, serverName, context) - .last() - .flatMap(this.client::getLroFinalResultOrError); - } - - /** - * Stops a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void stop(String resourceGroupName, String serverName) { - stopAsync(resourceGroupName, serverName).block(); - } - - /** - * Stops a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - public void stop(String resourceGroupName, String serverName, Context context) { - stopAsync(resourceGroupName, serverName, context).block(); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of servers. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext( - context -> service.listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of servers. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listByResourceGroupNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listByResourceGroupNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of servers. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - return FluxUtil - .withContext(context -> service.listNext(nextLink, this.client.getEndpoint(), accept, context)) - .>map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)) - .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); - } - - /** - * Get the next page of items. - * - * @param nextLink The nextLink parameter. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return a list of servers. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> listNextSinglePageAsync(String nextLink, Context context) { - if (nextLink == null) { - return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); - } - if (this.client.getEndpoint() == null) { - return Mono - .error( - new IllegalArgumentException( - "Parameter this.client.getEndpoint() is required and cannot be null.")); - } - final String accept = "application/json"; - context = this.client.mergeContext(context); - return service - .listNext(nextLink, this.client.getEndpoint(), accept, context) - .map( - res -> - new PagedResponseBase<>( - res.getRequest(), - res.getStatusCode(), - res.getHeaders(), - res.getValue().value(), - res.getValue().nextLink(), - null)); + public void restart(String resourceGroupName, String serverName, Context context) { + restartAsync(resourceGroupName, serverName, context).block(); } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServersImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServersImpl.java index e63332b338f9..d3112593898f 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServersImpl.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/ServersImpl.java @@ -11,7 +11,6 @@ import com.azure.core.util.logging.ClientLogger; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.ServersClient; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerInner; -import com.azure.resourcemanager.postgresqlflexibleserver.models.RestartParameter; import com.azure.resourcemanager.postgresqlflexibleserver.models.Server; import com.azure.resourcemanager.postgresqlflexibleserver.models.Servers; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -82,32 +81,12 @@ public PagedIterable list(Context context) { return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager())); } - public void restart(String resourceGroupName, String serverName, RestartParameter parameters) { - this.serviceClient().restart(resourceGroupName, serverName, parameters); - } - public void restart(String resourceGroupName, String serverName) { this.serviceClient().restart(resourceGroupName, serverName); } - public void restart(String resourceGroupName, String serverName, RestartParameter parameters, Context context) { - this.serviceClient().restart(resourceGroupName, serverName, parameters, context); - } - - public void start(String resourceGroupName, String serverName) { - this.serviceClient().start(resourceGroupName, serverName); - } - - public void start(String resourceGroupName, String serverName, Context context) { - this.serviceClient().start(resourceGroupName, serverName, context); - } - - public void stop(String resourceGroupName, String serverName) { - this.serviceClient().stop(resourceGroupName, serverName); - } - - public void stop(String resourceGroupName, String serverName, Context context) { - this.serviceClient().stop(resourceGroupName, serverName, context); + public void restart(String resourceGroupName, String serverName, Context context) { + this.serviceClient().restart(resourceGroupName, serverName, context); } public Server getById(String id) { @@ -119,13 +98,12 @@ public Server getById(String id) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw logger .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } return this.getByResourceGroupWithResponse(resourceGroupName, serverName, Context.NONE).getValue(); } @@ -139,13 +117,12 @@ public Response getByIdWithResponse(String id, Context context) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw logger .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } return this.getByResourceGroupWithResponse(resourceGroupName, serverName, context); } @@ -159,13 +136,12 @@ public void deleteById(String id) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw logger .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } this.delete(resourceGroupName, serverName, Context.NONE); } @@ -179,13 +155,12 @@ public void deleteByIdWithResponse(String id, Context context) { String .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); } - String serverName = Utils.getValueFromIdByName(id, "flexibleServers"); + String serverName = Utils.getValueFromIdByName(id, "servers"); if (serverName == null) { throw logger .logExceptionAsError( new IllegalArgumentException( - String - .format("The resource ID '%s' is not valid. Missing path segment 'flexibleServers'.", id))); + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); } this.delete(resourceGroupName, serverName, context); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkRuleImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkRuleImpl.java new file mode 100644 index 000000000000..ac32efccc2d2 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkRuleImpl.java @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkRuleInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkRule; +import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkRuleState; + +public final class VirtualNetworkRuleImpl + implements VirtualNetworkRule, VirtualNetworkRule.Definition, VirtualNetworkRule.Update { + private VirtualNetworkRuleInner innerObject; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public String id() { + return this.innerModel().id(); + } + + public String name() { + return this.innerModel().name(); + } + + public String type() { + return this.innerModel().type(); + } + + public String virtualNetworkSubnetId() { + return this.innerModel().virtualNetworkSubnetId(); + } + + public Boolean ignoreMissingVnetServiceEndpoint() { + return this.innerModel().ignoreMissingVnetServiceEndpoint(); + } + + public VirtualNetworkRuleState state() { + return this.innerModel().state(); + } + + public VirtualNetworkRuleInner innerModel() { + return this.innerObject; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } + + private String resourceGroupName; + + private String serverName; + + private String virtualNetworkRuleName; + + public VirtualNetworkRuleImpl withExistingServer(String resourceGroupName, String serverName) { + this.resourceGroupName = resourceGroupName; + this.serverName = serverName; + return this; + } + + public VirtualNetworkRule create() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualNetworkRule create(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), context); + return this; + } + + VirtualNetworkRuleImpl( + String name, com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerObject = new VirtualNetworkRuleInner(); + this.serviceManager = serviceManager; + this.virtualNetworkRuleName = name; + } + + public VirtualNetworkRuleImpl update() { + return this; + } + + public VirtualNetworkRule apply() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), Context.NONE); + return this; + } + + public VirtualNetworkRule apply(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .createOrUpdate(resourceGroupName, serverName, virtualNetworkRuleName, this.innerModel(), context); + return this; + } + + VirtualNetworkRuleImpl( + VirtualNetworkRuleInner innerObject, + com.azure.resourcemanager.postgresqlflexibleserver.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"); + } + + public VirtualNetworkRule refresh() { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, Context.NONE) + .getValue(); + return this; + } + + public VirtualNetworkRule refresh(Context context) { + this.innerObject = + serviceManager + .serviceClient() + .getVirtualNetworkRules() + .getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, context) + .getValue(); + return this; + } + + public VirtualNetworkRuleImpl withVirtualNetworkSubnetId(String virtualNetworkSubnetId) { + this.innerModel().withVirtualNetworkSubnetId(virtualNetworkSubnetId); + return this; + } + + public VirtualNetworkRuleImpl withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint) { + this.innerModel().withIgnoreMissingVnetServiceEndpoint(ignoreMissingVnetServiceEndpoint); + return this; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkRulesClientImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkRulesClientImpl.java new file mode 100644 index 000000000000..29d5abfe4ba9 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkRulesClientImpl.java @@ -0,0 +1,1152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.annotation.BodyParam; +import com.azure.core.annotation.Delete; +import com.azure.core.annotation.ExpectedResponses; +import com.azure.core.annotation.Get; +import com.azure.core.annotation.HeaderParam; +import com.azure.core.annotation.Headers; +import com.azure.core.annotation.Host; +import com.azure.core.annotation.HostParam; +import com.azure.core.annotation.PathParam; +import com.azure.core.annotation.Put; +import com.azure.core.annotation.QueryParam; +import com.azure.core.annotation.ReturnType; +import com.azure.core.annotation.ServiceInterface; +import com.azure.core.annotation.ServiceMethod; +import com.azure.core.annotation.UnexpectedResponseExceptionType; +import com.azure.core.http.rest.PagedFlux; +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.PagedResponse; +import com.azure.core.http.rest.PagedResponseBase; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.RestProxy; +import com.azure.core.management.exception.ManagementException; +import com.azure.core.management.polling.PollResult; +import com.azure.core.util.Context; +import com.azure.core.util.FluxUtil; +import com.azure.core.util.logging.ClientLogger; +import com.azure.core.util.polling.PollerFlux; +import com.azure.core.util.polling.SyncPoller; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.VirtualNetworkRulesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkRuleInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkRuleListResult; +import java.nio.ByteBuffer; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +/** An instance of this class provides access to all the operations defined in VirtualNetworkRulesClient. */ +public final class VirtualNetworkRulesClientImpl implements VirtualNetworkRulesClient { + private final ClientLogger logger = new ClientLogger(VirtualNetworkRulesClientImpl.class); + + /** The proxy service used to perform REST calls. */ + private final VirtualNetworkRulesService service; + + /** The service client containing this operation class. */ + private final PostgreSqlManagementClientImpl client; + + /** + * Initializes an instance of VirtualNetworkRulesClientImpl. + * + * @param client the instance of the service client containing this operation class. + */ + VirtualNetworkRulesClientImpl(PostgreSqlManagementClientImpl client) { + this.service = + RestProxy.create(VirtualNetworkRulesService.class, client.getHttpPipeline(), client.getSerializerAdapter()); + this.client = client; + } + + /** + * The interface defining all the services for PostgreSqlManagementClientVirtualNetworkRules to be used by the proxy + * service to perform REST calls. + */ + @Host("{$host}") + @ServiceInterface(name = "PostgreSqlManagement") + private interface VirtualNetworkRulesService { + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> get( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("virtualNetworkRuleName") String virtualNetworkRuleName, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Put( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + @ExpectedResponses({200, 201, 202}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> createOrUpdate( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @PathParam("virtualNetworkRuleName") String virtualNetworkRuleName, + @BodyParam("application/json") VirtualNetworkRuleInner parameters, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"}) + @Delete( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/virtualNetworkRules/{virtualNetworkRuleName}") + @ExpectedResponses({200, 202, 204}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono>> delete( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("virtualNetworkRuleName") String virtualNetworkRuleName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get( + "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBforPostgreSQL" + + "/servers/{serverName}/virtualNetworkRules") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServer( + @HostParam("$host") String endpoint, + @PathParam("resourceGroupName") String resourceGroupName, + @PathParam("serverName") String serverName, + @PathParam("subscriptionId") String subscriptionId, + @QueryParam("api-version") String apiVersion, + @HeaderParam("Accept") String accept, + Context context); + + @Headers({"Content-Type: application/json"}) + @Get("{nextLink}") + @ExpectedResponses({200}) + @UnexpectedResponseExceptionType(ManagementException.class) + Mono> listByServerNext( + @PathParam(value = "nextLink", encoded = true) String nextLink, + @HostParam("$host") String endpoint, + @HeaderParam("Accept") String accept, + Context context); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + virtualNetworkRuleName, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> getWithResponseAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .get( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + virtualNetworkRuleName, + accept, + context); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono getAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return getWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName) + .flatMap( + (Response res) -> { + if (res.getValue() != null) { + return Mono.just(res.getValue()); + } else { + return Mono.empty(); + } + }); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkRuleInner get(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return getAsync(resourceGroupName, serverName, virtualNetworkRuleName).block(); + } + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + return getWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, context).block(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + virtualNetworkRuleName, + parameters, + accept, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> createOrUpdateWithResponseAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + if (parameters == null) { + return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null.")); + } else { + parameters.validate(); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .createOrUpdate( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + virtualNetworkRuleName, + parameters, + accept, + context); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, VirtualNetworkRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualNetworkRuleInner.class, + VirtualNetworkRuleInner.class, + Context.NONE); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, VirtualNetworkRuleInner> beginCreateOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + createOrUpdateWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context); + return this + .client + .getLroResult( + mono, + this.client.getHttpPipeline(), + VirtualNetworkRuleInner.class, + VirtualNetworkRuleInner.class, + context); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters) + .getSyncPoller(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, VirtualNetworkRuleInner> beginCreateOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context) + .getSyncPoller(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono createOrUpdateAsync( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + return beginCreateOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters) { + return createOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters).block(); + } + + /** + * Creates or updates an existing virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param parameters The requested virtual Network Rule Resource state. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public VirtualNetworkRuleInner createOrUpdate( + String resourceGroupName, + String serverName, + String virtualNetworkRuleName, + VirtualNetworkRuleInner parameters, + Context context) { + return createOrUpdateAsync(resourceGroupName, serverName, virtualNetworkRuleName, parameters, context).block(); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + return FluxUtil + .withContext( + context -> + service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + virtualNetworkRuleName, + this.client.getSubscriptionId(), + apiVersion, + context)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono>> deleteWithResponseAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (virtualNetworkRuleName == null) { + return Mono + .error( + new IllegalArgumentException("Parameter virtualNetworkRuleName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + context = this.client.mergeContext(context); + return service + .delete( + this.client.getEndpoint(), + resourceGroupName, + serverName, + virtualNetworkRuleName, + this.client.getSubscriptionId(), + apiVersion, + context); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, Context.NONE); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private PollerFlux, Void> beginDeleteAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + context = this.client.mergeContext(context); + Mono>> mono = + deleteWithResponseAsync(resourceGroupName, serverName, virtualNetworkRuleName, context); + return this + .client + .getLroResult(mono, this.client.getHttpPipeline(), Void.class, Void.class, context); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName).getSyncPoller(); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public SyncPoller, Void> beginDelete( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName, context).getSyncPoller(); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return the completion. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono deleteAsync( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + return beginDeleteAsync(resourceGroupName, serverName, virtualNetworkRuleName, context) + .last() + .flatMap(this.client::getLroFinalResultOrError); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + deleteAsync(resourceGroupName, serverName, virtualNetworkRuleName).block(); + } + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + public void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + deleteAsync(resourceGroupName, serverName, virtualNetworkRuleName, context).block(); + } + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + return FluxUtil + .withContext( + context -> + service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerSinglePageAsync( + String resourceGroupName, String serverName, Context context) { + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + if (resourceGroupName == null) { + return Mono + .error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null.")); + } + if (serverName == null) { + return Mono.error(new IllegalArgumentException("Parameter serverName is required and cannot be null.")); + } + if (this.client.getSubscriptionId() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getSubscriptionId() is required and cannot be null.")); + } + final String apiVersion = "2017-12-01"; + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServer( + this.client.getEndpoint(), + resourceGroupName, + serverName, + this.client.getSubscriptionId(), + apiVersion, + accept, + context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync(String resourceGroupName, String serverName) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName), + nextLink -> listByServerNextSinglePageAsync(nextLink)); + } + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + private PagedFlux listByServerAsync( + String resourceGroupName, String serverName, Context context) { + return new PagedFlux<>( + () -> listByServerSinglePageAsync(resourceGroupName, serverName, context), + nextLink -> listByServerNextSinglePageAsync(nextLink, context)); + } + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer(String resourceGroupName, String serverName) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName)); + } + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + @ServiceMethod(returns = ReturnType.COLLECTION) + public PagedIterable listByServer( + String resourceGroupName, String serverName, Context context) { + return new PagedIterable<>(listByServerAsync(resourceGroupName, serverName, context)); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync(String nextLink) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + return FluxUtil + .withContext(context -> service.listByServerNext(nextLink, this.client.getEndpoint(), accept, context)) + .>map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)) + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); + } + + /** + * Get the next page of items. + * + * @param nextLink The nextLink parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules. + */ + @ServiceMethod(returns = ReturnType.SINGLE) + private Mono> listByServerNextSinglePageAsync( + String nextLink, Context context) { + if (nextLink == null) { + return Mono.error(new IllegalArgumentException("Parameter nextLink is required and cannot be null.")); + } + if (this.client.getEndpoint() == null) { + return Mono + .error( + new IllegalArgumentException( + "Parameter this.client.getEndpoint() is required and cannot be null.")); + } + final String accept = "application/json"; + context = this.client.mergeContext(context); + return service + .listByServerNext(nextLink, this.client.getEndpoint(), accept, context) + .map( + res -> + new PagedResponseBase<>( + res.getRequest(), + res.getStatusCode(), + res.getHeaders(), + res.getValue().value(), + res.getValue().nextLink(), + null)); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkRulesImpl.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkRulesImpl.java new file mode 100644 index 000000000000..4324b936eed0 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/implementation/VirtualNetworkRulesImpl.java @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.implementation; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.http.rest.SimpleResponse; +import com.azure.core.util.Context; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.VirtualNetworkRulesClient; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkRuleInner; +import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkRule; +import com.azure.resourcemanager.postgresqlflexibleserver.models.VirtualNetworkRules; +import com.fasterxml.jackson.annotation.JsonIgnore; + +public final class VirtualNetworkRulesImpl implements VirtualNetworkRules { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkRulesImpl.class); + + private final VirtualNetworkRulesClient innerClient; + + private final com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager; + + public VirtualNetworkRulesImpl( + VirtualNetworkRulesClient innerClient, + com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager serviceManager) { + this.innerClient = innerClient; + this.serviceManager = serviceManager; + } + + public VirtualNetworkRule get(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + VirtualNetworkRuleInner inner = this.serviceClient().get(resourceGroupName, serverName, virtualNetworkRuleName); + if (inner != null) { + return new VirtualNetworkRuleImpl(inner, this.manager()); + } else { + return null; + } + } + + public Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + Response inner = + this.serviceClient().getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, context); + if (inner != null) { + return new SimpleResponse<>( + inner.getRequest(), + inner.getStatusCode(), + inner.getHeaders(), + new VirtualNetworkRuleImpl(inner.getValue(), this.manager())); + } else { + return null; + } + } + + public void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName) { + this.serviceClient().delete(resourceGroupName, serverName, virtualNetworkRuleName); + } + + public void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context) { + this.serviceClient().delete(resourceGroupName, serverName, virtualNetworkRuleName, context); + } + + public PagedIterable listByServer(String resourceGroupName, String serverName) { + PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); + return Utils.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())); + } + + public VirtualNetworkRule getById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, Context.NONE).getValue(); + } + + public Response getByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + return this.getWithResponse(resourceGroupName, serverName, virtualNetworkRuleName, context); + } + + public void deleteById(String id) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + this.delete(resourceGroupName, serverName, virtualNetworkRuleName, Context.NONE); + } + + public void deleteByIdWithResponse(String id, Context context) { + String resourceGroupName = Utils.getValueFromIdByName(id, "resourceGroups"); + if (resourceGroupName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format("The resource ID '%s' is not valid. Missing path segment 'resourceGroups'.", id))); + } + String serverName = Utils.getValueFromIdByName(id, "servers"); + if (serverName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String.format("The resource ID '%s' is not valid. Missing path segment 'servers'.", id))); + } + String virtualNetworkRuleName = Utils.getValueFromIdByName(id, "virtualNetworkRules"); + if (virtualNetworkRuleName == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + String + .format( + "The resource ID '%s' is not valid. Missing path segment 'virtualNetworkRules'.", id))); + } + this.delete(resourceGroupName, serverName, virtualNetworkRuleName, context); + } + + private VirtualNetworkRulesClient serviceClient() { + return this.innerClient; + } + + private com.azure.resourcemanager.postgresqlflexibleserver.PostgreSqlManager manager() { + return this.serviceManager; + } + + public VirtualNetworkRuleImpl define(String name) { + return new VirtualNetworkRuleImpl(name, this.manager()); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ResourceIdentityType.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/AdministratorType.java similarity index 54% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ResourceIdentityType.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/AdministratorType.java index 9f67e80d91ef..a9795ffa8c68 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ResourceIdentityType.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/AdministratorType.java @@ -7,28 +7,28 @@ import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonValue; -/** Defines values for ResourceIdentityType. */ -public enum ResourceIdentityType { - /** Enum value SystemAssigned. */ - SYSTEM_ASSIGNED("SystemAssigned"); +/** Defines values for AdministratorType. */ +public enum AdministratorType { + /** Enum value ActiveDirectory. */ + ACTIVE_DIRECTORY("ActiveDirectory"); - /** The actual serialized value for a ResourceIdentityType instance. */ + /** The actual serialized value for a AdministratorType instance. */ private final String value; - ResourceIdentityType(String value) { + AdministratorType(String value) { this.value = value; } /** - * Parses a serialized value to a ResourceIdentityType instance. + * Parses a serialized value to a AdministratorType instance. * * @param value the serialized value to parse. - * @return the parsed ResourceIdentityType object, or null if unable to parse. + * @return the parsed AdministratorType object, or null if unable to parse. */ @JsonCreator - public static ResourceIdentityType fromString(String value) { - ResourceIdentityType[] items = ResourceIdentityType.values(); - for (ResourceIdentityType item : items) { + public static AdministratorType fromString(String value) { + AdministratorType[] items = AdministratorType.values(); + for (AdministratorType item : items) { if (item.toString().equalsIgnoreCase(value)) { return item; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Backup.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Backup.java deleted file mode 100644 index 2d9a197b1740..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Backup.java +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.time.OffsetDateTime; - -/** Backup properties of a server. */ -@Fluent -public final class Backup { - @JsonIgnore private final ClientLogger logger = new ClientLogger(Backup.class); - - /* - * Backup retention days for the server. - */ - @JsonProperty(value = "backupRetentionDays") - private Integer backupRetentionDays; - - /* - * A value indicating whether Geo-Redundant backup is enabled on the - * server. - */ - @JsonProperty(value = "geoRedundantBackup") - private GeoRedundantBackupEnum geoRedundantBackup; - - /* - * The earliest restore point time (ISO8601 format) for server. - */ - @JsonProperty(value = "earliestRestoreDate", access = JsonProperty.Access.WRITE_ONLY) - private OffsetDateTime earliestRestoreDate; - - /** - * Get the backupRetentionDays property: Backup retention days for the server. - * - * @return the backupRetentionDays value. - */ - public Integer backupRetentionDays() { - return this.backupRetentionDays; - } - - /** - * Set the backupRetentionDays property: Backup retention days for the server. - * - * @param backupRetentionDays the backupRetentionDays value to set. - * @return the Backup object itself. - */ - public Backup withBackupRetentionDays(Integer backupRetentionDays) { - this.backupRetentionDays = backupRetentionDays; - return this; - } - - /** - * Get the geoRedundantBackup property: A value indicating whether Geo-Redundant backup is enabled on the server. - * - * @return the geoRedundantBackup value. - */ - public GeoRedundantBackupEnum geoRedundantBackup() { - return this.geoRedundantBackup; - } - - /** - * Set the geoRedundantBackup property: A value indicating whether Geo-Redundant backup is enabled on the server. - * - * @param geoRedundantBackup the geoRedundantBackup value to set. - * @return the Backup object itself. - */ - public Backup withGeoRedundantBackup(GeoRedundantBackupEnum geoRedundantBackup) { - this.geoRedundantBackup = geoRedundantBackup; - return this; - } - - /** - * Get the earliestRestoreDate property: The earliest restore point time (ISO8601 format) for server. - * - * @return the earliestRestoreDate value. - */ - public OffsetDateTime earliestRestoreDate() { - return this.earliestRestoreDate; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilityProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilityProperties.java deleted file mode 100644 index f2799bb69683..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilityProperties.java +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; -import java.util.List; - -/** An immutable client-side representation of CapabilityProperties. */ -public interface CapabilityProperties { - /** - * Gets the zone property: zone name. - * - * @return the zone value. - */ - String zone(); - - /** - * Gets the geoBackupSupported property: A value indicating whether a new server in this region can have geo-backups - * to paired region. - * - * @return the geoBackupSupported value. - */ - Boolean geoBackupSupported(); - - /** - * Gets the zoneRedundantHaSupported property: A value indicating whether a new server in this region can support - * multi zone HA. - * - * @return the zoneRedundantHaSupported value. - */ - Boolean zoneRedundantHaSupported(); - - /** - * Gets the zoneRedundantHaAndGeoBackupSupported property: A value indicating whether a new server in this region - * can have geo-backups to paired region. - * - * @return the zoneRedundantHaAndGeoBackupSupported value. - */ - Boolean zoneRedundantHaAndGeoBackupSupported(); - - /** - * Gets the supportedFlexibleServerEditions property: The supportedFlexibleServerEditions property. - * - * @return the supportedFlexibleServerEditions value. - */ - List supportedFlexibleServerEditions(); - - /** - * Gets the supportedHyperscaleNodeEditions property: The supportedHyperscaleNodeEditions property. - * - * @return the supportedHyperscaleNodeEditions value. - */ - List supportedHyperscaleNodeEditions(); - - /** - * Gets the status property: The status. - * - * @return the status value. - */ - String status(); - - /** - * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner object. - * - * @return the inner object. - */ - CapabilityPropertiesInner innerModel(); -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Configuration.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Configuration.java index 3d97d7b2ce17..06a056d9c9a2 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Configuration.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Configuration.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.postgresqlflexibleserver.models; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationInner; @@ -31,13 +30,6 @@ public interface Configuration { */ String type(); - /** - * Gets the systemData property: The system metadata relating to this resource. - * - * @return the systemData value. - */ - SystemData systemData(); - /** * Gets the value property: Value of the configuration. * @@ -64,7 +56,7 @@ public interface Configuration { * * @return the dataType value. */ - ConfigurationDataType dataType(); + String dataType(); /** * Gets the allowedValues property: Allowed values of the configuration. @@ -105,7 +97,7 @@ interface WithParentResource { * @param serverName The name of the server. * @return the next definition stage. */ - WithCreate withExistingFlexibleServer(String resourceGroupName, String serverName); + WithCreate withExistingServer(String resourceGroupName, String serverName); } /** * The stage of the Configuration definition which contains all the minimum required properties for the resource diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ConfigurationDataType.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ConfigurationDataType.java deleted file mode 100644 index 2ad8baef47f3..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ConfigurationDataType.java +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for ConfigurationDataType. */ -public final class ConfigurationDataType extends ExpandableStringEnum { - /** Static value Boolean for ConfigurationDataType. */ - public static final ConfigurationDataType BOOLEAN = fromString("Boolean"); - - /** Static value Numeric for ConfigurationDataType. */ - public static final ConfigurationDataType NUMERIC = fromString("Numeric"); - - /** Static value Integer for ConfigurationDataType. */ - public static final ConfigurationDataType INTEGER = fromString("Integer"); - - /** Static value Enumeration for ConfigurationDataType. */ - public static final ConfigurationDataType ENUMERATION = fromString("Enumeration"); - - /** - * Creates or finds a ConfigurationDataType from its string representation. - * - * @param name a name to look for. - * @return the corresponding ConfigurationDataType. - */ - @JsonCreator - public static ConfigurationDataType fromString(String name) { - return fromString(name, ConfigurationDataType.class); - } - - /** @return known ConfigurationDataType values. */ - public static Collection values() { - return values(ConfigurationDataType.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ConfigurationListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ConfigurationListResult.java index a3dbf2b42d81..4fc178139c66 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ConfigurationListResult.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ConfigurationListResult.java @@ -4,78 +4,23 @@ package com.azure.resourcemanager.postgresqlflexibleserver.models; -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationInner; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationListResultInner; import java.util.List; -/** A list of server configurations. */ -@Fluent -public final class ConfigurationListResult { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ConfigurationListResult.class); - - /* - * The list of server configurations. - */ - @JsonProperty(value = "value") - private List value; - - /* - * The link used to get the next page of operations. - */ - @JsonProperty(value = "nextLink") - private String nextLink; - +/** An immutable client-side representation of ConfigurationListResult. */ +public interface ConfigurationListResult { /** - * Get the value property: The list of server configurations. + * Gets the value property: The list of server configurations. * * @return the value value. */ - public List value() { - return this.value; - } - - /** - * Set the value property: The list of server configurations. - * - * @param value the value value to set. - * @return the ConfigurationListResult object itself. - */ - public ConfigurationListResult withValue(List value) { - this.value = value; - return this; - } - - /** - * Get the nextLink property: The link used to get the next page of operations. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Set the nextLink property: The link used to get the next page of operations. - * - * @param nextLink the nextLink value to set. - * @return the ConfigurationListResult object itself. - */ - public ConfigurationListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } + List value(); /** - * Validates the instance. + * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationListResultInner + * object. * - * @throws IllegalArgumentException thrown if the instance is not valid. + * @return the inner object. */ - public void validate() { - if (value() != null) { - value().forEach(e -> e.validate()); - } - } + ConfigurationListResultInner innerModel(); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Configurations.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Configurations.java index 5a652717ea7f..5a9d5221d553 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Configurations.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Configurations.java @@ -11,57 +11,57 @@ /** Resource collection API of Configurations. */ public interface Configurations { /** - * List all the configurations in a given 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. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if 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 information about a configuration of server. */ - PagedIterable listByServer(String resourceGroupName, String serverName); + Configuration get(String resourceGroupName, String serverName, String configurationName); /** - * List all the configurations in a given 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. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if 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 information about a configuration of server. */ - PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + Response getWithResponse( + String resourceGroupName, String serverName, String configurationName, Context context); /** - * Gets information about a configuration of server. + * 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 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 a list of server configurations. */ - Configuration get(String resourceGroupName, String serverName, String configurationName); + PagedIterable listByServer(String resourceGroupName, String serverName); /** - * Gets information about a configuration of server. + * 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 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 a list of server configurations. */ - Response getWithResponse( - String resourceGroupName, String serverName, String configurationName, Context context); + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); /** * Gets information about a configuration of server. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CreateMode.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CreateMode.java index 52ef2e4ee6bc..11710299e080 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CreateMode.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CreateMode.java @@ -13,15 +13,15 @@ public final class CreateMode extends ExpandableStringEnum { /** Static value Default for CreateMode. */ public static final CreateMode DEFAULT = fromString("Default"); - /** Static value Create for CreateMode. */ - public static final CreateMode CREATE = fromString("Create"); - - /** Static value Update for CreateMode. */ - public static final CreateMode UPDATE = fromString("Update"); - /** Static value PointInTimeRestore for CreateMode. */ public static final CreateMode POINT_IN_TIME_RESTORE = fromString("PointInTimeRestore"); + /** Static value GeoRestore for CreateMode. */ + public static final CreateMode GEO_RESTORE = fromString("GeoRestore"); + + /** Static value Replica for CreateMode. */ + public static final CreateMode REPLICA = fromString("Replica"); + /** * Creates or finds a CreateMode from its string representation. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CreateModeForUpdate.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CreateModeForUpdate.java deleted file mode 100644 index fe86dc41cd21..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CreateModeForUpdate.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for CreateModeForUpdate. */ -public final class CreateModeForUpdate extends ExpandableStringEnum { - /** Static value Default for CreateModeForUpdate. */ - public static final CreateModeForUpdate DEFAULT = fromString("Default"); - - /** Static value Update for CreateModeForUpdate. */ - public static final CreateModeForUpdate UPDATE = fromString("Update"); - - /** - * Creates or finds a CreateModeForUpdate from its string representation. - * - * @param name a name to look for. - * @return the corresponding CreateModeForUpdate. - */ - @JsonCreator - public static CreateModeForUpdate fromString(String name) { - return fromString(name, CreateModeForUpdate.class); - } - - /** @return known CreateModeForUpdate values. */ - public static Collection values() { - return values(CreateModeForUpdate.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Database.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Database.java index e76a42f4f8c9..f9f5de3dd6a6 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Database.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Database.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.postgresqlflexibleserver.models; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.DatabaseInner; @@ -31,13 +30,6 @@ public interface Database { */ String type(); - /** - * Gets the systemData property: The system metadata relating to this resource. - * - * @return the systemData value. - */ - SystemData systemData(); - /** * Gets the charset property: The charset of the database. * @@ -77,7 +69,7 @@ interface WithParentResource { * @param serverName The name of the server. * @return the next definition stage. */ - WithCreate withExistingFlexibleServer(String resourceGroupName, String serverName); + WithCreate withExistingServer(String resourceGroupName, String serverName); } /** * The stage of the Database definition which contains all the minimum required properties for the resource to @@ -120,6 +112,53 @@ interface WithCollation { WithCreate withCollation(String collation); } } + /** + * Begins update for the Database resource. + * + * @return the stage of resource update. + */ + Database.Update update(); + + /** The template for Database update. */ + interface Update extends UpdateStages.WithCharset, UpdateStages.WithCollation { + /** + * Executes the update request. + * + * @return the updated resource. + */ + Database apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + Database apply(Context context); + } + /** The Database update stages. */ + interface UpdateStages { + /** The stage of the Database update allowing to specify charset. */ + interface WithCharset { + /** + * Specifies the charset property: The charset of the database.. + * + * @param charset The charset of the database. + * @return the next definition stage. + */ + Update withCharset(String charset); + } + /** The stage of the Database update allowing to specify collation. */ + interface WithCollation { + /** + * Specifies the collation property: The collation of the database.. + * + * @param collation The collation of the database. + * @return the next definition stage. + */ + Update withCollation(String collation); + } + } /** * Refreshes the resource to sync with Azure. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DatabaseListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DatabaseListResult.java index 89f858bbda9a..fe48f9f4b1a0 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DatabaseListResult.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DatabaseListResult.java @@ -22,12 +22,6 @@ public final class DatabaseListResult { @JsonProperty(value = "value") private List value; - /* - * The link used to get the next page of databases. - */ - @JsonProperty(value = "nextLink") - private String nextLink; - /** * Get the value property: The list of databases housed in a server. * @@ -48,26 +42,6 @@ public DatabaseListResult withValue(List value) { return this; } - /** - * Get the nextLink property: The link used to get the next page of databases. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Set the nextLink property: The link used to get the next page of databases. - * - * @param nextLink the nextLink value to set. - * @return the DatabaseListResult object itself. - */ - public DatabaseListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - /** * Validates the instance. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DelegatedSubnetUsage.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DelegatedSubnetUsage.java deleted file mode 100644 index 49a79c73012b..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/DelegatedSubnetUsage.java +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.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; - -/** Delegated subnet usage data. */ -@Immutable -public final class DelegatedSubnetUsage { - @JsonIgnore private final ClientLogger logger = new ClientLogger(DelegatedSubnetUsage.class); - - /* - * name of the subnet - */ - @JsonProperty(value = "subnetName", access = JsonProperty.Access.WRITE_ONLY) - private String subnetName; - - /* - * Number of used delegated subnets - */ - @JsonProperty(value = "usage", access = JsonProperty.Access.WRITE_ONLY) - private Long usage; - - /** - * Get the subnetName property: name of the subnet. - * - * @return the subnetName value. - */ - public String subnetName() { - return this.subnetName; - } - - /** - * Get the usage property: Number of used delegated subnets. - * - * @return the usage value. - */ - public Long usage() { - return this.usage; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRule.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRule.java index d1827e1d80c4..2c39ef4bf836 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRule.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRule.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.postgresqlflexibleserver.models; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.FirewallRuleInner; @@ -31,13 +30,6 @@ public interface FirewallRule { */ String type(); - /** - * Gets the systemData property: The system metadata relating to this resource. - * - * @return the systemData value. - */ - SystemData systemData(); - /** * Gets the startIpAddress property: The start IP address of the server firewall rule. Must be IPv4 format. * @@ -81,7 +73,7 @@ interface WithParentResource { * @param serverName The name of the server. * @return the next definition stage. */ - WithStartIpAddress withExistingFlexibleServer(String resourceGroupName, String serverName); + WithStartIpAddress withExistingServer(String resourceGroupName, String serverName); } /** The stage of the FirewallRule definition allowing to specify startIpAddress. */ interface WithStartIpAddress { diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRuleListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRuleListResult.java index 2c28efd29e47..10ae147adc07 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRuleListResult.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRuleListResult.java @@ -22,12 +22,6 @@ public final class FirewallRuleListResult { @JsonProperty(value = "value") private List value; - /* - * The link used to get the next page of operations. - */ - @JsonProperty(value = "nextLink") - private String nextLink; - /** * Get the value property: The list of firewall rules in a server. * @@ -48,26 +42,6 @@ public FirewallRuleListResult withValue(List value) { return this; } - /** - * Get the nextLink property: The link used to get the next page of operations. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Set the nextLink property: The link used to get the next page of operations. - * - * @param nextLink the nextLink value to set. - * @return the FirewallRuleListResult object itself. - */ - public FirewallRuleListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - /** * Validates the instance. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRules.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRules.java index 434fedc573dd..4acec511e89a 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRules.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FirewallRules.java @@ -11,7 +11,7 @@ /** Resource collection API of FirewallRules. */ public interface FirewallRules { /** - * Deletes a PostgreSQL server firewall rule. + * 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. @@ -23,7 +23,7 @@ public interface FirewallRules { void delete(String resourceGroupName, String serverName, String firewallRuleName); /** - * Deletes a PostgreSQL server firewall rule. + * 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. @@ -36,7 +36,7 @@ public interface FirewallRules { void delete(String resourceGroupName, String serverName, String firewallRuleName, Context context); /** - * List all the firewall rules in a given server. + * 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. @@ -44,12 +44,12 @@ public interface FirewallRules { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown 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. + * @return information about a server firewall rule. */ FirewallRule get(String resourceGroupName, String serverName, String firewallRuleName); /** - * List all the firewall rules in a given server. + * 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. @@ -58,13 +58,13 @@ public interface FirewallRules { * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown 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. + * @return information about a server firewall rule. */ Response getWithResponse( String resourceGroupName, String serverName, String firewallRuleName, Context context); /** - * List all the firewall rules in a given PostgreSQL server. + * 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. @@ -76,7 +76,7 @@ Response getWithResponse( PagedIterable listByServer(String resourceGroupName, String serverName); /** - * List all the firewall rules in a given PostgreSQL server. + * 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. @@ -89,30 +89,30 @@ Response getWithResponse( PagedIterable listByServer(String resourceGroupName, String serverName, Context context); /** - * List all the firewall rules in a given server. + * Gets information about a server firewall rule. * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a server firewall rule. + * @return information about a server firewall rule. */ FirewallRule getById(String id); /** - * List all the firewall rules in a given server. + * Gets information about a server firewall rule. * * @param id the resource ID. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return represents a server firewall rule. + * @return information about a server firewall rule. */ Response getByIdWithResponse(String id, Context context); /** - * Deletes a PostgreSQL server firewall rule. + * Deletes a server firewall rule. * * @param id the resource ID. * @throws IllegalArgumentException thrown if parameters fail the validation. @@ -122,7 +122,7 @@ Response getWithResponse( void deleteById(String id); /** - * Deletes a PostgreSQL server firewall rule. + * Deletes a server firewall rule. * * @param id the resource ID. * @param context The context to associate with this operation. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServerEditionCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServerEditionCapability.java deleted file mode 100644 index 8e897aec4146..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/FlexibleServerEditionCapability.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** Flexible server edition capabilities. */ -@Immutable -public final class FlexibleServerEditionCapability { - @JsonIgnore private final ClientLogger logger = new ClientLogger(FlexibleServerEditionCapability.class); - - /* - * Server edition name - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * The list of editions supported by this server edition. - */ - @JsonProperty(value = "supportedStorageEditions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedStorageEditions; - - /* - * The list of server versions supported by this server edition. - */ - @JsonProperty(value = "supportedServerVersions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedServerVersions; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** - * Get the name property: Server edition name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the supportedStorageEditions property: The list of editions supported by this server edition. - * - * @return the supportedStorageEditions value. - */ - public List supportedStorageEditions() { - return this.supportedStorageEditions; - } - - /** - * Get the supportedServerVersions property: The list of server versions supported by this server edition. - * - * @return the supportedServerVersions value. - */ - public List supportedServerVersions() { - return this.supportedServerVersions; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (supportedStorageEditions() != null) { - supportedStorageEditions().forEach(e -> e.validate()); - } - if (supportedServerVersions() != null) { - supportedServerVersions().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GeoRedundantBackup.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GeoRedundantBackup.java new file mode 100644 index 000000000000..3e780d0427f4 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GeoRedundantBackup.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for GeoRedundantBackup. */ +public final class GeoRedundantBackup extends ExpandableStringEnum { + /** Static value Enabled for GeoRedundantBackup. */ + public static final GeoRedundantBackup ENABLED = fromString("Enabled"); + + /** Static value Disabled for GeoRedundantBackup. */ + public static final GeoRedundantBackup DISABLED = fromString("Disabled"); + + /** + * Creates or finds a GeoRedundantBackup from its string representation. + * + * @param name a name to look for. + * @return the corresponding GeoRedundantBackup. + */ + @JsonCreator + public static GeoRedundantBackup fromString(String name) { + return fromString(name, GeoRedundantBackup.class); + } + + /** @return known GeoRedundantBackup values. */ + public static Collection values() { + return values(GeoRedundantBackup.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GeoRedundantBackupEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GeoRedundantBackupEnum.java deleted file mode 100644 index 0a748facd2ba..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GeoRedundantBackupEnum.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for GeoRedundantBackupEnum. */ -public final class GeoRedundantBackupEnum extends ExpandableStringEnum { - /** Static value Enabled for GeoRedundantBackupEnum. */ - public static final GeoRedundantBackupEnum ENABLED = fromString("Enabled"); - - /** Static value Disabled for GeoRedundantBackupEnum. */ - public static final GeoRedundantBackupEnum DISABLED = fromString("Disabled"); - - /** - * Creates or finds a GeoRedundantBackupEnum from its string representation. - * - * @param name a name to look for. - * @return the corresponding GeoRedundantBackupEnum. - */ - @JsonCreator - public static GeoRedundantBackupEnum fromString(String name) { - return fromString(name, GeoRedundantBackupEnum.class); - } - - /** @return known GeoRedundantBackupEnum values. */ - public static Collection values() { - return values(GeoRedundantBackupEnum.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HighAvailability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HighAvailability.java deleted file mode 100644 index 2a5c28d6e7e3..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HighAvailability.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.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; - -/** High availability properties of a server. */ -@Fluent -public final class HighAvailability { - @JsonIgnore private final ClientLogger logger = new ClientLogger(HighAvailability.class); - - /* - * The HA mode for the server. - */ - @JsonProperty(value = "mode") - private HighAvailabilityMode mode; - - /* - * A state of a HA server that is visible to user. - */ - @JsonProperty(value = "state", access = JsonProperty.Access.WRITE_ONLY) - private ServerHAState state; - - /* - * availability zone information of the standby. - */ - @JsonProperty(value = "standbyAvailabilityZone") - private String standbyAvailabilityZone; - - /** - * Get the mode property: The HA mode for the server. - * - * @return the mode value. - */ - public HighAvailabilityMode mode() { - return this.mode; - } - - /** - * Set the mode property: The HA mode for the server. - * - * @param mode the mode value to set. - * @return the HighAvailability object itself. - */ - public HighAvailability withMode(HighAvailabilityMode mode) { - this.mode = mode; - return this; - } - - /** - * Get the state property: A state of a HA server that is visible to user. - * - * @return the state value. - */ - public ServerHAState state() { - return this.state; - } - - /** - * Get the standbyAvailabilityZone property: availability zone information of the standby. - * - * @return the standbyAvailabilityZone value. - */ - public String standbyAvailabilityZone() { - return this.standbyAvailabilityZone; - } - - /** - * Set the standbyAvailabilityZone property: availability zone information of the standby. - * - * @param standbyAvailabilityZone the standbyAvailabilityZone value to set. - * @return the HighAvailability object itself. - */ - public HighAvailability withStandbyAvailabilityZone(String standbyAvailabilityZone) { - this.standbyAvailabilityZone = standbyAvailabilityZone; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HighAvailabilityMode.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HighAvailabilityMode.java deleted file mode 100644 index eed7bcb19113..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HighAvailabilityMode.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for HighAvailabilityMode. */ -public final class HighAvailabilityMode extends ExpandableStringEnum { - /** Static value Disabled for HighAvailabilityMode. */ - public static final HighAvailabilityMode DISABLED = fromString("Disabled"); - - /** Static value ZoneRedundant for HighAvailabilityMode. */ - public static final HighAvailabilityMode ZONE_REDUNDANT = fromString("ZoneRedundant"); - - /** - * Creates or finds a HighAvailabilityMode from its string representation. - * - * @param name a name to look for. - * @return the corresponding HighAvailabilityMode. - */ - @JsonCreator - public static HighAvailabilityMode fromString(String name) { - return fromString(name, HighAvailabilityMode.class); - } - - /** @return known HighAvailabilityMode values. */ - public static Collection values() { - return values(HighAvailabilityMode.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HyperscaleNodeEditionCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HyperscaleNodeEditionCapability.java deleted file mode 100644 index cc91921e4d67..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/HyperscaleNodeEditionCapability.java +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** Hyperscale node edition capabilities. */ -@Immutable -public final class HyperscaleNodeEditionCapability { - @JsonIgnore private final ClientLogger logger = new ClientLogger(HyperscaleNodeEditionCapability.class); - - /* - * Server edition name - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * The list of editions supported by this server edition. - */ - @JsonProperty(value = "supportedStorageEditions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedStorageEditions; - - /* - * The list of server versions supported by this server edition. - */ - @JsonProperty(value = "supportedServerVersions", access = JsonProperty.Access.WRITE_ONLY) - private List supportedServerVersions; - - /* - * The list of Node Types supported by this server edition. - */ - @JsonProperty(value = "supportedNodeTypes", access = JsonProperty.Access.WRITE_ONLY) - private List supportedNodeTypes; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** - * Get the name property: Server edition name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the supportedStorageEditions property: The list of editions supported by this server edition. - * - * @return the supportedStorageEditions value. - */ - public List supportedStorageEditions() { - return this.supportedStorageEditions; - } - - /** - * Get the supportedServerVersions property: The list of server versions supported by this server edition. - * - * @return the supportedServerVersions value. - */ - public List supportedServerVersions() { - return this.supportedServerVersions; - } - - /** - * Get the supportedNodeTypes property: The list of Node Types supported by this server edition. - * - * @return the supportedNodeTypes value. - */ - public List supportedNodeTypes() { - return this.supportedNodeTypes; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (supportedStorageEditions() != null) { - supportedStorageEditions().forEach(e -> e.validate()); - } - if (supportedServerVersions() != null) { - supportedServerVersions().forEach(e -> e.validate()); - } - if (supportedNodeTypes() != null) { - supportedNodeTypes().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/IdentityType.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/IdentityType.java new file mode 100644 index 000000000000..be5a076cbeef --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/IdentityType.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.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for IdentityType. */ +public final class IdentityType extends ExpandableStringEnum { + /** Static value SystemAssigned for IdentityType. */ + public static final IdentityType SYSTEM_ASSIGNED = fromString("SystemAssigned"); + + /** + * 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. */ + public static Collection values() { + return values(IdentityType.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/InfrastructureEncryption.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/InfrastructureEncryption.java new file mode 100644 index 000000000000..6ef38491f5c7 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/InfrastructureEncryption.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.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for InfrastructureEncryption. */ +public final class InfrastructureEncryption extends ExpandableStringEnum { + /** Static value Enabled for InfrastructureEncryption. */ + public static final InfrastructureEncryption ENABLED = fromString("Enabled"); + + /** Static value Disabled for InfrastructureEncryption. */ + public static final InfrastructureEncryption DISABLED = fromString("Disabled"); + + /** + * 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. */ + public static Collection values() { + return values(InfrastructureEncryption.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LocationBasedCapabilities.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LocationBasedPerformanceTiers.java similarity index 67% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LocationBasedCapabilities.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LocationBasedPerformanceTiers.java index 16b8b88d359e..dd119a38761b 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LocationBasedCapabilities.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LocationBasedPerformanceTiers.java @@ -7,28 +7,28 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; -/** Resource collection API of LocationBasedCapabilities. */ -public interface LocationBasedCapabilities { +/** Resource collection API of LocationBasedPerformanceTiers. */ +public interface LocationBasedPerformanceTiers { /** - * Get capabilities at specified location in a given subscription. + * 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 capabilities at specified location in a given subscription. + * @return a list of performance tiers. */ - PagedIterable execute(String locationName); + PagedIterable list(String locationName); /** - * Get capabilities at specified location in a given subscription. + * 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 capabilities at specified location in a given subscription. + * @return a list of performance tiers. */ - PagedIterable execute(String locationName, Context context); + PagedIterable list(String locationName, Context context); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFile.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFile.java new file mode 100644 index 000000000000..6c901e07b052 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFile.java @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner; +import java.time.OffsetDateTime; + +/** An immutable client-side representation of LogFile. */ +public interface LogFile { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the sizeInKB property: Size of the log file. + * + * @return the sizeInKB value. + */ + Long sizeInKB(); + + /** + * Gets the createdTime property: Creation timestamp of the log file. + * + * @return the createdTime value. + */ + OffsetDateTime createdTime(); + + /** + * Gets the lastModifiedTime property: Last modified timestamp of the log file. + * + * @return the lastModifiedTime value. + */ + OffsetDateTime lastModifiedTime(); + + /** + * Gets the typePropertiesType property: Type of the log file. + * + * @return the typePropertiesType value. + */ + String typePropertiesType(); + + /** + * Gets the url property: The url to download the log file from. + * + * @return the url value. + */ + String url(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner object. + * + * @return the inner object. + */ + LogFileInner innerModel(); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFileListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFileListResult.java new file mode 100644 index 000000000000..f5bd000f8b82 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFileListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.LogFileInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of log files. */ +@Fluent +public final class LogFileListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(LogFileListResult.class); + + /* + * The list of log files. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of log files. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of log files. + * + * @param value the value value to set. + * @return the LogFileListResult object itself. + */ + public LogFileListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFiles.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFiles.java new file mode 100644 index 000000000000..930f21a4ff7b --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/LogFiles.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of LogFiles. */ +public interface LogFiles { + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the log files in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of log files. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MaintenanceWindow.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MaintenanceWindow.java deleted file mode 100644 index 873a552898e9..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MaintenanceWindow.java +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.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; - -/** Maintenance window properties of a server. */ -@Fluent -public final class MaintenanceWindow { - @JsonIgnore private final ClientLogger logger = new ClientLogger(MaintenanceWindow.class); - - /* - * indicates whether custom window is enabled or disabled - */ - @JsonProperty(value = "customWindow") - private String customWindow; - - /* - * start hour for maintenance window - */ - @JsonProperty(value = "startHour") - private Integer startHour; - - /* - * start minute for maintenance window - */ - @JsonProperty(value = "startMinute") - private Integer startMinute; - - /* - * day of week for maintenance window - */ - @JsonProperty(value = "dayOfWeek") - private Integer dayOfWeek; - - /** - * Get the customWindow property: indicates whether custom window is enabled or disabled. - * - * @return the customWindow value. - */ - public String customWindow() { - return this.customWindow; - } - - /** - * Set the customWindow property: indicates whether custom window is enabled or disabled. - * - * @param customWindow the customWindow value to set. - * @return the MaintenanceWindow object itself. - */ - public MaintenanceWindow withCustomWindow(String customWindow) { - this.customWindow = customWindow; - return this; - } - - /** - * Get the startHour property: start hour for maintenance window. - * - * @return the startHour value. - */ - public Integer startHour() { - return this.startHour; - } - - /** - * Set the startHour property: start hour for maintenance window. - * - * @param startHour the startHour value to set. - * @return the MaintenanceWindow object itself. - */ - public MaintenanceWindow withStartHour(Integer startHour) { - this.startHour = startHour; - return this; - } - - /** - * Get the startMinute property: start minute for maintenance window. - * - * @return the startMinute value. - */ - public Integer startMinute() { - return this.startMinute; - } - - /** - * Set the startMinute property: start minute for maintenance window. - * - * @param startMinute the startMinute value to set. - * @return the MaintenanceWindow object itself. - */ - public MaintenanceWindow withStartMinute(Integer startMinute) { - this.startMinute = startMinute; - return this; - } - - /** - * Get the dayOfWeek property: day of week for maintenance window. - * - * @return the dayOfWeek value. - */ - public Integer dayOfWeek() { - return this.dayOfWeek; - } - - /** - * Set the dayOfWeek property: day of week for maintenance window. - * - * @param dayOfWeek the dayOfWeek value to set. - * @return the MaintenanceWindow object itself. - */ - public MaintenanceWindow withDayOfWeek(Integer dayOfWeek) { - this.dayOfWeek = dayOfWeek; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MinimalTlsVersionEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MinimalTlsVersionEnum.java new file mode 100644 index 000000000000..5da0e3fbdee5 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/MinimalTlsVersionEnum.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.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for MinimalTlsVersionEnum. */ +public final class MinimalTlsVersionEnum extends ExpandableStringEnum { + /** Static value TLS1_0 for MinimalTlsVersionEnum. */ + public static final MinimalTlsVersionEnum TLS1_0 = fromString("TLS1_0"); + + /** Static value TLS1_1 for MinimalTlsVersionEnum. */ + public static final MinimalTlsVersionEnum TLS1_1 = fromString("TLS1_1"); + + /** Static value TLS1_2 for MinimalTlsVersionEnum. */ + public static final MinimalTlsVersionEnum TLS1_2 = fromString("TLS1_2"); + + /** Static value TLSEnforcementDisabled for MinimalTlsVersionEnum. */ + public static final MinimalTlsVersionEnum TLSENFORCEMENT_DISABLED = fromString("TLSEnforcementDisabled"); + + /** + * 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. */ + public static Collection values() { + return values(MinimalTlsVersionEnum.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NameAvailability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NameAvailability.java index 8b9fc32300db..81ac4318d42b 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NameAvailability.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NameAvailability.java @@ -23,18 +23,11 @@ public interface NameAvailability { Boolean nameAvailable(); /** - * Gets the name property: name of the PostgreSQL server. + * Gets the reason property: Reason for name being unavailable. * - * @return the name value. + * @return the reason value. */ - String name(); - - /** - * Gets the type property: type of the server. - * - * @return the type value. - */ - String type(); + String reason(); /** * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.NameAvailabilityInner object. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Network.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Network.java deleted file mode 100644 index 3beddc4f1538..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Network.java +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.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; - -/** Network properties of a server. */ -@Fluent -public final class Network { - @JsonIgnore private final ClientLogger logger = new ClientLogger(Network.class); - - /* - * public network access is enabled or not - */ - @JsonProperty(value = "publicNetworkAccess", access = JsonProperty.Access.WRITE_ONLY) - private ServerPublicNetworkAccessState publicNetworkAccess; - - /* - * delegated subnet arm resource id. - */ - @JsonProperty(value = "delegatedSubnetResourceId") - private String delegatedSubnetResourceId; - - /* - * private dns zone arm resource id. - */ - @JsonProperty(value = "privateDnsZoneArmResourceId") - private String privateDnsZoneArmResourceId; - - /** - * Get the publicNetworkAccess property: public network access is enabled or not. - * - * @return the publicNetworkAccess value. - */ - public ServerPublicNetworkAccessState publicNetworkAccess() { - return this.publicNetworkAccess; - } - - /** - * Get the delegatedSubnetResourceId property: delegated subnet arm resource id. - * - * @return the delegatedSubnetResourceId value. - */ - public String delegatedSubnetResourceId() { - return this.delegatedSubnetResourceId; - } - - /** - * Set the delegatedSubnetResourceId property: delegated subnet arm resource id. - * - * @param delegatedSubnetResourceId the delegatedSubnetResourceId value to set. - * @return the Network object itself. - */ - public Network withDelegatedSubnetResourceId(String delegatedSubnetResourceId) { - this.delegatedSubnetResourceId = delegatedSubnetResourceId; - return this; - } - - /** - * Get the privateDnsZoneArmResourceId property: private dns zone arm resource id. - * - * @return the privateDnsZoneArmResourceId value. - */ - public String privateDnsZoneArmResourceId() { - return this.privateDnsZoneArmResourceId; - } - - /** - * Set the privateDnsZoneArmResourceId property: private dns zone arm resource id. - * - * @param privateDnsZoneArmResourceId the privateDnsZoneArmResourceId value to set. - * @return the Network object itself. - */ - public Network withPrivateDnsZoneArmResourceId(String privateDnsZoneArmResourceId) { - this.privateDnsZoneArmResourceId = privateDnsZoneArmResourceId; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NodeTypeCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NodeTypeCapability.java deleted file mode 100644 index 0ff57ce894e6..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/NodeTypeCapability.java +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.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; - -/** node type capability. */ -@Immutable -public final class NodeTypeCapability { - @JsonIgnore private final ClientLogger logger = new ClientLogger(NodeTypeCapability.class); - - /* - * note type name - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * note type - */ - @JsonProperty(value = "nodeType", access = JsonProperty.Access.WRITE_ONLY) - private String nodeType; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** - * Get the name property: note type name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the nodeType property: note type. - * - * @return the nodeType value. - */ - public String nodeType() { - return this.nodeType; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Operation.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Operation.java index 404105e6a79f..fae59b083e52 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Operation.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Operation.java @@ -4,14 +4,14 @@ package com.azure.resourcemanager.postgresqlflexibleserver.models; -import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Immutable; import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Map; /** REST API operation definition. */ -@Fluent +@Immutable public final class Operation { @JsonIgnore private final ClientLogger logger = new ClientLogger(Operation.class); @@ -28,12 +28,6 @@ public final class Operation { @JsonProperty(value = "display", access = JsonProperty.Access.WRITE_ONLY) private OperationDisplay display; - /* - * Indicates whether the operation is a data action - */ - @JsonProperty(value = "isDataAction") - private Boolean isDataAction; - /* * The intended executor of the operation. */ @@ -64,26 +58,6 @@ public OperationDisplay display() { return this.display; } - /** - * Get the isDataAction property: Indicates whether the operation is a data action. - * - * @return the isDataAction value. - */ - public Boolean isDataAction() { - return this.isDataAction; - } - - /** - * Set the isDataAction property: Indicates whether the operation is a data action. - * - * @param isDataAction the isDataAction value to set. - * @return the Operation object itself. - */ - public Operation withIsDataAction(Boolean isDataAction) { - this.isDataAction = isDataAction; - return this; - } - /** * Get the origin property: The intended executor of the operation. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OperationListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OperationListResult.java index 18f64714771b..24745916f96e 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OperationListResult.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/OperationListResult.java @@ -10,20 +10,12 @@ /** An immutable client-side representation of OperationListResult. */ public interface OperationListResult { /** - * Gets the value property: Collection of available operation details. + * Gets the value property: The list of resource provider operations. * * @return the value value. */ List value(); - /** - * Gets the nextLink property: URL client should use to fetch the next page (per server side paging). It's null for - * now, added for future use. - * - * @return the nextLink value. - */ - String nextLink(); - /** * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.OperationListResultInner object. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PerformanceTierListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PerformanceTierListResult.java new file mode 100644 index 000000000000..04291687dc5d --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PerformanceTierListResult.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of performance tiers. */ +@Fluent +public final class PerformanceTierListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PerformanceTierListResult.class); + + /* + * The list of performance tiers + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of performance tiers. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Set the value property: The list of performance tiers. + * + * @param value the value value to set. + * @return the PerformanceTierListResult object itself. + */ + public PerformanceTierListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PerformanceTierProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PerformanceTierProperties.java new file mode 100644 index 000000000000..fb47604a8d6e --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PerformanceTierProperties.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.postgresqlflexibleserver.models; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PerformanceTierPropertiesInner; +import java.util.List; + +/** An immutable client-side representation of PerformanceTierProperties. */ +public interface PerformanceTierProperties { + /** + * Gets the id property: ID of the performance tier. + * + * @return the id value. + */ + String id(); + + /** + * Gets the maxBackupRetentionDays property: Maximum Backup retention in days for the performance tier edition. + * + * @return the maxBackupRetentionDays value. + */ + Integer maxBackupRetentionDays(); + + /** + * Gets the minBackupRetentionDays property: Minimum Backup retention in days for the performance tier edition. + * + * @return the minBackupRetentionDays value. + */ + Integer minBackupRetentionDays(); + + /** + * Gets the maxStorageMB property: Max storage allowed for a server. + * + * @return the maxStorageMB value. + */ + Integer maxStorageMB(); + + /** + * Gets the minLargeStorageMB property: Max storage allowed for a server. + * + * @return the minLargeStorageMB value. + */ + Integer minLargeStorageMB(); + + /** + * Gets the maxLargeStorageMB property: Max storage allowed for a server. + * + * @return the maxLargeStorageMB value. + */ + Integer maxLargeStorageMB(); + + /** + * Gets the minStorageMB property: Max storage allowed for a server. + * + * @return the minStorageMB value. + */ + Integer minStorageMB(); + + /** + * Gets the serviceLevelObjectives property: Service level objectives associated with the performance tier. + * + * @return the serviceLevelObjectives value. + */ + List serviceLevelObjectives(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PerformanceTierPropertiesInner + * object. + * + * @return the inner object. + */ + PerformanceTierPropertiesInner innerModel(); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PerformanceTierServiceLevelObjectives.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PerformanceTierServiceLevelObjectives.java new file mode 100644 index 000000000000..ee9dbafa646f --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PerformanceTierServiceLevelObjectives.java @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Service level objectives for performance tier. */ +@Fluent +public final class PerformanceTierServiceLevelObjectives { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PerformanceTierServiceLevelObjectives.class); + + /* + * ID for the service level objective. + */ + @JsonProperty(value = "id") + private String id; + + /* + * Edition of the performance tier. + */ + @JsonProperty(value = "edition") + private String edition; + + /* + * vCore associated with the service level objective + */ + @JsonProperty(value = "vCore") + private Integer vCore; + + /* + * Hardware generation associated with the service level objective + */ + @JsonProperty(value = "hardwareGeneration") + private String hardwareGeneration; + + /* + * Maximum Backup retention in days for the performance tier edition + */ + @JsonProperty(value = "maxBackupRetentionDays") + private Integer maxBackupRetentionDays; + + /* + * Minimum Backup retention in days for the performance tier edition + */ + @JsonProperty(value = "minBackupRetentionDays") + private Integer minBackupRetentionDays; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "maxStorageMB") + private Integer maxStorageMB; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "minStorageMB") + private Integer minStorageMB; + + /** + * Get the id property: ID for the service level objective. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Set the id property: ID for the service level objective. + * + * @param id the id value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withId(String id) { + this.id = id; + return this; + } + + /** + * Get the edition property: Edition of the performance tier. + * + * @return the edition value. + */ + public String edition() { + return this.edition; + } + + /** + * Set the edition property: Edition of the performance tier. + * + * @param edition the edition value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withEdition(String edition) { + this.edition = edition; + return this; + } + + /** + * Get the vCore property: vCore associated with the service level objective. + * + * @return the vCore value. + */ + public Integer vCore() { + return this.vCore; + } + + /** + * Set the vCore property: vCore associated with the service level objective. + * + * @param vCore the vCore value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withVCore(Integer vCore) { + this.vCore = vCore; + return this; + } + + /** + * Get the hardwareGeneration property: Hardware generation associated with the service level objective. + * + * @return the hardwareGeneration value. + */ + public String hardwareGeneration() { + return this.hardwareGeneration; + } + + /** + * Set the hardwareGeneration property: Hardware generation associated with the service level objective. + * + * @param hardwareGeneration the hardwareGeneration value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withHardwareGeneration(String hardwareGeneration) { + this.hardwareGeneration = hardwareGeneration; + return this; + } + + /** + * Get the maxBackupRetentionDays property: Maximum Backup retention in days for the performance tier edition. + * + * @return the maxBackupRetentionDays value. + */ + public Integer maxBackupRetentionDays() { + return this.maxBackupRetentionDays; + } + + /** + * Set the maxBackupRetentionDays property: Maximum Backup retention in days for the performance tier edition. + * + * @param maxBackupRetentionDays the maxBackupRetentionDays value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withMaxBackupRetentionDays(Integer maxBackupRetentionDays) { + this.maxBackupRetentionDays = maxBackupRetentionDays; + return this; + } + + /** + * Get the minBackupRetentionDays property: Minimum Backup retention in days for the performance tier edition. + * + * @return the minBackupRetentionDays value. + */ + public Integer minBackupRetentionDays() { + return this.minBackupRetentionDays; + } + + /** + * Set the minBackupRetentionDays property: Minimum Backup retention in days for the performance tier edition. + * + * @param minBackupRetentionDays the minBackupRetentionDays value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withMinBackupRetentionDays(Integer minBackupRetentionDays) { + this.minBackupRetentionDays = minBackupRetentionDays; + return this; + } + + /** + * Get the maxStorageMB property: Max storage allowed for a server. + * + * @return the maxStorageMB value. + */ + public Integer maxStorageMB() { + return this.maxStorageMB; + } + + /** + * Set the maxStorageMB property: Max storage allowed for a server. + * + * @param maxStorageMB the maxStorageMB value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withMaxStorageMB(Integer maxStorageMB) { + this.maxStorageMB = maxStorageMB; + return this; + } + + /** + * Get the minStorageMB property: Max storage allowed for a server. + * + * @return the minStorageMB value. + */ + public Integer minStorageMB() { + return this.minStorageMB; + } + + /** + * Set the minStorageMB property: Max storage allowed for a server. + * + * @param minStorageMB the minStorageMB value to set. + * @return the PerformanceTierServiceLevelObjectives object itself. + */ + public PerformanceTierServiceLevelObjectives withMinStorageMB(Integer minStorageMB) { + this.minStorageMB = minStorageMB; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointConnection.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointConnection.java new file mode 100644 index 000000000000..aebd7a4c1b9e --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointConnection.java @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateEndpointConnectionInner; +import java.util.Map; + +/** An immutable client-side representation of PrivateEndpointConnection. */ +public interface PrivateEndpointConnection { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + PrivateEndpointProperty privateEndpoint(); + + /** + * Gets the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState(); + + /** + * Gets the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + String provisioningState(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateEndpointConnectionInner + * object. + * + * @return the inner object. + */ + PrivateEndpointConnectionInner innerModel(); + + /** The entirety of the PrivateEndpointConnection definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The PrivateEndpointConnection definition stages. */ + interface DefinitionStages { + /** The first stage of the PrivateEndpointConnection definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the PrivateEndpointConnection definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the PrivateEndpointConnection definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithPrivateEndpoint, DefinitionStages.WithPrivateLinkServiceConnectionState { + /** + * Executes the create request. + * + * @return the created resource. + */ + PrivateEndpointConnection create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + PrivateEndpointConnection create(Context context); + } + /** The stage of the PrivateEndpointConnection definition allowing to specify privateEndpoint. */ + interface WithPrivateEndpoint { + /** + * Specifies the privateEndpoint property: Private endpoint which the connection belongs to.. + * + * @param privateEndpoint Private endpoint which the connection belongs to. + * @return the next definition stage. + */ + WithCreate withPrivateEndpoint(PrivateEndpointProperty privateEndpoint); + } + /** + * The stage of the PrivateEndpointConnection definition allowing to specify privateLinkServiceConnectionState. + */ + interface WithPrivateLinkServiceConnectionState { + /** + * Specifies the privateLinkServiceConnectionState property: Connection state of the private endpoint + * connection.. + * + * @param privateLinkServiceConnectionState Connection state of the private endpoint connection. + * @return the next definition stage. + */ + WithCreate withPrivateLinkServiceConnectionState( + PrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState); + } + } + /** + * Begins update for the PrivateEndpointConnection resource. + * + * @return the stage of resource update. + */ + PrivateEndpointConnection.Update update(); + + /** The template for PrivateEndpointConnection update. */ + interface Update extends UpdateStages.WithTags { + /** + * Executes the update request. + * + * @return the updated resource. + */ + PrivateEndpointConnection apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + PrivateEndpointConnection apply(Context context); + } + /** The PrivateEndpointConnection update stages. */ + interface UpdateStages { + /** The stage of the PrivateEndpointConnection update allowing to specify tags. */ + interface WithTags { + /** + * Specifies the tags property: Resource tags.. + * + * @param tags Resource tags. + * @return the next definition stage. + */ + Update withTags(Map tags); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + PrivateEndpointConnection refresh(Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointConnectionListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointConnectionListResult.java new file mode 100644 index 000000000000..1a950995d9f7 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointConnectionListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateEndpointConnectionInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private endpoint connections. */ +@Immutable +public final class PrivateEndpointConnectionListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointConnectionListResult.class); + + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointConnections.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointConnections.java new file mode 100644 index 000000000000..81cec528ebec --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointConnections.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateEndpointConnections. */ +public interface PrivateEndpointConnections { + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + PrivateEndpointConnection get(String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Gets a private endpoint connection. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The name of the private endpoint connection. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param privateEndpointConnectionName The privateEndpointConnectionName parameter. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String privateEndpointConnectionName, Context context); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets all private endpoint connections on a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return all private endpoint connections on a server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a private endpoint connection. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + PrivateEndpointConnection getById(String id); + + /** + * Gets a private endpoint connection. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a private endpoint connection. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes a private endpoint connection with a given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new PrivateEndpointConnection resource. + * + * @param name resource name. + * @return the first stage of the new PrivateEndpointConnection definition. + */ + PrivateEndpointConnection.DefinitionStages.Blank define(String name); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Storage.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointProperty.java similarity index 52% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Storage.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointProperty.java index e883de3b7446..f1371de84dba 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Storage.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointProperty.java @@ -9,34 +9,34 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -/** Storage properties of a server. */ +/** The PrivateEndpointProperty model. */ @Fluent -public final class Storage { - @JsonIgnore private final ClientLogger logger = new ClientLogger(Storage.class); +public final class PrivateEndpointProperty { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateEndpointProperty.class); /* - * Max storage allowed for a server. + * Resource id of the private endpoint. */ - @JsonProperty(value = "storageSizeGB") - private Integer storageSizeGB; + @JsonProperty(value = "id") + private String id; /** - * Get the storageSizeGB property: Max storage allowed for a server. + * Get the id property: Resource id of the private endpoint. * - * @return the storageSizeGB value. + * @return the id value. */ - public Integer storageSizeGB() { - return this.storageSizeGB; + public String id() { + return this.id; } /** - * Set the storageSizeGB property: Max storage allowed for a server. + * Set the id property: Resource id of the private endpoint. * - * @param storageSizeGB the storageSizeGB value to set. - * @return the Storage object itself. + * @param id the id value to set. + * @return the PrivateEndpointProperty object itself. */ - public Storage withStorageSizeGB(Integer storageSizeGB) { - this.storageSizeGB = storageSizeGB; + public PrivateEndpointProperty withId(String id) { + this.id = id; return this; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointProvisioningState.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointProvisioningState.java new file mode 100644 index 000000000000..be620253da96 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateEndpointProvisioningState.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateEndpointProvisioningState. */ +public final class PrivateEndpointProvisioningState extends ExpandableStringEnum { + /** Static value Approving for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState APPROVING = fromString("Approving"); + + /** Static value Ready for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState READY = fromString("Ready"); + + /** Static value Dropping for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState DROPPING = fromString("Dropping"); + + /** Static value Failed for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState FAILED = fromString("Failed"); + + /** Static value Rejecting for PrivateEndpointProvisioningState. */ + public static final PrivateEndpointProvisioningState REJECTING = fromString("Rejecting"); + + /** + * Creates or finds a PrivateEndpointProvisioningState from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateEndpointProvisioningState. + */ + @JsonCreator + public static PrivateEndpointProvisioningState fromString(String name) { + return fromString(name, PrivateEndpointProvisioningState.class); + } + + /** @return known PrivateEndpointProvisioningState values. */ + public static Collection values() { + return values(PrivateEndpointProvisioningState.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResource.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResource.java new file mode 100644 index 000000000000..8ce9e7aa576f --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResource.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateLinkResourceInner; + +/** An immutable client-side representation of PrivateLinkResource. */ +public interface PrivateLinkResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the properties property: The private link resource group id. + * + * @return the properties value. + */ + PrivateLinkResourceProperties properties(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateLinkResourceInner object. + * + * @return the inner object. + */ + PrivateLinkResourceInner innerModel(); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResourceListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResourceListResult.java new file mode 100644 index 000000000000..6755a5d9e433 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResourceListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.PrivateLinkResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of private link resources. */ +@Immutable +public final class PrivateLinkResourceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceListResult.class); + + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResourceProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResourceProperties.java new file mode 100644 index 000000000000..b251f8ec868c --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResourceProperties.java @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** Properties of a private link resource. */ +@Immutable +public final class PrivateLinkResourceProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkResourceProperties.class); + + /* + * The private link resource group id. + */ + @JsonProperty(value = "groupId", access = JsonProperty.Access.WRITE_ONLY) + private String groupId; + + /* + * The private link resource required member names. + */ + @JsonProperty(value = "requiredMembers", access = JsonProperty.Access.WRITE_ONLY) + private List requiredMembers; + + /** + * Get the groupId property: The private link resource group id. + * + * @return the groupId value. + */ + public String groupId() { + return this.groupId; + } + + /** + * Get the requiredMembers property: The private link resource required member names. + * + * @return the requiredMembers value. + */ + public List requiredMembers() { + return this.requiredMembers; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResources.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResources.java new file mode 100644 index 000000000000..36de79be28e2 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkResources.java @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of PrivateLinkResources. */ +public interface PrivateLinkResources { + /** + * Gets the private link resources for 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. + */ + 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. + */ + 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. + */ + PrivateLinkResource get(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String groupName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkServiceConnectionStateActionsRequire.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkServiceConnectionStateActionsRequire.java new file mode 100644 index 000000000000..90075bdab77f --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkServiceConnectionStateActionsRequire.java @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateLinkServiceConnectionStateActionsRequire. */ +public final class PrivateLinkServiceConnectionStateActionsRequire + extends ExpandableStringEnum { + /** Static value None for PrivateLinkServiceConnectionStateActionsRequire. */ + public static final PrivateLinkServiceConnectionStateActionsRequire NONE = fromString("None"); + + /** + * Creates or finds a PrivateLinkServiceConnectionStateActionsRequire from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateLinkServiceConnectionStateActionsRequire. + */ + @JsonCreator + public static PrivateLinkServiceConnectionStateActionsRequire fromString(String name) { + return fromString(name, PrivateLinkServiceConnectionStateActionsRequire.class); + } + + /** @return known PrivateLinkServiceConnectionStateActionsRequire values. */ + public static Collection values() { + return values(PrivateLinkServiceConnectionStateActionsRequire.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkServiceConnectionStateProperty.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkServiceConnectionStateProperty.java new file mode 100644 index 000000000000..c2d3c164f981 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkServiceConnectionStateProperty.java @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The PrivateLinkServiceConnectionStateProperty model. */ +@Fluent +public final class PrivateLinkServiceConnectionStateProperty { + @JsonIgnore private final ClientLogger logger = new ClientLogger(PrivateLinkServiceConnectionStateProperty.class); + + /* + * The private link service connection status. + */ + @JsonProperty(value = "status", required = true) + private String status; + + /* + * The private link service connection description. + */ + @JsonProperty(value = "description", required = true) + private String description; + + /* + * The actions required for private link service connection. + */ + @JsonProperty(value = "actionsRequired", access = JsonProperty.Access.WRITE_ONLY) + private String actionsRequired; + + /** + * Get the status property: The private link service connection status. + * + * @return the status value. + */ + public String status() { + return this.status; + } + + /** + * Set the status property: The private link service connection status. + * + * @param status the status value to set. + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withStatus(String status) { + this.status = status; + return this; + } + + /** + * Get the description property: The private link service connection description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The private link service connection description. + * + * @param description the description value to set. + * @return the PrivateLinkServiceConnectionStateProperty object itself. + */ + public PrivateLinkServiceConnectionStateProperty withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: The actions required for private link service connection. + * + * @return the actionsRequired value. + */ + public String actionsRequired() { + return this.actionsRequired; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property status in model PrivateLinkServiceConnectionStateProperty")); + } + if (description() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property description in model PrivateLinkServiceConnectionStateProperty")); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkServiceConnectionStateStatus.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkServiceConnectionStateStatus.java new file mode 100644 index 000000000000..3cda01c6e8f1 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PrivateLinkServiceConnectionStateStatus.java @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PrivateLinkServiceConnectionStateStatus. */ +public final class PrivateLinkServiceConnectionStateStatus + extends ExpandableStringEnum { + /** Static value Approved for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus APPROVED = fromString("Approved"); + + /** Static value Pending for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus PENDING = fromString("Pending"); + + /** Static value Rejected for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus REJECTED = fromString("Rejected"); + + /** Static value Disconnected for PrivateLinkServiceConnectionStateStatus. */ + public static final PrivateLinkServiceConnectionStateStatus DISCONNECTED = fromString("Disconnected"); + + /** + * Creates or finds a PrivateLinkServiceConnectionStateStatus from its string representation. + * + * @param name a name to look for. + * @return the corresponding PrivateLinkServiceConnectionStateStatus. + */ + @JsonCreator + public static PrivateLinkServiceConnectionStateStatus fromString(String name) { + return fromString(name, PrivateLinkServiceConnectionStateStatus.class); + } + + /** @return known PrivateLinkServiceConnectionStateStatus values. */ + public static Collection values() { + return values(PrivateLinkServiceConnectionStateStatus.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PublicNetworkAccessEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PublicNetworkAccessEnum.java new file mode 100644 index 000000000000..d05f889f87d3 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/PublicNetworkAccessEnum.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for PublicNetworkAccessEnum. */ +public final class PublicNetworkAccessEnum extends ExpandableStringEnum { + /** Static value Enabled for PublicNetworkAccessEnum. */ + public static final PublicNetworkAccessEnum ENABLED = fromString("Enabled"); + + /** Static value Disabled for PublicNetworkAccessEnum. */ + public static final PublicNetworkAccessEnum DISABLED = fromString("Disabled"); + + /** + * Creates or finds a PublicNetworkAccessEnum from its string representation. + * + * @param name a name to look for. + * @return the corresponding PublicNetworkAccessEnum. + */ + @JsonCreator + public static PublicNetworkAccessEnum fromString(String name) { + return fromString(name, PublicNetworkAccessEnum.class); + } + + /** @return known PublicNetworkAccessEnum values. */ + public static Collection values() { + return values(PublicNetworkAccessEnum.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RecoverableServerResource.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RecoverableServerResource.java new file mode 100644 index 000000000000..bb0da41b041e --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RecoverableServerResource.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.postgresqlflexibleserver.models; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.RecoverableServerResourceInner; + +/** An immutable client-side representation of RecoverableServerResource. */ +public interface RecoverableServerResource { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the lastAvailableBackupDateTime property: The last available backup date time. + * + * @return the lastAvailableBackupDateTime value. + */ + String lastAvailableBackupDateTime(); + + /** + * Gets the serviceLevelObjective property: The service level objective. + * + * @return the serviceLevelObjective value. + */ + String serviceLevelObjective(); + + /** + * Gets the edition property: Edition of the performance tier. + * + * @return the edition value. + */ + String edition(); + + /** + * Gets the vCore property: vCore associated with the service level objective. + * + * @return the vCore value. + */ + Integer vCore(); + + /** + * Gets the hardwareGeneration property: Hardware generation associated with the service level objective. + * + * @return the hardwareGeneration value. + */ + String hardwareGeneration(); + + /** + * Gets the version property: The PostgreSQL version. + * + * @return the version value. + */ + String version(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.RecoverableServerResourceInner + * object. + * + * @return the inner object. + */ + RecoverableServerResourceInner innerModel(); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GetPrivateDnsZoneSuffixes.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RecoverableServers.java similarity index 52% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GetPrivateDnsZoneSuffixes.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RecoverableServers.java index ce8b75e03617..7f8cb1769fcb 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/GetPrivateDnsZoneSuffixes.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RecoverableServers.java @@ -7,25 +7,30 @@ import com.azure.core.http.rest.Response; import com.azure.core.util.Context; -/** Resource collection API of GetPrivateDnsZoneSuffixes. */ -public interface GetPrivateDnsZoneSuffixes { +/** Resource collection API of RecoverableServers. */ +public interface RecoverableServers { /** - * Get private DNS zone suffix in the cloud. + * 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 private DNS zone suffix in the cloud. + * @return a recoverable PostgreSQL Server. */ - String execute(); + RecoverableServerResource get(String resourceGroupName, String serverName); /** - * Get private DNS zone suffix in the cloud. + * 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 private DNS zone suffix in the cloud. + * @return a recoverable PostgreSQL Server. */ - Response executeWithResponse(Context context); + Response getWithResponse(String resourceGroupName, String serverName, Context context); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Replicas.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Replicas.java new file mode 100644 index 000000000000..f67b0f6a13a5 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Replicas.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of Replicas. */ +public interface Replicas { + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * List all the replicas for a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of servers. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Identity.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ResourceIdentity.java similarity index 51% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Identity.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ResourceIdentity.java index 9f6aa149c6f3..25dcec646175 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Identity.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ResourceIdentity.java @@ -8,68 +8,73 @@ import com.azure.core.util.logging.ClientLogger; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.UUID; -/** Identity for the resource. */ +/** Azure Active Directory identity configuration for a resource. */ @Fluent -public class Identity { - @JsonIgnore private final ClientLogger logger = new ClientLogger(Identity.class); +public class ResourceIdentity { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ResourceIdentity.class); /* - * The principal ID of resource identity. + * The Azure Active Directory principal id. */ @JsonProperty(value = "principalId", access = JsonProperty.Access.WRITE_ONLY) - private String principalId; + private UUID principalId; /* - * The tenant ID of 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 = "tenantId", access = JsonProperty.Access.WRITE_ONLY) - private String tenantId; + @JsonProperty(value = "type") + private IdentityType type; /* - * The identity type. + * The Azure Active Directory tenant id. */ - @JsonProperty(value = "type") - private ResourceIdentityType type; + @JsonProperty(value = "tenantId", access = JsonProperty.Access.WRITE_ONLY) + private UUID tenantId; /** - * Get the principalId property: The principal ID of resource identity. + * Get the principalId property: The Azure Active Directory principal id. * * @return the principalId value. */ - public String principalId() { + public UUID principalId() { return this.principalId; } /** - * Get the tenantId property: The tenant ID of resource. - * - * @return the tenantId value. - */ - public String tenantId() { - return this.tenantId; - } - - /** - * Get the type property: The identity type. + * 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 ResourceIdentityType type() { + public IdentityType type() { return this.type; } /** - * Set the type property: The identity 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 Identity object itself. + * @return the ResourceIdentity object itself. */ - public Identity withType(ResourceIdentityType type) { + public ResourceIdentity withType(IdentityType type) { this.type = type; return this; } + /** + * Get the tenantId property: The Azure Active Directory tenant id. + * + * @return the tenantId value. + */ + public UUID tenantId() { + return this.tenantId; + } + /** * Validates the instance. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RestartParameter.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RestartParameter.java deleted file mode 100644 index 651901e69129..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/RestartParameter.java +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; - -/** Represents server restart parameters. */ -@Fluent -public final class RestartParameter { - @JsonIgnore private final ClientLogger logger = new ClientLogger(RestartParameter.class); - - /* - * Indicates whether to restart the server with failover. - */ - @JsonProperty(value = "restartWithFailover") - private Boolean restartWithFailover; - - /* - * Failover mode. - */ - @JsonProperty(value = "failoverMode") - private String failoverMode; - - /** - * Get the restartWithFailover property: Indicates whether to restart the server with failover. - * - * @return the restartWithFailover value. - */ - public Boolean restartWithFailover() { - return this.restartWithFailover; - } - - /** - * Set the restartWithFailover property: Indicates whether to restart the server with failover. - * - * @param restartWithFailover the restartWithFailover value to set. - * @return the RestartParameter object itself. - */ - public RestartParameter withRestartWithFailover(Boolean restartWithFailover) { - this.restartWithFailover = restartWithFailover; - return this; - } - - /** - * Get the failoverMode property: Failover mode. - * - * @return the failoverMode value. - */ - public String failoverMode() { - return this.failoverMode; - } - - /** - * Set the failoverMode property: Failover mode. - * - * @param failoverMode the failoverMode value to set. - * @return the RestartParameter object itself. - */ - public RestartParameter withFailoverMode(String failoverMode) { - this.failoverMode = failoverMode; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SecurityAlertPolicyName.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SecurityAlertPolicyName.java new file mode 100644 index 000000000000..c20ff06ef173 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SecurityAlertPolicyName.java @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for SecurityAlertPolicyName. */ +public final class SecurityAlertPolicyName extends ExpandableStringEnum { + /** Static value Default for SecurityAlertPolicyName. */ + public static final SecurityAlertPolicyName DEFAULT = fromString("Default"); + + /** + * Creates or finds a SecurityAlertPolicyName from its string representation. + * + * @param name a name to look for. + * @return the corresponding SecurityAlertPolicyName. + */ + @JsonCreator + public static SecurityAlertPolicyName fromString(String name) { + return fromString(name, SecurityAlertPolicyName.class); + } + + /** @return known SecurityAlertPolicyName values. */ + public static Collection values() { + return values(SecurityAlertPolicyName.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Server.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Server.java index 4f8521d0e5c5..6b0608505f7d 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Server.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Server.java @@ -5,10 +5,10 @@ package com.azure.resourcemanager.postgresqlflexibleserver.models; import com.azure.core.management.Region; -import com.azure.core.management.SystemData; import com.azure.core.util.Context; import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerInner; import java.time.OffsetDateTime; +import java.util.List; import java.util.Map; /** An immutable client-side representation of Server. */ @@ -53,7 +53,7 @@ public interface Server { * * @return the identity value. */ - Identity identity(); + ResourceIdentity identity(); /** * Gets the sku property: The SKU (pricing tier) of the server. @@ -62,13 +62,6 @@ public interface Server { */ Sku sku(); - /** - * Gets the systemData property: The system metadata relating to this resource. - * - * @return the systemData value. - */ - SystemData systemData(); - /** * 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). @@ -78,111 +71,104 @@ public interface Server { String administratorLogin(); /** - * Gets the administratorLoginPassword property: The administrator login password (required for server creation). - * - * @return the administratorLoginPassword value. - */ - String administratorLoginPassword(); - - /** - * Gets the version property: PostgreSQL Server version. + * Gets the version property: Server version. * * @return the version value. */ ServerVersion version(); /** - * Gets the minorVersion property: The minor version of the server. + * Gets the sslEnforcement property: Enable ssl enforcement or not when connect to server. * - * @return the minorVersion value. + * @return the sslEnforcement value. */ - String minorVersion(); + SslEnforcementEnum sslEnforcement(); /** - * Gets the state property: A state of a server that is visible to user. + * Gets the minimalTlsVersion property: Enforce a minimal Tls version for the server. * - * @return the state value. + * @return the minimalTlsVersion value. */ - ServerState state(); + MinimalTlsVersionEnum minimalTlsVersion(); /** - * Gets the fullyQualifiedDomainName property: The fully qualified domain name of a server. + * Gets the byokEnforcement property: Status showing whether the server data encryption is enabled with + * customer-managed keys. * - * @return the fullyQualifiedDomainName value. + * @return the byokEnforcement value. */ - String fullyQualifiedDomainName(); + String byokEnforcement(); /** - * Gets the storage property: Storage properties of a server. + * Gets the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. * - * @return the storage value. + * @return the infrastructureEncryption value. */ - Storage storage(); + InfrastructureEncryption infrastructureEncryption(); /** - * Gets the backup property: Backup properties of a server. + * Gets the userVisibleState property: A state of a server that is visible to user. * - * @return the backup value. + * @return the userVisibleState value. */ - Backup backup(); + ServerState userVisibleState(); /** - * Gets the network property: Network properties of a server. + * Gets the fullyQualifiedDomainName property: The fully qualified domain name of a server. * - * @return the network value. + * @return the fullyQualifiedDomainName value. */ - Network network(); + String fullyQualifiedDomainName(); /** - * Gets the highAvailability property: High availability properties of a server. + * Gets the earliestRestoreDate property: Earliest restore point creation time (ISO8601 format). * - * @return the highAvailability value. + * @return the earliestRestoreDate value. */ - HighAvailability highAvailability(); + OffsetDateTime earliestRestoreDate(); /** - * Gets the maintenanceWindow property: Maintenance window properties of a server. + * Gets the storageProfile property: Storage profile of a server. * - * @return the maintenanceWindow value. + * @return the storageProfile value. */ - MaintenanceWindow maintenanceWindow(); + StorageProfile storageProfile(); /** - * Gets the sourceServerResourceId property: The source server resource ID to restore from. It's required when - * 'createMode' is 'PointInTimeRestore'. + * Gets the replicationRole property: The replication role of the server. * - * @return the sourceServerResourceId value. + * @return the replicationRole value. */ - String sourceServerResourceId(); + String replicationRole(); /** - * Gets the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time to restore - * from. It's required when 'createMode' is 'PointInTimeRestore'. + * Gets the masterServerId property: The master server id of a replica server. * - * @return the pointInTimeUtc value. + * @return the masterServerId value. */ - OffsetDateTime pointInTimeUtc(); + String masterServerId(); /** - * Gets the availabilityZone property: availability zone information of the server. + * Gets the replicaCapacity property: The maximum number of replicas that a master server can have. * - * @return the availabilityZone value. + * @return the replicaCapacity value. */ - String availabilityZone(); + Integer replicaCapacity(); /** - * Gets the createMode property: The mode to create a new PostgreSQL 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 createMode value. + * @return the publicNetworkAccess value. */ - CreateMode createMode(); + PublicNetworkAccessEnum publicNetworkAccess(); /** - * Gets the tagsPropertiesTags property: Application-specific metadata in the form of key-value pairs. + * Gets the privateEndpointConnections property: List of private endpoint connections on a server. * - * @return the tagsPropertiesTags value. + * @return the privateEndpointConnections value. */ - Map tagsPropertiesTags(); + List privateEndpointConnections(); /** * Gets the region of the resource. @@ -210,6 +196,7 @@ interface Definition extends DefinitionStages.Blank, DefinitionStages.WithLocation, DefinitionStages.WithResourceGroup, + DefinitionStages.WithProperties, DefinitionStages.WithCreate { } /** The Server definition stages. */ @@ -222,7 +209,7 @@ interface WithLocation { /** * Specifies the region for the resource. * - * @param location The geo-location where the resource lives. + * @param location The location the resource resides in. * @return the next definition stage. */ WithResourceGroup withRegion(Region location); @@ -230,7 +217,7 @@ interface WithLocation { /** * Specifies the region for the resource. * - * @param location The geo-location where the resource lives. + * @param location The location the resource resides in. * @return the next definition stage. */ WithResourceGroup withRegion(String location); @@ -243,28 +230,24 @@ interface WithResourceGroup { * @param resourceGroupName The name of the resource group. The name is case insensitive. * @return the next definition stage. */ - WithCreate withExistingResourceGroup(String resourceGroupName); + WithProperties withExistingResourceGroup(String resourceGroupName); + } + /** The stage of the Server definition allowing to specify properties. */ + interface WithProperties { + /** + * Specifies the properties property: Properties of the server.. + * + * @param properties Properties of the server. + * @return the next definition stage. + */ + WithCreate withProperties(ServerPropertiesForCreate properties); } /** * The stage of the Server definition which contains all the minimum required properties for the resource to be * created, but also allows for any other optional properties to be specified. */ interface WithCreate - extends DefinitionStages.WithTags, - DefinitionStages.WithIdentity, - DefinitionStages.WithSku, - DefinitionStages.WithAdministratorLogin, - DefinitionStages.WithAdministratorLoginPassword, - DefinitionStages.WithVersion, - DefinitionStages.WithStorage, - DefinitionStages.WithBackup, - DefinitionStages.WithNetwork, - DefinitionStages.WithHighAvailability, - DefinitionStages.WithSourceServerResourceId, - DefinitionStages.WithPointInTimeUtc, - DefinitionStages.WithAvailabilityZone, - DefinitionStages.WithCreateMode, - DefinitionStages.WithTagsPropertiesTags { + extends DefinitionStages.WithTags, DefinitionStages.WithIdentity, DefinitionStages.WithSku { /** * Executes the create request. * @@ -283,9 +266,9 @@ interface WithCreate /** The stage of the Server definition allowing to specify tags. */ interface WithTags { /** - * Specifies the tags property: Resource tags.. + * Specifies the tags property: Application-specific metadata in the form of key-value pairs.. * - * @param tags Resource tags. + * @param tags Application-specific metadata in the form of key-value pairs. * @return the next definition stage. */ WithCreate withTags(Map tags); @@ -298,7 +281,7 @@ interface WithIdentity { * @param identity The Azure Active Directory identity of the server. * @return the next definition stage. */ - WithCreate withIdentity(Identity identity); + WithCreate withIdentity(ResourceIdentity identity); } /** The stage of the Server definition allowing to specify sku. */ interface WithSku { @@ -310,133 +293,6 @@ interface WithSku { */ WithCreate withSku(Sku sku); } - /** The stage of the Server definition allowing to specify administratorLogin. */ - interface WithAdministratorLogin { - /** - * Specifies 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 administrator's login name of a server. Can only be specified when the - * server is being created (and is required for creation). - * @return the next definition stage. - */ - WithCreate withAdministratorLogin(String administratorLogin); - } - /** The stage of the Server definition allowing to specify administratorLoginPassword. */ - interface WithAdministratorLoginPassword { - /** - * Specifies the administratorLoginPassword property: The administrator login password (required for server - * creation).. - * - * @param administratorLoginPassword The administrator login password (required for server creation). - * @return the next definition stage. - */ - WithCreate withAdministratorLoginPassword(String administratorLoginPassword); - } - /** The stage of the Server definition allowing to specify version. */ - interface WithVersion { - /** - * Specifies the version property: PostgreSQL Server version.. - * - * @param version PostgreSQL Server version. - * @return the next definition stage. - */ - WithCreate withVersion(ServerVersion version); - } - /** The stage of the Server definition allowing to specify storage. */ - interface WithStorage { - /** - * Specifies the storage property: Storage properties of a server.. - * - * @param storage Storage properties of a server. - * @return the next definition stage. - */ - WithCreate withStorage(Storage storage); - } - /** The stage of the Server definition allowing to specify backup. */ - interface WithBackup { - /** - * Specifies the backup property: Backup properties of a server.. - * - * @param backup Backup properties of a server. - * @return the next definition stage. - */ - WithCreate withBackup(Backup backup); - } - /** The stage of the Server definition allowing to specify network. */ - interface WithNetwork { - /** - * Specifies the network property: Network properties of a server.. - * - * @param network Network properties of a server. - * @return the next definition stage. - */ - WithCreate withNetwork(Network network); - } - /** The stage of the Server definition allowing to specify highAvailability. */ - interface WithHighAvailability { - /** - * Specifies the highAvailability property: High availability properties of a server.. - * - * @param highAvailability High availability properties of a server. - * @return the next definition stage. - */ - WithCreate withHighAvailability(HighAvailability highAvailability); - } - /** The stage of the Server definition allowing to specify sourceServerResourceId. */ - interface WithSourceServerResourceId { - /** - * Specifies the sourceServerResourceId property: The source server resource ID to restore from. It's - * required when 'createMode' is 'PointInTimeRestore'.. - * - * @param sourceServerResourceId The source server resource ID to restore from. It's required when - * 'createMode' is 'PointInTimeRestore'. - * @return the next definition stage. - */ - WithCreate withSourceServerResourceId(String sourceServerResourceId); - } - /** The stage of the Server definition allowing to specify pointInTimeUtc. */ - interface WithPointInTimeUtc { - /** - * Specifies the pointInTimeUtc property: Restore point creation time (ISO8601 format), specifying the time - * to restore from. It's required when 'createMode' is 'PointInTimeRestore'.. - * - * @param pointInTimeUtc Restore point creation time (ISO8601 format), specifying the time to restore from. - * It's required when 'createMode' is 'PointInTimeRestore'. - * @return the next definition stage. - */ - WithCreate withPointInTimeUtc(OffsetDateTime pointInTimeUtc); - } - /** The stage of the Server definition allowing to specify availabilityZone. */ - interface WithAvailabilityZone { - /** - * Specifies the availabilityZone property: availability zone information of the server.. - * - * @param availabilityZone availability zone information of the server. - * @return the next definition stage. - */ - WithCreate withAvailabilityZone(String availabilityZone); - } - /** The stage of the Server definition allowing to specify createMode. */ - interface WithCreateMode { - /** - * Specifies the createMode property: The mode to create a new PostgreSQL server.. - * - * @param createMode The mode to create a new PostgreSQL server. - * @return the next definition stage. - */ - WithCreate withCreateMode(CreateMode createMode); - } - /** The stage of the Server definition allowing to specify tagsPropertiesTags. */ - interface WithTagsPropertiesTags { - /** - * Specifies the tagsPropertiesTags property: Application-specific metadata in the form of key-value pairs.. - * - * @param tagsPropertiesTags Application-specific metadata in the form of key-value pairs. - * @return the next definition stage. - */ - WithCreate withTagsPropertiesTags(Map tagsPropertiesTags); - } } /** * Begins update for the Server resource. @@ -448,13 +304,15 @@ interface WithTagsPropertiesTags { /** The template for Server update. */ interface Update extends UpdateStages.WithTags, + UpdateStages.WithIdentity, UpdateStages.WithSku, + UpdateStages.WithStorageProfile, UpdateStages.WithAdministratorLoginPassword, - UpdateStages.WithStorage, - UpdateStages.WithBackup, - UpdateStages.WithHighAvailability, - UpdateStages.WithMaintenanceWindow, - UpdateStages.WithCreateMode { + UpdateStages.WithVersion, + UpdateStages.WithSslEnforcement, + UpdateStages.WithMinimalTlsVersion, + UpdateStages.WithPublicNetworkAccess, + UpdateStages.WithReplicationRole { /** * Executes the update request. * @@ -482,6 +340,16 @@ interface WithTags { */ Update withTags(Map tags); } + /** 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. */ interface WithSku { /** @@ -492,6 +360,16 @@ interface WithSku { */ Update withSku(Sku sku); } + /** The stage of the Server update allowing to specify storageProfile. */ + interface WithStorageProfile { + /** + * Specifies the storageProfile property: Storage profile of a server.. + * + * @param storageProfile Storage profile of a server. + * @return the next definition stage. + */ + Update withStorageProfile(StorageProfile storageProfile); + } /** The stage of the Server update allowing to specify administratorLoginPassword. */ interface WithAdministratorLoginPassword { /** @@ -502,55 +380,57 @@ interface WithAdministratorLoginPassword { */ Update withAdministratorLoginPassword(String administratorLoginPassword); } - /** The stage of the Server update allowing to specify storage. */ - interface WithStorage { + /** The stage of the Server update allowing to specify version. */ + interface WithVersion { /** - * Specifies the storage property: Storage properties of a server.. + * Specifies the version property: The version of a server.. * - * @param storage Storage properties of a server. + * @param version The version of a server. * @return the next definition stage. */ - Update withStorage(Storage storage); + Update withVersion(ServerVersion version); } - /** The stage of the Server update allowing to specify backup. */ - interface WithBackup { + /** The stage of the Server update allowing to specify sslEnforcement. */ + interface WithSslEnforcement { /** - * Specifies the backup property: Backup properties of a server.. + * Specifies the sslEnforcement property: Enable ssl enforcement or not when connect to server.. * - * @param backup Backup properties of a server. + * @param sslEnforcement Enable ssl enforcement or not when connect to server. * @return the next definition stage. */ - Update withBackup(Backup backup); + Update withSslEnforcement(SslEnforcementEnum sslEnforcement); } - /** The stage of the Server update allowing to specify highAvailability. */ - interface WithHighAvailability { + /** The stage of the Server update allowing to specify minimalTlsVersion. */ + interface WithMinimalTlsVersion { /** - * Specifies the highAvailability property: High availability properties of a server.. + * Specifies the minimalTlsVersion property: Enforce a minimal Tls version for the server.. * - * @param highAvailability High availability properties of a server. + * @param minimalTlsVersion Enforce a minimal Tls version for the server. * @return the next definition stage. */ - Update withHighAvailability(HighAvailability highAvailability); + Update withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion); } - /** The stage of the Server update allowing to specify maintenanceWindow. */ - interface WithMaintenanceWindow { + /** The stage of the Server update allowing to specify publicNetworkAccess. */ + interface WithPublicNetworkAccess { /** - * Specifies the maintenanceWindow property: Maintenance window properties of a server.. + * 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 maintenanceWindow Maintenance window properties of a server. + * @param publicNetworkAccess Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. * @return the next definition stage. */ - Update withMaintenanceWindow(MaintenanceWindow maintenanceWindow); + Update withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess); } - /** The stage of the Server update allowing to specify createMode. */ - interface WithCreateMode { + /** The stage of the Server update allowing to specify replicationRole. */ + interface WithReplicationRole { /** - * Specifies the createMode property: The mode to update a new PostgreSQL server.. + * Specifies the replicationRole property: The replication role of the server.. * - * @param createMode The mode to update a new PostgreSQL server. + * @param replicationRole The replication role of the server. * @return the next definition stage. */ - Update withCreateMode(CreateModeForUpdate createMode); + Update withReplicationRole(String replicationRole); } } /** @@ -568,16 +448,6 @@ interface WithCreateMode { */ Server refresh(Context context); - /** - * Restarts a server. - * - * @param parameters The parameters for restarting 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. - */ - void restart(RestartParameter parameters); - /** * Restarts a server. * @@ -589,47 +459,10 @@ interface WithCreateMode { /** * Restarts a server. * - * @param parameters The parameters for restarting a server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void restart(RestartParameter parameters, Context context); - - /** - * Starts 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. - */ - void start(); - - /** - * Starts a server. - * - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void start(Context context); - - /** - * Stops 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. - */ - void stop(); - - /** - * Stops a server. - * * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ - void stop(Context context); + void restart(Context context); } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerAdministratorResource.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerAdministratorResource.java new file mode 100644 index 000000000000..3527194ce1db --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerAdministratorResource.java @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerAdministratorResourceInner; +import java.util.UUID; + +/** 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.postgresqlflexibleserver.fluent.models.ServerAdministratorResourceInner + * object. + * + * @return the inner object. + */ + ServerAdministratorResourceInner innerModel(); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerAdministratorResourceListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerAdministratorResourceListResult.java new file mode 100644 index 000000000000..223de9a68d8e --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerAdministratorResourceListResult.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.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerAdministratorResourceInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** The response to a list Active Directory Administrators request. */ +@Fluent +public final class ServerAdministratorResourceListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerAdministratorResourceListResult.class); + + /* + * The list of server Active Directory Administrators for the server. + */ + @JsonProperty(value = "value") + private List value; + + /** + * Get the value property: The list of server Active Directory Administrators for the server. + * + * @return the value value. + */ + public List value() { + return this.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. + */ + public ServerAdministratorResourceListResult withValue(List value) { + this.value = value; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerAdministrators.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerAdministrators.java new file mode 100644 index 000000000000..20a15f7abb58 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerAdministrators.java @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerAdministratorResourceInner; + +/** 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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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. + */ + ServerAdministratorResource get(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. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.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. + */ + Response getWithResponse(String resourceGroupName, String serverName, Context context); + + /** + * 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. + */ + ServerAdministratorResource createOrUpdate( + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown 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. + */ + ServerAdministratorResource createOrUpdate( + String resourceGroupName, String serverName, ServerAdministratorResourceInner properties, 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. + */ + void deleteByResourceGroup(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. + */ + 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 com.azure.core.management.exception.ManagementException 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. + */ + 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. + */ + PagedIterable list(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerBasedPerformanceTiers.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerBasedPerformanceTiers.java new file mode 100644 index 000000000000..7b22b3bd5f5d --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerBasedPerformanceTiers.java @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.util.Context; + +/** Resource collection API of ServerBasedPerformanceTiers. */ +public interface ServerBasedPerformanceTiers { + /** + * List all the performance tiers for a 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. + */ + 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. + */ + PagedIterable list(String resourceGroupName, String serverName, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerForCreate.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerForCreate.java new file mode 100644 index 000000000000..2366882dae9b --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerForCreate.java @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Represents a server to be created. */ +@Fluent +public final class ServerForCreate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerForCreate.class); + + /* + * The 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") + private Map tags; + + /** + * Get the identity property: The Azure Active Directory identity of the server. + * + * @return the identity value. + */ + public ResourceIdentity identity() { + return this.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. + */ + public ServerForCreate withIdentity(ResourceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the sku property: The SKU (pricing tier) of the server. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU (pricing tier) of the server. + * + * @param sku the sku value to set. + * @return the ServerForCreate object itself. + */ + public ServerForCreate withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the properties property: Properties of the server. + * + * @return the properties value. + */ + public ServerPropertiesForCreate properties() { + return this.properties; + } + + /** + * Set the properties property: Properties of the server. + * + * @param properties the properties value to set. + * @return the ServerForCreate object itself. + */ + public ServerForCreate withProperties(ServerPropertiesForCreate properties) { + this.properties = properties; + return this; + } + + /** + * Get the location property: The location the resource resides in. + * + * @return the location value. + */ + public String location() { + return this.location; + } + + /** + * Set the location property: The location the resource resides in. + * + * @param location the location value to set. + * @return the ServerForCreate object itself. + */ + public ServerForCreate withLocation(String location) { + this.location = location; + return this; + } + + /** + * Get the tags property: Application-specific metadata in the form of key-value pairs. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Application-specific metadata in the form of key-value pairs. + * + * @param tags the tags value to set. + * @return the ServerForCreate object itself. + */ + public ServerForCreate withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (sku() != null) { + sku().validate(); + } + if (properties() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property properties in model ServerForCreate")); + } else { + properties().validate(); + } + if (location() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException("Missing required property location in model ServerForCreate")); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerForUpdate.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerForUpdate.java deleted file mode 100644 index 05e42824b190..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerForUpdate.java +++ /dev/null @@ -1,276 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Fluent; -import com.azure.core.annotation.JsonFlatten; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.Map; - -/** Represents a server to be updated. */ -@JsonFlatten -@Fluent -public class ServerForUpdate { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerForUpdate.class); - - /* - * The location the resource resides in. - */ - @JsonProperty(value = "location") - private String location; - - /* - * The SKU (pricing tier) of the server. - */ - @JsonProperty(value = "sku") - private Sku sku; - - /* - * Application-specific metadata in the form of key-value pairs. - */ - @JsonProperty(value = "tags") - private Map tags; - - /* - * The password of the administrator login. - */ - @JsonProperty(value = "properties.administratorLoginPassword") - private String administratorLoginPassword; - - /* - * Storage properties of a server. - */ - @JsonProperty(value = "properties.storage") - private Storage storage; - - /* - * Backup properties of a server. - */ - @JsonProperty(value = "properties.backup") - private Backup backup; - - /* - * High availability properties of a server. - */ - @JsonProperty(value = "properties.highAvailability") - private HighAvailability highAvailability; - - /* - * Maintenance window properties of a server. - */ - @JsonProperty(value = "properties.maintenanceWindow") - private MaintenanceWindow maintenanceWindow; - - /* - * The mode to update a new PostgreSQL server. - */ - @JsonProperty(value = "properties.createMode") - private CreateModeForUpdate createMode; - - /** - * Get the location property: The location the resource resides in. - * - * @return the location value. - */ - public String location() { - return this.location; - } - - /** - * Set the location property: The location the resource resides in. - * - * @param location the location value to set. - * @return the ServerForUpdate object itself. - */ - public ServerForUpdate withLocation(String location) { - this.location = location; - return this; - } - - /** - * Get the sku property: The SKU (pricing tier) of the server. - * - * @return the sku value. - */ - public Sku sku() { - return this.sku; - } - - /** - * Set the sku property: The SKU (pricing tier) of the server. - * - * @param sku the sku value to set. - * @return the ServerForUpdate object itself. - */ - public ServerForUpdate withSku(Sku sku) { - this.sku = sku; - return this; - } - - /** - * Get the tags property: Application-specific metadata in the form of key-value pairs. - * - * @return the tags value. - */ - public Map tags() { - return this.tags; - } - - /** - * Set the tags property: Application-specific metadata in the form of key-value pairs. - * - * @param tags the tags value to set. - * @return the ServerForUpdate object itself. - */ - public ServerForUpdate withTags(Map tags) { - this.tags = tags; - return this; - } - - /** - * Get the administratorLoginPassword property: The password of the administrator login. - * - * @return the administratorLoginPassword value. - */ - public String administratorLoginPassword() { - return this.administratorLoginPassword; - } - - /** - * Set the administratorLoginPassword property: The password of the administrator login. - * - * @param administratorLoginPassword the administratorLoginPassword value to set. - * @return the ServerForUpdate object itself. - */ - public ServerForUpdate withAdministratorLoginPassword(String administratorLoginPassword) { - this.administratorLoginPassword = administratorLoginPassword; - return this; - } - - /** - * Get the storage property: Storage properties of a server. - * - * @return the storage value. - */ - public Storage storage() { - return this.storage; - } - - /** - * Set the storage property: Storage properties of a server. - * - * @param storage the storage value to set. - * @return the ServerForUpdate object itself. - */ - public ServerForUpdate withStorage(Storage storage) { - this.storage = storage; - return this; - } - - /** - * Get the backup property: Backup properties of a server. - * - * @return the backup value. - */ - public Backup backup() { - return this.backup; - } - - /** - * Set the backup property: Backup properties of a server. - * - * @param backup the backup value to set. - * @return the ServerForUpdate object itself. - */ - public ServerForUpdate withBackup(Backup backup) { - this.backup = backup; - return this; - } - - /** - * Get the highAvailability property: High availability properties of a server. - * - * @return the highAvailability value. - */ - public HighAvailability highAvailability() { - return this.highAvailability; - } - - /** - * Set the highAvailability property: High availability properties of a server. - * - * @param highAvailability the highAvailability value to set. - * @return the ServerForUpdate object itself. - */ - public ServerForUpdate withHighAvailability(HighAvailability highAvailability) { - this.highAvailability = highAvailability; - return this; - } - - /** - * Get the maintenanceWindow property: Maintenance window properties of a server. - * - * @return the maintenanceWindow value. - */ - public MaintenanceWindow maintenanceWindow() { - return this.maintenanceWindow; - } - - /** - * Set the maintenanceWindow property: Maintenance window properties of a server. - * - * @param maintenanceWindow the maintenanceWindow value to set. - * @return the ServerForUpdate object itself. - */ - public ServerForUpdate withMaintenanceWindow(MaintenanceWindow maintenanceWindow) { - this.maintenanceWindow = maintenanceWindow; - return this; - } - - /** - * Get the createMode property: The mode to update a new PostgreSQL server. - * - * @return the createMode value. - */ - public CreateModeForUpdate createMode() { - return this.createMode; - } - - /** - * Set the createMode property: The mode to update a new PostgreSQL server. - * - * @param createMode the createMode value to set. - * @return the ServerForUpdate object itself. - */ - public ServerForUpdate withCreateMode(CreateModeForUpdate createMode) { - this.createMode = createMode; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (sku() != null) { - sku().validate(); - } - if (storage() != null) { - storage().validate(); - } - if (backup() != null) { - backup().validate(); - } - if (highAvailability() != null) { - highAvailability().validate(); - } - if (maintenanceWindow() != null) { - maintenanceWindow().validate(); - } - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerHAState.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerHAState.java deleted file mode 100644 index 60270001c020..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerHAState.java +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for ServerHAState. */ -public final class ServerHAState extends ExpandableStringEnum { - /** Static value NotEnabled for ServerHAState. */ - public static final ServerHAState NOT_ENABLED = fromString("NotEnabled"); - - /** Static value CreatingStandby for ServerHAState. */ - public static final ServerHAState CREATING_STANDBY = fromString("CreatingStandby"); - - /** Static value ReplicatingData for ServerHAState. */ - public static final ServerHAState REPLICATING_DATA = fromString("ReplicatingData"); - - /** Static value FailingOver for ServerHAState. */ - public static final ServerHAState FAILING_OVER = fromString("FailingOver"); - - /** Static value Healthy for ServerHAState. */ - public static final ServerHAState HEALTHY = fromString("Healthy"); - - /** Static value RemovingStandby for ServerHAState. */ - public static final ServerHAState REMOVING_STANDBY = fromString("RemovingStandby"); - - /** - * Creates or finds a ServerHAState from its string representation. - * - * @param name a name to look for. - * @return the corresponding ServerHAState. - */ - @JsonCreator - public static ServerHAState fromString(String name) { - return fromString(name, ServerHAState.class); - } - - /** @return known ServerHAState values. */ - public static Collection values() { - return values(ServerHAState.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKey.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKey.java new file mode 100644 index 000000000000..63948698c93c --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKey.java @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerKeyInner; +import java.time.OffsetDateTime; + +/** 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 inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerKeyInner object. + * + * @return the inner object. + */ + ServerKeyInner innerModel(); + + /** The entirety of the ServerKey definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerKey definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerKey definition. */ + interface Blank extends WithParentResource { + } + /** 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. + */ + WithCreate withExistingServer(String serverName, String resourceGroupName); + } + /** + * The stage of the ServerKey definition which contains all the minimum required properties for the resource to + * be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate extends DefinitionStages.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. */ + 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. */ + interface WithUri { + /** + * Specifies the uri property: The URI of the key.. + * + * @param uri The URI of the key. + * @return the next definition stage. + */ + WithCreate withUri(String uri); + } + } + /** + * Begins update for the ServerKey resource. + * + * @return the stage of resource update. + */ + ServerKey.Update 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. */ + interface UpdateStages { + /** 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. */ + interface WithUri { + /** + * Specifies the uri property: The URI of the key.. + * + * @param uri The URI of the key. + * @return the next definition stage. + */ + Update withUri(String uri); + } + } + /** + * 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. + */ + ServerKey refresh(Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilitiesListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKeyListResult.java similarity index 79% rename from sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilitiesListResult.java rename to sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKeyListResult.java index 744b0c831cdc..526b2e78ff12 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/CapabilitiesListResult.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKeyListResult.java @@ -6,21 +6,21 @@ import com.azure.core.annotation.Immutable; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.CapabilityPropertiesInner; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerKeyInner; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; -/** location capability. */ +/** A list of PostgreSQL Server keys. */ @Immutable -public final class CapabilitiesListResult { - @JsonIgnore private final ClientLogger logger = new ClientLogger(CapabilitiesListResult.class); +public final class ServerKeyListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerKeyListResult.class); /* - * A list of supported capabilities. + * A list of PostgreSQL Server keys. */ @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) - private List value; + private List value; /* * Link to retrieve next page of results. @@ -29,11 +29,11 @@ public final class CapabilitiesListResult { private String nextLink; /** - * Get the value property: A list of supported capabilities. + * Get the value property: A list of PostgreSQL Server keys. * * @return the value value. */ - public List value() { + public List value() { return this.value; } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKeyType.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKeyType.java new file mode 100644 index 000000000000..e17db68236c2 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKeyType.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.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for ServerKeyType. */ +public final class ServerKeyType extends ExpandableStringEnum { + /** Static value AzureKeyVault for ServerKeyType. */ + public static final ServerKeyType AZURE_KEY_VAULT = fromString("AzureKeyVault"); + + /** + * 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. */ + public static Collection values() { + return values(ServerKeyType.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKeys.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKeys.java new file mode 100644 index 000000000000..3700691db21c --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerKeys.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of 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. + */ + 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. + */ + 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. + */ + ServerKey get(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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + Response getWithResponse(String resourceGroupName, String serverName, String keyName, Context context); + + /** + * 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. + */ + 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. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String serverName, String keyName, String resourceGroupName, Context context); + + /** + * 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a PostgreSQL Server key. + */ + ServerKey getById(String id); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException 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. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * 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. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerKey resource. + * + * @param name resource name. + * @return the first stage of the new ServerKey definition. + */ + ServerKey.DefinitionStages.Blank define(String name); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerListResult.java index cea9de78098c..51b5e79d009f 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerListResult.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerListResult.java @@ -17,19 +17,13 @@ public final class ServerListResult { @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerListResult.class); /* - * The list of flexible servers + * The list of servers */ @JsonProperty(value = "value") private List value; - /* - * The link used to get the next page of operations. - */ - @JsonProperty(value = "nextLink") - private String nextLink; - /** - * Get the value property: The list of flexible servers. + * Get the value property: The list of servers. * * @return the value value. */ @@ -38,7 +32,7 @@ public List value() { } /** - * Set the value property: The list of flexible servers. + * Set the value property: The list of servers. * * @param value the value value to set. * @return the ServerListResult object itself. @@ -48,26 +42,6 @@ public ServerListResult withValue(List value) { return this; } - /** - * Get the nextLink property: The link used to get the next page of operations. - * - * @return the nextLink value. - */ - public String nextLink() { - return this.nextLink; - } - - /** - * Set the nextLink property: The link used to get the next page of operations. - * - * @param nextLink the nextLink value to set. - * @return the ServerListResult object itself. - */ - public ServerListResult withNextLink(String nextLink) { - this.nextLink = nextLink; - return this; - } - /** * Validates the instance. * diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerParameters.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerParameters.java new file mode 100644 index 000000000000..bb1604ad126b --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerParameters.java @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ConfigurationListResultInner; + +/** Resource collection API of ServerParameters. */ +public interface ServerParameters { + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + ConfigurationListResult listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value); + + /** + * Update a list of configurations in a given server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param value The parameters for updating a list of server configuration. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of server configurations. + */ + ConfigurationListResult listUpdateConfigurations( + String resourceGroupName, String serverName, ConfigurationListResultInner value, Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPrivateEndpointConnection.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPrivateEndpointConnection.java new file mode 100644 index 000000000000..d3e95d4b0aa5 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPrivateEndpointConnection.java @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A private endpoint connection under a server. */ +@Immutable +public final class ServerPrivateEndpointConnection { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerPrivateEndpointConnection.class); + + /* + * Resource ID of the Private Endpoint Connection. + */ + @JsonProperty(value = "id", access = JsonProperty.Access.WRITE_ONLY) + private String id; + + /* + * Private endpoint connection properties + */ + @JsonProperty(value = "properties", access = JsonProperty.Access.WRITE_ONLY) + private ServerPrivateEndpointConnectionProperties properties; + + /** + * Get the id property: Resource ID of the Private Endpoint Connection. + * + * @return the id value. + */ + public String id() { + return this.id; + } + + /** + * Get the properties property: Private endpoint connection properties. + * + * @return the properties value. + */ + public ServerPrivateEndpointConnectionProperties properties() { + return this.properties; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (properties() != null) { + properties().validate(); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPrivateEndpointConnectionProperties.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPrivateEndpointConnectionProperties.java new file mode 100644 index 000000000000..0c5fdc071d31 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPrivateEndpointConnectionProperties.java @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Properties of a private endpoint connection. */ +@Fluent +public final class ServerPrivateEndpointConnectionProperties { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerPrivateEndpointConnectionProperties.class); + + /* + * Private endpoint which the connection belongs to. + */ + @JsonProperty(value = "privateEndpoint") + private PrivateEndpointProperty privateEndpoint; + + /* + * Connection state of the private endpoint connection. + */ + @JsonProperty(value = "privateLinkServiceConnectionState") + private ServerPrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState; + + /* + * State of the private endpoint connection. + */ + @JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY) + private PrivateEndpointProvisioningState provisioningState; + + /** + * Get the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @return the privateEndpoint value. + */ + public PrivateEndpointProperty privateEndpoint() { + return this.privateEndpoint; + } + + /** + * Set the privateEndpoint property: Private endpoint which the connection belongs to. + * + * @param privateEndpoint the privateEndpoint value to set. + * @return the ServerPrivateEndpointConnectionProperties object itself. + */ + public ServerPrivateEndpointConnectionProperties withPrivateEndpoint(PrivateEndpointProperty privateEndpoint) { + this.privateEndpoint = privateEndpoint; + return this; + } + + /** + * Get the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @return the privateLinkServiceConnectionState value. + */ + public ServerPrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState() { + return this.privateLinkServiceConnectionState; + } + + /** + * Set the privateLinkServiceConnectionState property: Connection state of the private endpoint connection. + * + * @param privateLinkServiceConnectionState the privateLinkServiceConnectionState value to set. + * @return the ServerPrivateEndpointConnectionProperties object itself. + */ + public ServerPrivateEndpointConnectionProperties withPrivateLinkServiceConnectionState( + ServerPrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState) { + this.privateLinkServiceConnectionState = privateLinkServiceConnectionState; + return this; + } + + /** + * Get the provisioningState property: State of the private endpoint connection. + * + * @return the provisioningState value. + */ + public PrivateEndpointProvisioningState provisioningState() { + return this.provisioningState; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (privateEndpoint() != null) { + privateEndpoint().validate(); + } + if (privateLinkServiceConnectionState() != null) { + privateLinkServiceConnectionState().validate(); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPrivateLinkServiceConnectionStateProperty.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPrivateLinkServiceConnectionStateProperty.java new file mode 100644 index 000000000000..a8dfe4b0ee44 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPrivateLinkServiceConnectionStateProperty.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The ServerPrivateLinkServiceConnectionStateProperty model. */ +@Fluent +public final class ServerPrivateLinkServiceConnectionStateProperty { + @JsonIgnore + private final ClientLogger logger = new ClientLogger(ServerPrivateLinkServiceConnectionStateProperty.class); + + /* + * The private link service connection status. + */ + @JsonProperty(value = "status", required = true) + private PrivateLinkServiceConnectionStateStatus status; + + /* + * The private link service connection description. + */ + @JsonProperty(value = "description", required = true) + private String description; + + /* + * The actions required for private link service connection. + */ + @JsonProperty(value = "actionsRequired", access = JsonProperty.Access.WRITE_ONLY) + private PrivateLinkServiceConnectionStateActionsRequire actionsRequired; + + /** + * Get the status property: The private link service connection status. + * + * @return the status value. + */ + public PrivateLinkServiceConnectionStateStatus status() { + return this.status; + } + + /** + * Set the status property: The private link service connection status. + * + * @param status the status value to set. + * @return the ServerPrivateLinkServiceConnectionStateProperty object itself. + */ + public ServerPrivateLinkServiceConnectionStateProperty withStatus(PrivateLinkServiceConnectionStateStatus status) { + this.status = status; + return this; + } + + /** + * Get the description property: The private link service connection description. + * + * @return the description value. + */ + public String description() { + return this.description; + } + + /** + * Set the description property: The private link service connection description. + * + * @param description the description value to set. + * @return the ServerPrivateLinkServiceConnectionStateProperty object itself. + */ + public ServerPrivateLinkServiceConnectionStateProperty withDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the actionsRequired property: The actions required for private link service connection. + * + * @return the actionsRequired value. + */ + public PrivateLinkServiceConnectionStateActionsRequire actionsRequired() { + return this.actionsRequired; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (status() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property status in model ServerPrivateLinkServiceConnectionStateProperty")); + } + if (description() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property description in model" + + " ServerPrivateLinkServiceConnectionStateProperty")); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForCreate.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForCreate.java new file mode 100644 index 000000000000..7520168a3899 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForCreate.java @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The properties used to create a new server. */ +@JsonTypeInfo( + use = JsonTypeInfo.Id.NAME, + include = JsonTypeInfo.As.PROPERTY, + property = "createMode", + defaultImpl = ServerPropertiesForCreate.class) +@JsonTypeName("ServerPropertiesForCreate") +@JsonSubTypes({ + @JsonSubTypes.Type(name = "Default", value = ServerPropertiesForDefaultCreate.class), + @JsonSubTypes.Type(name = "PointInTimeRestore", value = ServerPropertiesForRestore.class), + @JsonSubTypes.Type(name = "GeoRestore", value = ServerPropertiesForGeoRestore.class), + @JsonSubTypes.Type(name = "Replica", value = ServerPropertiesForReplica.class) +}) +@Fluent +public class ServerPropertiesForCreate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerPropertiesForCreate.class); + + /* + * Server version. + */ + @JsonProperty(value = "version") + private ServerVersion version; + + /* + * Enable ssl enforcement or not when connect to server. + */ + @JsonProperty(value = "sslEnforcement") + private SslEnforcementEnum sslEnforcement; + + /* + * 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' + */ + @JsonProperty(value = "publicNetworkAccess") + private PublicNetworkAccessEnum publicNetworkAccess; + + /* + * Storage profile of a server. + */ + @JsonProperty(value = "storageProfile") + private StorageProfile storageProfile; + + /** + * Get the version property: Server version. + * + * @return the version value. + */ + public ServerVersion version() { + return this.version; + } + + /** + * Set the version property: Server version. + * + * @param version the version value to set. + * @return the ServerPropertiesForCreate object itself. + */ + public ServerPropertiesForCreate withVersion(ServerVersion version) { + this.version = version; + return this; + } + + /** + * Get the sslEnforcement property: Enable ssl enforcement or not when connect to server. + * + * @return the sslEnforcement value. + */ + public SslEnforcementEnum sslEnforcement() { + return this.sslEnforcement; + } + + /** + * Set the sslEnforcement property: Enable ssl enforcement or not when connect to server. + * + * @param sslEnforcement the sslEnforcement value to set. + * @return the ServerPropertiesForCreate object itself. + */ + public ServerPropertiesForCreate withSslEnforcement(SslEnforcementEnum sslEnforcement) { + this.sslEnforcement = sslEnforcement; + return this; + } + + /** + * Get the minimalTlsVersion property: Enforce a minimal Tls version for the server. + * + * @return the minimalTlsVersion value. + */ + public MinimalTlsVersionEnum minimalTlsVersion() { + return this.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. + */ + public ServerPropertiesForCreate withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; + return this; + } + + /** + * Get the infrastructureEncryption property: Status showing whether the server enabled infrastructure encryption. + * + * @return the infrastructureEncryption value. + */ + public InfrastructureEncryption infrastructureEncryption() { + return this.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. + */ + public ServerPropertiesForCreate withInfrastructureEncryption(InfrastructureEncryption infrastructureEncryption) { + this.infrastructureEncryption = infrastructureEncryption; + return this; + } + + /** + * Get the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccessEnum publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the ServerPropertiesForCreate object itself. + */ + public ServerPropertiesForCreate withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the storageProfile property: Storage profile of a server. + * + * @return the storageProfile value. + */ + public StorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: Storage profile of a server. + * + * @param storageProfile the storageProfile value to set. + * @return the ServerPropertiesForCreate object itself. + */ + public ServerPropertiesForCreate withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (storageProfile() != null) { + storageProfile().validate(); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForDefaultCreate.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForDefaultCreate.java new file mode 100644 index 000000000000..9ec8acbd318f --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForDefaultCreate.java @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The properties used to create a new server. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "createMode") +@JsonTypeName("Default") +@Fluent +public final class ServerPropertiesForDefaultCreate extends ServerPropertiesForCreate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerPropertiesForDefaultCreate.class); + + /* + * The administrator's login name of a server. Can only be specified when + * the server is being created (and is required for creation). + */ + @JsonProperty(value = "administratorLogin", required = true) + private String administratorLogin; + + /* + * The password of the administrator login. + */ + @JsonProperty(value = "administratorLoginPassword", required = true) + private String administratorLoginPassword; + + /** + * Get the administratorLogin property: The administrator's login name of a server. Can only be specified when the + * server is being created (and is required for creation). + * + * @return the administratorLogin value. + */ + public String administratorLogin() { + return this.administratorLogin; + } + + /** + * Set the administratorLogin property: The administrator's login name of a server. Can only be specified when the + * server is being created (and is required for creation). + * + * @param administratorLogin the administratorLogin value to set. + * @return the ServerPropertiesForDefaultCreate object itself. + */ + public ServerPropertiesForDefaultCreate withAdministratorLogin(String administratorLogin) { + this.administratorLogin = administratorLogin; + return this; + } + + /** + * Get the administratorLoginPassword property: The password of the administrator login. + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: The password of the administrator login. + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ServerPropertiesForDefaultCreate object itself. + */ + public ServerPropertiesForDefaultCreate withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForDefaultCreate withVersion(ServerVersion version) { + super.withVersion(version); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForDefaultCreate withSslEnforcement(SslEnforcementEnum sslEnforcement) { + super.withSslEnforcement(sslEnforcement); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForDefaultCreate withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + super.withMinimalTlsVersion(minimalTlsVersion); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForDefaultCreate withInfrastructureEncryption( + InfrastructureEncryption infrastructureEncryption) { + super.withInfrastructureEncryption(infrastructureEncryption); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForDefaultCreate withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + super.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForDefaultCreate withStorageProfile(StorageProfile storageProfile) { + super.withStorageProfile(storageProfile); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (administratorLogin() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorLogin in model ServerPropertiesForDefaultCreate")); + } + if (administratorLoginPassword() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property administratorLoginPassword in model" + + " ServerPropertiesForDefaultCreate")); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForGeoRestore.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForGeoRestore.java new file mode 100644 index 000000000000..0e942952d27c --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForGeoRestore.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The properties used to create a new server by restoring to a different region from a geo replicated backup. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "createMode") +@JsonTypeName("GeoRestore") +@Fluent +public final class ServerPropertiesForGeoRestore extends ServerPropertiesForCreate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerPropertiesForGeoRestore.class); + + /* + * The source server id to restore from. + */ + @JsonProperty(value = "sourceServerId", required = true) + private String sourceServerId; + + /** + * Get the sourceServerId property: The source server id to restore from. + * + * @return the sourceServerId value. + */ + public String sourceServerId() { + return this.sourceServerId; + } + + /** + * Set the sourceServerId property: The source server id to restore from. + * + * @param sourceServerId the sourceServerId value to set. + * @return the ServerPropertiesForGeoRestore object itself. + */ + public ServerPropertiesForGeoRestore withSourceServerId(String sourceServerId) { + this.sourceServerId = sourceServerId; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForGeoRestore withVersion(ServerVersion version) { + super.withVersion(version); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForGeoRestore withSslEnforcement(SslEnforcementEnum sslEnforcement) { + super.withSslEnforcement(sslEnforcement); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForGeoRestore withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + super.withMinimalTlsVersion(minimalTlsVersion); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForGeoRestore withInfrastructureEncryption( + InfrastructureEncryption infrastructureEncryption) { + super.withInfrastructureEncryption(infrastructureEncryption); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForGeoRestore withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + super.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForGeoRestore withStorageProfile(StorageProfile storageProfile) { + super.withStorageProfile(storageProfile); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (sourceServerId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceServerId in model ServerPropertiesForGeoRestore")); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForReplica.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForReplica.java new file mode 100644 index 000000000000..051533fc6fe3 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForReplica.java @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; + +/** The properties to create a new replica. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "createMode") +@JsonTypeName("Replica") +@Fluent +public final class ServerPropertiesForReplica extends ServerPropertiesForCreate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerPropertiesForReplica.class); + + /* + * The master server id to create replica from. + */ + @JsonProperty(value = "sourceServerId", required = true) + private String sourceServerId; + + /** + * Get the sourceServerId property: The master server id to create replica from. + * + * @return the sourceServerId value. + */ + public String sourceServerId() { + return this.sourceServerId; + } + + /** + * Set the sourceServerId property: The master server id to create replica from. + * + * @param sourceServerId the sourceServerId value to set. + * @return the ServerPropertiesForReplica object itself. + */ + public ServerPropertiesForReplica withSourceServerId(String sourceServerId) { + this.sourceServerId = sourceServerId; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForReplica withVersion(ServerVersion version) { + super.withVersion(version); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForReplica withSslEnforcement(SslEnforcementEnum sslEnforcement) { + super.withSslEnforcement(sslEnforcement); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForReplica withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + super.withMinimalTlsVersion(minimalTlsVersion); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForReplica withInfrastructureEncryption(InfrastructureEncryption infrastructureEncryption) { + super.withInfrastructureEncryption(infrastructureEncryption); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForReplica withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + super.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForReplica withStorageProfile(StorageProfile storageProfile) { + super.withStorageProfile(storageProfile); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (sourceServerId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceServerId in model ServerPropertiesForReplica")); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForRestore.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForRestore.java new file mode 100644 index 000000000000..4c9bb789e765 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPropertiesForRestore.java @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonTypeName; +import java.time.OffsetDateTime; + +/** The properties used to create a new server by restoring from a backup. */ +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "createMode") +@JsonTypeName("PointInTimeRestore") +@Fluent +public final class ServerPropertiesForRestore extends ServerPropertiesForCreate { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerPropertiesForRestore.class); + + /* + * The source server id to restore from. + */ + @JsonProperty(value = "sourceServerId", required = true) + private String sourceServerId; + + /* + * Restore point creation time (ISO8601 format), specifying the time to + * restore from. + */ + @JsonProperty(value = "restorePointInTime", required = true) + private OffsetDateTime restorePointInTime; + + /** + * Get the sourceServerId property: The source server id to restore from. + * + * @return the sourceServerId value. + */ + public String sourceServerId() { + return this.sourceServerId; + } + + /** + * Set the sourceServerId property: The source server id to restore from. + * + * @param sourceServerId the sourceServerId value to set. + * @return the ServerPropertiesForRestore object itself. + */ + public ServerPropertiesForRestore withSourceServerId(String sourceServerId) { + this.sourceServerId = sourceServerId; + return this; + } + + /** + * Get the restorePointInTime property: Restore point creation time (ISO8601 format), specifying the time to restore + * from. + * + * @return the restorePointInTime value. + */ + public OffsetDateTime restorePointInTime() { + return this.restorePointInTime; + } + + /** + * Set the restorePointInTime property: Restore point creation time (ISO8601 format), specifying the time to restore + * from. + * + * @param restorePointInTime the restorePointInTime value to set. + * @return the ServerPropertiesForRestore object itself. + */ + public ServerPropertiesForRestore withRestorePointInTime(OffsetDateTime restorePointInTime) { + this.restorePointInTime = restorePointInTime; + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForRestore withVersion(ServerVersion version) { + super.withVersion(version); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForRestore withSslEnforcement(SslEnforcementEnum sslEnforcement) { + super.withSslEnforcement(sslEnforcement); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForRestore withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + super.withMinimalTlsVersion(minimalTlsVersion); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForRestore withInfrastructureEncryption(InfrastructureEncryption infrastructureEncryption) { + super.withInfrastructureEncryption(infrastructureEncryption); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForRestore withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + super.withPublicNetworkAccess(publicNetworkAccess); + return this; + } + + /** {@inheritDoc} */ + @Override + public ServerPropertiesForRestore withStorageProfile(StorageProfile storageProfile) { + super.withStorageProfile(storageProfile); + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + @Override + public void validate() { + super.validate(); + if (sourceServerId() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property sourceServerId in model ServerPropertiesForRestore")); + } + if (restorePointInTime() == null) { + throw logger + .logExceptionAsError( + new IllegalArgumentException( + "Missing required property restorePointInTime in model ServerPropertiesForRestore")); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPublicNetworkAccessState.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPublicNetworkAccessState.java deleted file mode 100644 index 242ff99a99f1..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerPublicNetworkAccessState.java +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.util.ExpandableStringEnum; -import com.fasterxml.jackson.annotation.JsonCreator; -import java.util.Collection; - -/** Defines values for ServerPublicNetworkAccessState. */ -public final class ServerPublicNetworkAccessState extends ExpandableStringEnum { - /** Static value Enabled for ServerPublicNetworkAccessState. */ - public static final ServerPublicNetworkAccessState ENABLED = fromString("Enabled"); - - /** Static value Disabled for ServerPublicNetworkAccessState. */ - public static final ServerPublicNetworkAccessState DISABLED = fromString("Disabled"); - - /** - * Creates or finds a ServerPublicNetworkAccessState from its string representation. - * - * @param name a name to look for. - * @return the corresponding ServerPublicNetworkAccessState. - */ - @JsonCreator - public static ServerPublicNetworkAccessState fromString(String name) { - return fromString(name, ServerPublicNetworkAccessState.class); - } - - /** @return known ServerPublicNetworkAccessState values. */ - public static Collection values() { - return values(ServerPublicNetworkAccessState.class); - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicies.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicies.java new file mode 100644 index 000000000000..a7110e82dd63 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicies.java @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of ServerSecurityAlertPolicies. */ +public interface ServerSecurityAlertPolicies { + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + ServerSecurityAlertPolicy get( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName); + + /** + * Get a server's security alert policy. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param securityAlertPolicyName The name of the security alert policy. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + Response getWithResponse( + String resourceGroupName, String serverName, SecurityAlertPolicyName securityAlertPolicyName, Context context); + + /** + * Get 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. + */ + 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. + */ + 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. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + ServerSecurityAlertPolicy getById(String id); + + /** + * Get a server's security alert policy. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a server's security alert policy. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new ServerSecurityAlertPolicy resource. + * + * @param name resource name. + * @return the first stage of the new ServerSecurityAlertPolicy definition. + */ + ServerSecurityAlertPolicy.DefinitionStages.Blank define(SecurityAlertPolicyName name); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicy.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicy.java new file mode 100644 index 000000000000..e86039f5c471 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicy.java @@ -0,0 +1,350 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerSecurityAlertPolicyInner; +import java.util.List; + +/** An immutable client-side representation of ServerSecurityAlertPolicy. */ +public interface ServerSecurityAlertPolicy { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the state property: Specifies the state of the policy, whether it is enabled or disabled. + * + * @return the state value. + */ + ServerSecurityAlertPolicyState state(); + + /** + * Gets the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values are: + * Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly. + * + * @return the disabledAlerts value. + */ + List disabledAlerts(); + + /** + * Gets the emailAddresses property: Specifies an array of e-mail addresses to which the alert is sent. + * + * @return the emailAddresses value. + */ + List emailAddresses(); + + /** + * Gets the emailAccountAdmins property: Specifies that the alert is sent to the account administrators. + * + * @return the emailAccountAdmins value. + */ + Boolean emailAccountAdmins(); + + /** + * Gets the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs. + * + * @return the storageEndpoint value. + */ + String storageEndpoint(); + + /** + * Gets the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection audit storage + * account. + * + * @return the storageAccountAccessKey value. + */ + String storageAccountAccessKey(); + + /** + * Gets the retentionDays property: Specifies the number of days to keep in the Threat Detection audit logs. + * + * @return the retentionDays value. + */ + Integer retentionDays(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerSecurityAlertPolicyInner + * object. + * + * @return the inner object. + */ + ServerSecurityAlertPolicyInner innerModel(); + + /** The entirety of the ServerSecurityAlertPolicy definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The ServerSecurityAlertPolicy definition stages. */ + interface DefinitionStages { + /** The first stage of the ServerSecurityAlertPolicy definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the ServerSecurityAlertPolicy definition which contains all the minimum required properties for + * the resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithState, + DefinitionStages.WithDisabledAlerts, + DefinitionStages.WithEmailAddresses, + DefinitionStages.WithEmailAccountAdmins, + DefinitionStages.WithStorageEndpoint, + DefinitionStages.WithStorageAccountAccessKey, + DefinitionStages.WithRetentionDays { + /** + * Executes the create request. + * + * @return the created resource. + */ + ServerSecurityAlertPolicy create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + ServerSecurityAlertPolicy create(Context context); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled. + * @return the next definition stage. + */ + WithCreate withState(ServerSecurityAlertPolicyState state); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly. + * @return the next definition stage. + */ + WithCreate withDisabledAlerts(List disabledAlerts); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + WithCreate withEmailAddresses(List emailAddresses); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + WithCreate withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + WithCreate withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + WithCreate withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerSecurityAlertPolicy definition allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + WithCreate withRetentionDays(Integer retentionDays); + } + } + /** + * Begins update for the ServerSecurityAlertPolicy resource. + * + * @return the stage of resource update. + */ + ServerSecurityAlertPolicy.Update update(); + + /** The template for ServerSecurityAlertPolicy update. */ + interface Update + extends UpdateStages.WithState, + UpdateStages.WithDisabledAlerts, + UpdateStages.WithEmailAddresses, + UpdateStages.WithEmailAccountAdmins, + UpdateStages.WithStorageEndpoint, + UpdateStages.WithStorageAccountAccessKey, + UpdateStages.WithRetentionDays { + /** + * Executes the update request. + * + * @return the updated resource. + */ + ServerSecurityAlertPolicy apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + ServerSecurityAlertPolicy apply(Context context); + } + /** The ServerSecurityAlertPolicy update stages. */ + interface UpdateStages { + /** The stage of the ServerSecurityAlertPolicy update allowing to specify state. */ + interface WithState { + /** + * Specifies the state property: Specifies the state of the policy, whether it is enabled or disabled.. + * + * @param state Specifies the state of the policy, whether it is enabled or disabled. + * @return the next definition stage. + */ + Update withState(ServerSecurityAlertPolicyState state); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify disabledAlerts. */ + interface WithDisabledAlerts { + /** + * Specifies the disabledAlerts property: Specifies an array of alerts that are disabled. Allowed values + * are: Sql_Injection, Sql_Injection_Vulnerability, Access_Anomaly. + * + * @param disabledAlerts Specifies an array of alerts that are disabled. Allowed values are: Sql_Injection, + * Sql_Injection_Vulnerability, Access_Anomaly. + * @return the next definition stage. + */ + Update withDisabledAlerts(List disabledAlerts); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify emailAddresses. */ + interface WithEmailAddresses { + /** + * Specifies the emailAddresses property: Specifies an array of e-mail addresses to which the alert is + * sent.. + * + * @param emailAddresses Specifies an array of e-mail addresses to which the alert is sent. + * @return the next definition stage. + */ + Update withEmailAddresses(List emailAddresses); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify emailAccountAdmins. */ + interface WithEmailAccountAdmins { + /** + * Specifies the emailAccountAdmins property: Specifies that the alert is sent to the account + * administrators.. + * + * @param emailAccountAdmins Specifies that the alert is sent to the account administrators. + * @return the next definition stage. + */ + Update withEmailAccountAdmins(Boolean emailAccountAdmins); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify storageEndpoint. */ + interface WithStorageEndpoint { + /** + * Specifies the storageEndpoint property: Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit logs.. + * + * @param storageEndpoint Specifies the blob storage endpoint (e.g. + * https://MyAccount.blob.core.windows.net). This blob storage will hold all Threat Detection audit + * logs. + * @return the next definition stage. + */ + Update withStorageEndpoint(String storageEndpoint); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify storageAccountAccessKey. */ + interface WithStorageAccountAccessKey { + /** + * Specifies the storageAccountAccessKey property: Specifies the identifier key of the Threat Detection + * audit storage account.. + * + * @param storageAccountAccessKey Specifies the identifier key of the Threat Detection audit storage + * account. + * @return the next definition stage. + */ + Update withStorageAccountAccessKey(String storageAccountAccessKey); + } + /** The stage of the ServerSecurityAlertPolicy update allowing to specify retentionDays. */ + interface WithRetentionDays { + /** + * Specifies the retentionDays property: Specifies the number of days to keep in the Threat Detection audit + * logs.. + * + * @param retentionDays Specifies the number of days to keep in the Threat Detection audit logs. + * @return the next definition stage. + */ + Update withRetentionDays(Integer retentionDays); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + ServerSecurityAlertPolicy refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + ServerSecurityAlertPolicy refresh(Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicyListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicyListResult.java new file mode 100644 index 000000000000..0782b102499c --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicyListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.ServerSecurityAlertPolicyInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of the server's security alert policies. */ +@Immutable +public final class ServerSecurityAlertPolicyListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerSecurityAlertPolicyListResult.class); + + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicyState.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicyState.java new file mode 100644 index 000000000000..42a4883c36a9 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerSecurityAlertPolicyState.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for ServerSecurityAlertPolicyState. */ +public enum ServerSecurityAlertPolicyState { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a ServerSecurityAlertPolicyState instance. */ + private final String value; + + ServerSecurityAlertPolicyState(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a ServerSecurityAlertPolicyState instance. + * + * @param value the serialized value to parse. + * @return the parsed ServerSecurityAlertPolicyState object, or null if unable to parse. + */ + @JsonCreator + public static ServerSecurityAlertPolicyState fromString(String value) { + ServerSecurityAlertPolicyState[] items = ServerSecurityAlertPolicyState.values(); + for (ServerSecurityAlertPolicyState item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerState.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerState.java index 4252c5056048..f7add7f5a43a 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerState.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerState.java @@ -19,17 +19,8 @@ public final class ServerState extends ExpandableStringEnum { /** Static value Disabled for ServerState. */ public static final ServerState DISABLED = fromString("Disabled"); - /** Static value Starting for ServerState. */ - public static final ServerState STARTING = fromString("Starting"); - - /** Static value Stopping for ServerState. */ - public static final ServerState STOPPING = fromString("Stopping"); - - /** Static value Stopped for ServerState. */ - public static final ServerState STOPPED = fromString("Stopped"); - - /** Static value Updating for ServerState. */ - public static final ServerState UPDATING = fromString("Updating"); + /** Static value Inaccessible for ServerState. */ + public static final ServerState INACCESSIBLE = fromString("Inaccessible"); /** * Creates or finds a ServerState from its string representation. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerUpdateParameters.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerUpdateParameters.java new file mode 100644 index 000000000000..4fc7a9b9295e --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerUpdateParameters.java @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.JsonFlatten; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Parameters allowed to update for a server. */ +@JsonFlatten +@Fluent +public class ServerUpdateParameters { + @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerUpdateParameters.class); + + /* + * The 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; + + /* + * Application-specific metadata in the form of key-value pairs. + */ + @JsonProperty(value = "tags") + private Map tags; + + /* + * Storage profile of a server. + */ + @JsonProperty(value = "properties.storageProfile") + private StorageProfile storageProfile; + + /* + * The password of the administrator login. + */ + @JsonProperty(value = "properties.administratorLoginPassword") + private String administratorLoginPassword; + + /* + * The version of a server. + */ + @JsonProperty(value = "properties.version") + private ServerVersion version; + + /* + * Enable ssl enforcement or not when connect to server. + */ + @JsonProperty(value = "properties.sslEnforcement") + private SslEnforcementEnum sslEnforcement; + + /* + * Enforce a minimal Tls version for the server. + */ + @JsonProperty(value = "properties.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' + */ + @JsonProperty(value = "properties.publicNetworkAccess") + private PublicNetworkAccessEnum publicNetworkAccess; + + /* + * The replication role of the server. + */ + @JsonProperty(value = "properties.replicationRole") + private String replicationRole; + + /** + * Get the identity property: The Azure Active Directory identity of the server. + * + * @return the identity value. + */ + public ResourceIdentity identity() { + return this.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. + */ + public ServerUpdateParameters withIdentity(ResourceIdentity identity) { + this.identity = identity; + return this; + } + + /** + * Get the sku property: The SKU (pricing tier) of the server. + * + * @return the sku value. + */ + public Sku sku() { + return this.sku; + } + + /** + * Set the sku property: The SKU (pricing tier) of the server. + * + * @param sku the sku value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withSku(Sku sku) { + this.sku = sku; + return this; + } + + /** + * Get the tags property: Application-specific metadata in the form of key-value pairs. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Application-specific metadata in the form of key-value pairs. + * + * @param tags the tags value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Get the storageProfile property: Storage profile of a server. + * + * @return the storageProfile value. + */ + public StorageProfile storageProfile() { + return this.storageProfile; + } + + /** + * Set the storageProfile property: Storage profile of a server. + * + * @param storageProfile the storageProfile value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withStorageProfile(StorageProfile storageProfile) { + this.storageProfile = storageProfile; + return this; + } + + /** + * Get the administratorLoginPassword property: The password of the administrator login. + * + * @return the administratorLoginPassword value. + */ + public String administratorLoginPassword() { + return this.administratorLoginPassword; + } + + /** + * Set the administratorLoginPassword property: The password of the administrator login. + * + * @param administratorLoginPassword the administratorLoginPassword value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withAdministratorLoginPassword(String administratorLoginPassword) { + this.administratorLoginPassword = administratorLoginPassword; + return this; + } + + /** + * Get the version property: The version of a server. + * + * @return the version value. + */ + public ServerVersion version() { + return this.version; + } + + /** + * Set the version property: The version of a server. + * + * @param version the version value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withVersion(ServerVersion version) { + this.version = version; + return this; + } + + /** + * Get the sslEnforcement property: Enable ssl enforcement or not when connect to server. + * + * @return the sslEnforcement value. + */ + public SslEnforcementEnum sslEnforcement() { + return this.sslEnforcement; + } + + /** + * Set the sslEnforcement property: Enable ssl enforcement or not when connect to server. + * + * @param sslEnforcement the sslEnforcement value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withSslEnforcement(SslEnforcementEnum sslEnforcement) { + this.sslEnforcement = sslEnforcement; + return this; + } + + /** + * Get the minimalTlsVersion property: Enforce a minimal Tls version for the server. + * + * @return the minimalTlsVersion value. + */ + public MinimalTlsVersionEnum minimalTlsVersion() { + return this.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. + */ + public ServerUpdateParameters withMinimalTlsVersion(MinimalTlsVersionEnum minimalTlsVersion) { + this.minimalTlsVersion = minimalTlsVersion; + return this; + } + + /** + * Get the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @return the publicNetworkAccess value. + */ + public PublicNetworkAccessEnum publicNetworkAccess() { + return this.publicNetworkAccess; + } + + /** + * Set the publicNetworkAccess property: Whether or not public network access is allowed for this server. Value is + * optional but if passed in, must be 'Enabled' or 'Disabled'. + * + * @param publicNetworkAccess the publicNetworkAccess value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withPublicNetworkAccess(PublicNetworkAccessEnum publicNetworkAccess) { + this.publicNetworkAccess = publicNetworkAccess; + return this; + } + + /** + * Get the replicationRole property: The replication role of the server. + * + * @return the replicationRole value. + */ + public String replicationRole() { + return this.replicationRole; + } + + /** + * Set the replicationRole property: The replication role of the server. + * + * @param replicationRole the replicationRole value to set. + * @return the ServerUpdateParameters object itself. + */ + public ServerUpdateParameters withReplicationRole(String replicationRole) { + this.replicationRole = replicationRole; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (identity() != null) { + identity().validate(); + } + if (sku() != null) { + sku().validate(); + } + if (storageProfile() != null) { + storageProfile().validate(); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersion.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersion.java index 898b4c14cb99..48b615162d67 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersion.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersion.java @@ -10,11 +10,20 @@ /** Defines values for ServerVersion. */ public final class ServerVersion extends ExpandableStringEnum { - /** Static value 13 for ServerVersion. */ - public static final ServerVersion ONE_THREE = fromString("13"); + /** Static value 9.5 for ServerVersion. */ + public static final ServerVersion NINE_FIVE = fromString("9.5"); - /** Static value 12 for ServerVersion. */ - public static final ServerVersion ONE_TWO = fromString("12"); + /** Static value 9.6 for ServerVersion. */ + public static final ServerVersion NINE_SIX = fromString("9.6"); + + /** Static value 10 for ServerVersion. */ + public static final ServerVersion ONE_ZERO = fromString("10"); + + /** Static value 10.0 for ServerVersion. */ + public static final ServerVersion ONE_ZERO_ZERO = fromString("10.0"); + + /** Static value 10.2 for ServerVersion. */ + public static final ServerVersion ONE_ZERO_TWO = fromString("10.2"); /** Static value 11 for ServerVersion. */ public static final ServerVersion ONE_ONE = fromString("11"); diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersionCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersionCapability.java deleted file mode 100644 index 802ba6973d7e..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/ServerVersionCapability.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** Server version capabilities. */ -@Immutable -public final class ServerVersionCapability { - @JsonIgnore private final ClientLogger logger = new ClientLogger(ServerVersionCapability.class); - - /* - * server version - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * The supportedVcores property. - */ - @JsonProperty(value = "supportedVcores", access = JsonProperty.Access.WRITE_ONLY) - private List supportedVcores; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** - * Get the name property: server version. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the supportedVcores property: The supportedVcores property. - * - * @return the supportedVcores value. - */ - public List supportedVcores() { - return this.supportedVcores; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (supportedVcores() != null) { - supportedVcores().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Servers.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Servers.java index 22598f8e0f67..e071aef96691 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Servers.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Servers.java @@ -101,18 +101,6 @@ public interface Servers { */ PagedIterable list(Context context); - /** - * Restarts a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param parameters The parameters for restarting 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. - */ - void restart(String resourceGroupName, String serverName, RestartParameter parameters); - /** * Restarts a server. * @@ -129,59 +117,12 @@ public interface Servers { * * @param resourceGroupName The name of the resource group. The name is case insensitive. * @param serverName The name of the server. - * @param parameters The parameters for restarting a server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void restart(String resourceGroupName, String serverName, RestartParameter parameters, Context context); - - /** - * Starts a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void start(String resourceGroupName, String serverName); - - /** - * Starts a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void start(String resourceGroupName, String serverName, Context context); - - /** - * Stops a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - */ - void stop(String resourceGroupName, String serverName); - - /** - * Stops a server. - * - * @param resourceGroupName The name of the resource group. The name is case insensitive. - * @param serverName The name of the server. * @param context The context to associate with this operation. * @throws IllegalArgumentException thrown if parameters fail the validation. * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. */ - void stop(String resourceGroupName, String serverName, Context context); + void restart(String resourceGroupName, String serverName, Context context); /** * Gets information about a server. diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Sku.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Sku.java index 9e050e0b8222..d41d82c795b2 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Sku.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/Sku.java @@ -9,26 +9,44 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonProperty; -/** Sku information related properties of a server. */ +/** Billing information related properties of a server. */ @Fluent public final class Sku { @JsonIgnore private final ClientLogger logger = new ClientLogger(Sku.class); /* - * The name of the sku, typically, tier + family + cores, e.g. - * Standard_D4s_v3. + * 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. Burstable. + * The tier of the particular SKU, e.g. Basic. */ - @JsonProperty(value = "tier", required = true) + @JsonProperty(value = "tier") private SkuTier tier; + /* + * The scale up/out capacity, representing server's compute units. + */ + @JsonProperty(value = "capacity") + private Integer capacity; + + /* + * The size code, to be interpreted by resource as appropriate. + */ + @JsonProperty(value = "size") + private String size; + + /* + * The family of hardware. + */ + @JsonProperty(value = "family") + private String family; + /** - * Get the name property: The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. + * 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. */ @@ -37,7 +55,7 @@ public String name() { } /** - * Set the name property: The name of the sku, typically, tier + family + cores, e.g. Standard_D4s_v3. + * 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. @@ -48,7 +66,7 @@ public Sku withName(String name) { } /** - * Get the tier property: The tier of the particular SKU, e.g. Burstable. + * Get the tier property: The tier of the particular SKU, e.g. Basic. * * @return the tier value. */ @@ -57,7 +75,7 @@ public SkuTier tier() { } /** - * Set the tier property: The tier of the particular SKU, e.g. Burstable. + * 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. @@ -67,6 +85,66 @@ public Sku withTier(SkuTier tier) { return this; } + /** + * Get the capacity property: The scale up/out capacity, representing server's compute units. + * + * @return the capacity value. + */ + public Integer capacity() { + return this.capacity; + } + + /** + * Set the capacity property: The scale up/out capacity, representing server's compute units. + * + * @param capacity the capacity value to set. + * @return the Sku object itself. + */ + public Sku withCapacity(Integer capacity) { + this.capacity = capacity; + return this; + } + + /** + * Get the size property: The size code, to be interpreted by resource as appropriate. + * + * @return the size value. + */ + public String size() { + return this.size; + } + + /** + * Set the size property: The size code, to be interpreted by resource as appropriate. + * + * @param size the size value to set. + * @return the Sku object itself. + */ + public Sku withSize(String size) { + this.size = size; + return this; + } + + /** + * Get the family property: The family of hardware. + * + * @return the family value. + */ + public String family() { + return this.family; + } + + /** + * Set the family property: The family of hardware. + * + * @param family the family value to set. + * @return the Sku object itself. + */ + public Sku withFamily(String family) { + this.family = family; + return this; + } + /** * Validates the instance. * @@ -77,9 +155,5 @@ public void validate() { throw logger .logExceptionAsError(new IllegalArgumentException("Missing required property name in model Sku")); } - if (tier() == null) { - throw logger - .logExceptionAsError(new IllegalArgumentException("Missing required property tier in model Sku")); - } } } diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SkuTier.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SkuTier.java index 0c6c06a9d03d..08ce0fb944f1 100644 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SkuTier.java +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SkuTier.java @@ -10,8 +10,8 @@ /** Defines values for SkuTier. */ public final class SkuTier extends ExpandableStringEnum { - /** Static value Burstable for SkuTier. */ - public static final SkuTier BURSTABLE = fromString("Burstable"); + /** Static value Basic for SkuTier. */ + public static final SkuTier BASIC = fromString("Basic"); /** Static value GeneralPurpose for SkuTier. */ public static final SkuTier GENERAL_PURPOSE = fromString("GeneralPurpose"); diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SslEnforcementEnum.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SslEnforcementEnum.java new file mode 100644 index 000000000000..2ddc1b8d7729 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/SslEnforcementEnum.java @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** Defines values for SslEnforcementEnum. */ +public enum SslEnforcementEnum { + /** Enum value Enabled. */ + ENABLED("Enabled"), + + /** Enum value Disabled. */ + DISABLED("Disabled"); + + /** The actual serialized value for a SslEnforcementEnum instance. */ + private final String value; + + SslEnforcementEnum(String value) { + this.value = value; + } + + /** + * Parses a serialized value to a SslEnforcementEnum instance. + * + * @param value the serialized value to parse. + * @return the parsed SslEnforcementEnum object, or null if unable to parse. + */ + @JsonCreator + public static SslEnforcementEnum fromString(String value) { + SslEnforcementEnum[] items = SslEnforcementEnum.values(); + for (SslEnforcementEnum item : items) { + if (item.toString().equalsIgnoreCase(value)) { + return item; + } + } + return null; + } + + @JsonValue + @Override + public String toString() { + return this.value; + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageAutogrow.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageAutogrow.java new file mode 100644 index 000000000000..f3932bf78b01 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageAutogrow.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for StorageAutogrow. */ +public final class StorageAutogrow extends ExpandableStringEnum { + /** Static value Enabled for StorageAutogrow. */ + public static final StorageAutogrow ENABLED = fromString("Enabled"); + + /** Static value Disabled for StorageAutogrow. */ + public static final StorageAutogrow DISABLED = fromString("Disabled"); + + /** + * Creates or finds a StorageAutogrow from its string representation. + * + * @param name a name to look for. + * @return the corresponding StorageAutogrow. + */ + @JsonCreator + public static StorageAutogrow fromString(String name) { + return fromString(name, StorageAutogrow.class); + } + + /** @return known StorageAutogrow values. */ + public static Collection values() { + return values(StorageAutogrow.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageEditionCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageEditionCapability.java deleted file mode 100644 index e0d7e05cfe7e..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageEditionCapability.java +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.annotation.Immutable; -import com.azure.core.util.logging.ClientLogger; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonProperty; -import java.util.List; - -/** storage edition capability. */ -@Immutable -public final class StorageEditionCapability { - @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageEditionCapability.class); - - /* - * storage edition name - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * The supportedStorageMB property. - */ - @JsonProperty(value = "supportedStorageMB", access = JsonProperty.Access.WRITE_ONLY) - private List supportedStorageMB; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** - * Get the name property: storage edition name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the supportedStorageMB property: The supportedStorageMB property. - * - * @return the supportedStorageMB value. - */ - public List supportedStorageMB() { - return this.supportedStorageMB; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - if (supportedStorageMB() != null) { - supportedStorageMB().forEach(e -> e.validate()); - } - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageMBCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageMBCapability.java deleted file mode 100644 index e6477236c257..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageMBCapability.java +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.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; - -/** storage size in MB capability. */ -@Immutable -public final class StorageMBCapability { - @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageMBCapability.class); - - /* - * storage MB name - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * supported IOPS - */ - @JsonProperty(value = "supportedIops", access = JsonProperty.Access.WRITE_ONLY) - private Long supportedIops; - - /* - * storage size in MB - */ - @JsonProperty(value = "storageSizeMB", access = JsonProperty.Access.WRITE_ONLY) - private Long storageSizeMB; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** - * Get the name property: storage MB name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the supportedIops property: supported IOPS. - * - * @return the supportedIops value. - */ - public Long supportedIops() { - return this.supportedIops; - } - - /** - * Get the storageSizeMB property: storage size in MB. - * - * @return the storageSizeMB value. - */ - public Long storageSizeMB() { - return this.storageSizeMB; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageProfile.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageProfile.java new file mode 100644 index 000000000000..fbf4229cc5be --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/StorageProfile.java @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Storage Profile properties of a server. */ +@Fluent +public final class StorageProfile { + @JsonIgnore private final ClientLogger logger = new ClientLogger(StorageProfile.class); + + /* + * Backup retention days for the server. + */ + @JsonProperty(value = "backupRetentionDays") + private Integer backupRetentionDays; + + /* + * Enable Geo-redundant or not for server backup. + */ + @JsonProperty(value = "geoRedundantBackup") + private GeoRedundantBackup geoRedundantBackup; + + /* + * Max storage allowed for a server. + */ + @JsonProperty(value = "storageMB") + private Integer storageMB; + + /* + * Enable Storage Auto Grow. + */ + @JsonProperty(value = "storageAutogrow") + private StorageAutogrow storageAutogrow; + + /** + * Get the backupRetentionDays property: Backup retention days for the server. + * + * @return the backupRetentionDays value. + */ + public Integer backupRetentionDays() { + return this.backupRetentionDays; + } + + /** + * Set the backupRetentionDays property: Backup retention days for the server. + * + * @param backupRetentionDays the backupRetentionDays value to set. + * @return the StorageProfile object itself. + */ + public StorageProfile withBackupRetentionDays(Integer backupRetentionDays) { + this.backupRetentionDays = backupRetentionDays; + return this; + } + + /** + * Get the geoRedundantBackup property: Enable Geo-redundant or not for server backup. + * + * @return the geoRedundantBackup value. + */ + public GeoRedundantBackup geoRedundantBackup() { + return this.geoRedundantBackup; + } + + /** + * Set the geoRedundantBackup property: Enable Geo-redundant or not for server backup. + * + * @param geoRedundantBackup the geoRedundantBackup value to set. + * @return the StorageProfile object itself. + */ + public StorageProfile withGeoRedundantBackup(GeoRedundantBackup geoRedundantBackup) { + this.geoRedundantBackup = geoRedundantBackup; + return this; + } + + /** + * Get the storageMB property: Max storage allowed for a server. + * + * @return the storageMB value. + */ + public Integer storageMB() { + return this.storageMB; + } + + /** + * Set the storageMB property: Max storage allowed for a server. + * + * @param storageMB the storageMB value to set. + * @return the StorageProfile object itself. + */ + public StorageProfile withStorageMB(Integer storageMB) { + this.storageMB = storageMB; + return this; + } + + /** + * Get the storageAutogrow property: Enable Storage Auto Grow. + * + * @return the storageAutogrow value. + */ + public StorageAutogrow storageAutogrow() { + return this.storageAutogrow; + } + + /** + * Set the storageAutogrow property: Enable Storage Auto Grow. + * + * @param storageAutogrow the storageAutogrow value to set. + * @return the StorageProfile object itself. + */ + public StorageProfile withStorageAutogrow(StorageAutogrow storageAutogrow) { + this.storageAutogrow = storageAutogrow; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/TagsObject.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/TagsObject.java new file mode 100644 index 000000000000..e3fb34a11def --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/TagsObject.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.util.logging.ClientLogger; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +/** Tags object for patch operations. */ +@Fluent +public final class TagsObject { + @JsonIgnore private final ClientLogger logger = new ClientLogger(TagsObject.class); + + /* + * Resource tags. + */ + @JsonProperty(value = "tags") + private Map tags; + + /** + * Get the tags property: Resource tags. + * + * @return the tags value. + */ + public Map tags() { + return this.tags; + } + + /** + * Set the tags property: Resource tags. + * + * @param tags the tags value to set. + * @return the TagsObject object itself. + */ + public TagsObject withTags(Map tags) { + this.tags = tags; + return this; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VcoreCapability.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VcoreCapability.java deleted file mode 100644 index fc1806c08cff..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VcoreCapability.java +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.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; - -/** Vcores capability. */ -@Immutable -public final class VcoreCapability { - @JsonIgnore private final ClientLogger logger = new ClientLogger(VcoreCapability.class); - - /* - * vCore name - */ - @JsonProperty(value = "name", access = JsonProperty.Access.WRITE_ONLY) - private String name; - - /* - * supported vCores - */ - @JsonProperty(value = "vCores", access = JsonProperty.Access.WRITE_ONLY) - private Long vCores; - - /* - * supported IOPS - */ - @JsonProperty(value = "supportedIops", access = JsonProperty.Access.WRITE_ONLY) - private Long supportedIops; - - /* - * supported memory per vCore in MB - */ - @JsonProperty(value = "supportedMemoryPerVcoreMB", access = JsonProperty.Access.WRITE_ONLY) - private Long supportedMemoryPerVcoreMB; - - /* - * The status - */ - @JsonProperty(value = "status", access = JsonProperty.Access.WRITE_ONLY) - private String status; - - /** - * Get the name property: vCore name. - * - * @return the name value. - */ - public String name() { - return this.name; - } - - /** - * Get the vCores property: supported vCores. - * - * @return the vCores value. - */ - public Long vCores() { - return this.vCores; - } - - /** - * Get the supportedIops property: supported IOPS. - * - * @return the supportedIops value. - */ - public Long supportedIops() { - return this.supportedIops; - } - - /** - * Get the supportedMemoryPerVcoreMB property: supported memory per vCore in MB. - * - * @return the supportedMemoryPerVcoreMB value. - */ - public Long supportedMemoryPerVcoreMB() { - return this.supportedMemoryPerVcoreMB; - } - - /** - * Get the status property: The status. - * - * @return the status value. - */ - public String status() { - return this.status; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRule.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRule.java new file mode 100644 index 000000000000..72356106d111 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRule.java @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.Context; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkRuleInner; + +/** An immutable client-side representation of VirtualNetworkRule. */ +public interface VirtualNetworkRule { + /** + * Gets the id property: Fully qualified resource Id for the resource. + * + * @return the id value. + */ + String id(); + + /** + * Gets the name property: The name of the resource. + * + * @return the name value. + */ + String name(); + + /** + * Gets the type property: The type of the resource. + * + * @return the type value. + */ + String type(); + + /** + * Gets the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet. + * + * @return the virtualNetworkSubnetId value. + */ + String virtualNetworkSubnetId(); + + /** + * Gets the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network has vnet + * service endpoint enabled. + * + * @return the ignoreMissingVnetServiceEndpoint value. + */ + Boolean ignoreMissingVnetServiceEndpoint(); + + /** + * Gets the state property: Virtual Network Rule State. + * + * @return the state value. + */ + VirtualNetworkRuleState state(); + + /** + * Gets the inner com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkRuleInner object. + * + * @return the inner object. + */ + VirtualNetworkRuleInner innerModel(); + + /** The entirety of the VirtualNetworkRule definition. */ + interface Definition + extends DefinitionStages.Blank, DefinitionStages.WithParentResource, DefinitionStages.WithCreate { + } + /** The VirtualNetworkRule definition stages. */ + interface DefinitionStages { + /** The first stage of the VirtualNetworkRule definition. */ + interface Blank extends WithParentResource { + } + /** The stage of the VirtualNetworkRule definition allowing to specify parent resource. */ + interface WithParentResource { + /** + * Specifies resourceGroupName, serverName. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @return the next definition stage. + */ + WithCreate withExistingServer(String resourceGroupName, String serverName); + } + /** + * The stage of the VirtualNetworkRule definition which contains all the minimum required properties for the + * resource to be created, but also allows for any other optional properties to be specified. + */ + interface WithCreate + extends DefinitionStages.WithVirtualNetworkSubnetId, DefinitionStages.WithIgnoreMissingVnetServiceEndpoint { + /** + * Executes the create request. + * + * @return the created resource. + */ + VirtualNetworkRule create(); + + /** + * Executes the create request. + * + * @param context The context to associate with this operation. + * @return the created resource. + */ + VirtualNetworkRule create(Context context); + } + /** The stage of the VirtualNetworkRule definition allowing to specify virtualNetworkSubnetId. */ + interface WithVirtualNetworkSubnetId { + /** + * Specifies the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet.. + * + * @param virtualNetworkSubnetId The ARM resource id of the virtual network subnet. + * @return the next definition stage. + */ + WithCreate withVirtualNetworkSubnetId(String virtualNetworkSubnetId); + } + /** The stage of the VirtualNetworkRule definition allowing to specify ignoreMissingVnetServiceEndpoint. */ + interface WithIgnoreMissingVnetServiceEndpoint { + /** + * Specifies the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network + * has vnet service endpoint enabled.. + * + * @param ignoreMissingVnetServiceEndpoint Create firewall rule before the virtual network has vnet service + * endpoint enabled. + * @return the next definition stage. + */ + WithCreate withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint); + } + } + /** + * Begins update for the VirtualNetworkRule resource. + * + * @return the stage of resource update. + */ + VirtualNetworkRule.Update update(); + + /** The template for VirtualNetworkRule update. */ + interface Update + extends UpdateStages.WithVirtualNetworkSubnetId, UpdateStages.WithIgnoreMissingVnetServiceEndpoint { + /** + * Executes the update request. + * + * @return the updated resource. + */ + VirtualNetworkRule apply(); + + /** + * Executes the update request. + * + * @param context The context to associate with this operation. + * @return the updated resource. + */ + VirtualNetworkRule apply(Context context); + } + /** The VirtualNetworkRule update stages. */ + interface UpdateStages { + /** The stage of the VirtualNetworkRule update allowing to specify virtualNetworkSubnetId. */ + interface WithVirtualNetworkSubnetId { + /** + * Specifies the virtualNetworkSubnetId property: The ARM resource id of the virtual network subnet.. + * + * @param virtualNetworkSubnetId The ARM resource id of the virtual network subnet. + * @return the next definition stage. + */ + Update withVirtualNetworkSubnetId(String virtualNetworkSubnetId); + } + /** The stage of the VirtualNetworkRule update allowing to specify ignoreMissingVnetServiceEndpoint. */ + interface WithIgnoreMissingVnetServiceEndpoint { + /** + * Specifies the ignoreMissingVnetServiceEndpoint property: Create firewall rule before the virtual network + * has vnet service endpoint enabled.. + * + * @param ignoreMissingVnetServiceEndpoint Create firewall rule before the virtual network has vnet service + * endpoint enabled. + * @return the next definition stage. + */ + Update withIgnoreMissingVnetServiceEndpoint(Boolean ignoreMissingVnetServiceEndpoint); + } + } + /** + * Refreshes the resource to sync with Azure. + * + * @return the refreshed resource. + */ + VirtualNetworkRule refresh(); + + /** + * Refreshes the resource to sync with Azure. + * + * @param context The context to associate with this operation. + * @return the refreshed resource. + */ + VirtualNetworkRule refresh(Context context); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRuleListResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRuleListResult.java new file mode 100644 index 000000000000..272ee6fbbb38 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRuleListResult.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.annotation.Immutable; +import com.azure.core.util.logging.ClientLogger; +import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkRuleInner; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** A list of virtual network rules. */ +@Immutable +public final class VirtualNetworkRuleListResult { + @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkRuleListResult.class); + + /* + * Array of results. + */ + @JsonProperty(value = "value", access = JsonProperty.Access.WRITE_ONLY) + private List value; + + /* + * Link to retrieve next page of results. + */ + @JsonProperty(value = "nextLink", access = JsonProperty.Access.WRITE_ONLY) + private String nextLink; + + /** + * Get the value property: Array of results. + * + * @return the value value. + */ + public List value() { + return this.value; + } + + /** + * Get the nextLink property: Link to retrieve next page of results. + * + * @return the nextLink value. + */ + public String nextLink() { + return this.nextLink; + } + + /** + * Validates the instance. + * + * @throws IllegalArgumentException thrown if the instance is not valid. + */ + public void validate() { + if (value() != null) { + value().forEach(e -> e.validate()); + } + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRuleState.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRuleState.java new file mode 100644 index 000000000000..9f6c6f994962 --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRuleState.java @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines values for VirtualNetworkRuleState. */ +public final class VirtualNetworkRuleState extends ExpandableStringEnum { + /** Static value Initializing for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState INITIALIZING = fromString("Initializing"); + + /** Static value InProgress for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState IN_PROGRESS = fromString("InProgress"); + + /** Static value Ready for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState READY = fromString("Ready"); + + /** Static value Deleting for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState DELETING = fromString("Deleting"); + + /** Static value Unknown for VirtualNetworkRuleState. */ + public static final VirtualNetworkRuleState UNKNOWN = fromString("Unknown"); + + /** + * Creates or finds a VirtualNetworkRuleState from its string representation. + * + * @param name a name to look for. + * @return the corresponding VirtualNetworkRuleState. + */ + @JsonCreator + public static VirtualNetworkRuleState fromString(String name) { + return fromString(name, VirtualNetworkRuleState.class); + } + + /** @return known VirtualNetworkRuleState values. */ + public static Collection values() { + return values(VirtualNetworkRuleState.class); + } +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRules.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRules.java new file mode 100644 index 000000000000..c988c7af07de --- /dev/null +++ b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkRules.java @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) AutoRest Code Generator. + +package com.azure.resourcemanager.postgresqlflexibleserver.models; + +import com.azure.core.http.rest.PagedIterable; +import com.azure.core.http.rest.Response; +import com.azure.core.util.Context; + +/** Resource collection API of VirtualNetworkRules. */ +public interface VirtualNetworkRules { + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + VirtualNetworkRule get(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Gets a virtual network rule. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + Response getWithResponse( + String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName); + + /** + * Deletes the virtual network rule with the given name. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param virtualNetworkRuleName The name of the virtual network rule. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void delete(String resourceGroupName, String serverName, String virtualNetworkRuleName, Context context); + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName); + + /** + * Gets a list of virtual network rules in a server. + * + * @param resourceGroupName The name of the resource group. The name is case insensitive. + * @param serverName The name of the server. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a list of virtual network rules in a server. + */ + PagedIterable listByServer(String resourceGroupName, String serverName, Context context); + + /** + * Gets a virtual network rule. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + VirtualNetworkRule getById(String id); + + /** + * Gets a virtual network rule. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + * @return a virtual network rule. + */ + Response getByIdWithResponse(String id, Context context); + + /** + * Deletes the virtual network rule with the given name. + * + * @param id the resource ID. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteById(String id); + + /** + * Deletes the virtual network rule with the given name. + * + * @param id the resource ID. + * @param context The context to associate with this operation. + * @throws IllegalArgumentException thrown if parameters fail the validation. + * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. + */ + void deleteByIdWithResponse(String id, Context context); + + /** + * Begins definition for a new VirtualNetworkRule resource. + * + * @param name resource name. + * @return the first stage of the new VirtualNetworkRule definition. + */ + VirtualNetworkRule.DefinitionStages.Blank define(String name); +} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkSubnetUsageParameter.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkSubnetUsageParameter.java deleted file mode 100644 index b76dce3dfce5..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkSubnetUsageParameter.java +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.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; - -/** Virtual network subnet usage parameter. */ -@Fluent -public final class VirtualNetworkSubnetUsageParameter { - @JsonIgnore private final ClientLogger logger = new ClientLogger(VirtualNetworkSubnetUsageParameter.class); - - /* - * Virtual network resource id. - */ - @JsonProperty(value = "virtualNetworkArmResourceId") - private String virtualNetworkArmResourceId; - - /** - * Get the virtualNetworkArmResourceId property: Virtual network resource id. - * - * @return the virtualNetworkArmResourceId value. - */ - public String virtualNetworkArmResourceId() { - return this.virtualNetworkArmResourceId; - } - - /** - * Set the virtualNetworkArmResourceId property: Virtual network resource id. - * - * @param virtualNetworkArmResourceId the virtualNetworkArmResourceId value to set. - * @return the VirtualNetworkSubnetUsageParameter object itself. - */ - public VirtualNetworkSubnetUsageParameter withVirtualNetworkArmResourceId(String virtualNetworkArmResourceId) { - this.virtualNetworkArmResourceId = virtualNetworkArmResourceId; - return this; - } - - /** - * Validates the instance. - * - * @throws IllegalArgumentException thrown if the instance is not valid. - */ - public void validate() { - } -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkSubnetUsageResult.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkSubnetUsageResult.java deleted file mode 100644 index 40385f3db533..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkSubnetUsageResult.java +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner; -import java.util.List; - -/** An immutable client-side representation of VirtualNetworkSubnetUsageResult. */ -public interface VirtualNetworkSubnetUsageResult { - /** - * Gets the delegatedSubnetsUsage property: The delegatedSubnetsUsage property. - * - * @return the delegatedSubnetsUsage value. - */ - List delegatedSubnetsUsage(); - - /** - * Gets the inner - * com.azure.resourcemanager.postgresqlflexibleserver.fluent.models.VirtualNetworkSubnetUsageResultInner object. - * - * @return the inner object. - */ - VirtualNetworkSubnetUsageResultInner innerModel(); -} diff --git a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkSubnetUsages.java b/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkSubnetUsages.java deleted file mode 100644 index 2a5dc25ac53b..000000000000 --- a/sdk/postgresqlflexibleserver/azure-resourcemanager-postgresqlflexibleserver/src/main/java/com/azure/resourcemanager/postgresqlflexibleserver/models/VirtualNetworkSubnetUsages.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. -// Code generated by Microsoft (R) AutoRest Code Generator. - -package com.azure.resourcemanager.postgresqlflexibleserver.models; - -import com.azure.core.http.rest.Response; -import com.azure.core.util.Context; - -/** Resource collection API of VirtualNetworkSubnetUsages. */ -public interface VirtualNetworkSubnetUsages { - /** - * Get virtual network subnet usage for a given vNet resource id. - * - * @param locationName The name of the location. - * @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 virtual network subnet usage for a given vNet resource id. - */ - VirtualNetworkSubnetUsageResult execute(String locationName, VirtualNetworkSubnetUsageParameter parameters); - - /** - * Get virtual network subnet usage for a given vNet resource id. - * - * @param locationName The name of the location. - * @param parameters The required parameters for creating or updating a server. - * @param context The context to associate with this operation. - * @throws IllegalArgumentException thrown if parameters fail the validation. - * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server. - * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. - * @return virtual network subnet usage for a given vNet resource id. - */ - Response executeWithResponse( - String locationName, VirtualNetworkSubnetUsageParameter parameters, Context context); -}