Skip to content

Commit 0cf0541

Browse files
authored
mgmt, local generation for Cosmos DB 2025-04-15 Stable SDK (#45273)
* generated codes * update changelog * fix test exception * update record session * fix test exception * update record session * fix comments of interface * fix for comments * fix comments
1 parent 856ef02 commit 0cf0541

File tree

206 files changed

+590
-356
lines changed

Some content is hidden

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

206 files changed

+590
-356
lines changed

sdk/resourcemanager/api-specs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
"dir": "azure-resourcemanager-cosmos",
8383
"source": "specification/cosmos-db/resource-manager/readme.md",
8484
"package": "com.azure.resourcemanager.cosmos",
85-
"args": "--tag=package-2024-11-15 --modelerfour.lenient-model-deduplication --rename-model=DataTransferServiceResourceCreateUpdateProperties:DataTransferServiceResourceCreateUpdateParameters,GraphApiComputeServiceResourceCreateUpdateProperties:GraphApiComputeServiceResourceCreateUpdateParameters,MaterializedViewsBuilderServiceResourceCreateUpdateProperties:MaterializedViewsBuilderServiceResourceCreateUpdateParameters,SqlDedicatedGatewayServiceResourceCreateUpdateProperties:SqlDedicatedGatewayServiceResourceCreateUpdateParameters --enable-sync-stack=false"
85+
"args": "--tag=package-2025-04-15 --modelerfour.lenient-model-deduplication --rename-model=DataTransferServiceResourceCreateUpdateProperties:DataTransferServiceResourceCreateUpdateParameters,GraphApiComputeServiceResourceCreateUpdateProperties:GraphApiComputeServiceResourceCreateUpdateParameters,MaterializedViewsBuilderServiceResourceCreateUpdateProperties:MaterializedViewsBuilderServiceResourceCreateUpdateParameters,SqlDedicatedGatewayServiceResourceCreateUpdateProperties:SqlDedicatedGatewayServiceResourceCreateUpdateParameters --enable-sync-stack=false"
8686
},
8787
"deploymentstacks": {
8888
"dir": "azure-resourcemanager-resources",

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
## 2.51.0-beta.1 (Unreleased)
44

5-
### Features Added
6-
7-
### Breaking Changes
5+
### Other Changes
86

9-
### Bugs Fixed
7+
#### Dependency Updates
108

11-
### Other Changes
9+
- Updated `api-version` to `2025-04-15`.
1210

1311
## 2.50.0 (2025-04-24)
1412

sdk/resourcemanager/azure-resourcemanager-cosmos/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/resourcemanager/azure-resourcemanager-cosmos",
5-
"Tag": "java/resourcemanager/azure-resourcemanager-cosmos_18217f87ff"
5+
"Tag": "java/resourcemanager/azure-resourcemanager-cosmos_b947f3e69a"
66
}

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,12 @@ public Mono<PrivateEndpointConnection> getPrivateEndpointConnectionAsync(String
228228

229229
@Override
230230
public boolean multipleWriteLocationsEnabled() {
231-
return this.innerModel().enableMultipleWriteLocations();
231+
return ResourceManagerUtils.toPrimitiveBoolean(this.innerModel().enableMultipleWriteLocations());
232232
}
233233

234234
@Override
235235
public boolean cassandraConnectorEnabled() {
236-
return this.innerModel().enableCassandraConnector();
236+
return ResourceManagerUtils.toPrimitiveBoolean(this.innerModel().enableCassandraConnector());
237237
}
238238

239239
@Override
@@ -243,7 +243,7 @@ public ConnectorOffer cassandraConnectorOffer() {
243243

244244
@Override
245245
public boolean keyBasedMetadataWriteAccessDisabled() {
246-
return this.innerModel().disableKeyBasedMetadataWriteAccess();
246+
return ResourceManagerUtils.toPrimitiveBoolean(this.innerModel().disableKeyBasedMetadataWriteAccess());
247247
}
248248

249249
@Override
@@ -317,6 +317,11 @@ public Mono<Void> regenerateKeyAsync(KeyKind keyKind) {
317317
new DatabaseAccountRegenerateKeyParameters().withKeyKind(keyKind));
318318
}
319319

320+
@Override
321+
public boolean localAuthDisabled() {
322+
return ResourceManagerUtils.toPrimitiveBoolean(this.innerModel().disableLocalAuth());
323+
}
324+
320325
@Override
321326
public CosmosDBAccountImpl withKind(DatabaseAccountKind kind) {
322327
this.innerModel().withKind(kind);
@@ -508,7 +513,7 @@ private DatabaseAccountCreateUpdateParameters createUpdateParametersInner(Databa
508513
this.virtualNetworkRulesMap = null;
509514
}
510515
createUpdateParametersInner.withPublicNetworkAccess(inner.publicNetworkAccess());
511-
516+
createUpdateParametersInner.withDisableLocalAuth(inner.disableLocalAuth());
512517
return createUpdateParametersInner;
513518
}
514519

@@ -790,6 +795,12 @@ public CosmosDBAccountImpl disablePublicNetworkAccess() {
790795
return this;
791796
}
792797

798+
@Override
799+
public CosmosDBAccountImpl disableLocalAuth() {
800+
this.innerModel().withDisableLocalAuth(true);
801+
return this;
802+
}
803+
793804
interface HasLocations {
794805
String location();
795806

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ public ServicesClient getServices() {
674674
this.defaultPollInterval = defaultPollInterval;
675675
this.subscriptionId = subscriptionId;
676676
this.endpoint = endpoint;
677-
this.apiVersion = "2024-11-15";
677+
this.apiVersion = "2025-04-15";
678678
this.databaseAccounts = new DatabaseAccountsClientImpl(this);
679679
this.operations = new OperationsClientImpl(this);
680680
this.databases = new DatabasesClientImpl(this);

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,13 @@ public interface CosmosDBAccount extends GroupableResource<CosmosManager, Databa
299299
*/
300300
Mono<Void> regenerateKeyAsync(KeyKind keyKind);
301301

302+
/**
303+
* Checks whether local auth is disabled.
304+
*
305+
* @return whether local auth is disabled or not.
306+
*/
307+
boolean localAuthDisabled();
308+
302309
/** Grouping of cosmos db definition stages. */
303310
interface Definition extends DefinitionStages.Blank, DefinitionStages.WithGroup, DefinitionStages.WithKind,
304311
DefinitionStages.WithWriteReplication, DefinitionStages.WithReadReplication, DefinitionStages.WithCreate {
@@ -527,13 +534,23 @@ interface WithPublicNetworkAccess {
527534
WithCreate disablePublicNetworkAccess();
528535
}
529536

537+
/** The stage of CosmosDB account definition allowing to configure local auth settings. */
538+
interface WithLocalAuth {
539+
/**
540+
* Disables local auth for the CosmosDB account.
541+
*
542+
* @return the next stage of the definition
543+
*/
544+
WithCreate disableLocalAuth();
545+
}
546+
530547
/**
531548
* The stage of the definition which contains all the minimum required inputs for the resource to be created,
532549
* but also allows for any other optional settings to be specified.
533550
*/
534551
interface WithCreate extends Creatable<CosmosDBAccount>, WithConsistencyPolicy, WithReadReplication,
535552
WithIpRules, WithVirtualNetworkRule, WithMultipleLocations, WithConnector, WithKeyBasedMetadataWriteAccess,
536-
WithPrivateEndpointConnection, DefinitionWithTags<WithCreate>, WithPublicNetworkAccess {
553+
WithPrivateEndpointConnection, DefinitionWithTags<WithCreate>, WithPublicNetworkAccess, WithLocalAuth {
537554
}
538555
}
539556

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

Lines changed: 4 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import com.azure.json.JsonToken;
1111
import com.azure.json.JsonWriter;
1212
import java.io.IOException;
13-
import java.time.OffsetDateTime;
1413
import java.util.LinkedHashMap;
1514
import java.util.List;
1615
import java.util.Map;
@@ -30,16 +29,6 @@ public final class DataTransferServiceResourceProperties extends ServiceResource
3029
*/
3130
private List<DataTransferRegionalServiceResource> locations;
3231

33-
/*
34-
* Describes the status of a service.
35-
*/
36-
private ServiceStatus status;
37-
38-
/*
39-
* Time of the last state change (ISO-8601 format).
40-
*/
41-
private OffsetDateTime creationTime;
42-
4332
/**
4433
* Creates an instance of DataTransferServiceResourceProperties class.
4534
*/
@@ -65,26 +54,6 @@ public List<DataTransferRegionalServiceResource> locations() {
6554
return this.locations;
6655
}
6756

68-
/**
69-
* Get the status property: Describes the status of a service.
70-
*
71-
* @return the status value.
72-
*/
73-
@Override
74-
public ServiceStatus status() {
75-
return this.status;
76-
}
77-
78-
/**
79-
* Get the creationTime property: Time of the last state change (ISO-8601 format).
80-
*
81-
* @return the creationTime value.
82-
*/
83-
@Override
84-
public OffsetDateTime creationTime() {
85-
return this.creationTime;
86-
}
87-
8857
/**
8958
* {@inheritDoc}
9059
*/
@@ -150,17 +119,17 @@ public static DataTransferServiceResourceProperties fromJson(JsonReader jsonRead
150119
reader.nextToken();
151120

152121
if ("creationTime".equals(fieldName)) {
153-
deserializedDataTransferServiceResourceProperties.creationTime = reader
154-
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
122+
deserializedDataTransferServiceResourceProperties.withCreationTime(reader
123+
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString())));
155124
} else if ("instanceSize".equals(fieldName)) {
156125
deserializedDataTransferServiceResourceProperties
157126
.withInstanceSize(ServiceSize.fromString(reader.getString()));
158127
} else if ("instanceCount".equals(fieldName)) {
159128
deserializedDataTransferServiceResourceProperties
160129
.withInstanceCount(reader.getNullable(JsonReader::getInt));
161130
} else if ("status".equals(fieldName)) {
162-
deserializedDataTransferServiceResourceProperties.status
163-
= ServiceStatus.fromString(reader.getString());
131+
deserializedDataTransferServiceResourceProperties
132+
.withStatus(ServiceStatus.fromString(reader.getString()));
164133
} else if ("serviceType".equals(fieldName)) {
165134
deserializedDataTransferServiceResourceProperties.serviceType
166135
= ServiceType.fromString(reader.getString());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
// Code generated by Microsoft (R) AutoRest Code Generator.
4+
5+
package com.azure.resourcemanager.cosmos.models;
6+
7+
import com.azure.core.annotation.Fluent;
8+
import com.azure.core.util.logging.ClientLogger;
9+
import com.azure.json.JsonReader;
10+
import com.azure.json.JsonSerializable;
11+
import com.azure.json.JsonToken;
12+
import com.azure.json.JsonWriter;
13+
import java.io.IOException;
14+
15+
/**
16+
* Represents the full text path specification.
17+
*/
18+
@Fluent
19+
public final class FullTextPath implements JsonSerializable<FullTextPath> {
20+
/*
21+
* The path to the full text field in the document.
22+
*/
23+
private String path;
24+
25+
/*
26+
* The language of the full text field in the document.
27+
*/
28+
private String language;
29+
30+
/**
31+
* Creates an instance of FullTextPath class.
32+
*/
33+
public FullTextPath() {
34+
}
35+
36+
/**
37+
* Get the path property: The path to the full text field in the document.
38+
*
39+
* @return the path value.
40+
*/
41+
public String path() {
42+
return this.path;
43+
}
44+
45+
/**
46+
* Set the path property: The path to the full text field in the document.
47+
*
48+
* @param path the path value to set.
49+
* @return the FullTextPath object itself.
50+
*/
51+
public FullTextPath withPath(String path) {
52+
this.path = path;
53+
return this;
54+
}
55+
56+
/**
57+
* Get the language property: The language of the full text field in the document.
58+
*
59+
* @return the language value.
60+
*/
61+
public String language() {
62+
return this.language;
63+
}
64+
65+
/**
66+
* Set the language property: The language of the full text field in the document.
67+
*
68+
* @param language the language value to set.
69+
* @return the FullTextPath object itself.
70+
*/
71+
public FullTextPath withLanguage(String language) {
72+
this.language = language;
73+
return this;
74+
}
75+
76+
/**
77+
* Validates the instance.
78+
*
79+
* @throws IllegalArgumentException thrown if the instance is not valid.
80+
*/
81+
public void validate() {
82+
if (path() == null) {
83+
throw LOGGER.atError()
84+
.log(new IllegalArgumentException("Missing required property path in model FullTextPath"));
85+
}
86+
}
87+
88+
private static final ClientLogger LOGGER = new ClientLogger(FullTextPath.class);
89+
90+
/**
91+
* {@inheritDoc}
92+
*/
93+
@Override
94+
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
95+
jsonWriter.writeStartObject();
96+
jsonWriter.writeStringField("path", this.path);
97+
jsonWriter.writeStringField("language", this.language);
98+
return jsonWriter.writeEndObject();
99+
}
100+
101+
/**
102+
* Reads an instance of FullTextPath from the JsonReader.
103+
*
104+
* @param jsonReader The JsonReader being read.
105+
* @return An instance of FullTextPath if the JsonReader was pointing to an instance of it, or null if it was
106+
* pointing to JSON null.
107+
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
108+
* @throws IOException If an error occurs while reading the FullTextPath.
109+
*/
110+
public static FullTextPath fromJson(JsonReader jsonReader) throws IOException {
111+
return jsonReader.readObject(reader -> {
112+
FullTextPath deserializedFullTextPath = new FullTextPath();
113+
while (reader.nextToken() != JsonToken.END_OBJECT) {
114+
String fieldName = reader.getFieldName();
115+
reader.nextToken();
116+
117+
if ("path".equals(fieldName)) {
118+
deserializedFullTextPath.path = reader.getString();
119+
} else if ("language".equals(fieldName)) {
120+
deserializedFullTextPath.language = reader.getString();
121+
} else {
122+
reader.skipChildren();
123+
}
124+
}
125+
126+
return deserializedFullTextPath;
127+
});
128+
}
129+
}

0 commit comments

Comments
 (0)