Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Automation] Generate Fluent Lite from Swagger networkanalytics#package-2023-11-15 #43381

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
2 changes: 1 addition & 1 deletion eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ com.azure.resourcemanager:azure-resourcemanager-apicenter;1.0.0;1.1.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-hybridconnectivity;1.1.0;1.2.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-playwrighttesting;1.0.0-beta.3;1.0.0-beta.4
com.azure.resourcemanager:azure-resourcemanager-recoveryservicesdatareplication;1.0.0-beta.2;1.0.0-beta.3
com.azure.resourcemanager:azure-resourcemanager-networkanalytics;1.0.0;1.1.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-networkanalytics;1.0.0;1.1.0
com.azure.resourcemanager:azure-resourcemanager-springappdiscovery;1.0.0-beta.2;1.0.0-beta.3
com.azure.resourcemanager:azure-resourcemanager-astro;1.0.0-beta.2;1.0.0-beta.3
com.azure.resourcemanager:azure-resourcemanager-workloadssapvirtualinstance;1.0.0-beta.1;1.0.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
# Release History

## 1.1.0-beta.1 (Unreleased)
## 1.1.0 (2024-12-13)

### Features Added
- Azure Resource Manager Network Analytics client library for Java. This package contains Microsoft Azure SDK for Network Analytics Management SDK. Package tag package-2023-11-15. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).

### Breaking Changes

### Bugs Fixed
#### Serialization/Deserialization change

- `Jackson` is removed from dependency and no longer supported.

##### Migration Guide

### Other Changes
If you are using `Jackson`/`ObjectMapper` for manual serialization/deserialization, configure your `ObjectMapper` for backward compatibility:
```java
objectMapper.registerModule(com.azure.core.serializer.json.jackson.JacksonJsonProvider.getJsonSerializableDatabindModule());
```

## 1.0.0 (2024-01-24)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-networkanalytics</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
</dependency>
```
[//]: # ({x-version-update-end})
Expand All @@ -45,15 +45,11 @@ Azure Management Libraries require a `TokenCredential` implementation for authen

### Authentication

By default, Microsoft Entra ID token authentication depends on correct configuration of the following environment variables.
Microsoft Entra ID token authentication relies on the [credential class][azure_identity_credentials] from [Azure Identity][azure_identity] package.

- `AZURE_CLIENT_ID` for Azure client ID.
- `AZURE_TENANT_ID` for Azure tenant ID.
- `AZURE_CLIENT_SECRET` or `AZURE_CLIENT_CERTIFICATE_PATH` for client secret or client certificate.
Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable.

In addition, Azure subscription ID can be configured via `AZURE_SUBSCRIPTION_ID` environment variable.

With above configuration, `azure` client can be authenticated using the following code:
Assuming the use of the `DefaultAzureCredential` credential class, the client can be authenticated using the following code:

```java
AzureProfile profile = new AzureProfile(AzureEnvironment.AZURE);
Expand Down Expand Up @@ -97,6 +93,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m
[jdk]: https://learn.microsoft.com/azure/developer/java/fundamentals/
[azure_subscription]: https://azure.microsoft.com/free/
[azure_identity]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-java/tree/main/sdk/identity/azure-identity#credentials
[azure_core_http_netty]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/core/azure-core-http-netty
[authenticate]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/AUTH.md
[design]: https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/resourcemanager/docs/DESIGN.md
Expand Down
549 changes: 417 additions & 132 deletions sdk/networkanalytics/azure-resourcemanager-networkanalytics/SAMPLE.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-networkanalytics</artifactId>
<version>1.1.0-beta.1</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-networkanalytics;current} -->
<version>1.1.0</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-networkanalytics;current} -->
<packaging>jar</packaging>

<name>Microsoft Azure SDK for Network Analytics Management</name>
Expand Down Expand Up @@ -45,6 +45,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jacoco.min.linecoverage>0</jacoco.min.linecoverage>
<jacoco.min.branchcoverage>0</jacoco.min.branchcoverage>
<spotless.skip>false</spotless.skip>
</properties>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import com.azure.core.http.HttpPipelinePosition;
import com.azure.core.http.policy.AddDatePolicy;
import com.azure.core.http.policy.AddHeadersFromContextPolicy;
import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
import com.azure.core.http.policy.HttpLogOptions;
import com.azure.core.http.policy.HttpLoggingPolicy;
import com.azure.core.http.policy.HttpPipelinePolicy;
Expand All @@ -19,7 +20,6 @@
import com.azure.core.http.policy.RetryOptions;
import com.azure.core.http.policy.RetryPolicy;
import com.azure.core.http.policy.UserAgentPolicy;
import com.azure.core.management.http.policy.ArmChallengeAuthenticationPolicy;
import com.azure.core.management.profile.AzureProfile;
import com.azure.core.util.Configuration;
import com.azure.core.util.logging.ClientLogger;
Expand Down Expand Up @@ -216,7 +216,7 @@ public NetworkAnalyticsManager authenticate(TokenCredential credential, AzurePro
.append("-")
.append("com.azure.resourcemanager.networkanalytics")
.append("/")
.append("1.0.0");
.append("1.1.0");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder.append(" (")
.append(Configuration.getGlobalConfiguration().get("java.version"))
Expand Down Expand Up @@ -249,7 +249,7 @@ public NetworkAnalyticsManager authenticate(TokenCredential credential, AzurePro
HttpPolicyProviders.addBeforeRetryPolicies(policies);
policies.add(retryPolicy);
policies.add(new AddDatePolicy());
policies.add(new ArmChallengeAuthenticationPolicy(credential, scopes.toArray(new String[0])));
policies.add(new BearerTokenAuthenticationPolicy(credential, scopes.toArray(new String[0])));
policies.addAll(this.policies.stream()
.filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
.collect(Collectors.toList()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
* Details of storage account sas token .
*/
@Fluent
public final class AccountSasTokenInner {
public final class AccountSasTokenInner implements JsonSerializable<AccountSasTokenInner> {
/*
* Field to specify storage account sas token.
*/
@JsonProperty(value = "storageAccountSasToken")
private String storageAccountSasToken;

/**
Expand Down Expand Up @@ -52,10 +55,48 @@ public AccountSasTokenInner withStorageAccountSasToken(String storageAccountSasT
*/
public void validate() {
if (storageAccountSasToken() == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
"Missing required property storageAccountSasToken in model AccountSasTokenInner"));
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property storageAccountSasToken in model AccountSasTokenInner"));
}
}

private static final ClientLogger LOGGER = new ClientLogger(AccountSasTokenInner.class);

/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("storageAccountSasToken", this.storageAccountSasToken);
return jsonWriter.writeEndObject();
}

/**
* Reads an instance of AccountSasTokenInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AccountSasTokenInner if the JsonReader was pointing to an instance of it, or null if it
* was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the AccountSasTokenInner.
*/
public static AccountSasTokenInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AccountSasTokenInner deserializedAccountSasTokenInner = new AccountSasTokenInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

if ("storageAccountSasToken".equals(fieldName)) {
deserializedAccountSasTokenInner.storageAccountSasToken = reader.getString();
} else {
reader.skipChildren();
}
}

return deserializedAccountSasTokenInner;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,20 @@

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
* Details of storage container account sas token .
*/
@Fluent
public final class ContainerSasTokenInner {
public final class ContainerSasTokenInner implements JsonSerializable<ContainerSasTokenInner> {
/*
* Field to specify storage container sas token.
*/
@JsonProperty(value = "storageContainerSasToken")
private String storageContainerSasToken;

/**
Expand Down Expand Up @@ -52,10 +55,48 @@ public ContainerSasTokenInner withStorageContainerSasToken(String storageContain
*/
public void validate() {
if (storageContainerSasToken() == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
"Missing required property storageContainerSasToken in model ContainerSasTokenInner"));
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property storageContainerSasToken in model ContainerSasTokenInner"));
}
}

private static final ClientLogger LOGGER = new ClientLogger(ContainerSasTokenInner.class);

/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("storageContainerSasToken", this.storageContainerSasToken);
return jsonWriter.writeEndObject();
}

/**
* Reads an instance of ContainerSasTokenInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of ContainerSasTokenInner if the JsonReader was pointing to an instance of it, or null if it
* was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the ContainerSasTokenInner.
*/
public static ContainerSasTokenInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
ContainerSasTokenInner deserializedContainerSasTokenInner = new ContainerSasTokenInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

if ("storageContainerSasToken".equals(fieldName)) {
deserializedContainerSasTokenInner.storageContainerSasToken = reader.getString();
} else {
reader.skipChildren();
}
}

return deserializedContainerSasTokenInner;
});
}
}
Loading
Loading