Skip to content

Commit

Permalink
CodeGen from PR 13555 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge 8009a4f9dfa58be708b07a2faab9042a5291f2b4 into 1f4fb025ca56e6ce70726ceda02f28e40e1ca50e
  • Loading branch information
SDKAuto committed Apr 5, 2021
1 parent a175fe4 commit 3fc5c47
Show file tree
Hide file tree
Showing 61 changed files with 846 additions and 242 deletions.
3 changes: 2 additions & 1 deletion sdk/postgresql/azure-resourcemanager-postgresql/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
18 changes: 17 additions & 1 deletion sdk/postgresql/azure-resourcemanager-postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -18,7 +32,7 @@ This package contains Microsoft Azure SDK for PostgreSql Management SDK. The Mic
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-postgresql</artifactId>
<version>1.0.0-beta.1</version>
<version>1.0.0-beta.2</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand Down Expand Up @@ -75,6 +89,8 @@ For details on contributing to this repository, see the [contributing guide](htt
1. Create new Pull Request

<!-- LINKS -->
[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
Expand Down
7 changes: 6 additions & 1 deletion sdk/postgresql/azure-resourcemanager-postgresql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<packaging>jar</packaging>

<name>Microsoft Azure SDK for PostgreSql Management</name>
<description>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</description>
<description>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.</description>
<url>https://github.com/Azure/azure-sdk-for-java</url>

<licenses>
Expand Down Expand Up @@ -41,6 +41,11 @@
<legal><![CDATA[[INFO] Any downloads listed may be third party software. Microsoft grants you no rights for third party software.]]></legal>
</properties>
<dependencies>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core</artifactId>
<version>1.15.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
</dependency>
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-core-management</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<HttpPipelinePolicy> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<ServerSecurityAlertPolicyInner> 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<ServerSecurityAlertPolicyInner> listByServer(
String resourceGroupName, String serverName, Context context);
}
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ private Mono<Response<NameAvailabilityInner>> executeWithResponseAsync(
nameAvailabilityRequest,
accept,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down Expand Up @@ -56,7 +57,7 @@ private CheckNameAvailabilitiesClient serviceClient() {
return this.innerClient;
}

private PostgreSqlManager manager() {
private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() {
return this.serviceManager;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -54,7 +53,7 @@ public ConfigurationInner innerModel() {
return this.innerObject;
}

private PostgreSqlManager manager() {
private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() {
return this.serviceManager;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand All @@ -41,7 +42,7 @@ public ConfigurationListResultInner innerModel() {
return this.innerObject;
}

private PostgreSqlManager manager() {
private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() {
return this.serviceManager;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponseAsync(
parameters,
accept,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}

/**
Expand Down Expand Up @@ -473,7 +473,7 @@ private Mono<Response<ConfigurationInner>> getWithResponseAsync(
configurationName,
accept,
context))
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
.contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext()).readOnly()));
}

/**
Expand Down Expand Up @@ -637,7 +637,7 @@ private Mono<PagedResponse<ConfigurationInner>> 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()));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down Expand Up @@ -54,13 +54,13 @@ public Response<Configuration> getWithResponse(

public PagedIterable<Configuration> listByServer(String resourceGroupName, String serverName) {
PagedIterable<ConfigurationInner> 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<Configuration> listByServer(String resourceGroupName, String serverName, Context context) {
PagedIterable<ConfigurationInner> 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) {
Expand Down Expand Up @@ -121,7 +121,7 @@ private ConfigurationsClient serviceClient() {
return this.innerClient;
}

private PostgreSqlManager manager() {
private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() {
return this.serviceManager;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -38,7 +37,7 @@ public DatabaseInner innerModel() {
return this.innerObject;
}

private PostgreSqlManager manager() {
private com.azure.resourcemanager.postgresql.PostgreSqlManager manager() {
return this.serviceManager;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down
Loading

0 comments on commit 3fc5c47

Please sign in to comment.