Skip to content

Commit

Permalink
[Automation] Generate Fluent Lite from Swagger newrelic#package-2024-…
Browse files Browse the repository at this point in the history
…01-01 (#43468)
  • Loading branch information
azure-sdk authored Dec 19, 2024
1 parent 79ffe5f commit 171e418
Show file tree
Hide file tree
Showing 145 changed files with 3,674 additions and 1,578 deletions.
2 changes: 1 addition & 1 deletion eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ com.azure.resourcemanager:azure-resourcemanager-storagemover;1.2.0;1.3.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-newrelicobservability;1.1.0;1.2.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-newrelicobservability;1.1.0;1.2.0
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
com.azure.resourcemanager:azure-resourcemanager-networkcloud;1.0.0;1.1.0-beta.2
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 (2024-12-19)

### Features Added
- Azure Resource Manager NewRelicObservability client library for Java. This package contains Microsoft Azure SDK for NewRelicObservability Management SDK. Package tag package-2024-01-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 (2024-03-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-newrelicobservability</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 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

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-newrelicobservability</artifactId>
<version>1.2.0-beta.1</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-newrelicobservability;current} -->
<version>1.2.0</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-newrelicobservability;current} -->
<packaging>jar</packaging>

<name>Microsoft Azure SDK for NewRelicObservability 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 @@ -237,7 +237,7 @@ public NewRelicObservabilityManager authenticate(TokenCredential credential, Azu
.append("-")
.append("com.azure.resourcemanager.newrelicobservability")
.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 @@ -270,7 +270,7 @@ public NewRelicObservabilityManager authenticate(TokenCredential credential, Azu
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 @@ -100,7 +100,7 @@ MonitoredSubscriptionPropertiesInner get(String resourceGroupName, String monito
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param monitorName Name of the Monitors resource.
* @param configurationName The configuration name. Only 'default' value is supported.
* @param body The request to update subscriptions needed to be monitored by the NewRelic monitor resource.
* @param body The body 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 Expand Up @@ -134,7 +134,7 @@ MonitoredSubscriptionPropertiesInner createorUpdate(String resourceGroupName, St
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param monitorName Name of the Monitors resource.
* @param configurationName The configuration name. Only 'default' value is supported.
* @param body The request to update subscriptions needed to be monitored by the NewRelic monitor resource.
* @param body The body 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 Expand Up @@ -167,7 +167,7 @@ MonitoredSubscriptionPropertiesInner createorUpdate(String resourceGroupName, St
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param monitorName Name of the Monitors resource.
* @param configurationName The configuration name. Only 'default' value is supported.
* @param body The request to update subscriptions needed to be monitored by the NewRelic monitor resource.
* @param body The body 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 Expand Up @@ -201,7 +201,7 @@ MonitoredSubscriptionPropertiesInner update(String resourceGroupName, String mon
* @param resourceGroupName The name of the resource group. The name is case insensitive.
* @param monitorName Name of the Monitors resource.
* @param configurationName The configuration name. Only 'default' value is supported.
* @param body The request to update subscriptions needed to be monitored by the NewRelic monitor resource.
* @param body The body 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 @@ -5,35 +5,35 @@
package com.azure.resourcemanager.newrelicobservability.fluent.models;

import com.azure.core.annotation.Fluent;
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;

/**
* List of all the New relic accounts for the given user.
*/
@Fluent
public final class AccountProperties {
public final class AccountProperties implements JsonSerializable<AccountProperties> {
/*
* organization id
*/
@JsonProperty(value = "organizationId")
private String organizationId;

/*
* account id
*/
@JsonProperty(value = "accountId")
private String accountId;

/*
* account name
*/
@JsonProperty(value = "accountName")
private String accountName;

/*
* Region where New Relic account is present
*/
@JsonProperty(value = "region")
private String region;

/**
Expand Down Expand Up @@ -129,4 +129,49 @@ public AccountProperties withRegion(String region) {
*/
public void validate() {
}

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

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

if ("organizationId".equals(fieldName)) {
deserializedAccountProperties.organizationId = reader.getString();
} else if ("accountId".equals(fieldName)) {
deserializedAccountProperties.accountId = reader.getString();
} else if ("accountName".equals(fieldName)) {
deserializedAccountProperties.accountName = reader.getString();
} else if ("region".equals(fieldName)) {
deserializedAccountProperties.region = reader.getString();
} else {
reader.skipChildren();
}
}

return deserializedAccountProperties;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
import com.azure.core.annotation.Fluent;
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
* The details of a account resource.
Expand All @@ -17,15 +20,28 @@ public final class AccountResourceInner extends ProxyResource {
/*
* The resource-specific properties for this resource.
*/
@JsonProperty(value = "properties")
private AccountProperties innerProperties;

/*
* Azure Resource Manager metadata containing createdBy and modifiedBy information.
*/
@JsonProperty(value = "systemData", access = JsonProperty.Access.WRITE_ONLY)
private SystemData systemData;

/*
* The type of the resource.
*/
private String type;

/*
* The name of the resource.
*/
private String name;

/*
* Fully qualified resource Id for the resource.
*/
private String id;

/**
* Creates an instance of AccountResourceInner class.
*/
Expand All @@ -50,6 +66,36 @@ public SystemData systemData() {
return this.systemData;
}

/**
* Get the type property: The type of the resource.
*
* @return the type value.
*/
@Override
public String type() {
return this.type;
}

/**
* Get the name property: The name of the resource.
*
* @return the name value.
*/
@Override
public String name() {
return this.name;
}

/**
* Get the id property: Fully qualified resource Id for the resource.
*
* @return the id value.
*/
@Override
public String id() {
return this.id;
}

/**
* Get the organizationId property: organization id.
*
Expand Down Expand Up @@ -152,4 +198,49 @@ public void validate() {
innerProperties().validate();
}
}

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

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

if ("id".equals(fieldName)) {
deserializedAccountResourceInner.id = reader.getString();
} else if ("name".equals(fieldName)) {
deserializedAccountResourceInner.name = reader.getString();
} else if ("type".equals(fieldName)) {
deserializedAccountResourceInner.type = reader.getString();
} else if ("properties".equals(fieldName)) {
deserializedAccountResourceInner.innerProperties = AccountProperties.fromJson(reader);
} else if ("systemData".equals(fieldName)) {
deserializedAccountResourceInner.systemData = SystemData.fromJson(reader);
} else {
reader.skipChildren();
}
}

return deserializedAccountResourceInner;
});
}
}
Loading

0 comments on commit 171e418

Please sign in to comment.