Skip to content

Commit

Permalink
[Automation] Generate Fluent Lite from Swagger storagemover#package-2…
Browse files Browse the repository at this point in the history
…024-07 (#43543)
  • Loading branch information
azure-sdk authored Dec 23, 2024
1 parent 361dcff commit 31d8ff6
Show file tree
Hide file tree
Showing 85 changed files with 3,031 additions and 846 deletions.
2 changes: 1 addition & 1 deletion eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ com.azure.resourcemanager:azure-resourcemanager-billingbenefits;1.0.0-beta.2;1.0
com.azure.resourcemanager:azure-resourcemanager-providerhub;1.1.0;1.2.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-reservations;1.0.0-beta.3;1.0.0-beta.4
com.azure.resourcemanager:azure-resourcemanager-containerservicefleet;1.1.0;1.2.0-beta.2
com.azure.resourcemanager:azure-resourcemanager-storagemover;1.2.0;1.3.0-beta.1
com.azure.resourcemanager:azure-resourcemanager-storagemover;1.2.0;1.3.0
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
Expand Down
33 changes: 29 additions & 4 deletions sdk/storagemover/azure-resourcemanager-storagemover/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,39 @@
# Release History

## 1.3.0-beta.1 (Unreleased)
## 1.3.0 (2024-12-23)

### Features Added
- Azure Resource Manager Storage Mover client library for Java. This package contains Microsoft Azure SDK for Storage Mover Management SDK. The Azure Storage Mover REST API. Package tag package-2024-07. 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

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());
```

#### `StorageMoverManager` was modified

* `fluent.StorageMoverClient serviceClient()` -> `fluent.StorageMoverManagementClient serviceClient()`

#### `models.Minute` was modified

* `fromInt(int)` was removed

### Features Added

#### `models.Minute` was modified

### Other Changes
* `getValue()` was added
* `hashCode()` was added
* `equals(java.lang.Object)` was added
* `toString()` was added
* `fromValue(java.lang.Integer)` was added

## 1.2.0 (2024-06-24)

Expand Down
19 changes: 8 additions & 11 deletions sdk/storagemover/azure-resourcemanager-storagemover/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Azure Resource Manager StorageMover client library for Java
# Azure Resource Manager Storage Mover client library for Java

Azure Resource Manager StorageMover client library for Java.
Azure Resource Manager Storage Mover client library for Java.

This package contains Microsoft Azure SDK for StorageMover Management SDK. The Azure Storage Mover REST API. Package tag package-2024-07. For documentation on how to use this package, please see [Azure Management Libraries for Java](https://aka.ms/azsdk/java/mgmt).
This package contains Microsoft Azure SDK for Storage Mover Management SDK. The Azure Storage Mover REST API. Package tag package-2024-07. 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

Expand Down Expand Up @@ -32,7 +32,7 @@ Various documentation is available to help you get started
<dependency>
<groupId>com.azure.resourcemanager</groupId>
<artifactId>azure-resourcemanager-storagemover</artifactId>
<version>1.2.0</version>
<version>1.3.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 @@ -104,6 +100,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
8 changes: 5 additions & 3 deletions sdk/storagemover/azure-resourcemanager-storagemover/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

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

<name>Microsoft Azure SDK for StorageMover Management</name>
<description>This package contains Microsoft Azure SDK for StorageMover Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Azure Storage Mover REST API. Package tag package-2024-07.</description>
<name>Microsoft Azure SDK for Storage Mover Management</name>
<description>This package contains Microsoft Azure SDK for Storage Mover Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. The Azure Storage Mover REST API. Package tag package-2024-07.</description>
<url>https://github.com/Azure/azure-sdk-for-java</url>

<licenses>
Expand All @@ -45,6 +45,8 @@
<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>
<revapi.skip>true</revapi.skip>
</properties>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@
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.HttpLoggingPolicy;
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;
import com.azure.core.http.policy.HttpPolicyProviders;
import com.azure.core.http.policy.RequestIdPolicy;
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;
import com.azure.resourcemanager.storagemover.fluent.StorageMoverClient;
import com.azure.resourcemanager.storagemover.fluent.StorageMoverManagementClient;
import com.azure.resourcemanager.storagemover.implementation.AgentsImpl;
import com.azure.resourcemanager.storagemover.implementation.EndpointsImpl;
import com.azure.resourcemanager.storagemover.implementation.JobDefinitionsImpl;
import com.azure.resourcemanager.storagemover.implementation.JobRunsImpl;
import com.azure.resourcemanager.storagemover.implementation.OperationsImpl;
import com.azure.resourcemanager.storagemover.implementation.ProjectsImpl;
import com.azure.resourcemanager.storagemover.implementation.StorageMoverClientBuilder;
import com.azure.resourcemanager.storagemover.implementation.StorageMoverManagementClientBuilder;
import com.azure.resourcemanager.storagemover.implementation.StorageMoversImpl;
import com.azure.resourcemanager.storagemover.models.Agents;
import com.azure.resourcemanager.storagemover.models.Endpoints;
Expand Down Expand Up @@ -65,24 +65,24 @@ public final class StorageMoverManager {

private JobRuns jobRuns;

private final StorageMoverClient clientObject;
private final StorageMoverManagementClient clientObject;

private StorageMoverManager(HttpPipeline httpPipeline, AzureProfile profile, Duration defaultPollInterval) {
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
Objects.requireNonNull(profile, "'profile' cannot be null.");
this.clientObject = new StorageMoverClientBuilder().pipeline(httpPipeline)
this.clientObject = new StorageMoverManagementClientBuilder().pipeline(httpPipeline)
.endpoint(profile.getEnvironment().getResourceManagerEndpoint())
.subscriptionId(profile.getSubscriptionId())
.defaultPollInterval(defaultPollInterval)
.buildClient();
}

/**
* Creates an instance of StorageMover service API entry point.
* Creates an instance of Storage Mover service API entry point.
*
* @param credential the credential to use.
* @param profile the Azure profile for client.
* @return the StorageMover service API instance.
* @return the Storage Mover service API instance.
*/
public static StorageMoverManager authenticate(TokenCredential credential, AzureProfile profile) {
Objects.requireNonNull(credential, "'credential' cannot be null.");
Expand All @@ -91,11 +91,11 @@ public static StorageMoverManager authenticate(TokenCredential credential, Azure
}

/**
* Creates an instance of StorageMover service API entry point.
* Creates an instance of Storage Mover service API entry point.
*
* @param httpPipeline the {@link HttpPipeline} configured with Azure authentication credential.
* @param profile the Azure profile for client.
* @return the StorageMover service API instance.
* @return the Storage Mover service API instance.
*/
public static StorageMoverManager authenticate(HttpPipeline httpPipeline, AzureProfile profile) {
Objects.requireNonNull(httpPipeline, "'httpPipeline' cannot be null.");
Expand Down Expand Up @@ -214,11 +214,11 @@ public Configurable withDefaultPollInterval(Duration defaultPollInterval) {
}

/**
* Creates an instance of StorageMover service API entry point.
* Creates an instance of Storage Mover service API entry point.
*
* @param credential the credential to use.
* @param profile the Azure profile for client.
* @return the StorageMover service API instance.
* @return the Storage Mover service API instance.
*/
public StorageMoverManager authenticate(TokenCredential credential, AzureProfile profile) {
Objects.requireNonNull(credential, "'credential' cannot be null.");
Expand All @@ -229,7 +229,7 @@ public StorageMoverManager authenticate(TokenCredential credential, AzureProfile
.append("-")
.append("com.azure.resourcemanager.storagemover")
.append("/")
.append("1.2.0");
.append("1.3.0");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder.append(" (")
.append(Configuration.getGlobalConfiguration().get("java.version"))
Expand Down Expand Up @@ -262,7 +262,7 @@ public StorageMoverManager authenticate(TokenCredential credential, AzureProfile
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 Expand Up @@ -360,12 +360,12 @@ public JobRuns jobRuns() {
}

/**
* Gets wrapped service client StorageMoverClient providing direct access to the underlying auto-generated API
* implementation, based on Azure REST API.
* Gets wrapped service client StorageMoverManagementClient providing direct access to the underlying auto-generated
* API implementation, based on Azure REST API.
*
* @return Wrapped service client StorageMoverClient.
* @return Wrapped service client StorageMoverManagementClient.
*/
public StorageMoverClient serviceClient() {
public StorageMoverManagementClient serviceClient() {
return this.clientObject;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
import java.time.Duration;

/**
* The interface for StorageMoverClient class.
* The interface for StorageMoverManagementClient class.
*/
public interface StorageMoverClient {
public interface StorageMoverManagementClient {
/**
* Gets The ID of the target subscription.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.storagemover.models.AgentPropertiesErrorDetails;
import com.azure.resourcemanager.storagemover.models.AgentStatus;
import com.azure.resourcemanager.storagemover.models.ProvisioningState;
import com.azure.resourcemanager.storagemover.models.UploadLimitSchedule;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.IOException;
import java.time.OffsetDateTime;

/**
Expand All @@ -23,15 +26,28 @@ public final class AgentInner extends ProxyResource {
/*
* The properties property.
*/
@JsonProperty(value = "properties", required = true)
private AgentProperties innerProperties = new AgentProperties();

/*
* 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 AgentInner class.
*/
Expand All @@ -56,6 +72,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 description property: A description for the Agent.
*
Expand Down Expand Up @@ -259,4 +305,49 @@ public void validate() {
}

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

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

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

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

return deserializedAgentInner;
});
}
}
Loading

0 comments on commit 31d8ff6

Please sign in to comment.