Skip to content

Commit 0318f23

Browse files
author
SDKAuto
committed
CodeGen from PR 13236 in Azure/azure-rest-api-specs
Merge 9bf733879502332558b6d8505f3accd4f4c456e7 into 0a7c908bd6b77bafe8f547116cc4da5b63a2aa2d
1 parent f3004e4 commit 0318f23

29 files changed

+638
-46
lines changed

sdk/postgresql/azure-resourcemanager-postgresql/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# Release History
22

3-
## 1.0.0-beta.2 (Unreleased)
3+
## 1.0.0-beta.1 (2021-03-03)
44

5+
- 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).
56

67
## 1.0.0-beta.1 (2020-12-16)
78

sdk/postgresql/azure-resourcemanager-postgresql/README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,20 @@ Azure Resource Manager PostgreSql client library for Java.
44

55
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).
66

7+
## We'd love to hear your feedback
8+
9+
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.
10+
11+
If you haven't already, please take a few minutes to [complete this short survey][survey] we have put together.
12+
13+
Thank you in advance for your collaboration. We really appreciate your time!
14+
15+
## Documentation
16+
17+
Various documentation is available to help you get started
18+
19+
- [API reference documentation][docs]
20+
721
## Getting started
822

923
### Prerequisites
@@ -18,7 +32,7 @@ This package contains Microsoft Azure SDK for PostgreSql Management SDK. The Mic
1832
<dependency>
1933
<groupId>com.azure.resourcemanager</groupId>
2034
<artifactId>azure-resourcemanager-postgresql</artifactId>
21-
<version>1.0.0-beta.1</version>
35+
<version>1.0.0-beta.2</version>
2236
</dependency>
2337
```
2438
[//]: # ({x-version-update-end})
@@ -75,6 +89,8 @@ For details on contributing to this repository, see the [contributing guide](htt
7589
1. Create new Pull Request
7690

7791
<!-- LINKS -->
92+
[survey]: https://microsoft.qualtrics.com/jfe/form/SV_ehN0lIk2FKEBkwd?Q_CHL=DOCS
93+
[docs]: https://azure.github.io/azure-sdk-for-java/
7894
[jdk]: https://docs.microsoft.com/java/azure/jdk/
7995
[azure_subscription]: https://azure.microsoft.com/free/
8096
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/identity/azure-identity

sdk/postgresql/azure-resourcemanager-postgresql/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@
4141
<legal><![CDATA[[INFO] Any downloads listed may be third party software. Microsoft grants you no rights for third party software.]]></legal>
4242
</properties>
4343
<dependencies>
44+
<dependency>
45+
<groupId>com.azure</groupId>
46+
<artifactId>azure-core</artifactId>
47+
<version>1.13.0</version> <!-- {x-version-update;com.azure:azure-core;dependency} -->
48+
</dependency>
4449
<dependency>
4550
<groupId>com.azure</groupId>
4651
<artifactId>azure-core-management</artifactId>

sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/PostgreSqlManager.java

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,17 +224,31 @@ public PostgreSqlManager authenticate(TokenCredential credential, AzureProfile p
224224
Objects.requireNonNull(credential, "'credential' cannot be null.");
225225
Objects.requireNonNull(profile, "'profile' cannot be null.");
226226

227+
StringBuilder userAgentBuilder = new StringBuilder();
228+
userAgentBuilder
229+
.append("azsdk-java")
230+
.append("-")
231+
.append("com.azure.resourcemanager.postgresql")
232+
.append("/")
233+
.append("1.0.0-beta.1");
234+
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
235+
userAgentBuilder
236+
.append(" (")
237+
.append(Configuration.getGlobalConfiguration().get("java.version"))
238+
.append("; ")
239+
.append(Configuration.getGlobalConfiguration().get("os.name"))
240+
.append("; ")
241+
.append(Configuration.getGlobalConfiguration().get("os.version"))
242+
.append("; auto-generated)");
243+
} else {
244+
userAgentBuilder.append(" (auto-generated)");
245+
}
246+
227247
if (retryPolicy == null) {
228248
retryPolicy = new RetryPolicy("Retry-After", ChronoUnit.SECONDS);
229249
}
230250
List<HttpPipelinePolicy> policies = new ArrayList<>();
231-
policies
232-
.add(
233-
new UserAgentPolicy(
234-
null,
235-
"com.azure.resourcemanager.postgresql",
236-
"1.0.0-beta.1",
237-
Configuration.getGlobalConfiguration()));
251+
policies.add(new UserAgentPolicy(userAgentBuilder.toString()));
238252
policies.add(new RequestIdPolicy());
239253
HttpPolicyProviders.addBeforeRetryPolicies(policies);
240254
policies.add(retryPolicy);

sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/fluent/ServerSecurityAlertPoliciesClient.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import com.azure.core.annotation.ReturnType;
88
import com.azure.core.annotation.ServiceMethod;
9+
import com.azure.core.http.rest.PagedIterable;
910
import com.azure.core.http.rest.Response;
1011
import com.azure.core.management.polling.PollResult;
1112
import com.azure.core.util.Context;
@@ -125,4 +126,32 @@ ServerSecurityAlertPolicyInner createOrUpdate(
125126
SecurityAlertPolicyName securityAlertPolicyName,
126127
ServerSecurityAlertPolicyInner parameters,
127128
Context context);
129+
130+
/**
131+
* Get the server's threat detection policies.
132+
*
133+
* @param resourceGroupName The name of the resource group. The name is case insensitive.
134+
* @param serverName The name of the server.
135+
* @throws IllegalArgumentException thrown if parameters fail the validation.
136+
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
137+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
138+
* @return the server's threat detection policies.
139+
*/
140+
@ServiceMethod(returns = ReturnType.COLLECTION)
141+
PagedIterable<ServerSecurityAlertPolicyInner> listByServer(String resourceGroupName, String serverName);
142+
143+
/**
144+
* Get the server's threat detection policies.
145+
*
146+
* @param resourceGroupName The name of the resource group. The name is case insensitive.
147+
* @param serverName The name of the server.
148+
* @param context The context to associate with this operation.
149+
* @throws IllegalArgumentException thrown if parameters fail the validation.
150+
* @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
151+
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
152+
* @return the server's threat detection policies.
153+
*/
154+
@ServiceMethod(returns = ReturnType.COLLECTION)
155+
PagedIterable<ServerSecurityAlertPolicyInner> listByServer(
156+
String resourceGroupName, String serverName, Context context);
128157
}

sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/ConfigurationsImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,13 @@ public Response<Configuration> getWithResponse(
5454

5555
public PagedIterable<Configuration> listByServer(String resourceGroupName, String serverName) {
5656
PagedIterable<ConfigurationInner> inner = this.serviceClient().listByServer(resourceGroupName, serverName);
57-
return inner.mapPage(inner1 -> new ConfigurationImpl(inner1, this.manager()));
57+
return Utils.mapPage(inner, inner1 -> new ConfigurationImpl(inner1, this.manager()));
5858
}
5959

6060
public PagedIterable<Configuration> listByServer(String resourceGroupName, String serverName, Context context) {
6161
PagedIterable<ConfigurationInner> inner =
6262
this.serviceClient().listByServer(resourceGroupName, serverName, context);
63-
return inner.mapPage(inner1 -> new ConfigurationImpl(inner1, this.manager()));
63+
return Utils.mapPage(inner, inner1 -> new ConfigurationImpl(inner1, this.manager()));
6464
}
6565

6666
public Configuration getById(String id) {

sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabasesClientImpl.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Mono<Response<Flux<ByteBuffer>>> createOrUpdate(
8484
@HeaderParam("Accept") String accept,
8585
Context context);
8686

87-
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
87+
@Headers({"Content-Type: application/json"})
8888
@Delete(
8989
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL"
9090
+ "/servers/{serverName}/databases/{databaseName}")
@@ -97,6 +97,7 @@ Mono<Response<Flux<ByteBuffer>>> delete(
9797
@PathParam("resourceGroupName") String resourceGroupName,
9898
@PathParam("serverName") String serverName,
9999
@PathParam("databaseName") String databaseName,
100+
@HeaderParam("Accept") String accept,
100101
Context context);
101102

102103
@Headers({"Content-Type: application/json"})
@@ -452,6 +453,7 @@ private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
452453
return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null."));
453454
}
454455
final String apiVersion = "2017-12-01";
456+
final String accept = "application/json";
455457
return FluxUtil
456458
.withContext(
457459
context ->
@@ -463,6 +465,7 @@ private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
463465
resourceGroupName,
464466
serverName,
465467
databaseName,
468+
accept,
466469
context))
467470
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
468471
}
@@ -505,6 +508,7 @@ private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
505508
return Mono.error(new IllegalArgumentException("Parameter databaseName is required and cannot be null."));
506509
}
507510
final String apiVersion = "2017-12-01";
511+
final String accept = "application/json";
508512
context = this.client.mergeContext(context);
509513
return service
510514
.delete(
@@ -514,6 +518,7 @@ private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
514518
resourceGroupName,
515519
serverName,
516520
databaseName,
521+
accept,
517522
context);
518523
}
519524

sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/DatabasesImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@ public Response<Database> getWithResponse(
6262

6363
public PagedIterable<Database> listByServer(String resourceGroupName, String serverName) {
6464
PagedIterable<DatabaseInner> inner = this.serviceClient().listByServer(resourceGroupName, serverName);
65-
return inner.mapPage(inner1 -> new DatabaseImpl(inner1, this.manager()));
65+
return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager()));
6666
}
6767

6868
public PagedIterable<Database> listByServer(String resourceGroupName, String serverName, Context context) {
6969
PagedIterable<DatabaseInner> inner = this.serviceClient().listByServer(resourceGroupName, serverName, context);
70-
return inner.mapPage(inner1 -> new DatabaseImpl(inner1, this.manager()));
70+
return Utils.mapPage(inner, inner1 -> new DatabaseImpl(inner1, this.manager()));
7171
}
7272

7373
public Database getById(String id) {

sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRulesClientImpl.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Mono<Response<Flux<ByteBuffer>>> createOrUpdate(
8484
@HeaderParam("Accept") String accept,
8585
Context context);
8686

87-
@Headers({"Accept: application/json;q=0.9", "Content-Type: application/json"})
87+
@Headers({"Content-Type: application/json"})
8888
@Delete(
8989
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DBForPostgreSQL"
9090
+ "/servers/{serverName}/firewallRules/{firewallRuleName}")
@@ -97,6 +97,7 @@ Mono<Response<Flux<ByteBuffer>>> delete(
9797
@PathParam("resourceGroupName") String resourceGroupName,
9898
@PathParam("serverName") String serverName,
9999
@PathParam("firewallRuleName") String firewallRuleName,
100+
@HeaderParam("Accept") String accept,
100101
Context context);
101102

102103
@Headers({"Content-Type: application/json"})
@@ -475,6 +476,7 @@ private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
475476
.error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null."));
476477
}
477478
final String apiVersion = "2017-12-01";
479+
final String accept = "application/json";
478480
return FluxUtil
479481
.withContext(
480482
context ->
@@ -486,6 +488,7 @@ private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
486488
resourceGroupName,
487489
serverName,
488490
firewallRuleName,
491+
accept,
489492
context))
490493
.subscriberContext(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext())));
491494
}
@@ -529,6 +532,7 @@ private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
529532
.error(new IllegalArgumentException("Parameter firewallRuleName is required and cannot be null."));
530533
}
531534
final String apiVersion = "2017-12-01";
535+
final String accept = "application/json";
532536
context = this.client.mergeContext(context);
533537
return service
534538
.delete(
@@ -538,6 +542,7 @@ private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(
538542
resourceGroupName,
539543
serverName,
540544
firewallRuleName,
545+
accept,
541546
context);
542547
}
543548

sdk/postgresql/azure-resourcemanager-postgresql/src/main/java/com/azure/resourcemanager/postgresql/implementation/FirewallRulesImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ public Response<FirewallRule> getWithResponse(
6262

6363
public PagedIterable<FirewallRule> listByServer(String resourceGroupName, String serverName) {
6464
PagedIterable<FirewallRuleInner> inner = this.serviceClient().listByServer(resourceGroupName, serverName);
65-
return inner.mapPage(inner1 -> new FirewallRuleImpl(inner1, this.manager()));
65+
return Utils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager()));
6666
}
6767

6868
public PagedIterable<FirewallRule> listByServer(String resourceGroupName, String serverName, Context context) {
6969
PagedIterable<FirewallRuleInner> inner =
7070
this.serviceClient().listByServer(resourceGroupName, serverName, context);
71-
return inner.mapPage(inner1 -> new FirewallRuleImpl(inner1, this.manager()));
71+
return Utils.mapPage(inner, inner1 -> new FirewallRuleImpl(inner1, this.manager()));
7272
}
7373

7474
public FirewallRule getById(String id) {

0 commit comments

Comments
 (0)