Skip to content

Commit 1c38885

Browse files
authored
Merge pull request #70 from oracle/release_2018-06-28
Releasing version 1.2.41
2 parents c895ffa + f979ae2 commit 1c38885

File tree

126 files changed

+12351
-3515
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+12351
-3515
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
1313
### Added
1414
- N/A
1515

16+
## 1.2.41 - 2018-06-28
17+
### Added
18+
- Support for service gateway management in the Networking service
19+
- Support for backup and clone of boot volumes in the Block Storage service
20+
1621
## 1.2.40 - 2018-06-14
1722
### Added
1823
- Support for the Container Engine service. A sample showing how to use this service from the SDK is available [here](https://github.com/oracle/oci-java-sdk/blob/master/bmc-examples/src/main/java/ContainerEngineClusterExample.java)

bmc-audit/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.oracle.oci.sdk</groupId>
77
<artifactId>oci-java-sdk</artifactId>
8-
<version>1.2.40</version>
8+
<version>1.2.41</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

@@ -18,7 +18,7 @@
1818
<dependency>
1919
<groupId>com.oracle.oci.sdk</groupId>
2020
<artifactId>oci-java-sdk-common</artifactId>
21-
<version>1.2.40</version>
21+
<version>1.2.41</version>
2222
</dependency>
2323
</dependencies>
2424

bmc-audit/src/main/java/com/oracle/bmc/audit/AuditAsyncClient.java

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,11 @@ public java.util.concurrent.Future<GetConfigurationResponse> getConfiguration(
303303
handlerToUse = handler;
304304
if (handler != null
305305
&& this.authenticationDetailsProvider
306-
instanceof
307-
com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) {
306+
instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
308307
handlerToUse =
309-
new com.oracle.bmc.util.internal.InstancePrincipalsWrappingAsyncHandler<
308+
new com.oracle.bmc.util.internal.RefreshAuthTokenWrappingAsyncHandler<
310309
GetConfigurationRequest, GetConfigurationResponse>(
311-
(com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider)
310+
(com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
312311
this.authenticationDetailsProvider,
313312
handler) {
314313
@Override
@@ -335,12 +334,12 @@ public void retryCall() {
335334
client.get(ib, interceptedRequest, onSuccess, onError);
336335

337336
if (this.authenticationDetailsProvider
338-
instanceof com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) {
339-
return new com.oracle.bmc.util.internal.InstancePrincipalsBasedTransformingFuture<
337+
instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
338+
return new com.oracle.bmc.util.internal.RefreshAuthTokenTransformingFuture<
340339
javax.ws.rs.core.Response, GetConfigurationResponse>(
341340
responseFuture,
342341
transformer,
343-
(com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider)
342+
(com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
344343
this.authenticationDetailsProvider,
345344
new com.google.common.base.Supplier<
346345
java.util.concurrent.Future<javax.ws.rs.core.Response>>() {
@@ -371,12 +370,11 @@ public java.util.concurrent.Future<ListEventsResponse> listEvents(
371370
handler;
372371
if (handler != null
373372
&& this.authenticationDetailsProvider
374-
instanceof
375-
com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) {
373+
instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
376374
handlerToUse =
377-
new com.oracle.bmc.util.internal.InstancePrincipalsWrappingAsyncHandler<
375+
new com.oracle.bmc.util.internal.RefreshAuthTokenWrappingAsyncHandler<
378376
ListEventsRequest, ListEventsResponse>(
379-
(com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider)
377+
(com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
380378
this.authenticationDetailsProvider,
381379
handler) {
382380
@Override
@@ -403,12 +401,12 @@ public void retryCall() {
403401
client.get(ib, interceptedRequest, onSuccess, onError);
404402

405403
if (this.authenticationDetailsProvider
406-
instanceof com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) {
407-
return new com.oracle.bmc.util.internal.InstancePrincipalsBasedTransformingFuture<
404+
instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
405+
return new com.oracle.bmc.util.internal.RefreshAuthTokenTransformingFuture<
408406
javax.ws.rs.core.Response, ListEventsResponse>(
409407
responseFuture,
410408
transformer,
411-
(com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider)
409+
(com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
412410
this.authenticationDetailsProvider,
413411
new com.google.common.base.Supplier<
414412
java.util.concurrent.Future<javax.ws.rs.core.Response>>() {
@@ -443,12 +441,11 @@ public java.util.concurrent.Future<UpdateConfigurationResponse> updateConfigurat
443441
handlerToUse = handler;
444442
if (handler != null
445443
&& this.authenticationDetailsProvider
446-
instanceof
447-
com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) {
444+
instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
448445
handlerToUse =
449-
new com.oracle.bmc.util.internal.InstancePrincipalsWrappingAsyncHandler<
446+
new com.oracle.bmc.util.internal.RefreshAuthTokenWrappingAsyncHandler<
450447
UpdateConfigurationRequest, UpdateConfigurationResponse>(
451-
(com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider)
448+
(com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
452449
this.authenticationDetailsProvider,
453450
handler) {
454451
@Override
@@ -485,12 +482,12 @@ public void retryCall() {
485482
onError);
486483

487484
if (this.authenticationDetailsProvider
488-
instanceof com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) {
489-
return new com.oracle.bmc.util.internal.InstancePrincipalsBasedTransformingFuture<
485+
instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
486+
return new com.oracle.bmc.util.internal.RefreshAuthTokenTransformingFuture<
490487
javax.ws.rs.core.Response, UpdateConfigurationResponse>(
491488
responseFuture,
492489
transformer,
493-
(com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider)
490+
(com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
494491
this.authenticationDetailsProvider,
495492
new com.google.common.base.Supplier<
496493
java.util.concurrent.Future<javax.ws.rs.core.Response>>() {

bmc-audit/src/main/java/com/oracle/bmc/audit/AuditClient.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ public GetConfigurationResponse getConfiguration(GetConfigurationRequest request
308308
return transformer.apply(response);
309309
} catch (com.oracle.bmc.model.BmcException e) {
310310
if (++attempts < MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS
311-
&& canRetryRequestIfInstancePrincipalsUsed(e)) {
311+
&& canRetryRequestIfRefreshableAuthTokenUsed(e)) {
312312
continue;
313313
} else {
314314
throw e;
@@ -333,7 +333,7 @@ public ListEventsResponse listEvents(ListEventsRequest request) {
333333
return transformer.apply(response);
334334
} catch (com.oracle.bmc.model.BmcException e) {
335335
if (++attempts < MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS
336-
&& canRetryRequestIfInstancePrincipalsUsed(e)) {
336+
&& canRetryRequestIfRefreshableAuthTokenUsed(e)) {
337337
continue;
338338
} else {
339339
throw e;
@@ -359,7 +359,7 @@ public UpdateConfigurationResponse updateConfiguration(UpdateConfigurationReques
359359
return transformer.apply(response);
360360
} catch (com.oracle.bmc.model.BmcException e) {
361361
if (++attempts < MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS
362-
&& canRetryRequestIfInstancePrincipalsUsed(e)) {
362+
&& canRetryRequestIfRefreshableAuthTokenUsed(e)) {
363363
continue;
364364
} else {
365365
throw e;
@@ -368,14 +368,13 @@ && canRetryRequestIfInstancePrincipalsUsed(e)) {
368368
}
369369
}
370370

371-
private boolean canRetryRequestIfInstancePrincipalsUsed(com.oracle.bmc.model.BmcException e) {
371+
private boolean canRetryRequestIfRefreshableAuthTokenUsed(com.oracle.bmc.model.BmcException e) {
372372
if (e.getStatusCode() == 401
373373
&& this.authenticationDetailsProvider
374-
instanceof
375-
com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) {
376-
((com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider)
374+
instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
375+
((com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
377376
this.authenticationDetailsProvider)
378-
.refreshSecurityToken();
377+
.refresh();
379378
return true;
380379
}
381380
return false;

bmc-bom/pom.xml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.oracle.oci.sdk</groupId>
77
<artifactId>oci-java-sdk</artifactId>
8-
<version>1.2.40</version>
8+
<version>1.2.41</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111
<artifactId>oci-java-sdk-bom</artifactId>
@@ -19,68 +19,68 @@
1919
<dependency>
2020
<groupId>com.oracle.oci.sdk</groupId>
2121
<artifactId>oci-java-sdk-common</artifactId>
22-
<version>1.2.40</version>
22+
<version>1.2.41</version>
2323
<optional>false</optional>
2424
</dependency>
2525
<!-- Service modules, alpha sorted -->
2626
<dependency>
2727
<groupId>com.oracle.oci.sdk</groupId>
2828
<artifactId>oci-java-sdk-audit</artifactId>
29-
<version>1.2.40</version>
29+
<version>1.2.41</version>
3030
<optional>false</optional>
3131
</dependency>
3232
<dependency>
3333
<groupId>com.oracle.oci.sdk</groupId>
3434
<artifactId>oci-java-sdk-containerengine</artifactId>
35-
<version>1.2.40</version>
35+
<version>1.2.41</version>
3636
<optional>false</optional>
3737
</dependency>
3838
<dependency>
3939
<groupId>com.oracle.oci.sdk</groupId>
4040
<artifactId>oci-java-sdk-core</artifactId>
41-
<version>1.2.40</version>
41+
<version>1.2.41</version>
4242
<optional>false</optional>
4343
</dependency>
4444
<dependency>
4545
<groupId>com.oracle.oci.sdk</groupId>
4646
<artifactId>oci-java-sdk-database</artifactId>
47-
<version>1.2.40</version>
47+
<version>1.2.41</version>
4848
<optional>false</optional>
4949
</dependency>
5050
<dependency>
5151
<groupId>com.oracle.oci.sdk</groupId>
5252
<artifactId>oci-java-sdk-dns</artifactId>
53-
<version>1.2.40</version>
53+
<version>1.2.41</version>
5454
<optional>false</optional>
5555
</dependency>
5656
<dependency>
5757
<groupId>com.oracle.oci.sdk</groupId>
5858
<artifactId>oci-java-sdk-email</artifactId>
59-
<version>1.2.40</version>
59+
<version>1.2.41</version>
6060
<optional>false</optional>
6161
</dependency>
6262
<dependency>
6363
<groupId>com.oracle.oci.sdk</groupId>
6464
<artifactId>oci-java-sdk-filestorage</artifactId>
65-
<version>1.2.40</version>
65+
<version>1.2.41</version>
6666
<optional>false</optional>
6767
</dependency>
6868
<dependency>
6969
<groupId>com.oracle.oci.sdk</groupId>
7070
<artifactId>oci-java-sdk-identity</artifactId>
71-
<version>1.2.40</version>
71+
<version>1.2.41</version>
7272
<optional>false</optional>
7373
</dependency>
7474
<dependency>
7575
<groupId>com.oracle.oci.sdk</groupId>
7676
<artifactId>oci-java-sdk-loadbalancer</artifactId>
77-
<version>1.2.40</version>
77+
<version>1.2.41</version>
7878
<optional>false</optional>
7979
</dependency>
8080
<dependency>
8181
<groupId>com.oracle.oci.sdk</groupId>
8282
<artifactId>oci-java-sdk-objectstorage</artifactId>
83-
<version>1.2.40</version>
83+
<version>1.2.41</version>
8484
<optional>false</optional>
8585
<type>pom</type>
8686
</dependency>

bmc-common/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.oracle.oci.sdk</groupId>
77
<artifactId>oci-java-sdk</artifactId>
8-
<version>1.2.40</version>
8+
<version>1.2.41</version>
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

bmc-common/src/main/java/com/oracle/bmc/auth/InstancePrincipalsAuthenticationDetailsProvider.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,21 @@ public static InstancePrincipalsAuthenticationDetailsProviderBuilder builder() {
5252
return new InstancePrincipalsAuthenticationDetailsProviderBuilder();
5353
}
5454

55+
/**
56+
* Refreshes the authentication data used by the provider
57+
*
58+
* @return the refreshed authentication data
59+
*
60+
* @deprecated use {@link #refresh()} instead
61+
*/
62+
@Deprecated
5563
public String refreshSecurityToken() {
5664
return this.federationClient.refreshAndGetSecurityToken();
5765
}
5866

5967
@Override
6068
public String refresh() {
61-
return refreshSecurityToken();
69+
return this.federationClient.refreshAndGetSecurityToken();
6270
}
6371

6472
/**
Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
package com.oracle.bmc.util.internal;
55

66
import com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider;
7+
import com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider;
78
import com.oracle.bmc.http.internal.WrappedInvocationBuilder;
89
import com.oracle.bmc.model.BmcException;
910

@@ -23,27 +24,24 @@
2324

2425
/**
2526
* Future that both delegates to another one and provides the ability to transform
26-
* the response to another type. This is intended to work with instance principals
27-
* authenticated calls and has handling so that if we receive a 401, we'll refresh the
28-
* instance principals auth token and then try again.
27+
* the response to another type. This is intended to work with some authenticated calls, like instance principals,
28+
* and has handling so that if we receive a 401, we'll refresh the auth token and then try again.
2929
*
30-
* This is to account for scenarios where we have a valid/non-expired token but the permissions
30+
* This is to account for scenarios where we have a valid/non-expired token but the permissions
3131
* for the instance have changed since the token was issued and so on the server-side the presented
3232
* token is considered invalid.
3333
*
3434
* @param <FROM> The type returned by the delegate Future.
3535
* @param <TO> The type to convert to.
3636
*/
3737
@RequiredArgsConstructor
38-
public class InstancePrincipalsBasedTransformingFuture<FROM, TO> implements Future<TO> {
38+
public class RefreshAuthTokenTransformingFuture<FROM, TO> implements Future<TO> {
3939
@NonNull private Future<FROM> delegate;
4040

4141
private final Function<FROM, TO> transformer;
42-
private final InstancePrincipalsAuthenticationDetailsProvider authProvider;
42+
private final RefreshableOnNotAuthenticatedProvider<?> authProvider;
4343
private final Supplier<Future<FROM>> generateNewFutureForRetry;
4444

45-
private int numAttempts = 0;
46-
4745
@Override
4846
public boolean cancel(boolean mayInterruptIfRunning) {
4947
return delegate.cancel(mayInterruptIfRunning);
@@ -66,7 +64,7 @@ public TO get() throws InterruptedException, ExecutionException {
6664
return transformer.apply(from);
6765
} catch (BmcException e) {
6866
if (e.getStatusCode() == 401) {
69-
authProvider.refreshSecurityToken();
67+
authProvider.refresh();
7068
delegate = generateNewFutureForRetry.get();
7169
return transformer.apply(delegate.get());
7270
} else {
@@ -83,7 +81,7 @@ public TO get(long timeout, TimeUnit unit)
8381
return transformer.apply(from);
8482
} catch (BmcException e) {
8583
if (e.getStatusCode() == 401) {
86-
authProvider.refreshSecurityToken();
84+
authProvider.refresh();
8785
delegate = generateNewFutureForRetry.get();
8886
return transformer.apply(delegate.get(timeout, unit));
8987
} else {

bmc-common/src/main/java/com/oracle/bmc/util/internal/InstancePrincipalsWrappingAsyncHandler.java renamed to bmc-common/src/main/java/com/oracle/bmc/util/internal/RefreshAuthTokenWrappingAsyncHandler.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44
package com.oracle.bmc.util.internal;
55

66
import com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider;
7+
import com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider;
78
import com.oracle.bmc.model.BmcException;
89
import com.oracle.bmc.responses.AsyncHandler;
910

1011
import lombok.RequiredArgsConstructor;
1112

1213
/**
13-
* Callbacks for asynchronous requests intended to work with instance principals
14-
* authenticated calls. This handler wraps a base AsyncHandler and has additional logic so
15-
* that if a call fails with a 401, we'll refresh the instance principals auth token and
16-
* then try again up to a given number of retries (it is recommended that we only do one retry).
14+
* Callbacks for asynchronous requests intended to work with some authenticated calls, like instance principals.
15+
* This handler wraps a base AsyncHandler and has additional logic so that if a call fails with a 401, we'll
16+
* refresh the auth token and then try again up to a given number of retries (it is recommended that we only do one
17+
* retry).
1718
*
1819
* This is to account for scenarios where we have a valid/non-expired token but the permissions
1920
* for the instance have changed since the token was issued and so on the server-side the presented
@@ -25,11 +26,11 @@
2526
* The response type.
2627
*/
2728
@RequiredArgsConstructor
28-
public abstract class InstancePrincipalsWrappingAsyncHandler<REQUEST, RESPONSE>
29+
public abstract class RefreshAuthTokenWrappingAsyncHandler<REQUEST, RESPONSE>
2930
implements AsyncHandler<REQUEST, RESPONSE> {
3031
private static final int NUM_TRIES_ALLOWED = 2;
3132

32-
private final InstancePrincipalsAuthenticationDetailsProvider authDetailsProvider;
33+
private final RefreshableOnNotAuthenticatedProvider<?> authDetailsProvider;
3334
private final AsyncHandler<REQUEST, RESPONSE> innerHandler;
3435
private int currentAttempt = 0;
3536

@@ -44,7 +45,7 @@ public void onError(REQUEST request, Throwable error) {
4445
if (error instanceof BmcException) {
4546
if (((BmcException) error).getStatusCode() == 401
4647
&& currentAttempt < NUM_TRIES_ALLOWED) {
47-
authDetailsProvider.refreshSecurityToken();
48+
authDetailsProvider.refresh();
4849
retryCall();
4950
} else {
5051
innerHandler.onError(request, error);

0 commit comments

Comments
 (0)