Skip to content

Commit fd5cbfe

Browse files
authored
[AppConfig-Customization] getEtag to getETag (#35814)
1 parent 3f53f5d commit fd5cbfe

File tree

6 files changed

+31
-30
lines changed

6 files changed

+31
-30
lines changed

sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationAsyncClient.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
import static com.azure.data.appconfiguration.implementation.ConfigurationSettingDeserializationHelper.toConfigurationSettingWithResponse;
4545
import static com.azure.data.appconfiguration.implementation.Utility.ETAG_ANY;
4646
import static com.azure.data.appconfiguration.implementation.Utility.addTracingNamespace;
47-
import static com.azure.data.appconfiguration.implementation.Utility.getEtag;
47+
import static com.azure.data.appconfiguration.implementation.Utility.getETag;
4848
import static com.azure.data.appconfiguration.implementation.Utility.iterableToList;
4949
import static com.azure.data.appconfiguration.implementation.Utility.toKeyValue;
5050
import static com.azure.data.appconfiguration.implementation.Utility.toSettingFieldsList;
@@ -568,7 +568,7 @@ public Mono<Response<ConfigurationSetting>> setConfigurationSettingWithResponse(
568568
return withContext(
569569
context -> validateSettingAsync(setting).flatMap(
570570
settingInternal -> serviceClient.putKeyValueWithResponseAsync(settingInternal.getKey(),
571-
settingInternal.getLabel(), getEtag(ifUnchanged, settingInternal), null,
571+
settingInternal.getLabel(), getETag(ifUnchanged, settingInternal), null,
572572
toKeyValue(settingInternal), addTracingNamespace(context))
573573
.map(response -> toConfigurationSettingWithResponse(response))));
574574
}
@@ -716,7 +716,7 @@ public Mono<Response<ConfigurationSetting>> getConfigurationSettingWithResponse(
716716
settingInternal ->
717717
serviceClient.getKeyValueWithResponseAsync(settingInternal.getKey(), settingInternal.getLabel(),
718718
acceptDateTime == null ? null : acceptDateTime.toString(), null,
719-
getEtag(ifChanged, settingInternal), null, addTracingNamespace(context))
719+
getETag(ifChanged, settingInternal), null, addTracingNamespace(context))
720720
.onErrorResume(
721721
HttpResponseException.class,
722722
(Function<Throwable, Mono<ResponseBase<GetKeyValueHeaders, KeyValue>>>) throwable -> {
@@ -850,7 +850,7 @@ public Mono<Response<ConfigurationSetting>> deleteConfigurationSettingWithRespon
850850
boolean ifUnchanged) {
851851
return withContext(context -> validateSettingAsync(setting).flatMap(
852852
settingInternal -> serviceClient.deleteKeyValueWithResponseAsync(settingInternal.getKey(),
853-
settingInternal.getLabel(), getEtag(ifUnchanged, settingInternal), addTracingNamespace(context))
853+
settingInternal.getLabel(), getETag(ifUnchanged, settingInternal), addTracingNamespace(context))
854854
.map(response -> toConfigurationSettingWithResponse(response))));
855855
}
856856

@@ -1311,7 +1311,7 @@ public Mono<ConfigurationSettingSnapshot> archiveSnapshot(String name) {
13111311
* <!-- end com.azure.data.appconfiguration.configurationasyncclient.archiveSnapshotMaxOverload -->
13121312
*
13131313
* @param snapshot The snapshot to be archived.
1314-
* @param ifUnchanged Flag indicating if the {@code snapshot} {@link ConfigurationSettingSnapshot#getEtag ETag} is
1314+
* @param ifUnchanged Flag indicating if the {@code snapshot} {@link ConfigurationSettingSnapshot#getETag ETag} is
13151315
* used as a IF-MATCH header.
13161316
* @return A {@link Mono} of {@link ConfigurationSettingSnapshot}.
13171317
*/
@@ -1365,7 +1365,7 @@ public Mono<ConfigurationSettingSnapshot> recoverSnapshot(String name) {
13651365
* <!-- end com.azure.data.appconfiguration.configurationasyncclient.recoverSnapshotMaxOverload -->
13661366
*
13671367
* @param snapshot The snapshot to be archived.
1368-
* @param ifUnchanged Flag indicating if the {@code snapshot} {@link ConfigurationSettingSnapshot#getEtag()} ETag}
1368+
* @param ifUnchanged Flag indicating if the {@code snapshot} {@link ConfigurationSettingSnapshot#getETag()} ETag}
13691369
* is used as an IF-MATCH header.
13701370
* @return A {@link Mono} of {@link ConfigurationSettingSnapshot}.
13711371
*/

sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/ConfigurationClient.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
import static com.azure.data.appconfiguration.implementation.Utility.ETAG_ANY;
4444
import static com.azure.data.appconfiguration.implementation.Utility.addTracingNamespace;
4545
import static com.azure.data.appconfiguration.implementation.Utility.enableSyncRestProxy;
46-
import static com.azure.data.appconfiguration.implementation.Utility.getEtag;
46+
import static com.azure.data.appconfiguration.implementation.Utility.getETag;
4747
import static com.azure.data.appconfiguration.implementation.Utility.iterableToList;
4848
import static com.azure.data.appconfiguration.implementation.Utility.toKeyValue;
4949
import static com.azure.data.appconfiguration.implementation.Utility.toSettingFieldsList;
@@ -573,7 +573,7 @@ public Response<ConfigurationSetting> setConfigurationSettingWithResponse(Config
573573
validateSetting(setting);
574574
final ResponseBase<PutKeyValueHeaders, KeyValue> response =
575575
serviceClient.putKeyValueWithResponse(setting.getKey(), setting.getLabel(),
576-
getEtag(ifUnchanged, setting), null, toKeyValue(setting),
576+
getETag(ifUnchanged, setting), null, toKeyValue(setting),
577577
enableSyncRestProxy(addTracingNamespace(context)));
578578
return toConfigurationSettingWithResponse(response);
579579
}
@@ -720,7 +720,7 @@ public Response<ConfigurationSetting> getConfigurationSettingWithResponse(Config
720720
final ResponseBase<GetKeyValueHeaders, KeyValue> response =
721721
serviceClient.getKeyValueWithResponse(setting.getKey(), setting.getLabel(),
722722
acceptDateTime == null ? null : acceptDateTime.toString(), null,
723-
getEtag(ifChanged, setting), null, enableSyncRestProxy(addTracingNamespace(context)));
723+
getETag(ifChanged, setting), null, enableSyncRestProxy(addTracingNamespace(context)));
724724
return toConfigurationSettingWithResponse(response);
725725
} catch (HttpResponseException ex) {
726726
final HttpResponse httpResponse = ex.getResponse();
@@ -846,7 +846,7 @@ public Response<ConfigurationSetting> deleteConfigurationSettingWithResponse(Con
846846
validateSetting(setting);
847847
final ResponseBase<DeleteKeyValueHeaders, KeyValue> response =
848848
serviceClient.deleteKeyValueWithResponse(setting.getKey(), setting.getLabel(),
849-
getEtag(ifUnchanged, setting), enableSyncRestProxy(addTracingNamespace(context)));
849+
getETag(ifUnchanged, setting), enableSyncRestProxy(addTracingNamespace(context)));
850850
return toConfigurationSettingWithResponse(response);
851851
}
852852

@@ -1358,7 +1358,7 @@ public ConfigurationSettingSnapshot archiveSnapshot(String name) {
13581358
* <!-- end com.azure.data.appconfiguration.configurationclient.archiveSnapshotByNameMaxOverload -->
13591359
*
13601360
* @param snapshot The snapshot to be archived.
1361-
* @param ifUnchanged Flag indicating if the {@code snapshot} {@link ConfigurationSettingSnapshot#getEtag ETag} is
1361+
* @param ifUnchanged Flag indicating if the {@code snapshot} {@link ConfigurationSettingSnapshot#getETag ETag} is
13621362
* used as a IF-MATCH header.
13631363
* @param context Additional context that is passed through the Http pipeline during the service call.
13641364
* @return A {@link Response} of {@link ConfigurationSettingSnapshot}.
@@ -1408,7 +1408,7 @@ public ConfigurationSettingSnapshot recoverSnapshot(String name) {
14081408
* <!-- end com.azure.data.appconfiguration.configurationclient.recoverSnapshotMaxOverload -->
14091409
*
14101410
* @param snapshot The snapshot to be archived.
1411-
* @param ifUnchanged Flag indicating if the {@code snapshot} {@link ConfigurationSettingSnapshot#getEtag()} ETag}
1411+
* @param ifUnchanged Flag indicating if the {@code snapshot} {@link ConfigurationSettingSnapshot#getETag()} ETag}
14121412
* is used as an IF-MATCH header.
14131413
* @param context Additional context that is passed through the Http pipeline during the service call.
14141414
* @return A {@link Response} of {@link ConfigurationSettingSnapshot}.

sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/implementation/Utility.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,16 @@ private static String getETagValue(String etag) {
105105
* Get HTTP header value, if-match or if-none-match.. Used to perform an operation only if the targeted resource's
106106
* etag matches the value provided.
107107
*/
108-
public static String getEtag(boolean isEtagRequired, ConfigurationSetting setting) {
109-
return isEtagRequired ? getETagValue(setting.getETag()) : null;
108+
public static String getETag(boolean isETagRequired, ConfigurationSetting setting) {
109+
return isETagRequired ? getETagValue(setting.getETag()) : null;
110110
}
111111

112-
public static String getEtagSnapshot(boolean isEtagRequired, ConfigurationSettingSnapshot snapshot) {
113-
if (!isEtagRequired) {
112+
public static String getETagSnapshot(boolean isETagRequired, ConfigurationSettingSnapshot snapshot) {
113+
if (!isETagRequired) {
114114
return null;
115115
}
116116
Objects.requireNonNull(snapshot);
117-
return getETagValue(snapshot.getEtag());
117+
return getETagValue(snapshot.getETag());
118118
}
119119

120120
/*
@@ -166,7 +166,7 @@ public static Response<ConfigurationSettingSnapshot> updateSnapshotSync(String s
166166
final ResponseBase<UpdateSnapshotHeaders, ConfigurationSettingSnapshot> response =
167167
serviceClient.updateSnapshotWithResponse(snapshotName,
168168
new SnapshotUpdateParameters().setStatus(status),
169-
getEtagSnapshot(ifUnchanged, snapshot), null, context);
169+
getETagSnapshot(ifUnchanged, snapshot), null, context);
170170
return new SimpleResponse<>(response, response.getValue());
171171
}
172172

@@ -175,7 +175,7 @@ public static Mono<Response<ConfigurationSettingSnapshot>> updateSnapshotAsync(S
175175
AzureAppConfigurationImpl serviceClient) {
176176
return serviceClient.updateSnapshotWithResponseAsync(snapshotName,
177177
new SnapshotUpdateParameters().setStatus(status),
178-
getEtagSnapshot(ifUnchanged, snapshot),
178+
getETagSnapshot(ifUnchanged, snapshot),
179179
null)
180180
.map(response -> new SimpleResponse<>(response, response.getValue()));
181181
}

sdk/appconfiguration/azure-data-appconfiguration/src/main/java/com/azure/data/appconfiguration/models/ConfigurationSettingSnapshot.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public final class ConfigurationSettingSnapshot implements JsonSerializable<Conf
7777
/*
7878
* A value representing the current state of the snapshot.
7979
*/
80-
private String etag;
80+
private String eTag;
8181

8282
/**
8383
* Creates an instance of ConfigurationSettingSnapshot class.
@@ -223,12 +223,12 @@ public ConfigurationSettingSnapshot setTags(Map<String, String> tags) {
223223
}
224224

225225
/**
226-
* Get the etag property: A value representing the current state of the snapshot.
226+
* Get the eTag property: A value representing the current state of the snapshot.
227227
*
228-
* @return the etag value.
228+
* @return the eTag value.
229229
*/
230-
public String getEtag() {
231-
return this.etag;
230+
public String getETag() {
231+
return this.eTag;
232232
}
233233

234234
@Override
@@ -244,7 +244,7 @@ public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
244244
jsonWriter.writeNumberField("size", this.size);
245245
jsonWriter.writeNumberField("items_count", this.itemCount);
246246
jsonWriter.writeMapField("tags", this.tags, (writer, element) -> writer.writeString(element));
247-
jsonWriter.writeStringField("etag", this.etag);
247+
jsonWriter.writeStringField("etag", this.eTag);
248248
return jsonWriter.writeEndObject();
249249
}
250250

@@ -271,7 +271,7 @@ public static ConfigurationSettingSnapshot fromJson(JsonReader jsonReader) throw
271271
Long size = null;
272272
Long itemCount = null;
273273
Map<String, String> tags = null;
274-
String etag = null;
274+
String eTag = null;
275275
while (reader.nextToken() != JsonToken.END_OBJECT) {
276276
String fieldName = reader.getFieldName();
277277
reader.nextToken();
@@ -302,7 +302,7 @@ public static ConfigurationSettingSnapshot fromJson(JsonReader jsonReader) throw
302302
} else if ("tags".equals(fieldName)) {
303303
tags = reader.readMap(reader1 -> reader1.getString());
304304
} else if ("etag".equals(fieldName)) {
305-
etag = reader.getString();
305+
eTag = reader.getString();
306306
} else {
307307
reader.skipChildren();
308308
}
@@ -319,7 +319,7 @@ public static ConfigurationSettingSnapshot fromJson(JsonReader jsonReader) throw
319319
deserializedConfigurationSettingSnapshot.size = size;
320320
deserializedConfigurationSettingSnapshot.itemCount = itemCount;
321321
deserializedConfigurationSettingSnapshot.tags = tags;
322-
deserializedConfigurationSettingSnapshot.etag = etag;
322+
deserializedConfigurationSettingSnapshot.eTag = eTag;
323323

324324
return deserializedConfigurationSettingSnapshot;
325325
}

sdk/appconfiguration/azure-data-appconfiguration/src/test/java/com/azure/data/appconfiguration/ConfigurationClientTestBase.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ void assertEqualsConfigurationSettingSnapshot(String name, SnapshotStatus snapsh
819819
assertNotNull(actualSnapshot.getCreatedAt());
820820
assertEquals(itemCount, actualSnapshot.getItemCount());
821821
assertNotNull(actualSnapshot.getSize());
822-
assertNotNull(actualSnapshot.getEtag());
822+
assertNotNull(actualSnapshot.getETag());
823823

824824
if (!CoreUtils.isNullOrEmpty(tags)) {
825825
assertEquals(tags, actualSnapshot.getTags());

sdk/appconfiguration/azure-data-appconfiguration/swagger/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ customization-class: src/main/java/AppConfigCustomization.java
4141
```yaml
4242
output-folder: ..\
4343
java: true
44-
use: '@autorest/java@4.1.16'
44+
use: '@autorest/java@4.1.17'
4545
enable-sync-stack: true
4646
generate-client-interfaces: false
4747
generate-client-as-impl: true
@@ -65,6 +65,7 @@ directive:
6565
$["items_count"]["x-ms-client-name"] = "item_count";
6666
$["created"]["x-ms-client-name"] = "createdAt";
6767
$["expires"]["x-ms-client-name"] = "expiresAt";
68+
$["etag"]["x-ms-client-name"] = "eTag";
6869
```
6970
7071
### Renames

0 commit comments

Comments
 (0)