diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/CHANGELOG.md b/sdk/postgresql/azure-resourcemanager-postgresql/CHANGELOG.md index 40f907f8b61c4..1bc01b0db8a11 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-04-05) +- 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 8da18073b97f3..afb4749b60440 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/pom.xml +++ b/sdk/postgresql/azure-resourcemanager-postgresql/pom.xml @@ -13,7 +13,7 @@ jar Microsoft Azure SDK for PostgreSql Management - 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 https://aka.ms/azsdk/java/mgmt + 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 @@ -41,6 +41,11 @@ + + com.azure + azure-core + 1.15.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/CheckNameAvailabilitiesClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/CheckNameAvailabilitiesClientImpl.java index 8fd5bae0d420e..4efbaad126eb7 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/CheckNameAvailabilitiesClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/CheckNameAvailabilitiesClientImpl.java @@ -114,7 +114,7 @@ private Mono> executeWithResponseAsync( nameAvailabilityRequest, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/CheckNameAvailabilitiesImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/CheckNameAvailabilitiesImpl.java index 793dbd62dac4d..e58be5bce57cb 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/CheckNameAvailabilitiesImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/CheckNameAvailabilitiesImpl.java @@ -8,7 +8,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.CheckNameAvailabilitiesClient; import com.azure.resourcemanager.postgresql.fluent.models.NameAvailabilityInner; import com.azure.resourcemanager.postgresql.models.CheckNameAvailabilities; @@ -21,9 +20,11 @@ public final class CheckNameAvailabilitiesImpl implements CheckNameAvailabilitie private final CheckNameAvailabilitiesClient innerClient; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - public CheckNameAvailabilitiesImpl(CheckNameAvailabilitiesClient innerClient, PostgreSqlManager serviceManager) { + public CheckNameAvailabilitiesImpl( + CheckNameAvailabilitiesClient innerClient, + com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -56,7 +57,7 @@ private CheckNameAvailabilitiesClient serviceClient() { return this.innerClient; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationImpl.java index d1b93d3a5030e..beeee8868b351 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationImpl.java @@ -5,14 +5,13 @@ package com.azure.resourcemanager.postgresql.implementation; import com.azure.core.util.Context; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationInner; import com.azure.resourcemanager.postgresql.models.Configuration; public final class ConfigurationImpl implements Configuration, Configuration.Definition, Configuration.Update { private ConfigurationInner innerObject; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; public String id() { return this.innerModel().id(); @@ -54,7 +53,7 @@ public ConfigurationInner innerModel() { return this.innerObject; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } @@ -88,7 +87,7 @@ public Configuration create(Context context) { return this; } - ConfigurationImpl(String name, PostgreSqlManager serviceManager) { + ConfigurationImpl(String name, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = new ConfigurationInner(); this.serviceManager = serviceManager; this.configurationName = name; @@ -116,7 +115,8 @@ public Configuration apply(Context context) { return this; } - ConfigurationImpl(ConfigurationInner innerObject, PostgreSqlManager serviceManager) { + ConfigurationImpl( + ConfigurationInner innerObject, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationListResultImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationListResultImpl.java index daec32da28fd8..611e72323e0cb 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationListResultImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationListResultImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.postgresql.implementation; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationInner; import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationListResultInner; import com.azure.resourcemanager.postgresql.models.Configuration; @@ -16,9 +15,11 @@ public final class ConfigurationListResultImpl implements ConfigurationListResult { private ConfigurationListResultInner innerObject; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - ConfigurationListResultImpl(ConfigurationListResultInner innerObject, PostgreSqlManager serviceManager) { + ConfigurationListResultImpl( + ConfigurationListResultInner innerObject, + com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -41,7 +42,7 @@ public ConfigurationListResultInner innerModel() { return this.innerObject; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationsClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationsClientImpl.java index a9afb07097bc8..ed144ca55b0e2 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationsClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationsClientImpl.java @@ -174,7 +174,7 @@ private Mono>> createOrUpdateWithResponseAsync( parameters, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -473,7 +473,7 @@ private Mono> getWithResponseAsync( configurationName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -637,7 +637,7 @@ private Mono> listByServerSinglePageAsync( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** 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..d82df707d45ca 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 @@ -9,7 +9,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.ConfigurationsClient; import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationInner; import com.azure.resourcemanager.postgresql.models.Configuration; @@ -21,9 +20,10 @@ public final class ConfigurationsImpl implements Configurations { private final ConfigurationsClient innerClient; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - public ConfigurationsImpl(ConfigurationsClient innerClient, PostgreSqlManager serviceManager) { + public ConfigurationsImpl( + ConfigurationsClient innerClient, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -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) { @@ -121,7 +121,7 @@ private ConfigurationsClient serviceClient() { return this.innerClient; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabaseImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabaseImpl.java index fbe3a63e67f80..eb018f74a97ed 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabaseImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabaseImpl.java @@ -5,14 +5,13 @@ package com.azure.resourcemanager.postgresql.implementation; import com.azure.core.util.Context; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.models.DatabaseInner; import com.azure.resourcemanager.postgresql.models.Database; public final class DatabaseImpl implements Database, Database.Definition, Database.Update { private DatabaseInner innerObject; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; public String id() { return this.innerModel().id(); @@ -38,7 +37,7 @@ public DatabaseInner innerModel() { return this.innerObject; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } @@ -72,7 +71,7 @@ public Database create(Context context) { return this; } - DatabaseImpl(String name, PostgreSqlManager serviceManager) { + DatabaseImpl(String name, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = new DatabaseInner(); this.serviceManager = serviceManager; this.databaseName = name; @@ -100,7 +99,7 @@ public Database apply(Context context) { return this; } - DatabaseImpl(DatabaseInner innerObject, PostgreSqlManager serviceManager) { + DatabaseImpl(DatabaseInner innerObject, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); 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..f6df68301f095 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"}) @@ -189,7 +190,7 @@ private Mono>> createOrUpdateWithResponseAsync( parameters, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -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,8 +465,9 @@ private Mono>> deleteWithResponseAsync( resourceGroupName, serverName, databaseName, + accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -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); } @@ -714,7 +719,7 @@ private Mono> getWithResponseAsync( databaseName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -877,7 +882,7 @@ private Mono> listByServerSinglePageAsync( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** 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..1e56186f9cbf2 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 @@ -9,7 +9,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.DatabasesClient; import com.azure.resourcemanager.postgresql.fluent.models.DatabaseInner; import com.azure.resourcemanager.postgresql.models.Database; @@ -21,9 +20,10 @@ public final class DatabasesImpl implements Databases { private final DatabasesClient innerClient; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - public DatabasesImpl(DatabasesClient innerClient, PostgreSqlManager serviceManager) { + public DatabasesImpl( + DatabasesClient innerClient, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -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) { @@ -178,7 +178,7 @@ private DatabasesClient serviceClient() { return this.innerClient; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRuleImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRuleImpl.java index e65674a31660f..7f600a9cbc374 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRuleImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRuleImpl.java @@ -5,14 +5,13 @@ package com.azure.resourcemanager.postgresql.implementation; import com.azure.core.util.Context; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.models.FirewallRuleInner; import com.azure.resourcemanager.postgresql.models.FirewallRule; public final class FirewallRuleImpl implements FirewallRule, FirewallRule.Definition, FirewallRule.Update { private FirewallRuleInner innerObject; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; public String id() { return this.innerModel().id(); @@ -38,7 +37,7 @@ public FirewallRuleInner innerModel() { return this.innerObject; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } @@ -72,7 +71,7 @@ public FirewallRule create(Context context) { return this; } - FirewallRuleImpl(String name, PostgreSqlManager serviceManager) { + FirewallRuleImpl(String name, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = new FirewallRuleInner(); this.serviceManager = serviceManager; this.firewallRuleName = name; @@ -100,7 +99,8 @@ public FirewallRule apply(Context context) { return this; } - FirewallRuleImpl(FirewallRuleInner innerObject, PostgreSqlManager serviceManager) { + FirewallRuleImpl( + FirewallRuleInner innerObject, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); 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..a416ae07c627e 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"}) @@ -190,7 +191,7 @@ private Mono>> createOrUpdateWithResponseAsync( parameters, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -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,8 +488,9 @@ private Mono>> deleteWithResponseAsync( resourceGroupName, serverName, firewallRuleName, + accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -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); } @@ -741,7 +746,7 @@ private Mono> getWithResponseAsync( firewallRuleName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -905,7 +910,7 @@ private Mono> listByServerSinglePageAsync( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** 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..121bd5895a156 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 @@ -9,7 +9,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.FirewallRulesClient; import com.azure.resourcemanager.postgresql.fluent.models.FirewallRuleInner; import com.azure.resourcemanager.postgresql.models.FirewallRule; @@ -21,9 +20,10 @@ public final class FirewallRulesImpl implements FirewallRules { private final FirewallRulesClient innerClient; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - public FirewallRulesImpl(FirewallRulesClient innerClient, PostgreSqlManager serviceManager) { + public FirewallRulesImpl( + FirewallRulesClient innerClient, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -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) { @@ -179,7 +179,7 @@ private FirewallRulesClient serviceClient() { return this.innerClient; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LocationBasedPerformanceTiersClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LocationBasedPerformanceTiersClientImpl.java index 4de41b30ae1f8..c98b9cd8fe705 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LocationBasedPerformanceTiersClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LocationBasedPerformanceTiersClientImpl.java @@ -121,7 +121,7 @@ private Mono> listSinglePageAsync( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** 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..6f6ce118d31e7 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 @@ -7,7 +7,6 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.LocationBasedPerformanceTiersClient; import com.azure.resourcemanager.postgresql.fluent.models.PerformanceTierPropertiesInner; import com.azure.resourcemanager.postgresql.models.LocationBasedPerformanceTiers; @@ -19,29 +18,30 @@ public final class LocationBasedPerformanceTiersImpl implements LocationBasedPer private final LocationBasedPerformanceTiersClient innerClient; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; public LocationBasedPerformanceTiersImpl( - LocationBasedPerformanceTiersClient innerClient, PostgreSqlManager serviceManager) { + LocationBasedPerformanceTiersClient innerClient, + com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable list(String locationName) { PagedIterable inner = this.serviceClient().list(locationName); - return inner.mapPage(inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager())); + 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() { return this.innerClient; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFileImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFileImpl.java index 66641d96dc2f6..870d9d8a787a5 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFileImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFileImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.postgresql.implementation; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.models.LogFileInner; import com.azure.resourcemanager.postgresql.models.LogFile; import java.time.OffsetDateTime; @@ -12,9 +11,9 @@ public final class LogFileImpl implements LogFile { private LogFileInner innerObject; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - LogFileImpl(LogFileInner innerObject, PostgreSqlManager serviceManager) { + LogFileImpl(LogFileInner innerObject, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -55,7 +54,7 @@ public LogFileInner innerModel() { return this.innerObject; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFilesClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFilesClientImpl.java index 1fc742e13af21..c5921cda4c0c9 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFilesClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/LogFilesClientImpl.java @@ -123,7 +123,7 @@ private Mono> listByServerSinglePageAsync(String res res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** 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..48498ef6ed3be 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 @@ -7,7 +7,6 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.LogFilesClient; import com.azure.resourcemanager.postgresql.fluent.models.LogFileInner; import com.azure.resourcemanager.postgresql.models.LogFile; @@ -19,28 +18,29 @@ public final class LogFilesImpl implements LogFiles { private final LogFilesClient innerClient; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - public LogFilesImpl(LogFilesClient innerClient, PostgreSqlManager serviceManager) { + public LogFilesImpl( + LogFilesClient innerClient, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable listByServer(String resourceGroupName, String serverName) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); - return inner.mapPage(inner1 -> new LogFileImpl(inner1, this.manager())); + 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() { return this.innerClient; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/NameAvailabilityImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/NameAvailabilityImpl.java index 59471afdf4ce8..525c113c829e2 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/NameAvailabilityImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/NameAvailabilityImpl.java @@ -4,16 +4,16 @@ package com.azure.resourcemanager.postgresql.implementation; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.models.NameAvailabilityInner; import com.azure.resourcemanager.postgresql.models.NameAvailability; public final class NameAvailabilityImpl implements NameAvailability { private NameAvailabilityInner innerObject; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - NameAvailabilityImpl(NameAvailabilityInner innerObject, PostgreSqlManager serviceManager) { + NameAvailabilityImpl( + NameAvailabilityInner innerObject, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -34,7 +34,7 @@ public NameAvailabilityInner innerModel() { return this.innerObject; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationListResultImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationListResultImpl.java index 1cfba00f09d6a..3d57222d752d6 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationListResultImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationListResultImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.postgresql.implementation; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.models.OperationListResultInner; import com.azure.resourcemanager.postgresql.models.Operation; import com.azure.resourcemanager.postgresql.models.OperationListResult; @@ -14,9 +13,10 @@ public final class OperationListResultImpl implements OperationListResult { private OperationListResultInner innerObject; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - OperationListResultImpl(OperationListResultInner innerObject, PostgreSqlManager serviceManager) { + OperationListResultImpl( + OperationListResultInner innerObject, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -34,7 +34,7 @@ public OperationListResultInner innerModel() { return this.innerObject; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationsClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationsClientImpl.java index 14b25f275fc2a..4693fb7c2755a 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationsClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationsClientImpl.java @@ -83,7 +83,7 @@ private Mono> listWithResponseAsync() { final String accept = "application/json"; return FluxUtil .withContext(context -> service.list(this.client.getEndpoint(), apiVersion, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationsImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationsImpl.java index 55fc9f02e837c..25571ecc8fc7b 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationsImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/OperationsImpl.java @@ -8,7 +8,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.OperationsClient; import com.azure.resourcemanager.postgresql.fluent.models.OperationListResultInner; import com.azure.resourcemanager.postgresql.models.OperationListResult; @@ -20,9 +19,10 @@ public final class OperationsImpl implements Operations { private final OperationsClient innerClient; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - public OperationsImpl(OperationsClient innerClient, PostgreSqlManager serviceManager) { + public OperationsImpl( + OperationsClient innerClient, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -53,7 +53,7 @@ private OperationsClient serviceClient() { return this.innerClient; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PerformanceTierPropertiesImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PerformanceTierPropertiesImpl.java index 74224b700f8a6..2abfca28305d8 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PerformanceTierPropertiesImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PerformanceTierPropertiesImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.postgresql.implementation; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.models.PerformanceTierPropertiesInner; import com.azure.resourcemanager.postgresql.models.PerformanceTierProperties; import com.azure.resourcemanager.postgresql.models.PerformanceTierServiceLevelObjectives; @@ -14,9 +13,11 @@ public final class PerformanceTierPropertiesImpl implements PerformanceTierProperties { private PerformanceTierPropertiesInner innerObject; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - PerformanceTierPropertiesImpl(PerformanceTierPropertiesInner innerObject, PostgreSqlManager serviceManager) { + PerformanceTierPropertiesImpl( + PerformanceTierPropertiesInner innerObject, + com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -62,7 +63,7 @@ public PerformanceTierPropertiesInner innerModel() { return this.innerObject; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } } 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/PrivateEndpointConnectionImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionImpl.java index 9c08c33606b81..dc821ad3f8f62 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionImpl.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.postgresql.implementation; import com.azure.core.util.Context; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.models.PrivateEndpointConnectionInner; import com.azure.resourcemanager.postgresql.models.PrivateEndpointConnection; import com.azure.resourcemanager.postgresql.models.PrivateEndpointProperty; @@ -17,7 +16,7 @@ public final class PrivateEndpointConnectionImpl implements PrivateEndpointConnection, PrivateEndpointConnection.Definition, PrivateEndpointConnection.Update { private PrivateEndpointConnectionInner innerObject; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; public String id() { return this.innerModel().id(); @@ -47,7 +46,7 @@ public PrivateEndpointConnectionInner innerModel() { return this.innerObject; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } @@ -85,7 +84,7 @@ public PrivateEndpointConnection create(Context context) { return this; } - PrivateEndpointConnectionImpl(String name, PostgreSqlManager serviceManager) { + PrivateEndpointConnectionImpl(String name, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = new PrivateEndpointConnectionInner(); this.serviceManager = serviceManager; this.privateEndpointConnectionName = name; @@ -115,7 +114,9 @@ public PrivateEndpointConnection apply(Context context) { return this; } - PrivateEndpointConnectionImpl(PrivateEndpointConnectionInner innerObject, PostgreSqlManager serviceManager) { + PrivateEndpointConnectionImpl( + PrivateEndpointConnectionInner innerObject, + com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionsClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionsClientImpl.java index 0b7c46e090a01..b9e543b6f5392 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionsClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateEndpointConnectionsClientImpl.java @@ -217,7 +217,7 @@ private Mono> getWithResponseAsync( apiVersion, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -399,7 +399,7 @@ private Mono>> createOrUpdateWithResponseAsync( parameters, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -729,7 +729,7 @@ private Mono>> deleteWithResponseAsync( apiVersion, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -997,7 +997,7 @@ private Mono>> updateTagsWithResponseAsync( parameters, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1312,7 +1312,7 @@ private Mono> listByServerSinglePa res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1471,7 +1471,7 @@ private Mono> listByServerNextSing res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** 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..a0487b937fdea 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 @@ -9,7 +9,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.PrivateEndpointConnectionsClient; import com.azure.resourcemanager.postgresql.fluent.models.PrivateEndpointConnectionInner; import com.azure.resourcemanager.postgresql.models.PrivateEndpointConnection; @@ -21,10 +20,11 @@ public final class PrivateEndpointConnectionsImpl implements PrivateEndpointConn private final PrivateEndpointConnectionsClient innerClient; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; public PrivateEndpointConnectionsImpl( - PrivateEndpointConnectionsClient innerClient, PostgreSqlManager serviceManager) { + PrivateEndpointConnectionsClient innerClient, + com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -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) { @@ -199,7 +199,7 @@ private PrivateEndpointConnectionsClient serviceClient() { return this.innerClient; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourceImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourceImpl.java index 593c80b70a867..070fe45c19cbc 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourceImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourceImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.postgresql.implementation; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.models.PrivateLinkResourceInner; import com.azure.resourcemanager.postgresql.models.PrivateLinkResource; import com.azure.resourcemanager.postgresql.models.PrivateLinkResourceProperties; @@ -12,9 +11,10 @@ public final class PrivateLinkResourceImpl implements PrivateLinkResource { private PrivateLinkResourceInner innerObject; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - PrivateLinkResourceImpl(PrivateLinkResourceInner innerObject, PostgreSqlManager serviceManager) { + PrivateLinkResourceImpl( + PrivateLinkResourceInner innerObject, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -39,7 +39,7 @@ public PrivateLinkResourceInner innerModel() { return this.innerObject; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourcesClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourcesClientImpl.java index 4847abbf8a41c..c8c62566f47eb 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourcesClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/PrivateLinkResourcesClientImpl.java @@ -157,7 +157,7 @@ private Mono> listByServerSinglePageAsyn res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -335,7 +335,7 @@ private Mono> getWithResponseAsync( apiVersion, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -480,7 +480,7 @@ private Mono> listByServerNextSinglePage res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** 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..f61ffab1624e6 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 @@ -9,7 +9,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.PrivateLinkResourcesClient; import com.azure.resourcemanager.postgresql.fluent.models.PrivateLinkResourceInner; import com.azure.resourcemanager.postgresql.models.PrivateLinkResource; @@ -21,9 +20,10 @@ public final class PrivateLinkResourcesImpl implements PrivateLinkResources { private final PrivateLinkResourcesClient innerClient; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - public PrivateLinkResourcesImpl(PrivateLinkResourcesClient innerClient, PostgreSqlManager serviceManager) { + public PrivateLinkResourcesImpl( + PrivateLinkResourcesClient innerClient, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -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) { @@ -69,7 +69,7 @@ private PrivateLinkResourcesClient serviceClient() { return this.innerClient; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServerResourceImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServerResourceImpl.java index 98b67f0c98e8c..705b492a439a1 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServerResourceImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServerResourceImpl.java @@ -4,16 +4,17 @@ package com.azure.resourcemanager.postgresql.implementation; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.models.RecoverableServerResourceInner; import com.azure.resourcemanager.postgresql.models.RecoverableServerResource; public final class RecoverableServerResourceImpl implements RecoverableServerResource { private RecoverableServerResourceInner innerObject; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - RecoverableServerResourceImpl(RecoverableServerResourceInner innerObject, PostgreSqlManager serviceManager) { + RecoverableServerResourceImpl( + RecoverableServerResourceInner innerObject, + com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -58,7 +59,7 @@ public RecoverableServerResourceInner innerModel() { return this.innerObject; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServersClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServersClientImpl.java index 4eeda10fd56e9..01d1ca24b9cbd 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServersClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServersClientImpl.java @@ -116,7 +116,7 @@ private Mono> getWithResponseAsync( serverName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServersImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServersImpl.java index 8a461d2ce60a1..32ec80fd9ae80 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServersImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/RecoverableServersImpl.java @@ -8,7 +8,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.RecoverableServersClient; import com.azure.resourcemanager.postgresql.fluent.models.RecoverableServerResourceInner; import com.azure.resourcemanager.postgresql.models.RecoverableServerResource; @@ -20,9 +19,10 @@ public final class RecoverableServersImpl implements RecoverableServers { private final RecoverableServersClient innerClient; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - public RecoverableServersImpl(RecoverableServersClient innerClient, PostgreSqlManager serviceManager) { + public RecoverableServersImpl( + RecoverableServersClient innerClient, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -55,7 +55,7 @@ private RecoverableServersClient serviceClient() { return this.innerClient; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } } 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..6d08fcc876421 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( @@ -123,7 +123,7 @@ private Mono> listByServerSinglePageAsync(String reso res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** 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..f16a3878b5f99 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 @@ -7,7 +7,6 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.ReplicasClient; import com.azure.resourcemanager.postgresql.fluent.models.ServerInner; import com.azure.resourcemanager.postgresql.models.Replicas; @@ -19,28 +18,29 @@ public final class ReplicasImpl implements Replicas { private final ReplicasClient innerClient; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - public ReplicasImpl(ReplicasClient innerClient, PostgreSqlManager serviceManager) { + public ReplicasImpl( + ReplicasClient innerClient, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable listByServer(String resourceGroupName, String serverName) { PagedIterable inner = this.serviceClient().listByServer(resourceGroupName, serverName); - return inner.mapPage(inner1 -> new ServerImpl(inner1, this.manager())); + 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() { return this.innerClient; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorResourceImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorResourceImpl.java index 9b828872f3a13..e25842bcb3fac 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorResourceImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerAdministratorResourceImpl.java @@ -4,7 +4,6 @@ package com.azure.resourcemanager.postgresql.implementation; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.models.ServerAdministratorResourceInner; import com.azure.resourcemanager.postgresql.models.AdministratorType; import com.azure.resourcemanager.postgresql.models.ServerAdministratorResource; @@ -13,9 +12,11 @@ public final class ServerAdministratorResourceImpl implements ServerAdministratorResource { private ServerAdministratorResourceInner innerObject; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - ServerAdministratorResourceImpl(ServerAdministratorResourceInner innerObject, PostgreSqlManager serviceManager) { + ServerAdministratorResourceImpl( + ServerAdministratorResourceInner innerObject, + com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; } @@ -52,7 +53,7 @@ public ServerAdministratorResourceInner innerModel() { return this.innerObject; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } } 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..ec1b383bc7c12 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( @@ -176,7 +176,7 @@ private Mono> getWithResponseAsync( serverName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -335,7 +335,7 @@ private Mono>> createOrUpdateWithResponseAsync( properties, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -612,7 +612,7 @@ private Mono>> deleteWithResponseAsync(String resource serverName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -845,7 +845,7 @@ private Mono> listSinglePageAsyn res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** 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..4f8e445518f0b 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 @@ -9,7 +9,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.ServerAdministratorsClient; import com.azure.resourcemanager.postgresql.fluent.models.ServerAdministratorResourceInner; import com.azure.resourcemanager.postgresql.models.ServerAdministratorResource; @@ -21,9 +20,10 @@ public final class ServerAdministratorsImpl implements ServerAdministrators { private final ServerAdministratorsClient innerClient; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - public ServerAdministratorsImpl(ServerAdministratorsClient innerClient, PostgreSqlManager serviceManager) { + public ServerAdministratorsImpl( + ServerAdministratorsClient innerClient, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -85,21 +85,21 @@ 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() { return this.innerClient; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerBasedPerformanceTiersClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerBasedPerformanceTiersClientImpl.java index 9af73dca465b8..72905f82294d3 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerBasedPerformanceTiersClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerBasedPerformanceTiersClientImpl.java @@ -127,7 +127,7 @@ private Mono> listSinglePageAsync( res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** 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..2b03969ccb244 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 @@ -7,7 +7,6 @@ import com.azure.core.http.rest.PagedIterable; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.ServerBasedPerformanceTiersClient; import com.azure.resourcemanager.postgresql.fluent.models.PerformanceTierPropertiesInner; import com.azure.resourcemanager.postgresql.models.PerformanceTierProperties; @@ -19,30 +18,31 @@ public final class ServerBasedPerformanceTiersImpl implements ServerBasedPerform private final ServerBasedPerformanceTiersClient innerClient; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; public ServerBasedPerformanceTiersImpl( - ServerBasedPerformanceTiersClient innerClient, PostgreSqlManager serviceManager) { + ServerBasedPerformanceTiersClient innerClient, + com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable list(String resourceGroupName, String serverName) { PagedIterable inner = this.serviceClient().list(resourceGroupName, serverName); - return inner.mapPage(inner1 -> new PerformanceTierPropertiesImpl(inner1, this.manager())); + 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() { return this.innerClient; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerImpl.java index 66e0b5a06f87b..a0dca750ee6e2 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerImpl.java @@ -6,7 +6,6 @@ import com.azure.core.management.Region; import com.azure.core.util.Context; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.models.ServerInner; import com.azure.resourcemanager.postgresql.models.InfrastructureEncryption; import com.azure.resourcemanager.postgresql.models.MinimalTlsVersionEnum; @@ -30,7 +29,7 @@ public final class ServerImpl implements Server, Server.Definition, Server.Update { private ServerInner innerObject; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; public String id() { return this.innerModel().id(); @@ -142,7 +141,7 @@ public ServerInner innerModel() { return this.innerObject; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } @@ -177,7 +176,7 @@ public Server create(Context context) { return this; } - ServerImpl(String name, PostgreSqlManager serviceManager) { + ServerImpl(String name, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = new ServerInner(); this.serviceManager = serviceManager; this.serverName = name; @@ -207,7 +206,7 @@ public Server apply(Context context) { return this; } - ServerImpl(ServerInner innerObject, PostgreSqlManager serviceManager) { + ServerImpl(ServerInner innerObject, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeyImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeyImpl.java index 5dccce4e59013..eaabdd239aa84 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeyImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeyImpl.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.postgresql.implementation; import com.azure.core.util.Context; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.models.ServerKeyInner; import com.azure.resourcemanager.postgresql.models.ServerKey; import com.azure.resourcemanager.postgresql.models.ServerKeyType; @@ -14,7 +13,7 @@ public final class ServerKeyImpl implements ServerKey, ServerKey.Definition, ServerKey.Update { private ServerKeyInner innerObject; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; public String id() { return this.innerModel().id(); @@ -48,7 +47,7 @@ public ServerKeyInner innerModel() { return this.innerObject; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } @@ -82,7 +81,7 @@ public ServerKey create(Context context) { return this; } - ServerKeyImpl(String name, PostgreSqlManager serviceManager) { + ServerKeyImpl(String name, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = new ServerKeyInner(); this.serviceManager = serviceManager; this.keyName = name; @@ -110,7 +109,7 @@ public ServerKey apply(Context context) { return this; } - ServerKeyImpl(ServerKeyInner innerObject, PostgreSqlManager serviceManager) { + ServerKeyImpl(ServerKeyInner innerObject, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.serverName = Utils.getValueFromIdByName(innerObject.id(), "servers"); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeysClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeysClientImpl.java index bbfec8e441d5c..9374f57881da4 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeysClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerKeysClientImpl.java @@ -196,7 +196,7 @@ private Mono> listSinglePageAsync(String resourceG res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -371,7 +371,7 @@ private Mono> getWithResponseAsync( this.client.getSubscriptionId(), accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -542,7 +542,7 @@ private Mono>> createOrUpdateWithResponseAsync( parameters, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -818,7 +818,7 @@ private Mono>> deleteWithResponseAsync( resourceGroupName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1050,7 +1050,7 @@ private Mono> listNextSinglePageAsync(String nextL res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** 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..6bd01f9ed1223 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 @@ -9,7 +9,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.ServerKeysClient; import com.azure.resourcemanager.postgresql.fluent.models.ServerKeyInner; import com.azure.resourcemanager.postgresql.models.ServerKey; @@ -21,21 +20,22 @@ public final class ServerKeysImpl implements ServerKeys { private final ServerKeysClient innerClient; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - public ServerKeysImpl(ServerKeysClient innerClient, PostgreSqlManager serviceManager) { + public ServerKeysImpl( + ServerKeysClient innerClient, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } public PagedIterable list(String resourceGroupName, String serverName) { PagedIterable inner = this.serviceClient().list(resourceGroupName, serverName); - return inner.mapPage(inner1 -> new 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) { @@ -178,7 +178,7 @@ private ServerKeysClient serviceClient() { return this.innerClient; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerParametersClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerParametersClientImpl.java index 3987b76bfa0a1..0178f2cc04d8b 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerParametersClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerParametersClientImpl.java @@ -130,7 +130,7 @@ private Mono>> listUpdateConfigurationsWithResponseAsy value, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerParametersImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerParametersImpl.java index 8ad22723460ec..9dce6e00826ae 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerParametersImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerParametersImpl.java @@ -6,7 +6,6 @@ import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.ServerParametersClient; import com.azure.resourcemanager.postgresql.fluent.models.ConfigurationListResultInner; import com.azure.resourcemanager.postgresql.models.ConfigurationListResult; @@ -18,9 +17,10 @@ public final class ServerParametersImpl implements ServerParameters { private final ServerParametersClient innerClient; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - public ServerParametersImpl(ServerParametersClient innerClient, PostgreSqlManager serviceManager) { + public ServerParametersImpl( + ServerParametersClient innerClient, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -51,7 +51,7 @@ private ServerParametersClient serviceClient() { return this.innerClient; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } } 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..9b138dd2e137b 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); } /** @@ -151,7 +181,7 @@ private Mono> getWithResponseAsync( apiVersion, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -331,7 +361,7 @@ private Mono>> createOrUpdateWithResponseAsync( parameters, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -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)) + .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/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..cc2437538b739 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,11 +4,11 @@ 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; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.ServerSecurityAlertPoliciesClient; import com.azure.resourcemanager.postgresql.fluent.models.ServerSecurityAlertPolicyInner; import com.azure.resourcemanager.postgresql.models.SecurityAlertPolicyName; @@ -21,10 +21,11 @@ public final class ServerSecurityAlertPoliciesImpl implements ServerSecurityAler private final ServerSecurityAlertPoliciesClient innerClient; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; public ServerSecurityAlertPoliciesImpl( - ServerSecurityAlertPoliciesClient innerClient, PostgreSqlManager serviceManager) { + ServerSecurityAlertPoliciesClient innerClient, + com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -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) { @@ -119,7 +133,7 @@ private ServerSecurityAlertPoliciesClient serviceClient() { return this.innerClient; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPolicyImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPolicyImpl.java index e4cc37d348bb2..2047e41bbbe4c 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPolicyImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ServerSecurityAlertPolicyImpl.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.postgresql.implementation; import com.azure.core.util.Context; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.models.ServerSecurityAlertPolicyInner; import com.azure.resourcemanager.postgresql.models.SecurityAlertPolicyName; import com.azure.resourcemanager.postgresql.models.ServerSecurityAlertPolicy; @@ -17,7 +16,7 @@ public final class ServerSecurityAlertPolicyImpl implements ServerSecurityAlertPolicy, ServerSecurityAlertPolicy.Definition, ServerSecurityAlertPolicy.Update { private ServerSecurityAlertPolicyInner innerObject; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; public String id() { return this.innerModel().id(); @@ -73,7 +72,7 @@ public ServerSecurityAlertPolicyInner innerModel() { return this.innerObject; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } @@ -108,7 +107,8 @@ public ServerSecurityAlertPolicy create(Context context) { return this; } - ServerSecurityAlertPolicyImpl(SecurityAlertPolicyName name, PostgreSqlManager serviceManager) { + ServerSecurityAlertPolicyImpl( + SecurityAlertPolicyName name, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = new ServerSecurityAlertPolicyInner(); this.serviceManager = serviceManager; this.securityAlertPolicyName = name; @@ -137,7 +137,9 @@ public ServerSecurityAlertPolicy apply(Context context) { return this; } - ServerSecurityAlertPolicyImpl(ServerSecurityAlertPolicyInner innerObject, PostgreSqlManager serviceManager) { + ServerSecurityAlertPolicyImpl( + ServerSecurityAlertPolicyInner innerObject, + com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); 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..e56c48e1ce71c 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"}) @@ -225,7 +226,7 @@ private Mono>> createWithResponseAsync( parameters, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -488,7 +489,7 @@ private Mono>> updateWithResponseAsync( parameters, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -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,8 +751,9 @@ private Mono>> deleteWithResponseAsync(String resource this.client.getSubscriptionId(), resourceGroupName, serverName, + accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -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); } @@ -977,7 +982,7 @@ private Mono> getByResourceGroupWithResponseAsync( serverName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1126,7 +1131,7 @@ private Mono> listByResourceGroupSinglePageAsync(Stri res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1265,7 +1270,7 @@ private Mono> listSinglePageAsync() { res -> new PagedResponseBase<>( res.getRequest(), res.getStatusCode(), res.getHeaders(), res.getValue().value(), null, null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1399,7 +1404,7 @@ private Mono>> restartWithResponseAsync(String resourc serverName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** 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..6b8c4649e3815 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 @@ -9,7 +9,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.ServersClient; import com.azure.resourcemanager.postgresql.fluent.models.ServerInner; import com.azure.resourcemanager.postgresql.models.Server; @@ -21,9 +20,10 @@ public final class ServersImpl implements Servers { private final ServersClient innerClient; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - public ServersImpl(ServersClient innerClient, PostgreSqlManager serviceManager) { + public ServersImpl( + ServersClient innerClient, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -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) { @@ -168,7 +168,7 @@ private ServersClient serviceClient() { return this.innerClient; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } 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..9eee93b6f91b0 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.Flux; final class Utils { static String getValueFromIdByName(String id, String name) { @@ -64,4 +72,133 @@ 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 pagedIterable; + private final Function mapper; + private final Function, PagedResponse> pageMapper; + + private PagedIterableImpl(PagedIterable pagedIterable, Function mapper) { + super( + PagedFlux + .create( + () -> + (continuationToken, pageSize) -> + Flux.fromStream(pagedIterable.streamByPage().map(getPageMapper(mapper))))); + this.pagedIterable = pagedIterable; + this.mapper = mapper; + this.pageMapper = getPageMapper(mapper); + } + + private static Function, PagedResponse> getPageMapper(Function mapper) { + return page -> + new PagedResponseBase( + page.getRequest(), + page.getStatusCode(), + page.getHeaders(), + page.getElements().stream().map(mapper).collect(Collectors.toList()), + page.getContinuationToken(), + null); + } + + @Override + public Stream stream() { + return pagedIterable.stream().map(mapper); + } + + @Override + public Stream> streamByPage() { + return pagedIterable.streamByPage().map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken) { + return pagedIterable.streamByPage(continuationToken).map(pageMapper); + } + + @Override + public Stream> streamByPage(int preferredPageSize) { + return pagedIterable.streamByPage(preferredPageSize).map(pageMapper); + } + + @Override + public Stream> streamByPage(String continuationToken, int preferredPageSize) { + return pagedIterable.streamByPage(continuationToken, preferredPageSize).map(pageMapper); + } + + @Override + public Iterator iterator() { + return new IteratorImpl(pagedIterable.iterator(), mapper); + } + + @Override + public Iterable> iterableByPage() { + return new IterableImpl, PagedResponse>(pagedIterable.iterableByPage(), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken), pageMapper); + } + + @Override + public Iterable> iterableByPage(int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(preferredPageSize), pageMapper); + } + + @Override + public Iterable> iterableByPage(String continuationToken, int preferredPageSize) { + return new IterableImpl, PagedResponse>( + pagedIterable.iterableByPage(continuationToken, preferredPageSize), pageMapper); + } + } + + private static final class IteratorImpl implements Iterator { + + private final Iterator iterator; + private final Function mapper; + + private IteratorImpl(Iterator iterator, Function mapper) { + this.iterator = iterator; + this.mapper = mapper; + } + + @Override + public boolean hasNext() { + return iterator.hasNext(); + } + + @Override + public S next() { + return mapper.apply(iterator.next()); + } + + @Override + public void remove() { + iterator.remove(); + } + } + + private static final class IterableImpl implements Iterable { + + private final Iterable iterable; + private final Function mapper; + + private IterableImpl(Iterable iterable, Function mapper) { + this.iterable = iterable; + this.mapper = mapper; + } + + @Override + public Iterator iterator() { + return new IteratorImpl(iterable.iterator(), mapper); + } + } } diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRuleImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRuleImpl.java index 004042684606a..4585a28e37e1e 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRuleImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRuleImpl.java @@ -5,7 +5,6 @@ package com.azure.resourcemanager.postgresql.implementation; import com.azure.core.util.Context; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.models.VirtualNetworkRuleInner; import com.azure.resourcemanager.postgresql.models.VirtualNetworkRule; import com.azure.resourcemanager.postgresql.models.VirtualNetworkRuleState; @@ -14,7 +13,7 @@ public final class VirtualNetworkRuleImpl implements VirtualNetworkRule, VirtualNetworkRule.Definition, VirtualNetworkRule.Update { private VirtualNetworkRuleInner innerObject; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; public String id() { return this.innerModel().id(); @@ -44,7 +43,7 @@ public VirtualNetworkRuleInner innerModel() { return this.innerObject; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } @@ -78,7 +77,7 @@ public VirtualNetworkRule create(Context context) { return this; } - VirtualNetworkRuleImpl(String name, PostgreSqlManager serviceManager) { + VirtualNetworkRuleImpl(String name, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = new VirtualNetworkRuleInner(); this.serviceManager = serviceManager; this.virtualNetworkRuleName = name; @@ -106,7 +105,8 @@ public VirtualNetworkRule apply(Context context) { return this; } - VirtualNetworkRuleImpl(VirtualNetworkRuleInner innerObject, PostgreSqlManager serviceManager) { + VirtualNetworkRuleImpl( + VirtualNetworkRuleInner innerObject, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerObject = innerObject; this.serviceManager = serviceManager; this.resourceGroupName = Utils.getValueFromIdByName(innerObject.id(), "resourceGroups"); diff --git a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRulesClientImpl.java b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRulesClientImpl.java index 4db9b19b05cce..6ea002cf4e514 100644 --- a/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRulesClientImpl.java +++ b/sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/VirtualNetworkRulesClientImpl.java @@ -194,7 +194,7 @@ private Mono> getWithResponseAsync( virtualNetworkRuleName, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -373,7 +373,7 @@ private Mono>> createOrUpdateWithResponseAsync( parameters, accept, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -693,7 +693,7 @@ private Mono>> deleteWithResponseAsync( this.client.getSubscriptionId(), apiVersion, context)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -951,7 +951,7 @@ private Mono> listByServerSinglePageAsync res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** @@ -1110,7 +1110,7 @@ private Mono> listByServerNextSinglePageA res.getValue().value(), res.getValue().nextLink(), null)) - .subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()))); + .contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly())); } /** 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..1eb4fa6361680 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 @@ -9,7 +9,6 @@ import com.azure.core.http.rest.SimpleResponse; import com.azure.core.util.Context; import com.azure.core.util.logging.ClientLogger; -import com.azure.resourcemanager.postgresql.PostgreSqlManager; import com.azure.resourcemanager.postgresql.fluent.VirtualNetworkRulesClient; import com.azure.resourcemanager.postgresql.fluent.models.VirtualNetworkRuleInner; import com.azure.resourcemanager.postgresql.models.VirtualNetworkRule; @@ -21,9 +20,10 @@ public final class VirtualNetworkRulesImpl implements VirtualNetworkRules { private final VirtualNetworkRulesClient innerClient; - private final PostgreSqlManager serviceManager; + private final com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager; - public VirtualNetworkRulesImpl(VirtualNetworkRulesClient innerClient, PostgreSqlManager serviceManager) { + public VirtualNetworkRulesImpl( + VirtualNetworkRulesClient innerClient, com.azure.resourcemanager.postgresql.PostgreSqlManager serviceManager) { this.innerClient = innerClient; this.serviceManager = serviceManager; } @@ -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) { @@ -188,7 +188,7 @@ private VirtualNetworkRulesClient serviceClient() { return this.innerClient; } - private PostgreSqlManager manager() { + private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() { return this.serviceManager; } 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()); + } + } +}