Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
a913f0a
Convert credential scopes param to TokenRequest (#5492)
jianghaolu Sep 25, 2019
6c47f52
Chrande/cosmos/v4 (#5548)
christopheranderson Oct 5, 2019
5784cd3
CI-fixes (#5794)
mbhaskar Oct 16, 2019
c4af407
Porting changefeedprocessor hot fixes from v3 (#6001)
mbhaskar Oct 23, 2019
b0e0c2e
Porting reactor netty changes, NPE and minor fixes from v3 to v4 (#5…
mbhaskar Oct 23, 2019
2fcfa5d
Porting fixes from v3 to v4 (#6012)
mbhaskar Oct 24, 2019
fb4f9c3
Changing packages from com.azure.data.cosmos -> com.azure.cosmos (#6027)
mbhaskar Oct 25, 2019
b49f88a
Set resourceResponse in CosmosResponse (#6076)
kushagraThapar Oct 30, 2019
bf395b9
upgrading azure core version (#6084)
mbhaskar Oct 30, 2019
73b0c2c
Updating staging profile id to match com.azure namespace (#6108)
kushagraThapar Oct 31, 2019
987324a
Updated changelog and readme (#6123)
kushagraThapar Nov 1, 2019
b4029c2
Direct TCP: address read-my-writes test failure (#6201)
Nov 7, 2019
0dc6575
Port https://github.com/Azure/azure-sdk-for-java/pull/6148 (#6180)
milismsft Nov 7, 2019
8279b91
adding partition migration flag (#6191)
simplynaveen20 Nov 8, 2019
54401c6
Revert "adding partition migration flag (#6191)" (#6224)
kushagraThapar Nov 8, 2019
91b6715
adding partition migration flag (#6228)
moderakh Nov 8, 2019
81fc55e
ChangeFeedProcessor: fix a race condition issue where the lease docum…
milismsft Nov 8, 2019
dfb3f43
Updated internal lpackage name to implementation (#6234)
kushagraThapar Nov 8, 2019
0bb32e1
Corrected package misspelling in log4j.properties, removed System.exi…
Nov 9, 2019
921d5cc
Merge branch 'feature/cosmos/v4' of github.com:David-Noble-at-work/az…
Nov 9, 2019
2028dec
Merge branch 'feature/cosmos/v4' of https://github.com/Azure/azure-sd…
Nov 9, 2019
30f5fd3
Fixed a merge error and resolved #5043, Variables that specify time i…
Nov 9, 2019
7a9b947
Minor code cleanup in RntbdTransportClient
Nov 9, 2019
89bed8f
Fixed a second merge issue
Nov 9, 2019
584a7ac
Cosmos Issue #6250: Address memory leak in RntbdRequestTimer (#6251)
Nov 14, 2019
e4617f2
fixed emulator breaking change test (#6352)
kushagraThapar Nov 14, 2019
0b039d0
Merge branch 'feature/cosmos/v4' of https://github.com/Azure/azure-sd…
Nov 15, 2019
51a0abe
renaming diagnostic api (#6264)
simplynaveen20 Nov 15, 2019
c43b741
Null Value holder change across collection cache and address cache la…
kushagraThapar Nov 20, 2019
b18a6aa
Cosmos: clean test gates (#6373)
Nov 21, 2019
76492b5
Merge branch 'feature/cosmos/v4' of https://github.com/Azure/azure-sd…
Nov 21, 2019
5a6d2ab
Cosmos v4: ChangeFeedProcessor fix for load-balancing leases (#6430)
milismsft Nov 22, 2019
7bad43a
Merge branch 'feature/cosmos/v4' of https://github.com/Azure/azure-sd…
Nov 23, 2019
d42d9e1
[BUG] Update tests.yml with ACCOUNT_CONSISTENCY #6488 (#6490)
Nov 26, 2019
9cefe37
Merge branch 'feature/cosmos/v4' of https://github.com/Azure/azure-sd…
Nov 27, 2019
7e20f0f
Checkpoint for safe keeping
Nov 27, 2019
294ade5
Checkpoint for safe keeping
Nov 28, 2019
72b09b9
Checkpoint for safe keeping
Nov 28, 2019
b792310
Checkpoint for safe keeping (some testing successfully completed)
Nov 28, 2019
ad076a8
Checkpoint for safe keeping (some testing successfully completed)
Nov 29, 2019
7be144e
Checkpoint for safe keeping (some testing successfully completed)
Nov 29, 2019
f6fef4d
Checkpoint for safe keeping (some testing successfully completed)
Dec 1, 2019
23f7b44
V4 query api changes (#6464)
mbhaskar Dec 4, 2019
0e9115e
Merge branch 'feature/cosmos/v4' of https://github.com/Azure/azure-sd…
Dec 4, 2019
c495511
Fixes issue with template rendering. (#6654)
mitchdenny Dec 5, 2019
7ca1dfa
Updating code owners file to include David, Kiran and exclude Chris (…
kushagraThapar Dec 5, 2019
e42f498
AsyncReadBenchmark should use v4 API e2e (#6683)
moderakh Dec 6, 2019
3f49ed4
DR fix for V4 (#6271)
simplynaveen20 Dec 7, 2019
1c8f7fa
Adding memory/cpu statistics and gateway information (#6405)
simplynaveen20 Dec 10, 2019
2fab001
Merge branch 'feature/cosmos/v4' of https://github.com/Azure/azure-sd…
Dec 11, 2019
69374d4
v4 Read Throughput Perf improvement (#6694)
moderakh Dec 11, 2019
1092090
v4: adds a in clause query benchmark (#6771)
moderakh Dec 12, 2019
b4f1db2
Merge branch 'feature/cosmos/v4' of https://github.com/Azure/azure-sd…
Dec 13, 2019
c295e4d
Fixing checkstyle issues (#6643)
mbhaskar Dec 13, 2019
a316547
Merge branch 'feature/cosmos/v4' of https://github.com/Azure/azure-sd…
Dec 14, 2019
979e876
Addressed merge issue
Dec 14, 2019
1b31289
Optimized imports and tweaked some logger/argument validation messages
Dec 14, 2019
eba9ca8
Takes advantage of Reactive Stream Concurrency for Query (Improves la…
moderakh Dec 16, 2019
43fbc67
Query plan, Offset Limit (#6756)
mbhaskar Dec 19, 2019
1ae4b5d
logging improvements (#7076)
moderakh Jan 3, 2020
8966875
Merge branch 'feature/cosmos/v4' of https://github.com/Azure/azure-sd…
Jan 4, 2020
c17a695
Ported Default Direct TCP Options feature from v3
Jan 4, 2020
fced71e
Updated change log
Jan 4, 2020
6555a47
Use v4 API in benchmark perfs (#7095)
moderakh Jan 6, 2020
5439596
Merge branch 'feature/cosmos/v4' of https://github.com/Azure/azure-sd…
Jan 6, 2020
29306f5
Updated javadocs
Jan 6, 2020
1c8f7f4
Merge branch 'feature/cosmos/v4' of https://github.com/Azure/azure-sd…
Jan 6, 2020
4b273ae
Merge branch 'feature/cosmos/v4' of github.com:David-Noble-at-work/az…
Jan 6, 2020
6c70111
Cleaned up RngtbClientChannelHealthChecker and turned all trace log-l…
Jan 7, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/sdk/appconfiguration/ @mssfang @alzimmermsft @conniey @sima-zhu
/sdk/batch/ @xingwu1 @bgklein @matthchr
/sdk/core/ @alzimmermsft @jianghaolu @srnagar @hemanttanwar
/sdk/cosmos/ @moderakh @christopheranderson @kushagraThapar
/sdk/cosmos/ @moderakh @kushagraThapar @David-Noble-at-work @kirankumarkolli
/sdk/eventhubs/ @conniey @srnagar @mssfang
/sdk/identity/ @jianghaolu @g2vinay @hemanttanwar
/sdk/keyvault/ @g2vinay @samvaity
Expand Down
4 changes: 2 additions & 2 deletions eng/.docsettings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ known_presence_issues:
- ['sdk/core/azure-core-management', '#2847']
- ['cosmosdb/data-plane/commons-test-utils', '#2847']
- ['cosmosdb/data-plane/sdk', '#2847']
- ['sdk/cosmos/microsoft-azure-cosmos', '#2847']
- ['sdk/cosmos/azure-cosmos', '#2847']
- ['cosmosdb/data-plane/gateway', '#2847']
- ['cosmosdb/data-plane/commons', '#2847']
- ['cosmosdb/data-plane/direct-impl', '#2847']
Expand All @@ -73,7 +73,7 @@ known_content_issues:
- ['cosmosdb/data-plane/faq/README.md', '#3113']
- ['sdk/cosmos/faq/README.md', '#3113']
- ['sdk/cosmos/changelog/README.md', '#3113']
- ['sdk/cosmos/microsoft-azure-cosmos-benchmark/README.md', '#3113']
- ['sdk/cosmos/azure-cosmos-benchmark/README.md', '#3113']
- ['sdk/cosmos/README.md', '#3113']
- ['sdk/storage/azure-storage-blob/swagger/README.md', '#3113']
- ['sdk/storage/azure-storage-queue/swagger/README.md', '#3113']
Expand Down
12 changes: 6 additions & 6 deletions eng/pipelines/templates/variables/globals.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
variables:
DefaultOptions: '--batch-mode --fail-at-end --settings eng/settings.xml'
LoggingOptions: '-Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
MemoryOptions: '-Xmx3072m'
#Agent.Source.Git.ShallowFetchDepth: 1
skipComponentGovernanceDetection: true
EmulatorMsiUrl: 'https://acpedaily1.blob.core.windows.net/emulator/azure-cosmos-emulator.msi'
DefaultOptions: '--batch-mode --fail-at-end --settings eng/settings.xml'
LoggingOptions: '-Dorg.slf4j.simpleLogger.defaultLogLevel=error -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn'
MemoryOptions: '-Xmx3072m'
#Agent.Source.Git.ShallowFetchDepth: 1
skipComponentGovernanceDetection: true
EmulatorMsiUrl: 'https://aka.ms/cosmosdb-emulator'
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.azure.core.amqp.CBSNode;
import com.azure.core.amqp.RetryOptions;
import com.azure.core.credentials.TokenCredential;
import com.azure.core.credentials.TokenRequest;
import com.azure.core.util.logging.ClientLogger;
import org.apache.qpid.proton.Proton;
import org.apache.qpid.proton.amqp.messaging.AmqpValue;
Expand Down Expand Up @@ -53,7 +54,7 @@ public Mono<OffsetDateTime> authorize(final String tokenAudience) {
final ApplicationProperties applicationProperties = new ApplicationProperties(properties);
request.setApplicationProperties(applicationProperties);

return credential.getToken(tokenAudience).flatMap(accessToken -> {
return credential.getToken(new TokenRequest().addScopes(tokenAudience)).flatMap(accessToken -> {
request.setBody(new AmqpValue(accessToken.getToken()));

return cbsChannelMono.flatMap(x -> x.sendWithAck(request))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public BasicAuthenticationCredential(String userName, String password) {
* @throws RuntimeException If the UTF-8 encoding isn't supported.
*/
@Override
public Mono<AccessToken> getToken(String... scopes) {
public Mono<AccessToken> getToken(TokenRequest request) {
String credential = userName + ":" + password;
String encodedCredential;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
public interface TokenCredential {
/**
* Asynchronously get a token for a given resource/audience.
* @param scopes the scopes the token will be used for
* @param request the details of the token request
* @return a Publisher that emits a single access token
*/
Mono<AccessToken> getToken(String... scopes);
Mono<AccessToken> getToken(TokenRequest request);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.core.credentials;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;

/**
* Contains details of a request to Azure Active Directory to get a token.
*/
public class TokenRequest {
private final List<String> scopes;

/**
* Creates a token request instance.
*/
public TokenRequest() {
this.scopes = new ArrayList<>();
}

/**
* Gets the scopes required for the token.
* @return the scopes required for the token
*/
public List<String> getScopes() {
return scopes;
}

/**
* Sets the scopes required for the token.
* @param scopes the scopes required for the token
* @return the TokenRequest itself
*/
public TokenRequest setScopes(List<String> scopes) {
Objects.requireNonNull(scopes);
this.scopes.clear();
this.scopes.addAll(scopes);
return this;
}

/**
* Adds one or more scopes to the request scopes.
* @param scopes one or more scopes to add
* @return the TokenRequest itself
*/
public TokenRequest addScopes(String... scopes) {
this.scopes.addAll(Arrays.asList(scopes));
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import com.azure.core.credentials.SimpleTokenCache;
import com.azure.core.credentials.TokenCredential;
import com.azure.core.credentials.TokenRequest;
import com.azure.core.http.HttpPipelineCallContext;
import com.azure.core.http.HttpPipelineNextPolicy;
import com.azure.core.http.HttpResponse;
Expand Down Expand Up @@ -36,7 +37,7 @@ public BearerTokenAuthenticationPolicy(TokenCredential credential, String... sco
assert scopes.length > 0;
this.credential = credential;
this.scopes = scopes;
this.cache = new SimpleTokenCache(() -> credential.getToken(scopes));
this.cache = new SimpleTokenCache(() -> credential.getToken(new TokenRequest().addScopes(scopes)));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

package com.azure.core.implementation.util;

import java.util.List;
import java.util.Objects;

/**
Expand All @@ -18,18 +19,18 @@ public final class ScopeUtil {
* @return the resource to authenticate with Azure Active Directory.
* @throws IllegalArgumentException if scopes is empty or has more than 1 items
*/
public static String scopesToResource(String[] scopes) {
public static String scopesToResource(List<String> scopes) {
Objects.requireNonNull(scopes);
if (scopes.length != 1) {
if (scopes.size() != 1) {
throw new IllegalArgumentException(
"To convert to a resource string the specified array must be exactly length 1");
}

if (!scopes[0].endsWith(DEFAULT_SUFFIX)) {
return scopes[0];
if (!scopes.get(0).endsWith(DEFAULT_SUFFIX)) {
return scopes.get(0);
}

return scopes[0].substring(0, scopes[0].lastIndexOf(DEFAULT_SUFFIX));
return scopes.get(0).substring(0, scopes.get(0).lastIndexOf(DEFAULT_SUFFIX));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void basicCredentialsTest() throws Exception {
//
final HttpPipeline pipeline = new HttpPipelineBuilder()
.httpClient(new NoOpHttpClient())
.policies((context, next) -> credentials.getToken("scope./default")
.policies((context, next) -> credentials.getToken(new TokenRequest().addScopes("scope./default"))
.flatMap(token -> {
context.getHttpRequest().getHeaders().put("Authorization", "Basic " + token.getToken());
return next.process();
Expand All @@ -44,12 +44,7 @@ public void basicCredentialsTest() throws Exception {

@Test
public void tokenCredentialTest() throws Exception {
TokenCredential credentials = new TokenCredential() {
@Override
public Mono<AccessToken> getToken(String... scopes) {
return Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX));
}
};
TokenCredential credentials = request -> Mono.just(new AccessToken("this_is_a_token", OffsetDateTime.MAX));

HttpPipelinePolicy auditorPolicy = (context, next) -> {
String headerValue = context.getHttpRequest().getHeaders().getValue("Authorization");
Expand Down
2 changes: 1 addition & 1 deletion sdk/cosmos/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
# https://help.github.com/articles/about-codeowners/

# Default owner for repo
* @moderakh @christopheranderson @kushagraThapar
* @moderakh @kushagraThapar @David-Noble-at-work @kirankumarkolli
15 changes: 7 additions & 8 deletions sdk/cosmos/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
See the complete code for the above sample in [`HelloWorldDemo.java`](./microsoft-azure-cosmos-examples/src/main/java/com/azure/data/cosmos/examples/HelloWorldDemo.java)

```java
import com.azure.data.cosmos.*;
import com.azure.cosmos.*;
import reactor.core.publisher.Mono;

import java.io.IOException;
Expand Down Expand Up @@ -89,9 +89,9 @@ For example, using maven, you can add the following dependency to your maven pom

```xml
<dependency>
<groupId>com.microsoft.azure</groupId>
<groupId>com.azure</groupId>
<artifactId>azure-cosmos</artifactId>
<version>3.1.0</version>
<version>4.0.0-preview.1</version>
</dependency>
```

Expand Down Expand Up @@ -151,16 +151,15 @@ readItemMono
After result is received if you want to do CPU intensive work on the result you should avoid doing so on eventloop IO netty thread. You can instead provide your own Scheduler to provide your own thread for running your work.

```java
import rx.schedulers;

Mono<CosmosItemResponse> readItemMono = item.read();

readItemMono
.subscribeOn(Schedulers.computation())
.subscribeOn(Schedulers.parallel())
.subscribe(
resourceResponse -> {
// this is executed on threads provided by Scheduler.computation()
// Schedulers.computation() should be used only the work is cpu intensive and you are not doing blocking IO, thread sleep, etc. in this thread against other resources.
// this is executed on threads provided by Scheduler.parallel()
// Schedulers.parallel() should be used only when the work is cpu intensive and you are not doing blocking IO, thread sleep, etc. in this thread against other resources.
veryCpuIntensiveWork();
});

Expand Down Expand Up @@ -218,7 +217,7 @@ and add the following dependency to your project maven dependencies:
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative</artifactId>
<version>2.0.25.Final</version>
<version>2.0.26.Final</version>
<classifier>linux-x86_64</classifier>
</dependency>
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ Licensed under the MIT License.
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.microsoft.azure</groupId>
<groupId>com.azure</groupId>
<artifactId>azure-cosmos-parent</artifactId>
<version>3.3.0</version>
<version>4.0.0-SNAPSHOT</version>
</parent>

<groupId>com.microsoft.azure</groupId>
<groupId>com.azure</groupId>
<artifactId>azure-cosmos-benchmark</artifactId>
<version>3.3.0</version>
<version>4.0.0-SNAPSHOT</version>
<name>Microsoft Azure SDK for SQL API of Azure Cosmos DB Service - Benchmarking tool</name>
<description>This package contains Benchmarking tool for Microsoft Azure SDK for SQL API of Azure Cosmos DB Service</description>
<url>https://github.com/Azure/azure-sdk-for-java</url>
Expand All @@ -31,9 +31,9 @@ Licensed under the MIT License.

<dependencies>
<dependency>
<groupId>com.microsoft.azure</groupId>
<groupId>com.azure</groupId>
<artifactId>azure-cosmos</artifactId>
<version>3.3.0</version>
<version>4.0.0-SNAPSHOT</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -124,7 +124,7 @@ Licensed under the MIT License.
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<configuration>
<mainClass>com.azure.data.cosmos.benchmark.Main</mainClass>
<mainClass>com.azure.cosmos.benchmark.Main</mainClass>
</configuration>
</plugin>

Expand All @@ -137,7 +137,7 @@ Licensed under the MIT License.
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.azure.data.cosmos.benchmark.Main</mainClass>
<mainClass>com.azure.cosmos.benchmark.Main</mainClass>
</manifest>
</archive>
</configuration>
Expand Down
Loading