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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/).
### Added
- N/A

## 1.2.47 - 2018-09-27
### Added
- Support for `paravirtualized` launch mode when importing images in the Compute service
- Support for Key Management service
- Support for encrypting the contents of an Object Storage bucket using a Key Management service key
- Support for specifying a Key Management service key when launching a compute instance in the Compute service
- Support for specifying a Key Management service key when backing up or restoring a block storage volume in the Block Volume service

## 1.2.46 - 2018-09-06
### Added
- Support for updating metadata fields on an instance in the Compute service
Expand Down
4 changes: 2 additions & 2 deletions bmc-addons/bmc-apache-connector-provider/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-addons</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -37,7 +37,7 @@
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-common</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
</dependency>
</dependencies>
</project>
2 changes: 1 addition & 1 deletion bmc-addons/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
4 changes: 2 additions & 2 deletions bmc-audit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand All @@ -18,7 +18,7 @@
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-common</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ public class AuditAsyncClient implements AuditAsync {
* Service instance for Audit.
*/
public static final com.oracle.bmc.Service SERVICE =
com.oracle.bmc.Services.create("AUDIT", "audit");
com.oracle.bmc.Services.serviceBuilder()
.serviceName("AUDIT")
.serviceEndpointPrefix("audit")
.build();

@lombok.Getter(value = lombok.AccessLevel.PACKAGE)
private final com.oracle.bmc.http.internal.RestClient client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ public class AuditClient implements Audit {
* Service instance for Audit.
*/
public static final com.oracle.bmc.Service SERVICE =
com.oracle.bmc.Services.create("AUDIT", "audit");
com.oracle.bmc.Services.serviceBuilder()
.serviceName("AUDIT")
.serviceEndpointPrefix("audit")
.build();
// attempt twice if it's instance principals, immediately failures will try to refresh the token
private static final int MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS = 2;

Expand Down
37 changes: 21 additions & 16 deletions bmc-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>oci-java-sdk-bom</artifactId>
Expand All @@ -19,83 +19,88 @@
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-common</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
<optional>false</optional>
</dependency>
<!-- Service modules, alpha sorted -->
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-audit</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
<optional>false</optional>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-containerengine</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
<optional>false</optional>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-core</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
<optional>false</optional>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-database</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
<optional>false</optional>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-dns</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
<optional>false</optional>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-email</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
<optional>false</optional>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-filestorage</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
<optional>false</optional>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-identity</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
<optional>false</optional>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-loadbalancer</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
<optional>false</optional>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-objectstorage</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
<optional>false</optional>
<type>pom</type>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-resourcesearch</artifactId>
<optional>false</optional>
<version>1.2.46</version>
<version>1.2.47</version>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<optional>false</optional>
<artifactId>oci-java-sdk-addons-apache</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk-keymanagement</artifactId>
<version>1.2.47</version>
<optional>false</optional>
</dependency>
</dependencies>
</dependencyManagement>
</project>
</project>
2 changes: 1 addition & 1 deletion bmc-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.oracle.oci.sdk</groupId>
<artifactId>oci-java-sdk</artifactId>
<version>1.2.46</version>
<version>1.2.47</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
4 changes: 4 additions & 0 deletions bmc-common/src/main/java/com/oracle/bmc/Region.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

/**
* Enumeration of all of the known Regions that can be contacted.
Expand Down Expand Up @@ -98,6 +99,9 @@ public synchronized Optional<String> getEndpoint(Service service) {
* @return The endpoint.
*/
public static String formatDefaultRegionEndpoint(Service service, String regionId) {
if (StringUtils.isNotBlank(service.getServiceEndpointTemplate())) {
return service.getServiceEndpointTemplate().replace("{region}", regionId);
}
return String.format(DEFAULT_ENDPOINT_FORMAT, service.getServiceEndpointPrefix(), regionId);
}

Expand Down
6 changes: 6 additions & 0 deletions bmc-common/src/main/java/com/oracle/bmc/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,10 @@ public interface Service {
* "https://iaas.us-phoenix-1.oraclecloud.com".
*/
String getServiceEndpointPrefix();

/**
* The service endpoint template that will be used, ex
* "{region}.service.oci.oraclecloud.com"
*/
String getServiceEndpointTemplate();
}
39 changes: 26 additions & 13 deletions bmc-common/src/main/java/com/oracle/bmc/Services.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import java.util.HashMap;
import java.util.Map;

import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.ToString;
import lombok.Builder;
import lombok.Value;
import org.apache.commons.lang3.Validate;

/**
* Factory class to create new {@link Service} instances.
Expand All @@ -28,31 +28,44 @@ public class Services {
* @param serviceName The unique service name.
* @param serviceEndpointPrefix The endpoint prefix.
* @return A Service instance.
* @deprecated Use {@link #serviceBuilder()} instead
*/
public static synchronized Service create(
final String serviceName, final String serviceEndpointPrefix) {
@Deprecated
public static Service create(final String serviceName, final String serviceEndpointPrefix) {
return serviceBuilder()
.serviceName(serviceName)
.serviceEndpointPrefix(serviceEndpointPrefix)
.build();
}

@Builder(builderClassName = "ServiceBuilder", builderMethodName = "serviceBuilder")
private static synchronized Service create(
final String serviceName,
final String serviceEndpointPrefix,
final String serviceEndpointTemplate) {
Validate.notBlank(serviceName);
final Service newInstance =
new BasicService(serviceName, serviceEndpointPrefix, serviceEndpointTemplate);
if (SERVICE_CACHE.containsKey(serviceName)) {
Service existing = SERVICE_CACHE.get(serviceName);
if (existing.getServiceEndpointPrefix().equals(serviceEndpointPrefix)) {
if (existing.equals(newInstance)) {
return existing;
}
throw new IllegalArgumentException(
String.format(
"Cannot redefine service '%s' with with new endpoint prefix '%s', already set to '%s'",
"Cannot redefine service '%s'. Existing: '%s', New: '%s'",
serviceName,
serviceEndpointPrefix,
existing.getServiceEndpointPrefix()));
existing,
newInstance));
}
Service newInstance = new BasicService(serviceName, serviceEndpointPrefix);
SERVICE_CACHE.put(serviceName, newInstance);
return newInstance;
}

@RequiredArgsConstructor
@Getter
@ToString
@Value
private static final class BasicService implements Service {
private final String serviceName;
private final String serviceEndpointPrefix;
private final String serviceEndpointTemplate;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ public static class InstancePrincipalsAuthenticationDetailsProviderBuilder
* Service instance for auth.
*/
private static final com.oracle.bmc.Service SERVICE =
com.oracle.bmc.Services.create("AUTH", "auth");
com.oracle.bmc.Services.serviceBuilder()
.serviceName("AUTH")
.serviceEndpointPrefix("auth")
.build();

/**
* Base url of metadata service.
Expand Down
Loading