Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sdk/mysql/azure-resourcemanager-mysql/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-03-29)

- Azure Resource Manager MySql client library for Java. This package contains Microsoft Azure SDK for MySql Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, 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/mysql/azure-resourcemanager-mysql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ Azure Resource Manager MySql client library for Java.

This package contains Microsoft Azure SDK for MySql Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, 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 MySql Management SDK. The Microsof
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-mysql</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/mysql/azure-resourcemanager-mysql/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 MySql Management</name>
<description>This package contains Microsoft Azure SDK for MySql Management SDK. The Microsoft Azure management API provides create, read, update, and delete functionality for Azure MySQL resources including servers, databases, firewall rules, VNET rules, 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 MySql 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 MySQL resources including servers, databases, firewall rules, VNET rules, 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.14.1</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 @@ -256,17 +256,31 @@ public MySqlManager authenticate(TokenCredential credential, AzureProfile profil
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.mysql")
.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.mysql",
"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 @@ -4,16 +4,15 @@

package com.azure.resourcemanager.mysql.implementation;

import com.azure.resourcemanager.mysql.MySqlManager;
import com.azure.resourcemanager.mysql.fluent.models.AdvisorInner;
import com.azure.resourcemanager.mysql.models.Advisor;

public final class AdvisorImpl implements Advisor {
private AdvisorInner innerObject;

private final MySqlManager serviceManager;
private final com.azure.resourcemanager.mysql.MySqlManager serviceManager;

AdvisorImpl(AdvisorInner innerObject, MySqlManager serviceManager) {
AdvisorImpl(AdvisorInner innerObject, com.azure.resourcemanager.mysql.MySqlManager serviceManager) {
this.innerObject = innerObject;
this.serviceManager = serviceManager;
}
Expand All @@ -38,7 +37,7 @@ public AdvisorInner innerModel() {
return this.innerObject;
}

private MySqlManager manager() {
private com.azure.resourcemanager.mysql.MySqlManager manager() {
return this.serviceManager;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private Mono<Response<AdvisorInner>> getWithResponseAsync(
advisorName,
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 @@ -318,7 +318,7 @@ private Mono<PagedResponse<AdvisorInner>> listByServerSinglePageAsync(String res
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()));
}

/**
Expand Down Expand Up @@ -475,7 +475,7 @@ private Mono<PagedResponse<AdvisorInner>> listByServerNextSinglePageAsync(String
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()));
}

/**
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.mysql.MySqlManager;
import com.azure.resourcemanager.mysql.fluent.AdvisorsClient;
import com.azure.resourcemanager.mysql.fluent.models.AdvisorInner;
import com.azure.resourcemanager.mysql.models.Advisor;
Expand All @@ -21,9 +20,9 @@ public final class AdvisorsImpl implements Advisors {

private final AdvisorsClient innerClient;

private final MySqlManager serviceManager;
private final com.azure.resourcemanager.mysql.MySqlManager serviceManager;

public AdvisorsImpl(AdvisorsClient innerClient, MySqlManager serviceManager) {
public AdvisorsImpl(AdvisorsClient innerClient, com.azure.resourcemanager.mysql.MySqlManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
Expand Down Expand Up @@ -54,19 +53,19 @@ public Response<Advisor> getWithResponse(

public PagedIterable<Advisor> listByServer(String resourceGroupName, String serverName) {
PagedIterable<AdvisorInner> inner = this.serviceClient().listByServer(resourceGroupName, serverName);
return inner.mapPage(inner1 -> new AdvisorImpl(inner1, this.manager()));
return Utils.mapPage(inner, inner1 -> new AdvisorImpl(inner1, this.manager()));
}

public PagedIterable<Advisor> listByServer(String resourceGroupName, String serverName, Context context) {
PagedIterable<AdvisorInner> inner = this.serviceClient().listByServer(resourceGroupName, serverName, context);
return inner.mapPage(inner1 -> new AdvisorImpl(inner1, this.manager()));
return Utils.mapPage(inner, inner1 -> new AdvisorImpl(inner1, this.manager()));
}

private AdvisorsClient serviceClient() {
return this.innerClient;
}

private MySqlManager manager() {
private com.azure.resourcemanager.mysql.MySqlManager manager() {
return this.serviceManager;
}
}
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.mysql.MySqlManager;
import com.azure.resourcemanager.mysql.fluent.CheckNameAvailabilitiesClient;
import com.azure.resourcemanager.mysql.fluent.models.NameAvailabilityInner;
import com.azure.resourcemanager.mysql.models.CheckNameAvailabilities;
Expand All @@ -21,9 +20,10 @@ public final class CheckNameAvailabilitiesImpl implements CheckNameAvailabilitie

private final CheckNameAvailabilitiesClient innerClient;

private final MySqlManager serviceManager;
private final com.azure.resourcemanager.mysql.MySqlManager serviceManager;

public CheckNameAvailabilitiesImpl(CheckNameAvailabilitiesClient innerClient, MySqlManager serviceManager) {
public CheckNameAvailabilitiesImpl(
CheckNameAvailabilitiesClient innerClient, com.azure.resourcemanager.mysql.MySqlManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
Expand Down Expand Up @@ -56,7 +56,7 @@ private CheckNameAvailabilitiesClient serviceClient() {
return this.innerClient;
}

private MySqlManager manager() {
private com.azure.resourcemanager.mysql.MySqlManager manager() {
return this.serviceManager;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
package com.azure.resourcemanager.mysql.implementation;

import com.azure.core.util.Context;
import com.azure.resourcemanager.mysql.MySqlManager;
import com.azure.resourcemanager.mysql.fluent.models.ConfigurationInner;
import com.azure.resourcemanager.mysql.models.Configuration;

public final class ConfigurationImpl implements Configuration, Configuration.Definition, Configuration.Update {
private ConfigurationInner innerObject;

private final MySqlManager serviceManager;
private final com.azure.resourcemanager.mysql.MySqlManager serviceManager;

public String id() {
return this.innerModel().id();
Expand Down Expand Up @@ -54,7 +53,7 @@ public ConfigurationInner innerModel() {
return this.innerObject;
}

private MySqlManager manager() {
private com.azure.resourcemanager.mysql.MySqlManager manager() {
return this.serviceManager;
}

Expand Down Expand Up @@ -88,7 +87,7 @@ public Configuration create(Context context) {
return this;
}

ConfigurationImpl(String name, MySqlManager serviceManager) {
ConfigurationImpl(String name, com.azure.resourcemanager.mysql.MySqlManager serviceManager) {
this.innerObject = new ConfigurationInner();
this.serviceManager = serviceManager;
this.configurationName = name;
Expand Down Expand Up @@ -116,7 +115,7 @@ public Configuration apply(Context context) {
return this;
}

ConfigurationImpl(ConfigurationInner innerObject, MySqlManager serviceManager) {
ConfigurationImpl(ConfigurationInner innerObject, com.azure.resourcemanager.mysql.MySqlManager 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.mysql.implementation;

import com.azure.resourcemanager.mysql.MySqlManager;
import com.azure.resourcemanager.mysql.fluent.models.ConfigurationInner;
import com.azure.resourcemanager.mysql.fluent.models.ConfigurationListResultInner;
import com.azure.resourcemanager.mysql.models.Configuration;
Expand All @@ -16,9 +15,10 @@
public final class ConfigurationListResultImpl implements ConfigurationListResult {
private ConfigurationListResultInner innerObject;

private final MySqlManager serviceManager;
private final com.azure.resourcemanager.mysql.MySqlManager serviceManager;

ConfigurationListResultImpl(ConfigurationListResultInner innerObject, MySqlManager serviceManager) {
ConfigurationListResultImpl(
ConfigurationListResultInner innerObject, com.azure.resourcemanager.mysql.MySqlManager serviceManager) {
this.innerObject = innerObject;
this.serviceManager = serviceManager;
}
Expand All @@ -41,7 +41,7 @@ public ConfigurationListResultInner innerModel() {
return this.innerObject;
}

private MySqlManager manager() {
private com.azure.resourcemanager.mysql.MySqlManager 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
Loading