Skip to content

Commit

Permalink
[Automation] Generate Fluent Lite from Swagger devcenter#package-2024…
Browse files Browse the repository at this point in the history
…-02 (#43206)
  • Loading branch information
azure-sdk authored Dec 4, 2024
1 parent 5221cbf commit c3f494c
Show file tree
Hide file tree
Showing 345 changed files with 7,435 additions and 2,570 deletions.
15 changes: 11 additions & 4 deletions sdk/devcenter/azure-resourcemanager-devcenter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
# Release History

## 1.0.0-beta.8 (Unreleased)
## 1.0.0-beta.8 (2024-12-04)

### Features Added
- Azure Resource Manager DevCenter client library for Java. This package contains Microsoft Azure SDK for DevCenter Management SDK. DevCenter Management API. Package tag package-2024-02. 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-beta.7 (2024-04-23)

Expand Down
13 changes: 5 additions & 8 deletions sdk/devcenter/azure-resourcemanager-devcenter/README.md
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-devcenter</artifactId>
<version>1.0.0-beta.7</version>
<version>1.0.0-beta.8</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
335 changes: 231 additions & 104 deletions sdk/devcenter/azure-resourcemanager-devcenter/SAMPLE.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions sdk/devcenter/azure-resourcemanager-devcenter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<jacoco.min.linecoverage>0</jacoco.min.linecoverage>
<jacoco.min.branchcoverage>0</jacoco.min.branchcoverage>
<revapi.skip>true</revapi.skip>
<spotless.skip>false</spotless.skip>
</properties>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
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;
Expand All @@ -34,11 +34,11 @@
import com.azure.resourcemanager.devcenter.implementation.EnvironmentDefinitionsImpl;
import com.azure.resourcemanager.devcenter.implementation.EnvironmentTypesImpl;
import com.azure.resourcemanager.devcenter.implementation.GalleriesImpl;
import com.azure.resourcemanager.devcenter.implementation.ImagesImpl;
import com.azure.resourcemanager.devcenter.implementation.ImageVersionsImpl;
import com.azure.resourcemanager.devcenter.implementation.ImagesImpl;
import com.azure.resourcemanager.devcenter.implementation.NetworkConnectionsImpl;
import com.azure.resourcemanager.devcenter.implementation.OperationsImpl;
import com.azure.resourcemanager.devcenter.implementation.OperationStatusesImpl;
import com.azure.resourcemanager.devcenter.implementation.OperationsImpl;
import com.azure.resourcemanager.devcenter.implementation.PoolsImpl;
import com.azure.resourcemanager.devcenter.implementation.ProjectAllowedEnvironmentTypesImpl;
import com.azure.resourcemanager.devcenter.implementation.ProjectCatalogEnvironmentDefinitionsImpl;
Expand All @@ -57,11 +57,11 @@
import com.azure.resourcemanager.devcenter.models.EnvironmentDefinitions;
import com.azure.resourcemanager.devcenter.models.EnvironmentTypes;
import com.azure.resourcemanager.devcenter.models.Galleries;
import com.azure.resourcemanager.devcenter.models.Images;
import com.azure.resourcemanager.devcenter.models.ImageVersions;
import com.azure.resourcemanager.devcenter.models.Images;
import com.azure.resourcemanager.devcenter.models.NetworkConnections;
import com.azure.resourcemanager.devcenter.models.Operations;
import com.azure.resourcemanager.devcenter.models.OperationStatuses;
import com.azure.resourcemanager.devcenter.models.Operations;
import com.azure.resourcemanager.devcenter.models.Pools;
import com.azure.resourcemanager.devcenter.models.ProjectAllowedEnvironmentTypes;
import com.azure.resourcemanager.devcenter.models.ProjectCatalogEnvironmentDefinitions;
Expand Down Expand Up @@ -293,7 +293,7 @@ public DevCenterManager authenticate(TokenCredential credential, AzureProfile pr
.append("-")
.append("com.azure.resourcemanager.devcenter")
.append("/")
.append("1.0.0-beta.7");
.append("1.0.0-beta.8");
if (!Configuration.getGlobalConfiguration().get("AZURE_TELEMETRY_DISABLED", false)) {
userAgentBuilder.append(" (")
.append(Configuration.getGlobalConfiguration().get("java.version"))
Expand Down Expand Up @@ -326,7 +326,7 @@ public DevCenterManager authenticate(TokenCredential credential, AzureProfile pr
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 @@ -7,8 +7,11 @@
import com.azure.core.annotation.Immutable;
import com.azure.core.management.ProxyResource;
import com.azure.core.management.SystemData;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.devcenter.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.IOException;

/**
* Represents an allowed environment type.
Expand All @@ -18,15 +21,28 @@ public final class AllowedEnvironmentTypeInner extends ProxyResource {
/*
* Properties of an allowed environment type.
*/
@JsonProperty(value = "properties")
private AllowedEnvironmentTypeProperties 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 AllowedEnvironmentTypeInner class.
*/
Expand All @@ -51,6 +67,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 provisioningState property: The provisioning state of the resource.
*
Expand Down Expand Up @@ -79,4 +125,50 @@ 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 AllowedEnvironmentTypeInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of AllowedEnvironmentTypeInner 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 AllowedEnvironmentTypeInner.
*/
public static AllowedEnvironmentTypeInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
AllowedEnvironmentTypeInner deserializedAllowedEnvironmentTypeInner = new AllowedEnvironmentTypeInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

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

return deserializedAllowedEnvironmentTypeInner;
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,26 @@
package com.azure.resourcemanager.devcenter.fluent.models;

import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.devcenter.models.ProvisioningState;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.IOException;

/**
* Properties of an allowed environment type.
*/
@Immutable
public final class AllowedEnvironmentTypeProperties {
public final class AllowedEnvironmentTypeProperties implements JsonSerializable<AllowedEnvironmentTypeProperties> {
/*
* The provisioning state of the resource.
*/
@JsonProperty(value = "provisioningState", access = JsonProperty.Access.WRITE_ONLY)
private ProvisioningState provisioningState;

/*
* The display name of the allowed environment type.
*/
@JsonProperty(value = "displayName", access = JsonProperty.Access.WRITE_ONLY)
private String displayName;

/**
Expand Down Expand Up @@ -56,4 +58,43 @@ public String displayName() {
*/
public void validate() {
}

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

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

if ("provisioningState".equals(fieldName)) {
deserializedAllowedEnvironmentTypeProperties.provisioningState
= ProvisioningState.fromString(reader.getString());
} else if ("displayName".equals(fieldName)) {
deserializedAllowedEnvironmentTypeProperties.displayName = reader.getString();
} else {
reader.skipChildren();
}
}

return deserializedAllowedEnvironmentTypeProperties;
});
}
}
Loading

0 comments on commit c3f494c

Please sign in to comment.