Skip to content

Commit

Permalink
Get latest (#6841)
Browse files Browse the repository at this point in the history
* Ignore null headers and allow full url paths (#6760)

* Add changelog to artifacts if it exists (#6746)

* AzConfig: User provided Customized Headers Policy  (#6544)

Added support for user-provided customized headers

* Publish test results even if build is canceled (#6780)

- If build is cancelled due to agent timeout, some tests results may have already been generated and should still be published

* More tests on fluxUtil and Base64Util (#6770)

* Added response decoder configuration to fix max header size issue (#6690)

* Add eventhub properties to processing spans (#6768)

* Add "eng" folder to core path triggers (#6803)

- Aligns Java with other languages

* Added support for ADLS Error Mapping (#6753)

* Added changeLog for azure-core (#6805)

* Added changeLog for azure-core

* Added overloads that do not overwrite by default (#6774)

* Add connection string null or empty message error (#6811)

* 'connectionString' cannot be null or empty.

* Setting selector filter  (#6693)

Allowed user to define KeyFilter and LabelFilter

* Fixes wrong property file name with unknown name and unknown version (#6813)

* fixes wrong property file name and update headers for all json files

* Shorten tracing span names (#6810)

* This will snapshot the repo state for analysis if the build fails. (#6826)

* Capture repo state during build. (#6828)

* Remove repo capture logic (#6836)

* Removes the repo capture logic since it is relatively expensive.

* Move to condition for repo capture so we can do it easily in the future.
  • Loading branch information
tzhanl authored Dec 13, 2019
1 parent 99ff12d commit bc602a7
Show file tree
Hide file tree
Showing 123 changed files with 9,780 additions and 6,193 deletions.
6 changes: 5 additions & 1 deletion eng/pipelines/templates/jobs/archetype-sdk-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ jobs:
displayName: 'Publish Artifacts $(ArtifactName)'
artifact: '$(ArtifactName)'

- publish: $(System.DefaultWorkingDirectory)
condition: and(eq(variables['CaptureRepositoryOnFailure'], 'true'), failed())
displayName: 'Capture repo state for analysis'
artifact: repository

- job: 'Analyze'
condition: ne(variables['Skip.Analyze'], 'true')
Expand Down Expand Up @@ -286,7 +290,7 @@ jobs:
goals: ${{ parameters.TestGoals }}

- task: PublishTestResults@2
condition: succeededOrFailed()
condition: always()
inputs:
mergeTestResults: true
testRunTitle: '$(OSName) on Java $(JavaVersion)'
2 changes: 1 addition & 1 deletion eng/pipelines/templates/jobs/archetype-sdk-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
env: ${{ parameters.EnvVars }}

- task: PublishTestResults@2
condition: succeededOrFailed()
condition: always()
inputs:
mergeTestResults: true
testRunTitle: 'Live tests for ${{ parameters.ServiceDirectory }} $(DisplayName)'
Expand Down
2 changes: 1 addition & 1 deletion eng/versioning/version_client.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ com.azure:azure-sdk-all;1.0.0;1.0.0
com.azure:azure-sdk-parent;1.6.0;1.6.0
com.azure:azure-client-sdk-parent;1.7.0;1.7.0
com.azure:azure-core;1.2.0-beta.1;1.2.0-beta.1
com.azure:azure-core-amqp;1.0.0-beta.8;1.0.0-beta.9
com.azure:azure-core-amqp;1.0.0-beta.9;1.0.0-beta.9
com.azure:azure-core-http-netty;1.1.0;1.2.0-beta.1
com.azure:azure-core-http-okhttp;1.1.0-beta.1;1.1.0-beta.1
com.azure:azure-core-management;1.0.0-beta.8;1.0.0-beta.8
Expand Down
33 changes: 33 additions & 0 deletions pom.client.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,39 @@
</build>
</profile>

<profile>
<id>changelog</id>
<activation>
<file>
<exists>${basedir}/CHANGELOG.md</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version> <!-- {x-version-update;org.apache.maven.plugins:maven-antrun-plugin;external_dependency} -->
<executions>
<execution>
<id>copy-changelog</id>
<phase>package</phase>
<configuration>
<target>
<echo>Copying ${project.basedir}/CHANGELOG.md to ${packageOutputDirectory}/${project.build.finalName}-changelog.md</echo>
<copy file="${project.basedir}/CHANGELOG.md" tofile="${packageOutputDirectory}/${project.build.finalName}-changelog.md"/>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<!-- separate profile for windows as the executable on windows is named npx.cmd and npx on other os families -->
<id>readme-codesnippet-windows</id>
Expand Down
17 changes: 17 additions & 0 deletions sdk/appconfiguration/azure-data-appconfiguration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,22 @@ ConfigurationSetting setting = client.setReadOnly("some_key", "some_label", fals

When you interact with App Configuration using this Java client library, errors returned by the service correspond to the same HTTP status codes returned for [REST API][rest_api] requests. For example, if you try to retrieve a configuration setting that doesn't exist in your configuration store, a `404` error is returned, indicating `Not Found`.

App Configuration provides a way to define customized headers through `Context` object in the public API.

```java
// Add your headers
HttpHeaders headers = new HttpHeaders();
headers.put("my-header1", "my-header1-value");
headers.put("my-header2", "my-header2-value");
headers.put("my-header3", "my-header3-value");
// Call API by passing headers in Context.
configurationClient.addConfigurationSettingWithResponse(
new ConfigurationSetting().setKey("key").setValue("value"),
new Context(AddHeadersFromContextPolicy.AZURE_REQUEST_HTTP_HEADERS_KEY, headers));
// Above three HttpHeader will be added in outgoing HttpRequest.
```
For more detail information, check out the [AddHeadersFromContextPolicy][add_headers_from_context_policy]

## Next steps

- Samples are explained in detail [here][samples_readme].
Expand Down Expand Up @@ -338,5 +354,6 @@ This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For m
[source_code]: src
[spring_quickstart]: https://docs.microsoft.com/azure/azure-app-configuration/quickstart-java-spring-app
[performance_tuning]: https://github.com/Azure/azure-sdk-for-java/wiki/Performance-Tuning
[add_headers_from_context_policy]: https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/core/azure-core/src/main/java/com/azure/core/http/policy/AddHeadersFromContextPolicy.java

![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-java%2Fsdk%2Fappconfiguration%2Fazure-data-appconfiguration%2FREADME.png)
Original file line number Diff line number Diff line change
Expand Up @@ -585,11 +585,11 @@ private Mono<PagedResponse<ConfigurationSetting>> listFirstPageSettings(SettingS
.doOnError(error -> logger.warning("Failed to list all ConfigurationSetting", error));
}

String fields = CoreUtils.arrayToString(selector.getFields(), SettingFields::toStringMapper);
String keys = CoreUtils.arrayToString(selector.getKeys(), key -> key);
String labels = CoreUtils.arrayToString(selector.getLabels(), label -> label);
final String fields = CoreUtils.arrayToString(selector.getFields(), SettingFields::toStringMapper);
final String keyFilter = selector.getKeyFilter();
final String labelFilter = selector.getLabelFilter();

return service.listKeyValues(serviceEndpoint, keys, labels, apiVersion, fields,
return service.listKeyValues(serviceEndpoint, keyFilter, labelFilter, apiVersion, fields,
selector.getAcceptDateTime(), context)
.doOnSubscribe(ignoredValue -> logger.info("Listing ConfigurationSettings - {}", selector))
.doOnSuccess(response -> logger.info("Listed ConfigurationSettings - {}", selector))
Expand Down Expand Up @@ -633,12 +633,12 @@ Mono<PagedResponse<ConfigurationSetting>> listRevisionsFirstPage(SettingSelector
Mono<PagedResponse<ConfigurationSetting>> result;

if (selector != null) {
String fields = CoreUtils.arrayToString(selector.getFields(), SettingFields::toStringMapper);
String keys = CoreUtils.arrayToString(selector.getKeys(), key -> key);
String labels = CoreUtils.arrayToString(selector.getLabels(), label -> label);
final String fields = CoreUtils.arrayToString(selector.getFields(), SettingFields::toStringMapper);
final String keyFilter = selector.getKeyFilter();
final String labelFilter = selector.getLabelFilter();

result = service.listKeyValueRevisions(
serviceEndpoint, keys, labels, apiVersion, fields, selector.getAcceptDateTime(), null, context)
result = service.listKeyValueRevisions(serviceEndpoint, keyFilter, labelFilter, apiVersion, fields,
selector.getAcceptDateTime(), null, context)
.doOnRequest(ignoredValue -> logger.info("Listing ConfigurationSetting revisions - {}", selector))
.doOnSuccess(response -> logger.info("Listed ConfigurationSetting revisions - {}", selector))
.doOnError(error ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpPipelineBuilder;
import com.azure.core.http.policy.AddDatePolicy;
import com.azure.core.http.policy.AddHeadersFromContextPolicy;
import com.azure.core.http.policy.AddHeadersPolicy;
import com.azure.core.http.policy.BearerTokenAuthenticationPolicy;
import com.azure.core.http.policy.HttpLogDetailLevel;
Expand Down Expand Up @@ -77,7 +78,7 @@ public final class ConfigurationClientBuilder {
private static final String ACCEPT_HEADER = "Accept";
private static final String ACCEPT_HEADER_VALUE = "application/vnd.microsoft.azconfig.kv+json";
// This is properties file's name.
private static final String APP_CONFIG_PROPERTIES = "azure-appconfig.properties";
private static final String APP_CONFIG_PROPERTIES = "azure-data-appconfiguration.properties";
private static final String SDK_NAME = "name";
private static final String SDK_VERSION = "version";
private static final RetryPolicy DEFAULT_RETRY_POLICY = new RetryPolicy("retry-after-ms", ChronoUnit.MILLIS);
Expand Down Expand Up @@ -179,6 +180,7 @@ public ConfigurationAsyncClient buildAsyncClient() {
policies.add(new UserAgentPolicy(httpLogOptions.getApplicationId(), clientName, clientVersion,
buildConfiguration));
policies.add(new RequestIdPolicy());
policies.add(new AddHeadersFromContextPolicy());
policies.add(new AddHeadersPolicy(headers));
policies.add(new AddDatePolicy());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ byte[] secret() {

CredentialInformation(String connectionString) {
if (CoreUtils.isNullOrEmpty(connectionString)) {
throw new IllegalArgumentException(connectionString);
throw new IllegalArgumentException("'connectionString' cannot be null or empty.");
}

String[] args = connectionString.split(";");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
package com.azure.data.appconfiguration.models;

import com.azure.core.annotation.Fluent;
import com.azure.data.appconfiguration.ConfigurationAsyncClient;
import com.azure.core.util.CoreUtils;
import com.azure.data.appconfiguration.ConfigurationAsyncClient;

import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
Expand All @@ -15,8 +15,8 @@
*
* <ul>
* <li>
* Providing {@link #getLabels() labels} will filter {@link ConfigurationSetting ConfigurationSettings} that match any
* label name in conjunction with the keys that are passed in to the service request.
* Providing {@link #getLabelFilter() labelFilter} will filter {@link ConfigurationSetting ConfigurationSettings} that
* match any label name in conjunction with the keys that are passed in to the service request.
* </li>
* <li>
* Providing {@link #getAcceptDateTime() acceptDateTime} will return the representation of matching {@link
Expand All @@ -32,8 +32,8 @@
*/
@Fluent
public class SettingSelector {
private String[] keys;
private String[] labels;
private String keyFilter;
private String labelFilter;
private SettingFields[] fields;
private String acceptDatetime;

Expand All @@ -49,17 +49,18 @@ public SettingSelector() {
*
* <p>
* Examples:
* <ol>
* <li>If keys = "*", settings with any key are returned.</li>
* <li>If keys = "abc1234", settings with a key equal to "abc1234" are returned.</li>
* <li>If keys = "abc*", settings with a key starting with "abc" are returned.</li>
* <li>If keys = "*abc*", settings with a key containing "abc" are returned.</li>
* </ol>
* <ul>
* <li>If {@code keyFilter = "*"}, settings with any key are returned.</li>
* <li>If {@code keyFilter = "abc1234"}, settings with a key equal to "abc1234" are returned.</li>
* <li>If {@code keyFilter = "abc*"}, settings with a key starting with "abc" are returned.</li>
* <li>If {@code keyFilter = "*abc*"}, settings with a key containing "abc" are returned.</li>
* <li>If {@code keyFilter = "abc,def"}, settings with a key equal to "abc" or "def" are returned.</li>
* </ul>
*
* @return The expressions to filter ConfigurationSetting keys on.
*/
public String[] getKeys() {
return keys == null ? new String[0] : CoreUtils.clone(keys);
public String getKeyFilter() {
return keyFilter;
}

/**
Expand All @@ -68,18 +69,18 @@ public String[] getKeys() {
* <p>
* Examples:
* <ul>
* <li>If {@code keys = "*"}, settings with any key are returned.</li>
* <li>If {@code keys = "abc1234"}, settings with a key equal to "abc1234" are returned.</li>
* <li>If {@code keys = "abc*"}, settings with a key starting with "abc" are returned.</li>
* <li>If {@code keys = "*abc*"}, settings with a key containing "abc" are returned.</li>
* <li>If {@code keys = "abc,def"}, settings with a key equal to "abc" or "def" are returned.</li>
* <li>If {@code keyFilter = "*"}, settings with any key are returned.</li>
* <li>If {@code keyFilter = "abc1234"}, settings with a key equal to "abc1234" are returned.</li>
* <li>If {@code keyFilter = "abc*"}, settings with a key starting with "abc" are returned.</li>
* <li>If {@code keyFilter = "*abc*"}, settings with a key containing "abc" are returned.</li>
* <li>If {@code keyFilter = "abc,def"}, settings with a key equal to "abc" or "def" are returned.</li>
* </ul>
*
* @param keys The expressions to filter ConfigurationSetting keys on.
* @param keyFilter The expressions to filter ConfigurationSetting keys on.
* @return The updated SettingSelector object
*/
public SettingSelector setKeys(String... keys) {
this.keys = keys;
public SettingSelector setKeyFilter(String keyFilter) {
this.keyFilter = keyFilter;
return this;
}

Expand All @@ -93,42 +94,42 @@ public SettingSelector setKeys(String... keys) {
* <p>
* Examples:
* <ul>
* <li>If {@code labels = "*"}, settings with any label are returned.</li>
* <li>If {@code labels = "\0"}, settings without any label are returned.</li>
* <li>If {@code labels = ""}, settings without any label are returned.</li>
* <li>If {@code labels = null}, settings without any label are returned.</li>
* <li>If {@code labels = "abc1234"}, settings with a label equal to "abc1234" are returned.</li>
* <li>If {@code labels = "abc*"}, settings with a label starting with "abc" are returned.</li>
* <li>If {@code labels = "*abc*"}, settings with a label containing "abc" are returned.</li>
* <li>If {@code labels = "abc,def"}, settings with labels "abc" or "def" are returned.</li>
* <li>If {@code labelFilter = "*"}, settings with any label are returned.</li>
* <li>If {@code labelFilter = "\0"}, settings without any label are returned.</li>
* <li>If {@code labelFilter = ""}, settings without any label are returned.</li>
* <li>If {@code labelFilter = null}, settings without any label are returned.</li>
* <li>If {@code labelFilter = "abc1234"}, settings with a label equal to "abc1234" are returned.</li>
* <li>If {@code labelFilter = "abc*"}, settings with a label starting with "abc" are returned.</li>
* <li>If {@code labelFilter = "*abc*"}, settings with a label containing "abc" are returned.</li>
* <li>If {@code labelFilter = "abc,def"}, settings with labels "abc" or "def" are returned.</li>
* </ul>
*
* @return labels The labels used to filter GET requests from the service.
*/
public String[] getLabels() {
return labels == null ? new String[0] : CoreUtils.clone(labels);
public String getLabelFilter() {
return labelFilter;
}

/**
* Sets the query to match {@link ConfigurationSetting#getLabel() labels} in the service.
* Sets the expression to filter {@link ConfigurationSetting#getLabel() labels} on for the request.
*
* <p>
* Examples:
* <ul>
* <li>If {@code labels = "*"}, settings with any label are returned.</li>
* <li>If {@code labels = "\0"}, settings without any label are returned. (This is the default label.)</li>
* <li>If {@code labels = "abc1234"}, settings with a label equal to "abc1234" are returned.</li>
* <li>If {@code labels = "abc*"}, settings with a label starting with "abc" are returned.</li>
* <li>If {@code labels = "*abc*"}, settings with a label containing "abc" are returned.</li>
* <li>If {@code labels = "abc,def"}, settings with labels "abc" or "def" are returned.</li>
* <li>If {@code labelFilter = "*"}, settings with any label are returned.</li>
* <li>If {@code labelFilter = "\0"}, settings without any label are returned. (This is the default label.)</li>
* <li>If {@code labelFilter = "abc1234"}, settings with a label equal to "abc1234" are returned.</li>
* <li>If {@code labelFilter = "abc*"}, settings with a label starting with "abc" are returned.</li>
* <li>If {@code labelFilter = "*abc*"}, settings with a label containing "abc" are returned.</li>
* <li>If {@code labelFilter = "abc,def"}, settings with labels "abc" or "def" are returned.</li>
* </ul>
*
* @param labels The ConfigurationSetting labels to match. If the provided value is {@code null} or {@code ""}, all
* ConfigurationSettings will be returned regardless of their label.
* @param labelFilter The expressions to filter ConfigurationSetting labels on. If the provided value is
* {@code null} or {@code ""}, all ConfigurationSettings will be returned regardless of their label.
* @return SettingSelector The updated SettingSelector object.
*/
public SettingSelector setLabels(String... labels) {
this.labels = labels;
public SettingSelector setLabelFilter(String labelFilter) {
this.labelFilter = labelFilter;
return this;
}

Expand Down Expand Up @@ -187,10 +188,7 @@ public String toString() {
fields = CoreUtils.arrayToString(this.fields, SettingFields::toStringMapper);
}

return String.format("SettingSelector(keys=%s, labels=%s, acceptDateTime=%s, fields=%s)",
CoreUtils.arrayToString(this.keys, key -> key),
CoreUtils.arrayToString(this.labels, label -> label),
this.acceptDatetime,
fields);
return String.format("SettingSelector(keyFilter=%s, labelFilter=%s, acceptDateTime=%s, fields=%s)",
this.keyFilter, this.labelFilter, this.acceptDatetime, fields);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public void unlockSettingsCodeSnippet() {
public void listSettingCodeSnippet() {
ConfigurationAsyncClient client = getAsyncClient();
// BEGIN: com.azure.data.appconfiguration.configurationasyncclient.listsettings
client.listConfigurationSettings(new SettingSelector().setKeys("prodDBConnection"))
client.listConfigurationSettings(new SettingSelector().setKeyFilter("prodDBConnection"))
.subscriberContext(Context.of(key1, value1, key2, value2))
.subscribe(setting ->
System.out.printf("Key: %s, Value: %s", setting.getKey(), setting.getValue()));
Expand All @@ -226,7 +226,7 @@ public void listSettingCodeSnippet() {
public void listRevisionsCodeSnippet() {
ConfigurationAsyncClient client = getAsyncClient();
// BEGIN: com.azure.data.appconfiguration.configurationasyncclient.listsettingrevisions
client.listRevisions(new SettingSelector().setKeys("prodDBConnection"))
client.listRevisions(new SettingSelector().setKeyFilter("prodDBConnection"))
.subscriberContext(Context.of(key1, value1, key2, value2))
.subscribe(setting ->
System.out.printf("Key: %s, Value: %s", setting.getKey(), setting.getValue()));
Expand Down
Loading

0 comments on commit bc602a7

Please sign in to comment.