Skip to content

Commit 9336a4b

Browse files
[EventHubs] Migrate to TypeSpec (#48673)
1 parent eaaa764 commit 9336a4b

File tree

231 files changed

+9669
-6007
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+9669
-6007
lines changed

eng/lintingconfigs/revapi/track2/revapi.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,38 @@
769769
},
770770
"justification": "Pageable models moved to implementation package. Unlikely used by user."
771771
},
772+
{
773+
"code": "java.method.visibilityReduced",
774+
"old" : {
775+
"matcher": "regex",
776+
"match": "method void com\\.azure\\.resourcemanager\\.eventhubs\\.models\\..*\\:\\:\\<init\\>\\(\\)"
777+
},
778+
"justification": "Output-only immutable models' constructors are now private."
779+
},
780+
{
781+
"code": "java.method.visibilityReduced",
782+
"old" : {
783+
"matcher": "regex",
784+
"match": "method .* com\\.azure\\.resourcemanager\\.eventhubs\\.models\\..*\\:\\:with.*\\(.*\\).*"
785+
},
786+
"justification": "Output-only immutable models' setters are now package-private if it's being used by child class."
787+
},
788+
{
789+
"code": "java.method.removed",
790+
"old" : {
791+
"matcher": "regex",
792+
"match": "method .* com\\.azure\\.resourcemanager\\.eventhubs\\.models\\..*\\:\\:with.*\\(.*\\).*"
793+
},
794+
"justification": "Output-only immutable models' setters are removed if no explicit usage."
795+
},
796+
{
797+
"code": "java.class.removed",
798+
"old" : {
799+
"matcher": "regex",
800+
"match": "class com\\.azure\\.resourcemanager\\.eventhubs\\.models\\..*(ListResult|List)"
801+
},
802+
"justification": "Pageable models moved to implementation package. Unlikely used by user."
803+
},
772804
{
773805
"ignore": true,
774806
"code": "java.method.removed",

sdk/cosmos/azure-resourcemanager-cosmos/src/main/java/com/azure/resourcemanager/cosmos/implementation/CosmosDBAccountImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,12 @@ public CosmosDBAccountImpl disableLocalAuth() {
806806
return this;
807807
}
808808

809+
@Override
810+
public CosmosDBAccountImpl enableLocalAuth() {
811+
this.innerModel().withDisableLocalAuth(false);
812+
return this;
813+
}
814+
809815
@Override
810816
public CosmosDBAccountImpl enableAutomaticFailover() {
811817
this.innerModel().withEnableAutomaticFailover(true);

sdk/cosmos/azure-resourcemanager-cosmos/src/main/java/com/azure/resourcemanager/cosmos/models/CosmosDBAccount.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ interface WithOptionals extends Resource.UpdateWithTags<WithOptionals>, Appliabl
592592
UpdateStages.WithConsistencyPolicy, UpdateStages.WithVirtualNetworkRule, UpdateStages.WithMultipleLocations,
593593
UpdateStages.WithConnector, UpdateStages.WithKeyBasedMetadataWriteAccess,
594594
UpdateStages.WithPrivateEndpointConnection, UpdateStages.WithIpRules, UpdateStages.WithPublicNetworkAccess,
595-
UpdateStages.WithAutomaticFailover {
595+
UpdateStages.WithAutomaticFailover, UpdateStages.WithLocalAuth {
596596
}
597597

598598
/** The stage of the cosmos db definition allowing the definition of a write location. */
@@ -816,5 +816,28 @@ default Update disableAutomaticFailover() {
816816
throw new UnsupportedOperationException("[disableAutomaticFailover] is not supported in " + getClass());
817817
}
818818
}
819+
820+
/**
821+
* The stage of CosmosDB account update allowing to configure local auth settings.
822+
*/
823+
interface WithLocalAuth {
824+
/**
825+
* Disables local auth for the CosmosDB account.
826+
*
827+
* @return the next stage of the update
828+
*/
829+
default Update disableLocalAuth() {
830+
throw new UnsupportedOperationException("[disableLocalAuth] is not supported in " + getClass());
831+
}
832+
833+
/**
834+
* Enables local auth for the CosmosDB account.
835+
*
836+
* @return the next stage of the update
837+
*/
838+
default Update enableLocalAuth() {
839+
throw new UnsupportedOperationException("[enableLocalAuth] is not supported in " + getClass());
840+
}
841+
}
819842
}
820843
}

sdk/eventhubs/azure-resourcemanager-eventhubs/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
### Features Added
66

7+
- Supported `disableLocalAuth()` and `enableLocalAuth()` in `EventHubNamespace`.
8+
79
### Breaking Changes
810

911
### Bugs Fixed

sdk/eventhubs/azure-resourcemanager-eventhubs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ For documentation on how to use this package, please see [Azure Management Libra
1818
<dependency>
1919
<groupId>com.azure.resourcemanager</groupId>
2020
<artifactId>azure-resourcemanager-eventhubs</artifactId>
21-
<version>2.53.1</version>
21+
<version>2.54.0-beta.1</version>
2222
</dependency>
2323
```
2424
[//]: # ({x-version-update-end})

sdk/eventhubs/azure-resourcemanager-eventhubs/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "java",
44
"TagPrefix": "java/eventhubs/azure-resourcemanager-eventhubs",
5-
"Tag": "java/eventhubs/azure-resourcemanager-eventhubs_7f9757c7bd"
5+
"Tag": "java/eventhubs/azure-resourcemanager-eventhubs_aef499556f"
66
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
6+
<parent>
7+
<groupId>com.azure</groupId>
8+
<artifactId>azure-code-customization-parent</artifactId>
9+
<version>1.0.0-beta.1</version> <!-- {x-version-update;com.azure:azure-code-customization-parent;current} -->
10+
<relativePath>../../../parents/azure-code-customization-parent</relativePath>
11+
</parent>
12+
13+
<groupId>com.azure.resourcemanager</groupId>
14+
<artifactId>azure-resourcemanager-eventhubs-customization</artifactId>
15+
<version>1.0.0-beta.1</version>
16+
<modelVersion>4.0.0</modelVersion>
17+
</project>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
import com.azure.autorest.customization.ClassCustomization;
5+
import com.azure.autorest.customization.Customization;
6+
import com.azure.autorest.customization.LibraryCustomization;
7+
import com.azure.autorest.customization.PackageCustomization;
8+
import com.github.javaparser.ast.type.ClassOrInterfaceType;
9+
import org.slf4j.Logger;
10+
11+
/**
12+
* Code customization after code generation.
13+
*/
14+
public class EventHubsCustomization extends Customization {
15+
@Override
16+
public void customize(LibraryCustomization customization, Logger logger) {
17+
PackageCustomization fluentModelsPackage = customization.getPackage("com.azure.resourcemanager.eventhubs.fluent.models");
18+
// change base class from `ProxyResource` to `Resource`, to avoid breaking changes and compilation errors
19+
customizeResourceBaseClass(fluentModelsPackage.getClass("EHNamespaceInner"));
20+
customizeResourceBaseClass(fluentModelsPackage.getClass("ClusterInner"));
21+
}
22+
23+
/**
24+
* Customize the base class to be "com.azure.core.management.Resource".
25+
*
26+
* @param customization the customization for class
27+
*/
28+
private static void customizeResourceBaseClass(ClassCustomization customization) {
29+
customization.customizeAst(ast -> {
30+
ast.getClassByName(customization.getClassName()).ifPresent(clazz -> {
31+
String resourceClassName = "com.azure.core.management.Resource";
32+
ast.addImport(resourceClassName);
33+
clazz.getExtendedTypes().clear();
34+
clazz.addExtendedType(new ClassOrInterfaceType(null, "Resource"));
35+
});
36+
});
37+
}
38+
}

0 commit comments

Comments
 (0)