Skip to content

Commit

Permalink
Fix rest doc links for app config samples (Azure#17127)
Browse files Browse the repository at this point in the history
  • Loading branch information
weshaggard authored and annelo-msft committed Feb 17, 2021
1 parent b610149 commit 1bd46df
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sdk/appconfiguration/Azure.Data.AppConfiguration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ This project has adopted the [Microsoft Open Source Code of Conduct][code_of_con
[source_root]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/appconfiguration/Azure.Data.AppConfiguration/src
[source_samples]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/appconfiguration/Azure.Data.AppConfiguration/samples
[reference_docs]: https://azure.github.io/azure-sdk-for-net/appconfiguration.html
[azconfig_rest]: https://github.com/Azure/AppConfiguration#rest-api-reference
[azconfig_rest]: https://docs.microsoft.com/azure/azure-app-configuration/rest-api
[azure_cli]: https://docs.microsoft.com/cli/azure
[azure_sub]: https://azure.microsoft.com/free/
[configuration_client_class]: https://github.com/Azure/azure-sdk-for-net/blob/master/sdk/appconfiguration/Azure.Data.AppConfiguration/src/ConfigurationClient.cs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ await client.SetConfigurationSettingAsync(instancesToUpdate);

## Search by label filter

To gather all the information available for the "production" environment, call `GetConfigurationSettingsAsync` with a setting selector that filters for settings with the "production" label. This will retrieve all the Configuration Settings in the store that satisfy that condition. See App Configuration [REST API](https://github.com/Azure/AppConfiguration/blob/master/docs/REST/kv.md#filtering) for more information about filtering.
To gather all the information available for the "production" environment, call `GetConfigurationSettingsAsync` with a setting selector that filters for settings with the "production" label. This will retrieve all the Configuration Settings in the store that satisfy that condition. See App Configuration [REST API](https://docs.microsoft.com/azure/azure-app-configuration/rest-api-key-value#filtering) for more information about filtering.

```C# Snippet:AzConfigSample2_GetConfigurationSettingsAsync
var selector = new SettingSelector { LabelFilter = "production" };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ await client.SetConfigurationSettingAsync(setting);

## Retrieve revisions of the setting

To asynchronously get all unexpired revisions, call `GetRevisionsAsync` with a setting selector that has `KeyFilter` equal to `settings.Key`. This will retrieve all revisions of this setting in the store. See App Configuration [REST API](https://github.com/Azure/AppConfiguration/blob/master/docs/REST/revisions.md#filtering) for more information about filtering.
To asynchronously get all unexpired revisions, call `GetRevisionsAsync` with a setting selector that has `KeyFilter` equal to `settings.Key`. This will retrieve all revisions of this setting in the store. See App Configuration [REST API](https://docs.microsoft.com/azure/azure-app-configuration/rest-api-revisions#filtering) for more information about filtering.

```C# Snippet:AzConfigSample4_GetRevisions
var selector = new SettingSelector { KeyFilter = setting.Key };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This sample illustrates how to get a setting from the configuration store only i

## Define method `GetConfigurationSettingIfChanged`

When `GetConfigurationSetting` is called with `onlyIfChanged: true`, it adds an `If-None-Match` header to the HTTP request. The response will have an HTTP status code equals to either 200 if the setting value was modified or 304 otherwise. See App Configuration [REST API](https://github.com/Azure/AppConfiguration/blob/master/docs/REST/kv.md#get-conditionally) and [Azure API design](https://azure.github.io/azure-sdk/general_design.html#conditional-requests) for more information about conditional requests.
When `GetConfigurationSetting` is called with `onlyIfChanged: true`, it adds an `If-None-Match` header to the HTTP request. The response will have an HTTP status code equals to either 200 if the setting value was modified or 304 otherwise. See App Configuration [REST API](https://docs.microsoft.com/azure/azure-app-configuration/rest-api-key-value#get-conditionally) and [Azure API design](https://azure.github.io/azure-sdk/general_design.html#conditional-requests) for more information about conditional requests.

This logic can be encapsulated into a helper method that will return either a setting from the response if it was changed in the configuration store or the current local setting otherwise. The method must check the response's HTTP status code before accessing the response value. If `response.Value` is accessed when no value was returned, an exception will be thrown.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private int ReleaseVMs(int vmsToRelease)

## Define method `UpdateAvailableVms`

When `SetConfigurationSetting` is called with `onlyIfUnchanged: true`, it adds optional `If-Match` header to the HTTP request. Response will have HTTP status code equals to either 200 if client setting ETag matched the service one and setting has been successfully updated or 412 otherwise. See App Configuration [REST API](https://github.com/Azure/AppConfiguration/blob/master/docs/REST/kv.md#set-key-conditionally) and [Azure API design](https://azure.github.io/azure-sdk/general_design.html#conditional-requests) for more information about conditional requests.
When `SetConfigurationSetting` is called with `onlyIfUnchanged: true`, it adds optional `If-Match` header to the HTTP request. Response will have HTTP status code equals to either 200 if client setting ETag matched the service one and setting has been successfully updated or 412 otherwise. See App Configuration [REST API](https://docs.microsoft.com/azure/azure-app-configuration/rest-api-key-value#get-conditionally) and [Azure API design](https://azure.github.io/azure-sdk/general_design.html#conditional-requests) for more information about conditional requests.

To increase the number of available VMs, we need to get current number of VMs, add the number of released ones and send this number back to the service. If the `available_vms` setting has been modified since the last time our client retrieved it from the service, we need to catch `RequestFailedException` exception and re-apply our update logic before attempting to set it again on the service. This logic can be encapsulates into a helper method that will return the number of available VMs after the update.

Expand Down

0 comments on commit 1bd46df

Please sign in to comment.