Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ internal static void BuildBatchQuery(RequestUriBuilder builder, SettingSelector

if (selector.Fields != SettingFields.All)
{
var filter = selector.Fields.ToString().ToLowerInvariant();
var filter = selector.Fields.ToString().ToLowerInvariant().Replace("readonly", "locked");
builder.AppendQuery(FieldsQueryFilter, filter);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ public enum SettingFields : uint
/// </summary>
LastModified = 0x0020,
/// <summary>
/// A value indicating whether the configuration setting is locked.
/// A value indicating whether the configuration setting is read-only.
/// </summary>
Locked = 0x0040,
ReadOnly = 0x0040,
/// <summary>
/// A dictionary of tags that can help identify what a configuration setting may be applicable for.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,38 @@ public async Task GetBatchSettingWithFields()
}
}

[Test]
public async Task GetBatchSettingWithReadOnly()
{
ConfigurationClient service = GetClient();

string key = GenerateKeyId("key-");
ConfigurationSetting setting = await service.AddAsync(key, "my_value", "my_label");

try
{
SettingSelector selector = new SettingSelector(key)
{
Fields = SettingFields.Key | SettingFields.ReadOnly
};

List<ConfigurationSetting> batch = await service.GetSettingsAsync(selector, CancellationToken.None).ToEnumerableAsync();

CollectionAssert.IsNotEmpty(batch);
Assert.IsNotNull(batch[0].Key);
Assert.IsNotNull(batch[0].ReadOnly);
Assert.IsNull(batch[0].Label);
Assert.IsNull(batch[0].Value);
Assert.IsNull(batch[0].ContentType);
Assert.IsNull(batch[0].LastModified);
Assert.AreEqual(batch[0].ETag, default(ETag));
}
finally
{
await service.DeleteAsync(setting.Key, setting.Label);
}
}

[Test]
public async Task GetBatchSettingWithAllFields()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
{
"Entries": [
{
"RequestUri": "https://pakrym-azconfig-ui.azconfig.io/kv/key-2113346919?label=my_label\u0026api-version=1.0",
"RequestMethod": "PUT",
"RequestHeaders": {
"Accept": "application/vnd.microsoft.appconfig.kv\u002Bjson",
"Authorization": "Sanitized",
"Content-Length": "50",
"Content-Type": "application/json",
"Date": "Mon, 21 Oct 2019 21:57:00 GMT",
"If-None-Match": "*",
"traceparent": "00-6f300be9bed7ef44b7f8f5d9650520d0-ed27beaf854ccb4c-00",
"User-Agent": [
"azsdk-net-Data.AppConfiguration/1.0.0-dev.20191021.1\u002B7411666538d268ca6e3dc22be837bf2fc502a1be",
"(.NET Core 4.6.28008.01; Microsoft Windows 10.0.18362 )"
],
"x-ms-client-request-id": "b34f80ceea4102b71ca73b5a97455d5f",
"x-ms-content-sha256": "aDaoGrnXeLk4BtC\u002BbcUBHjAOl1G533H6XGiHrRY9PKA=",
"x-ms-return-client-request-id": "true"
},
"RequestBody": {
"value": "my_value",
"content_type": null,
"tags": {}
},
"StatusCode": 200,
"ResponseHeaders": {
"Access-Control-Allow-Credentials": "true",
"Access-Control-Allow-Headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate",
"Access-Control-Allow-Methods": "GET, PUT, POST, DELETE, PATCH, OPTIONS",
"Access-Control-Allow-Origin": "*",
"Access-Control-Expose-Headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate",
"Connection": "keep-alive",
"Content-Type": "application/vnd.microsoft.appconfig.kv\u002Bjson; charset=utf-8",
"Date": "Mon, 21 Oct 2019 21:56:57 GMT",
"ETag": "\u0022CF5BrDQFJWh6lVKjDNiXXfh16gp\u0022",
"Last-Modified": "Mon, 21 Oct 2019 21:56:58 GMT",
"Server": "openresty/1.15.8.1",
"Strict-Transport-Security": "max-age=15724800; includeSubDomains",
"Sync-Token": "zAJw6V16=ODotMSM2OTIyNzk=;sn=692279",
"Transfer-Encoding": "chunked",
"x-ms-client-request-id": "b34f80ceea4102b71ca73b5a97455d5f",
"x-ms-correlation-request-id": "7789606e-150e-4069-b347-d74500e245b5",
"x-ms-request-id": "7789606e-150e-4069-b347-d74500e245b5"
},
"ResponseBody": {
"etag": "CF5BrDQFJWh6lVKjDNiXXfh16gp",
"key": "key-2113346919",
"label": "my_label",
"content_type": null,
"value": "my_value",
"tags": {},
"locked": false,
"last_modified": "2019-10-21T21:56:58\u002B00:00"
}
},
{
"RequestUri": "https://pakrym-azconfig-ui.azconfig.io/kv/?key=key-2113346919\u0026$select=key%2C%20locked\u0026api-version=1.0",
"RequestMethod": "GET",
"RequestHeaders": {
"Accept": "application/vnd.microsoft.appconfig.kv\u002Bjson",
"Authorization": "Sanitized",
"Date": "Mon, 21 Oct 2019 21:57:00 GMT",
"Sync-Token": "zAJw6V16=ODotMSM2OTIyNzk=",
"User-Agent": [
"azsdk-net-Data.AppConfiguration/1.0.0-dev.20191021.1\u002B7411666538d268ca6e3dc22be837bf2fc502a1be",
"(.NET Core 4.6.28008.01; Microsoft Windows 10.0.18362 )"
],
"x-ms-client-request-id": "07e7129d8abf73ade0078a58590b9663",
"x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=",
"x-ms-return-client-request-id": "true"
},
"RequestBody": null,
"StatusCode": 200,
"ResponseHeaders": {
"Access-Control-Allow-Credentials": "true",
"Access-Control-Allow-Headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate",
"Access-Control-Allow-Methods": "GET, PUT, POST, DELETE, PATCH, OPTIONS",
"Access-Control-Allow-Origin": "*",
"Access-Control-Expose-Headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate",
"Connection": "keep-alive",
"Content-Type": "application/vnd.microsoft.appconfig.kvset\u002Bjson; charset=utf-8",
"Date": "Mon, 21 Oct 2019 21:56:58 GMT",
"Server": "openresty/1.15.8.1",
"Strict-Transport-Security": "max-age=15724800; includeSubDomains",
"Sync-Token": "zAJw6V16=ODotMSM2OTIyNzk=;sn=692279",
"Transfer-Encoding": "chunked",
"x-ms-client-request-id": "07e7129d8abf73ade0078a58590b9663",
"x-ms-correlation-request-id": "b76bbe48-3cc2-4071-987e-0b878f5eabe8",
"x-ms-request-id": "b76bbe48-3cc2-4071-987e-0b878f5eabe8"
},
"ResponseBody": {
"items": [
{
"key": "key-2113346919",
"locked": false
}
]
}
},
{
"RequestUri": "https://pakrym-azconfig-ui.azconfig.io/kv/key-2113346919?label=my_label\u0026api-version=1.0",
"RequestMethod": "DELETE",
"RequestHeaders": {
"Authorization": "Sanitized",
"Date": "Mon, 21 Oct 2019 21:57:00 GMT",
"Sync-Token": "zAJw6V16=ODotMSM2OTIyNzk=",
"traceparent": "00-5473f3cb0ceece48b41f5ee01f487cd1-74eb1fd6045f4d42-00",
"User-Agent": [
"azsdk-net-Data.AppConfiguration/1.0.0-dev.20191021.1\u002B7411666538d268ca6e3dc22be837bf2fc502a1be",
"(.NET Core 4.6.28008.01; Microsoft Windows 10.0.18362 )"
],
"x-ms-client-request-id": "2de28083079b955a2e7d07febae05545",
"x-ms-content-sha256": "47DEQpj8HBSa\u002B/TImW\u002B5JCeuQeRkm5NMpJWZG3hSuFU=",
"x-ms-return-client-request-id": "true"
},
"RequestBody": null,
"StatusCode": 200,
"ResponseHeaders": {
"Access-Control-Allow-Credentials": "true",
"Access-Control-Allow-Headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate",
"Access-Control-Allow-Methods": "GET, PUT, POST, DELETE, PATCH, OPTIONS",
"Access-Control-Allow-Origin": "*",
"Access-Control-Expose-Headers": "DNT, X-CustomHeader, Keep-Alive, User-Agent, X-Requested-With, If-Modified-Since, Cache-Control, Content-Type, Authorization, x-ms-client-request-id, x-ms-content-sha256, x-ms-date, host, Accept, Accept-Datetime, Date, If-Match, If-None-Match, Sync-Token, x-ms-return-client-request-id, ETag, Last-Modified, Link, Memento-Datetime, x-ms-retry-after, x-ms-request-id, WWW-Authenticate",
"Connection": "keep-alive",
"Content-Type": "application/vnd.microsoft.appconfig.kv\u002Bjson; charset=utf-8",
"Date": "Mon, 21 Oct 2019 21:56:58 GMT",
"ETag": "\u0022CF5BrDQFJWh6lVKjDNiXXfh16gp\u0022",
"Last-Modified": "Mon, 21 Oct 2019 21:56:58 GMT",
"Server": "openresty/1.15.8.1",
"Strict-Transport-Security": "max-age=15724800; includeSubDomains",
"Sync-Token": "zAJw6V16=ODotMSM2OTIyODA=;sn=692280",
"Transfer-Encoding": "chunked",
"x-ms-client-request-id": "2de28083079b955a2e7d07febae05545",
"x-ms-correlation-request-id": "0777ab69-4a91-40ba-bb37-ddc5e056f8b8",
"x-ms-request-id": "0777ab69-4a91-40ba-bb37-ddc5e056f8b8"
},
"ResponseBody": {
"etag": "CF5BrDQFJWh6lVKjDNiXXfh16gp",
"key": "key-2113346919",
"label": "my_label",
"content_type": null,
"value": "my_value",
"tags": {},
"locked": false,
"last_modified": "2019-10-21T21:56:58\u002B00:00"
}
}
],
"Variables": {
"APPCONFIGURATION_CONNECTION_STRING": "Endpoint=https://pakrym-azconfig-ui.azconfig.io;Id=0-l1-s0:h5pHKElA5IjSL3z\u002BFOYz;Secret=;",
"RandomSeed": "1860226769"
}
}
Loading