Skip to content
Merged
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 @@ -312,7 +312,7 @@ com.azure.resourcemanager:azure-resourcemanager-redisenterprise;2.0.0;2.1.0-beta
com.azure.resourcemanager:azure-resourcemanager-hybridkubernetes;1.0.0-beta.4;1.0.0-beta.5
com.azure.resourcemanager:azure-resourcemanager-iothub;1.3.0;1.4.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-datadog;1.1.0;1.2.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-communication;2.1.0;2.2.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-communication;2.1.0;2.2.0
com.azure.resourcemanager:azure-resourcemanager-apimanagement;1.0.0-beta.5;1.0.0-beta.6
com.azure.resourcemanager:azure-resourcemanager-kubernetesconfiguration;1.1.0;1.2.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-changeanalysis;1.1.0;1.2.0-beta.1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
# Release History

## 2.2.0-beta.1 (Unreleased)
## 2.2.0 (2024-12-19)

### Features Added
- Azure Resource Manager Communication client library for Java. This package contains Microsoft Azure SDK for Communication Management SDK. REST API for Azure Communication Services. Package tag package-2023-04. 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());
```

## 2.1.0 (2024-03-18)

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-communication</artifactId>
<version>2.1.0</version>
<version>2.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
188 changes: 116 additions & 72 deletions sdk/communication/azure-resourcemanager-communication/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-communication</artifactId>
<version>2.2.0-beta.1</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-communication;current} -->
<version>2.2.0</version> <!-- {x-version-update;com.azure.resourcemanager:azure-resourcemanager-communication;current} -->
<packaging>jar</packaging>

<name>Microsoft Azure SDK for Communication 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 @@ -221,7 +221,7 @@ public CommunicationManager authenticate(TokenCredential credential, AzureProfil
.append("-")
.append("com.azure.resourcemanager.communication")
.append("/")
.append("2.1.0");
.append("2.2.0");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder.append(" (")
.append(Configuration.getGlobalConfiguration().get("java.version"))
Expand Down Expand Up @@ -254,7 +254,7 @@ public CommunicationManager authenticate(TokenCredential credential, AzureProfil
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 @@ -5,30 +5,31 @@
package com.azure.resourcemanager.communication.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.communication.models.CheckNameAvailabilityReason;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.IOException;

/**
* The check availability result.
*/
@Fluent
public final class CheckNameAvailabilityResponseInner {
public final class CheckNameAvailabilityResponseInner implements JsonSerializable<CheckNameAvailabilityResponseInner> {
/*
* Indicates if the resource name is available.
*/
@JsonProperty(value = "nameAvailable")
private Boolean nameAvailable;

/*
* The reason why the given name is not available.
*/
@JsonProperty(value = "reason")
private CheckNameAvailabilityReason reason;

/*
* Detailed reason why the given name is available.
*/
@JsonProperty(value = "message")
private String message;

/**
Expand Down Expand Up @@ -104,4 +105,49 @@ public CheckNameAvailabilityResponseInner withMessage(String message) {
*/
public void validate() {
}

/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeBooleanField("nameAvailable", this.nameAvailable);
jsonWriter.writeStringField("reason", this.reason == null ? null : this.reason.toString());
jsonWriter.writeStringField("message", this.message);
return jsonWriter.writeEndObject();
}

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

if ("nameAvailable".equals(fieldName)) {
deserializedCheckNameAvailabilityResponseInner.nameAvailable
= reader.getNullable(JsonReader::getBoolean);
} else if ("reason".equals(fieldName)) {
deserializedCheckNameAvailabilityResponseInner.reason
= CheckNameAvailabilityReason.fromString(reader.getString());
} else if ("message".equals(fieldName)) {
deserializedCheckNameAvailabilityResponseInner.message = reader.getString();
} else {
reader.skipChildren();
}
}

return deserializedCheckNameAvailabilityResponseInner;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,35 @@
package com.azure.resourcemanager.communication.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;

/**
* A class representing the access keys of a CommunicationService.
*/
@Fluent
public final class CommunicationServiceKeysInner {
public final class CommunicationServiceKeysInner implements JsonSerializable<CommunicationServiceKeysInner> {
/*
* The primary access key.
*/
@JsonProperty(value = "primaryKey")
private String primaryKey;

/*
* The secondary access key.
*/
@JsonProperty(value = "secondaryKey")
private String secondaryKey;

/*
* CommunicationService connection string constructed via the primaryKey
*/
@JsonProperty(value = "primaryConnectionString")
private String primaryConnectionString;

/*
* CommunicationService connection string constructed via the secondaryKey
*/
@JsonProperty(value = "secondaryConnectionString")
private String secondaryConnectionString;

/**
Expand Down Expand Up @@ -131,4 +131,50 @@ public CommunicationServiceKeysInner withSecondaryConnectionString(String second
*/
public void validate() {
}

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

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

if ("primaryKey".equals(fieldName)) {
deserializedCommunicationServiceKeysInner.primaryKey = reader.getString();
} else if ("secondaryKey".equals(fieldName)) {
deserializedCommunicationServiceKeysInner.secondaryKey = reader.getString();
} else if ("primaryConnectionString".equals(fieldName)) {
deserializedCommunicationServiceKeysInner.primaryConnectionString = reader.getString();
} else if ("secondaryConnectionString".equals(fieldName)) {
deserializedCommunicationServiceKeysInner.secondaryConnectionString = reader.getString();
} else {
reader.skipChildren();
}
}

return deserializedCommunicationServiceKeysInner;
});
}
}
Loading