diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/CHANGELOG.md b/sdk/postgresql/azure-resourcemanager-postgresql/CHANGELOG.md
index 40f907f8b61c4..5ad522f6562b1 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/CHANGELOG.md
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/CHANGELOG.md
@@ -1,7 +1,8 @@
# Release History
-## 1.0.0-beta.2 (Unreleased)
+## 1.0.0-beta.1 (2021-02-25)
+- 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 (2020-12-16)
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/README.md b/sdk/postgresql/azure-resourcemanager-postgresql/README.md
index 08366e4ab53eb..7fc1dadaa6d9c 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/README.md
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/README.md
@@ -4,6 +4,20 @@ 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).
+## We'd love to hear your feedback
+
+We're always working on improving our products and the way we communicate with our users. So we'd love to learn what's working and how we can do better.
+
+If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together.
+
+Thank you in advance for your collaboration. We really appreciate your time!
+
+## Documentation
+
+Various documentation is available to help you get started
+
+- [API reference documentation][docs]
+
## Getting started
### Prerequisites
@@ -18,7 +32,7 @@ This package contains Microsoft Azure SDK for PostgreSql Management SDK. The Mic
com.azure.resourcemanager
azure-resourcemanager-postgresql
- 1.0.0-beta.1
+ 1.0.0-beta.2
```
[//]: # ({x-version-update-end})
@@ -75,6 +89,8 @@ For details on contributing to this repository, see the [contributing guide](htt
1. Create new Pull Request
+[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS
+[docs]: https://azure.github.io/azure-sdk-for-java/
[jdk]: https://docs.microsoft.com/java/azure/jdk/
[azure_subscription]: https://azure.microsoft.com/free/
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/pom.xml b/sdk/postgresql/azure-resourcemanager-postgresql/pom.xml
index f68b825ff9a87..27c7f570e12c0 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/pom.xml
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/pom.xml
@@ -41,6 +41,11 @@
+
+ com.azure
+ azure-core
+ 1.13.0
+
com.azure
azure-core-management
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/PostgreSqlManager.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/PostgreSqlManager.java
index 5f70f7628e91c..516aaaff3fed2 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/PostgreSqlManager.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/PostgreSqlManager.java
@@ -224,17 +224,31 @@ public PostgreSqlManager authenticate(TokenCredential credential, AzureProfile p
Objects.requireNonNull(credential, "'credential' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
+ StringBuilder userAgentBuilder = new StringBuilder();
+ userAgentBuilder
+ .append("azsdk-java")
+ .append("-")
+ .append("com.azure.resourcemanager.postgresql")
+ .append("/")
+ .append("1.0.0-beta.1");
+ if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
+ userAgentBuilder
+ .append(" (")
+ .append(Configuration.getGlobalConfiguration().get("java.version"))
+ .append("; ")
+ .append(Configuration.getGlobalConfiguration().get("os.name"))
+ .append("; ")
+ .append(Configuration.getGlobalConfiguration().get("os.version"))
+ .append("; auto-generated)");
+ } else {
+ userAgentBuilder.append(" (auto-generated)");
+ }
+
if (retryPolicy == null) {
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
}
List policies = new ArrayList<>();
- policies
- .add(
- new UserAgentPolicy(
- null,
- "com.azure.resourcemanager.postgresql",
- "1.0.0-beta.1",
- Configuration.getGlobalConfiguration()));
+ policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
policies.add(new RequestIdPolicy());
HttpPolicyProviders.addBeforeRetryPolicies(policies);
policies.add(retryPolicy);
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerSecurityAlertPoliciesClient.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerSecurityAlertPoliciesClient.java
index d09ad0ecc693d..bf08fe1260d3b 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerSecurityAlertPoliciesClient.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerSecurityAlertPoliciesClient.java
@@ -6,6 +6,7 @@
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;
@@ -125,4 +126,32 @@ ServerSecurityAlertPolicyInner createOrUpdate(
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/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationsImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationsImpl.java
index f037f5fe71856..68742ce56d72e 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationsImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationsImpl.java
@@ -54,13 +54,13 @@ public Response getWithResponse(
public PagedIterable listByServer(String resourceGroupName, String serverName) {
PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName);
- return inner.mapPage(inner1 -> new ConfigurationImpl(inner1, this.manager()));
+ 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 inner.mapPage(inner1 -> new ConfigurationImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new ConfigurationImpl(inner1, this.manager()));
}
public Configuration getById(String id) {
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabasesClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabasesClientImpl.java
index d1fe110f2339f..b2e9c05f26987 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabasesClientImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabasesClientImpl.java
@@ -84,7 +84,7 @@ Mono>> createOrUpdate(
@HeaderParam("Accept") String accept,
Context context);
- @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
+ @Headers({"Content-Type: application/json"})
@Delete(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL"
+ "/servers/{serverName}/databases/{databaseName}")
@@ -97,6 +97,7 @@ Mono>> delete(
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("serverName") String serverName,
@PathParam("databaseName") String databaseName,
+ @HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@@ -452,6 +453,7 @@ private Mono>> deleteWithResponseAsync(
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(
context ->
@@ -463,6 +465,7 @@ private Mono>> deleteWithResponseAsync(
resourceGroupName,
serverName,
databaseName,
+ accept,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
@@ -505,6 +508,7 @@ private Mono>> deleteWithResponseAsync(
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(
@@ -514,6 +518,7 @@ private Mono>> deleteWithResponseAsync(
resourceGroupName,
serverName,
databaseName,
+ accept,
context);
}
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabasesImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabasesImpl.java
index f58587c8d59eb..de390b20ed9fd 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabasesImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabasesImpl.java
@@ -62,12 +62,12 @@ public Response getWithResponse(
public PagedIterable listByServer(String resourceGroupName, String serverName) {
PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName);
- return inner.mapPage(inner1 -> new DatabaseImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager()));
}
public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) {
PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context);
- return inner.mapPage(inner1 -> new DatabaseImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager()));
}
public Database getById(String id) {
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRulesClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRulesClientImpl.java
index 0f69c96b993ad..e47eea7e8f903 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRulesClientImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRulesClientImpl.java
@@ -84,7 +84,7 @@ Mono>> createOrUpdate(
@HeaderParam("Accept") String accept,
Context context);
- @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
+ @Headers({"Content-Type: application/json"})
@Delete(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL"
+ "/servers/{serverName}/firewallRules/{firewallRuleName}")
@@ -97,6 +97,7 @@ Mono>> delete(
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("serverName") String serverName,
@PathParam("firewallRuleName") String firewallRuleName,
+ @HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@@ -475,6 +476,7 @@ private Mono>> deleteWithResponseAsync(
.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(
context ->
@@ -486,6 +488,7 @@ private Mono>> deleteWithResponseAsync(
resourceGroupName,
serverName,
firewallRuleName,
+ accept,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
@@ -529,6 +532,7 @@ private Mono>> deleteWithResponseAsync(
.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(
@@ -538,6 +542,7 @@ private Mono>> deleteWithResponseAsync(
resourceGroupName,
serverName,
firewallRuleName,
+ accept,
context);
}
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRulesImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRulesImpl.java
index d291555abb777..61912437995b1 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRulesImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRulesImpl.java
@@ -62,13 +62,13 @@ public Response getWithResponse(
public PagedIterable listByServer(String resourceGroupName, String serverName) {
PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName);
- return inner.mapPage(inner1 -> new FirewallRuleImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager()));
}
public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) {
PagedIterable inner =
this.serviceClient().listByServer(resourceGroupName, serverName, context);
- return inner.mapPage(inner1 -> new FirewallRuleImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager()));
}
public FirewallRule getById(String id) {
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LocationBasedPerformanceTiersImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LocationBasedPerformanceTiersImpl.java
index 166569787c1f6..6552ce32a1ce9 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LocationBasedPerformanceTiersImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LocationBasedPerformanceTiersImpl.java
@@ -29,12 +29,12 @@ public LocationBasedPerformanceTiersImpl(
public PagedIterable list(String locationName) {
PagedIterable inner = this.serviceClient().list(locationName);
- return inner.mapPage(inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager()));
+ 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 inner.mapPage(inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager()));
}
private LocationBasedPerformanceTiersClient serviceClient() {
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFilesImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFilesImpl.java
index 92367344b2207..24e91a99d5552 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFilesImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFilesImpl.java
@@ -28,12 +28,12 @@ public LogFilesImpl(LogFilesClient innerClient, PostgreSqlManager serviceManager
public PagedIterable listByServer(String resourceGroupName, String serverName) {
PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName);
- return inner.mapPage(inner1 -> new LogFileImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new LogFileImpl(inner1, this.manager()));
}
public PagedIterable listByServer(String resourceGroupName, String serverName, Context context) {
PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName, context);
- return inner.mapPage(inner1 -> new LogFileImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new LogFileImpl(inner1, this.manager()));
}
private LogFilesClient serviceClient() {
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PostgreSqlManagementClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PostgreSqlManagementClientImpl.java
index 8c0cd9737b869..68117cdfee4d1 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PostgreSqlManagementClientImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PostgreSqlManagementClientImpl.java
@@ -455,7 +455,7 @@ public Mono getLroFinalResultOrError(AsyncPollResponse,
if (managementError.getCode() == null || managementError.getMessage() == null) {
managementError = null;
}
- } catch (IOException ioe) {
+ } catch (IOException | RuntimeException ioe) {
logger.logThrowableAsWarning(ioe);
}
}
@@ -484,7 +484,7 @@ private static final class HttpResponseImpl extends HttpResponse {
super(null);
this.statusCode = statusCode;
this.httpHeaders = httpHeaders;
- this.responseBody = responseBody.getBytes(StandardCharsets.UTF_8);
+ this.responseBody = responseBody == null ? null : responseBody.getBytes(StandardCharsets.UTF_8);
}
public int getStatusCode() {
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionsImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionsImpl.java
index 1943ab0ff50df..7bd6696c395d6 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionsImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionsImpl.java
@@ -67,14 +67,14 @@ public void delete(
public PagedIterable listByServer(String resourceGroupName, String serverName) {
PagedIterable inner =
this.serviceClient().listByServer(resourceGroupName, serverName);
- return inner.mapPage(inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager()));
+ 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 inner.mapPage(inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new PrivateEndpointConnectionImpl(inner1, this.manager()));
}
public PrivateEndpointConnection getById(String id) {
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourcesImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourcesImpl.java
index 676d98785cf62..9665a90204d11 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourcesImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourcesImpl.java
@@ -31,14 +31,14 @@ public PrivateLinkResourcesImpl(PrivateLinkResourcesClient innerClient, PostgreS
public PagedIterable listByServer(String resourceGroupName, String serverName) {
PagedIterable inner =
this.serviceClient().listByServer(resourceGroupName, serverName);
- return inner.mapPage(inner1 -> new PrivateLinkResourceImpl(inner1, this.manager()));
+ 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 inner.mapPage(inner1 -> new PrivateLinkResourceImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new PrivateLinkResourceImpl(inner1, this.manager()));
}
public PrivateLinkResource get(String resourceGroupName, String serverName, String groupName) {
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ReplicasClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ReplicasClientImpl.java
index 5bc6c0d249d10..eee61bc6406bf 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ReplicasClientImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ReplicasClientImpl.java
@@ -61,7 +61,7 @@ private interface ReplicasService {
@Headers({"Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL"
- + "/servers/{serverName}/Replicas")
+ + "/servers/{serverName}/replicas")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> listByServer(
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ReplicasImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ReplicasImpl.java
index 56248259a5d01..333cdf194d087 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ReplicasImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ReplicasImpl.java
@@ -28,12 +28,12 @@ public ReplicasImpl(ReplicasClient innerClient, PostgreSqlManager serviceManager
public PagedIterable listByServer(String resourceGroupName, String serverName) {
PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName);
- return inner.mapPage(inner1 -> new ServerImpl(inner1, this.manager()));
+ 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 inner.mapPage(inner1 -> new ServerImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager()));
}
private ReplicasClient serviceClient() {
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorsClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorsClientImpl.java
index 5d2b9e090713a..4ac601a0f25f3 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorsClientImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorsClientImpl.java
@@ -71,7 +71,7 @@ private interface ServerAdministratorsService {
@Headers({"Content-Type: application/json"})
@Get(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL"
- + "/servers/{serverName}/Administrators/activeDirectory")
+ + "/servers/{serverName}/administrators/activeDirectory")
@ExpectedResponses({200})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono> get(
@@ -86,7 +86,7 @@ Mono> get(
@Headers({"Content-Type: application/json"})
@Put(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL"
- + "/servers/{serverName}/Administrators/activeDirectory")
+ + "/servers/{serverName}/administrators/activeDirectory")
@ExpectedResponses({200, 202})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> createOrUpdate(
@@ -102,7 +102,7 @@ Mono>> createOrUpdate(
@Headers({"Content-Type: application/json"})
@Delete(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL"
- + "/servers/{serverName}/Administrators/activeDirectory")
+ + "/servers/{serverName}/administrators/activeDirectory")
@ExpectedResponses({200, 202, 204})
@UnexpectedResponseExceptionType(ManagementException.class)
Mono>> delete(
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorsImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorsImpl.java
index ae2201a7b4f67..de86218db444c 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorsImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorsImpl.java
@@ -85,14 +85,14 @@ public void delete(String resourceGroupName, String serverName, Context context)
public PagedIterable list(String resourceGroupName, String serverName) {
PagedIterable inner =
this.serviceClient().list(resourceGroupName, serverName);
- return inner.mapPage(inner1 -> new ServerAdministratorResourceImpl(inner1, this.manager()));
+ 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 inner.mapPage(inner1 -> new ServerAdministratorResourceImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new ServerAdministratorResourceImpl(inner1, this.manager()));
}
private ServerAdministratorsClient serviceClient() {
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerBasedPerformanceTiersImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerBasedPerformanceTiersImpl.java
index 4d74c64e50b15..448d18a874aad 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerBasedPerformanceTiersImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerBasedPerformanceTiersImpl.java
@@ -29,13 +29,13 @@ public ServerBasedPerformanceTiersImpl(
public PagedIterable list(String resourceGroupName, String serverName) {
PagedIterable inner = this.serviceClient().list(resourceGroupName, serverName);
- return inner.mapPage(inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager()));
+ 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 inner.mapPage(inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager()));
}
private ServerBasedPerformanceTiersClient serviceClient() {
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeysImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeysImpl.java
index 881f996d6cdf1..df0d01c6cca47 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeysImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeysImpl.java
@@ -30,12 +30,12 @@ public ServerKeysImpl(ServerKeysClient innerClient, PostgreSqlManager serviceMan
public PagedIterable list(String resourceGroupName, String serverName) {
PagedIterable inner = this.serviceClient().list(resourceGroupName, serverName);
- return inner.mapPage(inner1 -> new ServerKeyImpl(inner1, this.manager()));
+ 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 inner.mapPage(inner1 -> new ServerKeyImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new ServerKeyImpl(inner1, this.manager()));
}
public ServerKey get(String resourceGroupName, String serverName, String keyName) {
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPoliciesClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPoliciesClientImpl.java
index 66b3ce0c70f57..b8d4545d5dd99 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPoliciesClientImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPoliciesClientImpl.java
@@ -18,6 +18,10 @@
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;
@@ -30,6 +34,7 @@
import com.azure.resourcemanager.postgresql.fluent.ServerSecurityAlertPoliciesClient;
import com.azure.resourcemanager.postgresql.fluent.models.ServerSecurityAlertPolicyInner;
import com.azure.resourcemanager.postgresql.models.SecurityAlertPolicyName;
+import com.azure.resourcemanager.postgresql.models.ServerSecurityAlertPolicyListResult;
import java.nio.ByteBuffer;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
@@ -96,6 +101,31 @@ Mono>> createOrUpdate(
@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);
}
/**
@@ -602,4 +632,258 @@ public ServerSecurityAlertPolicyInner createOrUpdate(
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))
+ .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
+ }
+
+ /**
+ * 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))
+ .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
+ }
+
+ /**
+ * Get the next page of items.
+ *
+ * @param nextLink The nextLink parameter.
+ * @param context The context to associate with this operation.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws ManagementException thrown if the request is rejected by server.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return a list of 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/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPoliciesImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPoliciesImpl.java
index 509574e16758d..a031503db9190 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPoliciesImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPoliciesImpl.java
@@ -4,6 +4,7 @@
package com.azure.resourcemanager.postgresql.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;
@@ -55,6 +56,19 @@ public Response getWithResponse(
}
}
+ 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) {
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServersClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServersClientImpl.java
index 5f189d1a48b3f..01028e018cef3 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServersClientImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServersClientImpl.java
@@ -102,7 +102,7 @@ Mono>> update(
@HeaderParam("Accept") String accept,
Context context);
- @Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
+ @Headers({"Content-Type: application/json"})
@Delete(
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL"
+ "/servers/{serverName}")
@@ -114,6 +114,7 @@ Mono>> delete(
@PathParam("subscriptionId") String subscriptionId,
@PathParam("resourceGroupName") String resourceGroupName,
@PathParam("serverName") String serverName,
+ @HeaderParam("Accept") String accept,
Context context);
@Headers({"Content-Type: application/json"})
@@ -739,6 +740,7 @@ private Mono>> deleteWithResponseAsync(String resource
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 ->
@@ -749,6 +751,7 @@ private Mono>> deleteWithResponseAsync(String resource
this.client.getSubscriptionId(),
resourceGroupName,
serverName,
+ accept,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
}
@@ -787,6 +790,7 @@ private Mono>> deleteWithResponseAsync(
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(
@@ -795,6 +799,7 @@ private Mono>> deleteWithResponseAsync(
this.client.getSubscriptionId(),
resourceGroupName,
serverName,
+ accept,
context);
}
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServersImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServersImpl.java
index 74d91208929fb..2720609f82731 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServersImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServersImpl.java
@@ -62,22 +62,22 @@ public Response getByResourceGroupWithResponse(
public PagedIterable listByResourceGroup(String resourceGroupName) {
PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName);
- return inner.mapPage(inner1 -> new ServerImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager()));
}
public PagedIterable listByResourceGroup(String resourceGroupName, Context context) {
PagedIterable inner = this.serviceClient().listByResourceGroup(resourceGroupName, context);
- return inner.mapPage(inner1 -> new ServerImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager()));
}
public PagedIterable list() {
PagedIterable inner = this.serviceClient().list();
- return inner.mapPage(inner1 -> new ServerImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager()));
}
public PagedIterable list(Context context) {
PagedIterable inner = this.serviceClient().list(context);
- return inner.mapPage(inner1 -> new ServerImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new ServerImpl(inner1, this.manager()));
}
public void restart(String resourceGroupName, String serverName) {
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/Utils.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/Utils.java
index b54d88a7ee104..82ad1895f4a2c 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/Utils.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/Utils.java
@@ -4,12 +4,20 @@
package com.azure.resourcemanager.postgresql.implementation;
+import com.azure.core.http.rest.PagedFlux;
+import com.azure.core.http.rest.PagedIterable;
+import com.azure.core.http.rest.PagedResponse;
+import com.azure.core.http.rest.PagedResponseBase;
import com.azure.core.util.CoreUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import reactor.core.publisher.Mono;
final class Utils {
static String getValueFromIdByName(String id, String name) {
@@ -64,4 +72,125 @@ static String getValueFromIdByParameterName(String id, String pathTemplate, Stri
}
return null;
}
+
+ static PagedIterable mapPage(PagedIterable pageIterable, Function mapper) {
+ return new PagedIterableImpl(pageIterable, mapper);
+ }
+
+ private static final class PagedIterableImpl extends PagedIterable {
+
+ private final PagedIterable pageIterable;
+ private final Function mapper;
+ private final Function, PagedResponse> pageMapper;
+
+ private PagedIterableImpl(PagedIterable pageIterable, Function mapper) {
+ super(new PagedFlux(Mono::empty));
+ this.pageIterable = pageIterable;
+ this.mapper = mapper;
+ this.pageMapper =
+ page ->
+ new PagedResponseBase(
+ page.getRequest(),
+ page.getStatusCode(),
+ page.getHeaders(),
+ page.getElements().stream().map(mapper).collect(Collectors.toList()),
+ page.getContinuationToken(),
+ null);
+ }
+
+ @Override
+ public Stream stream() {
+ return pageIterable.stream().map(mapper);
+ }
+
+ @Override
+ public Stream> streamByPage() {
+ return pageIterable.streamByPage().map(pageMapper);
+ }
+
+ @Override
+ public Stream> streamByPage(String continuationToken) {
+ return pageIterable.streamByPage(continuationToken).map(pageMapper);
+ }
+
+ @Override
+ public Stream> streamByPage(int preferredPageSize) {
+ return pageIterable.streamByPage(preferredPageSize).map(pageMapper);
+ }
+
+ @Override
+ public Stream> streamByPage(String continuationToken, int preferredPageSize) {
+ return pageIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper);
+ }
+
+ @Override
+ public Iterator iterator() {
+ return new IteratorImpl(pageIterable.iterator(), mapper);
+ }
+
+ @Override
+ public Iterable> iterableByPage() {
+ return new IterableImpl, PagedResponse>(pageIterable.iterableByPage(), pageMapper);
+ }
+
+ @Override
+ public Iterable> iterableByPage(String continuationToken) {
+ return new IterableImpl, PagedResponse>(
+ pageIterable.iterableByPage(continuationToken), pageMapper);
+ }
+
+ @Override
+ public Iterable> iterableByPage(int preferredPageSize) {
+ return new IterableImpl, PagedResponse>(
+ pageIterable.iterableByPage(preferredPageSize), pageMapper);
+ }
+
+ @Override
+ public Iterable> iterableByPage(String continuationToken, int preferredPageSize) {
+ return new IterableImpl, PagedResponse>(
+ pageIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper);
+ }
+ }
+
+ private static final class IteratorImpl implements Iterator {
+
+ private final Iterator iterator;
+ private final Function mapper;
+
+ private IteratorImpl(Iterator iterator, Function mapper) {
+ this.iterator = iterator;
+ this.mapper = mapper;
+ }
+
+ @Override
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ @Override
+ public S next() {
+ return mapper.apply(iterator.next());
+ }
+
+ @Override
+ public void remove() {
+ iterator.remove();
+ }
+ }
+
+ private static final class IterableImpl implements Iterable {
+
+ private final Iterable iterable;
+ private final Function mapper;
+
+ private IterableImpl(Iterable iterable, Function mapper) {
+ this.iterable = iterable;
+ this.mapper = mapper;
+ }
+
+ @Override
+ public Iterator iterator() {
+ return new IteratorImpl(iterable.iterator(), mapper);
+ }
+ }
}
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRulesImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRulesImpl.java
index 1dc9d53d48d78..c8953fd882229 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRulesImpl.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRulesImpl.java
@@ -62,14 +62,14 @@ public void delete(String resourceGroupName, String serverName, String virtualNe
public PagedIterable listByServer(String resourceGroupName, String serverName) {
PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName);
- return inner.mapPage(inner1 -> new VirtualNetworkRuleImpl(inner1, this.manager()));
+ 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 inner.mapPage(inner1 -> new VirtualNetworkRuleImpl(inner1, this.manager()));
+ return Utils.mapPage(inner, inner1 -> new VirtualNetworkRuleImpl(inner1, this.manager()));
}
public VirtualNetworkRule getById(String id) {
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicies.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicies.java
index c8ec9e9c5acab..9a7a855d5da6f 100644
--- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicies.java
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicies.java
@@ -4,6 +4,7 @@
package com.azure.resourcemanager.postgresql.models;
+import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;
@@ -38,6 +39,31 @@ ServerSecurityAlertPolicy get(
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.
*
diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicyListResult.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/models/ServerSecurityAlertPolicyListResult.java
new file mode 100644
index 0000000000000..7559cd335cdc8
--- /dev/null
+++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/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.postgresql.models;
+
+import com.azure.core.annotation.Immutable;
+import com.azure.core.util.logging.ClientLogger;
+import com.azure.resourcemanager.postgresql.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());
+ }
+ }
+}