Skip to content

Commit

Permalink
[Automation] Generate Fluent Lite from Swagger paloaltonetworks#packa…
Browse files Browse the repository at this point in the history
…ge-2023-09-01 (#43710)
  • Loading branch information
azure-sdk authored Jan 6, 2025
1 parent 4003419 commit db1de13
Show file tree
Hide file tree
Showing 265 changed files with 7,727 additions and 3,736 deletions.
2 changes: 1 addition & 1 deletion eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ com.azure.resourcemanager:azure-resourcemanager-containerservicefleet;1.1.0;1.2.
com.azure.resourcemanager:azure-resourcemanager-storagemover;1.3.0;1.4.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-graphservices;1.1.0;1.2.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-voiceservices;1.1.0;1.2.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-paloaltonetworks-ngfw;1.1.0;1.2.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-paloaltonetworks-ngfw;1.1.0;1.2.0
com.azure.resourcemanager:azure-resourcemanager-newrelicobservability;1.2.0;1.3.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-qumulo;1.1.0;1.2.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-selfhelp;1.0.0;1.1.0-beta.6
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
# Release History

## 1.2.0-beta.1 (Unreleased)
## 1.2.0 (2025-01-06)

### Features Added
- Azure Resource Manager PaloAlto Networks Ngfw client library for Java. This package contains Microsoft Azure SDK for PaloAlto Networks Ngfw Management SDK. Package tag package-2023-09-01. 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.1.0 (2023-11-15)

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-paloaltonetworks-ngfw</artifactId>
<version>1.1.0</version>
<version>1.2.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 All @@ -74,6 +70,15 @@ See [API design][design] for general introduction on design and key concepts on

## Examples

```java
localRulestackResource = paloAltoNetworksNgfwManager.localRulestacks()
.define(localRulestackName)
.withRegion(REGION)
.withExistingResourceGroup(resourceGroupName)
.withDefaultMode(DefaultMode.NONE)
.withScope(ScopeType.LOCAL)
.create();
```
[Code snippets and samples](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/paloaltonetworks/azure-resourcemanager-paloaltonetworks-ngfw/SAMPLE.md)


Expand All @@ -97,6 +102,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
1,971 changes: 1,506 additions & 465 deletions sdk/paloaltonetworks/azure-resourcemanager-paloaltonetworks-ngfw/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-paloaltonetworks-ngfw</artifactId>
<version>1.2.0-beta.1</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-paloaltonetworks-ngfw;current} -->
<version>1.2.0</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-paloaltonetworks-ngfw;current} -->
<packaging>jar</packaging>

<name>Microsoft Azure SDK for PaloAlto Networks Ngfw 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 Expand Up @@ -81,8 +82,6 @@
<version>4.11.0</version> <!-- {x-version-update;org.mockito:mockito-core;external_dependency} -->
<scope>test</scope>
</dependency>
<!-- bytebuddy dependencies are required for mockito 4.11.0 to work with Java 21. Mockito 4.11.0 is the last release -->
<!-- of Mockito supporting Java 8 as a baseline. -->
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
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 @@ -256,7 +256,7 @@ public PaloAltoNetworksNgfwManager authenticate(TokenCredential credential, Azur
.append("-")
.append("com.azure.resourcemanager.paloaltonetworks.ngfw")
.append("/")
.append("1.1.0");
.append("1.2.0");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder.append(" (")
.append(Configuration.getGlobalConfiguration().get("java.version"))
Expand Down Expand Up @@ -289,7 +289,7 @@ public PaloAltoNetworksNgfwManager authenticate(TokenCredential credential, Azur
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 @@ -329,7 +329,7 @@ Response<SupportInfoInner> getSupportInfoWithResponse(String resourceGroupName,
*
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param firewallName Firewall resource name.
* @param logSettings Log Settings for Firewall.
* @param logSettings The logSettings parameter.
* @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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,26 @@

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

/**
* advanced security object.
*/
@Fluent
public final class AdvSecurityObjectListResponseInner {
public final class AdvSecurityObjectListResponseInner implements JsonSerializable<AdvSecurityObjectListResponseInner> {
/*
* response value
*/
@JsonProperty(value = "value", required = true)
private AdvSecurityObjectModel value;

/*
* next link
*/
@JsonProperty(value = "nextLink")
private String nextLink;

/**
Expand Down Expand Up @@ -79,12 +81,54 @@ public AdvSecurityObjectListResponseInner withNextLink(String nextLink) {
*/
public void validate() {
if (value() == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
"Missing required property value in model AdvSecurityObjectListResponseInner"));
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property value in model AdvSecurityObjectListResponseInner"));
} else {
value().validate();
}
}

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

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

/**
* Reads an instance of AdvSecurityObjectListResponseInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AdvSecurityObjectListResponseInner 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 AdvSecurityObjectListResponseInner.
*/
public static AdvSecurityObjectListResponseInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AdvSecurityObjectListResponseInner deserializedAdvSecurityObjectListResponseInner
= new AdvSecurityObjectListResponseInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

if ("value".equals(fieldName)) {
deserializedAdvSecurityObjectListResponseInner.value = AdvSecurityObjectModel.fromJson(reader);
} else if ("nextLink".equals(fieldName)) {
deserializedAdvSecurityObjectListResponseInner.nextLink = reader.getString();
} else {
reader.skipChildren();
}
}

return deserializedAdvSecurityObjectListResponseInner;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,49 +6,47 @@

import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.BooleanEnum;
import com.azure.resourcemanager.paloaltonetworks.ngfw.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.IOException;

/**
* certificate used for inbound and outbound decryption.
*/
@Fluent
public final class CertificateObject {
public final class CertificateObject implements JsonSerializable<CertificateObject> {
/*
* Resource Id of certificate signer, to be populated only when certificateSelfSigned is false
*/
@JsonProperty(value = "certificateSignerResourceId")
private String certificateSignerResourceId;

/*
* use certificate self signed
*/
@JsonProperty(value = "certificateSelfSigned", required = true)
private BooleanEnum certificateSelfSigned;

/*
* comment for this object
*/
@JsonProperty(value = "auditComment")
private String auditComment;

/*
* user description for this object
*/
@JsonProperty(value = "description")
private String description;

/*
* read only string representing last create or update
*/
@JsonProperty(value = "etag")
private String etag;

/*
* Provisioning state of the resource.
*/
@JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
private ProvisioningState provisioningState;

/**
Expand Down Expand Up @@ -175,10 +173,63 @@ public ProvisioningState provisioningState() {
*/
public void validate() {
if (certificateSelfSigned() == null) {
throw LOGGER.logExceptionAsError(new IllegalArgumentException(
"Missing required property certificateSelfSigned in model CertificateObject"));
throw LOGGER.atError()
.log(new IllegalArgumentException(
"Missing required property certificateSelfSigned in model CertificateObject"));
}
}

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

/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("certificateSelfSigned",
this.certificateSelfSigned == null ? null : this.certificateSelfSigned.toString());
jsonWriter.writeStringField("certificateSignerResourceId", this.certificateSignerResourceId);
jsonWriter.writeStringField("auditComment", this.auditComment);
jsonWriter.writeStringField("description", this.description);
jsonWriter.writeStringField("etag", this.etag);
return jsonWriter.writeEndObject();
}

/**
* Reads an instance of CertificateObject from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of CertificateObject 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 CertificateObject.
*/
public static CertificateObject fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
CertificateObject deserializedCertificateObject = new CertificateObject();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

if ("certificateSelfSigned".equals(fieldName)) {
deserializedCertificateObject.certificateSelfSigned = BooleanEnum.fromString(reader.getString());
} else if ("certificateSignerResourceId".equals(fieldName)) {
deserializedCertificateObject.certificateSignerResourceId = reader.getString();
} else if ("auditComment".equals(fieldName)) {
deserializedCertificateObject.auditComment = reader.getString();
} else if ("description".equals(fieldName)) {
deserializedCertificateObject.description = reader.getString();
} else if ("etag".equals(fieldName)) {
deserializedCertificateObject.etag = reader.getString();
} else if ("provisioningState".equals(fieldName)) {
deserializedCertificateObject.provisioningState = ProvisioningState.fromString(reader.getString());
} else {
reader.skipChildren();
}
}

return deserializedCertificateObject;
});
}
}
Loading

0 comments on commit db1de13

Please sign in to comment.