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);
}
diff --git a/bmc-common/src/main/java/com/oracle/bmc/Service.java b/bmc-common/src/main/java/com/oracle/bmc/Service.java
index 39b9df33322..4e8be01dabd 100644
--- a/bmc-common/src/main/java/com/oracle/bmc/Service.java
+++ b/bmc-common/src/main/java/com/oracle/bmc/Service.java
@@ -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();
}
diff --git a/bmc-common/src/main/java/com/oracle/bmc/Services.java b/bmc-common/src/main/java/com/oracle/bmc/Services.java
index ffb9ade358b..1efebd91c81 100644
--- a/bmc-common/src/main/java/com/oracle/bmc/Services.java
+++ b/bmc-common/src/main/java/com/oracle/bmc/Services.java
@@ -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.
@@ -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;
}
}
diff --git a/bmc-common/src/main/java/com/oracle/bmc/auth/InstancePrincipalsAuthenticationDetailsProvider.java b/bmc-common/src/main/java/com/oracle/bmc/auth/InstancePrincipalsAuthenticationDetailsProvider.java
index 19b360dfcfe..dde9e995803 100644
--- a/bmc-common/src/main/java/com/oracle/bmc/auth/InstancePrincipalsAuthenticationDetailsProvider.java
+++ b/bmc-common/src/main/java/com/oracle/bmc/auth/InstancePrincipalsAuthenticationDetailsProvider.java
@@ -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.
diff --git a/bmc-common/src/main/java/com/oracle/bmc/http/signing/internal/RequestSignerImpl.java b/bmc-common/src/main/java/com/oracle/bmc/http/signing/internal/RequestSignerImpl.java
index 221efb34df8..98bd786de10 100644
--- a/bmc-common/src/main/java/com/oracle/bmc/http/signing/internal/RequestSignerImpl.java
+++ b/bmc-common/src/main/java/com/oracle/bmc/http/signing/internal/RequestSignerImpl.java
@@ -3,6 +3,27 @@
*/
package com.oracle.bmc.http.signing.internal;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.google.common.annotations.VisibleForTesting;
+import com.google.common.base.Optional;
+import com.google.common.base.Preconditions;
+import com.google.common.base.Supplier;
+import com.google.common.collect.ImmutableList;
+import com.google.common.hash.Hashing;
+import com.google.common.io.ByteStreams;
+import com.oracle.bmc.http.internal.RestClientFactory;
+import com.oracle.bmc.http.signing.RequestSigner;
+import com.oracle.bmc.http.signing.RequestSignerException;
+import com.oracle.bmc.http.signing.SigningStrategy;
+import com.oracle.bmc.io.DuplicatableInputStream;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+import javax.annotation.concurrent.Immutable;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
@@ -18,29 +39,6 @@
import java.util.Map.Entry;
import java.util.TimeZone;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.Immutable;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.common.io.ByteStreams;
-import com.oracle.bmc.http.signing.RequestSignerException;
-import com.oracle.bmc.io.DuplicatableInputStream;
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.lang3.StringUtils;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.base.Supplier;
-import com.google.common.hash.Hashing;
-import com.oracle.bmc.http.internal.RestClientFactory;
-import com.oracle.bmc.http.signing.RequestSigner;
-import com.oracle.bmc.http.signing.SigningStrategy;
-
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-
/**
* Implementation of the {@linkplain RequestSigner} interface
*
@@ -141,7 +139,7 @@ private Map signRequest(
final List requiredHeaders = getRequiredSigningHeaders(lowerHttpMethod);
// 2) copy of original headers as case-insensitive, do not modify input map
- final Map existingHeaders = ignoreCaseHeaders(headers);
+ final Map> existingHeaders = ignoreCaseHeaders(headers);
// 3) calculate any required headers that are missing
final Map missingHeaders =
@@ -154,13 +152,16 @@ private Map signRequest(
signingConfiguration);
// 4) create a map containing both existing + missing headers
- final Map allHeaders = new HashMap<>();
+ final Map> allHeaders = new HashMap<>();
allHeaders.putAll(existingHeaders);
- allHeaders.putAll(missingHeaders);
+ for (Map.Entry e : missingHeaders.entrySet()) {
+ allHeaders.put(e.getKey(), ImmutableList.of(e.getValue()));
+ }
// 5) calculate the signature
final String stringToSign =
- calculateStringToSign(lowerHttpMethod, path, allHeaders, requiredHeaders);
+ calculateStringToSign(
+ lowerHttpMethod, path, allHeaders, requiredHeaders, headers);
final String signature = sign(key, algorithm, stringToSign);
// 6) calculate the auth header and add to all the missing headers that should be added
@@ -217,22 +218,11 @@ private RSAPrivateKey getPrivateKey(String keyId) {
}
@VisibleForTesting
- static Map ignoreCaseHeaders(Map> originalHeaders) {
- Map transformedMap = new HashMap<>();
+ static Map> ignoreCaseHeaders(
+ final Map> originalHeaders) {
+ Map> transformedMap = new HashMap<>();
for (Entry> entry : originalHeaders.entrySet()) {
- if (entry.getValue().size() != 1) {
- final String headerKey = entry.getKey();
- final RequestSignerException exception =
- new RequestSignerException(
- "Expecting exactly one value for header " + headerKey);
- LOG.error(
- "More than one value for header [{}] found. All headers: {}",
- headerKey,
- transformHeadersToJsonString(originalHeaders),
- exception);
- throw exception;
- }
- transformedMap.put(entry.getKey().toLowerCase(Locale.ROOT), entry.getValue().get(0));
+ transformedMap.put(entry.getKey().toLowerCase(), entry.getValue());
}
return transformedMap;
}
@@ -258,7 +248,7 @@ private static String extractPath(URI uri) {
static Map calculateMissingHeaders(
final String httpMethod,
final URI uri,
- final Map existingHeaders,
+ final Map> existingHeaders,
final Object body,
final List requiredHeaders,
final SigningConfiguration signingConfiguration)
@@ -305,6 +295,16 @@ static Map calculateMissingHeaders(
if (!existingHeaders.containsKey(Constants.CONTENT_TYPE)) {
LOG.warn("Missing 'content-type' header, defaulting to 'application/json'");
missingHeaders.put(Constants.CONTENT_TYPE, Constants.JSON_CONTENT_TYPE);
+ } else {
+ List contentTypes = existingHeaders.get(Constants.CONTENT_TYPE);
+ if (contentTypes.size() != 1) {
+ throw new IllegalArgumentException(
+ "Expected exactly one '"
+ + Constants.CONTENT_TYPE
+ + " header (received "
+ + contentTypes.size()
+ + ")");
+ }
}
}
@@ -320,7 +320,7 @@ static Map calculateMissingHeaders(
}
private static boolean isRequiredHeaderMissing(
- String headerName, List requiredHeaders, Map existingHeaders) {
+ String headerName, List requiredHeaders, Map existingHeaders) {
return requiredHeaders.contains(headerName) && !existingHeaders.containsKey(headerName);
}
@@ -329,11 +329,13 @@ private static String calculateBodySHA256(final byte[] body) {
return base64Encode(hash);
}
- private String calculateStringToSign(
+ @VisibleForTesting
+ static String calculateStringToSign(
String httpMethod,
String path,
- Map allHeaders,
- List requiredHeaders) {
+ Map> allHeaders,
+ List requiredHeaders,
+ Map> originalHeaders) {
// Header name and value are separated with ": " and each (name, value)
// pair is separated with "\n"
@@ -342,13 +344,38 @@ private String calculateStringToSign(
// Use the order from requiredHeaders, which must match the order
// when creating the authorization header
for (String headerName : requiredHeaders) {
- String headerValue = allHeaders.get(headerName);
+ List headerValues = allHeaders.get(headerName);
+ if (headerValues != null && headerValues.size() != 1) {
+ final RequestSignerException exception =
+ new RequestSignerException(
+ "Expecting exactly one value for header " + headerName);
+ LOG.error(
+ "More than one value for header [{}] to be signed found. All headers: {}",
+ headerName,
+ transformHeadersToJsonString(originalHeaders),
+ exception);
+ throw exception;
+ }
+ String headerValue = (headerValues != null) ? headerValues.get(0) : null;
if (headerName.equals(Constants.REQUEST_TARGET)) {
// Manually compute pseudo-header (request-target), since it
// won't be in headers
headerValue = httpMethod + " " + path;
}
+
+ if (headerValue == null) {
+ final RequestSignerException exception =
+ new RequestSignerException(
+ "Expecting exactly one value for header " + headerName);
+ LOG.error(
+ "No header value for header [{}] to be signed found. All headers: {}",
+ headerName,
+ transformHeadersToJsonString(originalHeaders),
+ exception);
+ throw exception;
+ }
+
signatureParts.add(String.format("%s: %s", headerName, headerValue));
}
diff --git a/bmc-common/src/test/java/com/oracle/bmc/ServicesTest.java b/bmc-common/src/test/java/com/oracle/bmc/ServicesTest.java
new file mode 100644
index 00000000000..94a4c5acc10
--- /dev/null
+++ b/bmc-common/src/test/java/com/oracle/bmc/ServicesTest.java
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class ServicesTest {
+
+ @BeforeClass
+ public static void setup() {
+ final Service fooService =
+ Services.serviceBuilder().serviceName("FOO").serviceEndpointPrefix("foo").build();
+ }
+
+ @Test
+ public void addNewService() {
+ final Service newService =
+ Services.serviceBuilder().serviceName("NEW").serviceEndpointPrefix("new").build();
+ }
+
+ @Test
+ public void addExistingService() {
+ final Service fooService =
+ Services.serviceBuilder().serviceName("FOO").serviceEndpointPrefix("foo").build();
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void addExistingService_ConflictingEndpointPrefix() {
+ final Service fooService =
+ Services.serviceBuilder().serviceName("FOO").serviceEndpointPrefix("bar").build();
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void addExistingService_ConflictingEndpointTemplate() {
+ final Service fooService =
+ Services.serviceBuilder()
+ .serviceName("FOO")
+ .serviceEndpointPrefix("foo")
+ .serviceEndpointTemplate("{region}.foo.oci.oraclecloud.com")
+ .build();
+ }
+
+ @Test(expected = NullPointerException.class)
+ public void addService_NoName() {
+ final Service noNameService = Services.serviceBuilder().build();
+ }
+
+ @Test(expected = IllegalArgumentException.class)
+ public void addService_BlankName() {
+ final Service blankNameService = Services.serviceBuilder().serviceName("").build();
+ }
+}
diff --git a/bmc-common/src/test/java/com/oracle/bmc/http/signing/internal/RequestSignerImplTest.java b/bmc-common/src/test/java/com/oracle/bmc/http/signing/internal/RequestSignerImplTest.java
index 53fc57154e1..bbfdc2c431c 100644
--- a/bmc-common/src/test/java/com/oracle/bmc/http/signing/internal/RequestSignerImplTest.java
+++ b/bmc-common/src/test/java/com/oracle/bmc/http/signing/internal/RequestSignerImplTest.java
@@ -4,6 +4,7 @@
package com.oracle.bmc.http.signing.internal;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.io.ByteStreams;
@@ -14,7 +15,6 @@
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@@ -40,8 +40,6 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.verify;
import static org.powermock.api.mockito.PowerMockito.mockStatic;
import static org.powermock.api.mockito.PowerMockito.when;
@@ -77,18 +75,18 @@ public void ignoreCaseHeaders_shouldReturnMapWithLowerCaseKeys_whenHeadersContai
headers.put("Content-Type", Collections.singletonList(MediaType.APPLICATION_JSON));
headers.put("OPC-REQUEST-ID", Collections.singletonList("RequestID"));
- final Map actual = RequestSignerImpl.ignoreCaseHeaders(headers);
+ final Map> actual = RequestSignerImpl.ignoreCaseHeaders(headers);
assertNotNull("Map should not be null", actual);
assertEquals("Map should contain 3 entries", 3, actual.size());
for (Map.Entry> expectedEntry : headers.entrySet()) {
final String expectedKey = expectedEntry.getKey();
- final String expectedValue = expectedEntry.getValue().get(0);
+ final List expectedValue = expectedEntry.getValue();
assertTrue(
"Actual map should contain matching key for lower case value",
actual.containsKey(expectedKey.toLowerCase()));
- final String actualValue = actual.get(expectedKey.toLowerCase());
+ final List actualValue = actual.get(expectedKey.toLowerCase());
assertEquals(
"Values should be equal for key: " + expectedKey, expectedValue, actualValue);
}
@@ -97,34 +95,42 @@ public void ignoreCaseHeaders_shouldReturnMapWithLowerCaseKeys_whenHeadersContai
// Reload the classes so PowerMockito can inject the static mocks.
@PrepareForTest({LoggerFactory.class, RestClientFactory.class, RequestSignerImpl.class})
@Test
- public void ignoreCaseHeaders_shouldThrowRequestSignerException_whenDuplicateHeaderKeysExists()
- throws Exception {
+ public void ignoreCaseHeaders_whenDuplicateHeaderKeysExists() throws Exception {
final Map> headers = new HashMap<>();
headers.put("content-length", Collections.singletonList("238"));
headers.put("opc-request-id", Lists.newArrayList("ID1", "ID2"));
- try {
- RequestSignerImpl.ignoreCaseHeaders(headers);
- fail("RequestSignerException should have been thrown");
- } catch (RequestSignerException ex) {
- assertTrue(
- "Exception message should contain key with duplicate entries",
- ex.getMessage()
- .contains("Expecting exactly one value for header opc-request-id"));
- verify(mockObjectMapper).writeValueAsString(eq(headers));
-
- final ArgumentCaptor logMessageCaptor = ArgumentCaptor.forClass(String.class);
- verify(mockLogger)
- .error(
- logMessageCaptor.capture(),
- eq("opc-request-id"),
- eq(SERIALIZED_MAP_JSON_STRING),
- eq(ex));
-
- final String actaulLogMessageValue = logMessageCaptor.getValue();
+ final Map> actual = RequestSignerImpl.ignoreCaseHeaders(headers);
+
+ assertNotNull("Map should not be null", actual);
+ assertEquals("Map should contain 2 entries", 2, actual.size());
+ for (Map.Entry> expectedEntry : headers.entrySet()) {
+ final String expectedKey = expectedEntry.getKey();
+ final List expectedValue = expectedEntry.getValue();
+
assertTrue(
- "Logging messages should contain the base message",
- actaulLogMessageValue.contains("More than one value for header [{}] found."));
+ "Actual map should contain matching key for lower case value",
+ actual.containsKey(expectedKey.toLowerCase()));
+ final List actualValue = actual.get(expectedKey.toLowerCase());
+ assertEquals(
+ "Values should be equal for key: " + expectedKey, expectedValue, actualValue);
+ }
+ }
+
+ // Reload the classes so PowerMockito can inject the static mocks.
+ @PrepareForTest({LoggerFactory.class, RestClientFactory.class, RequestSignerImpl.class})
+ @Test
+ public void calculateStringToSign_whenDuplicateHeaderKeysExists() {
+ final Map> headers = new HashMap<>();
+ headers.put("content-length", Collections.singletonList("238"));
+ headers.put("opc-request-id", Lists.newArrayList("ID1", "ID2"));
+
+ try {
+ RequestSignerImpl.calculateStringToSign(
+ "get", "/path", headers, ImmutableList.of("opc-request-id"), headers);
+ fail("Should have thrown");
+ } catch (RequestSignerException e) {
+ assertEquals("Expecting exactly one value for header opc-request-id", e.getMessage());
}
}
@@ -180,14 +186,14 @@ private void calculateAndVerifyMissingHeaders(
final String contentType, final Object body, final int contentLength)
throws IOException {
final URI uri = URI.create("https://identity.us-phoenix-1.oraclecloud.com/20160918/users");
- final Map existingHeaders =
- ImmutableMap.of(
+ final Map> existingHeaders =
+ ImmutableMap.>of(
HttpHeaders.CONTENT_TYPE.toLowerCase(),
- contentType,
+ ImmutableList.of(contentType),
"opc-request-id",
- "2F9BA4A30BB3452397A5BC1BFE447C5D",
+ ImmutableList.of("2F9BA4A30BB3452397A5BC1BFE447C5D"),
HttpHeaders.ACCEPT.toLowerCase(),
- MediaType.APPLICATION_JSON);
+ ImmutableList.of(MediaType.APPLICATION_JSON));
final RequestSignerImpl.SigningConfiguration signingConfiguration =
new RequestSignerImpl.SigningConfiguration(
SigningStrategy.STANDARD.getHeadersToSign(),
diff --git a/bmc-containerengine/pom.xml b/bmc-containerengine/pom.xml
index ecef3863e91..97ae78d6fe4 100644
--- a/bmc-containerengine/pom.xml
+++ b/bmc-containerengine/pom.xml
@@ -5,7 +5,7 @@
com.oracle.oci.sdk
oci-java-sdk
- 1.2.46
+ 1.2.47
../pom.xml
@@ -18,7 +18,7 @@
com.oracle.oci.sdk
oci-java-sdk-common
- 1.2.46
+ 1.2.47
diff --git a/bmc-containerengine/src/main/java/com/oracle/bmc/containerengine/ContainerEngineAsyncClient.java b/bmc-containerengine/src/main/java/com/oracle/bmc/containerengine/ContainerEngineAsyncClient.java
index 84deb5ace46..d263fbcdabd 100644
--- a/bmc-containerengine/src/main/java/com/oracle/bmc/containerengine/ContainerEngineAsyncClient.java
+++ b/bmc-containerengine/src/main/java/com/oracle/bmc/containerengine/ContainerEngineAsyncClient.java
@@ -15,7 +15,10 @@ public class ContainerEngineAsyncClient implements ContainerEngineAsync {
* Service instance for ContainerEngine.
*/
public static final com.oracle.bmc.Service SERVICE =
- com.oracle.bmc.Services.create("CONTAINERENGINE", "containerengine");
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("CONTAINERENGINE")
+ .serviceEndpointPrefix("containerengine")
+ .build();
@lombok.Getter(value = lombok.AccessLevel.PACKAGE)
private final com.oracle.bmc.http.internal.RestClient client;
diff --git a/bmc-containerengine/src/main/java/com/oracle/bmc/containerengine/ContainerEngineClient.java b/bmc-containerengine/src/main/java/com/oracle/bmc/containerengine/ContainerEngineClient.java
index 833bdd88969..ff8ae01c6d9 100644
--- a/bmc-containerengine/src/main/java/com/oracle/bmc/containerengine/ContainerEngineClient.java
+++ b/bmc-containerengine/src/main/java/com/oracle/bmc/containerengine/ContainerEngineClient.java
@@ -15,7 +15,10 @@ public class ContainerEngineClient implements ContainerEngine {
* Service instance for ContainerEngine.
*/
public static final com.oracle.bmc.Service SERVICE =
- com.oracle.bmc.Services.create("CONTAINERENGINE", "containerengine");
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("CONTAINERENGINE")
+ .serviceEndpointPrefix("containerengine")
+ .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;
diff --git a/bmc-core/pom.xml b/bmc-core/pom.xml
index 2c1dab68280..6ae99ad6abb 100644
--- a/bmc-core/pom.xml
+++ b/bmc-core/pom.xml
@@ -5,7 +5,7 @@
com.oracle.oci.sdk
oci-java-sdk
- 1.2.46
+ 1.2.47
../pom.xml
@@ -18,7 +18,7 @@
com.oracle.oci.sdk
oci-java-sdk-common
- 1.2.46
+ 1.2.47
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/Blockstorage.java b/bmc-core/src/main/java/com/oracle/bmc/core/Blockstorage.java
index 70465a97cf6..5301d6ea2b7 100644
--- a/bmc-core/src/main/java/com/oracle/bmc/core/Blockstorage.java
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/Blockstorage.java
@@ -155,6 +155,15 @@ CreateVolumeBackupPolicyAssignmentResponse createVolumeBackupPolicyAssignment(
*/
DeleteBootVolumeBackupResponse deleteBootVolumeBackup(DeleteBootVolumeBackupRequest request);
+ /**
+ * Remove kms for the specific boot volume. If the volume doesn't use KMS, then do nothing.
+ *
+ * @param request The request object containing the details to send
+ * @return A response object containing details about the completed operation
+ * @throws BmcException when an error occurs.
+ */
+ DeleteBootVolumeKmsKeyResponse deleteBootVolumeKmsKey(DeleteBootVolumeKmsKeyRequest request);
+
/**
* Deletes the specified volume. The volume cannot have an active connection to an instance.
* To disconnect the volume from a connected instance, see
@@ -202,6 +211,15 @@ DeleteVolumeBackupPolicyAssignmentResponse deleteVolumeBackupPolicyAssignment(
*/
DeleteVolumeGroupBackupResponse deleteVolumeGroupBackup(DeleteVolumeGroupBackupRequest request);
+ /**
+ * Remove kms for the specific volume. If the volume doesn't use KMS, then do nothing.
+ *
+ * @param request The request object containing the details to send
+ * @return A response object containing details about the completed operation
+ * @throws BmcException when an error occurs.
+ */
+ DeleteVolumeKmsKeyResponse deleteVolumeKmsKey(DeleteVolumeKmsKeyRequest request);
+
/**
* Gets information for the specified boot volume.
* @param request The request object containing the details to send
@@ -218,6 +236,15 @@ DeleteVolumeBackupPolicyAssignmentResponse deleteVolumeBackupPolicyAssignment(
*/
GetBootVolumeBackupResponse getBootVolumeBackup(GetBootVolumeBackupRequest request);
+ /**
+ * Gets kms key id for the specified boot volume.
+ *
+ * @param request The request object containing the details to send
+ * @return A response object containing details about the completed operation
+ * @throws BmcException when an error occurs.
+ */
+ GetBootVolumeKmsKeyResponse getBootVolumeKmsKey(GetBootVolumeKmsKeyRequest request);
+
/**
* Gets information for the specified volume.
* @param request The request object containing the details to send
@@ -279,6 +306,15 @@ GetVolumeBackupPolicyAssignmentResponse getVolumeBackupPolicyAssignment(
*/
GetVolumeGroupBackupResponse getVolumeGroupBackup(GetVolumeGroupBackupRequest request);
+ /**
+ * Gets kms key id for the specified volume.
+ *
+ * @param request The request object containing the details to send
+ * @return A response object containing details about the completed operation
+ * @throws BmcException when an error occurs.
+ */
+ GetVolumeKmsKeyResponse getVolumeKmsKey(GetVolumeKmsKeyRequest request);
+
/**
* Lists the boot volume backups in the specified compartment. You can filter the results by boot volume.
*
@@ -362,6 +398,15 @@ ListVolumeBackupPoliciesResponse listVolumeBackupPolicies(
*/
UpdateBootVolumeBackupResponse updateBootVolumeBackup(UpdateBootVolumeBackupRequest request);
+ /**
+ * Update kms key id for the specific volume.
+ *
+ * @param request The request object containing the details to send
+ * @return A response object containing details about the completed operation
+ * @throws BmcException when an error occurs.
+ */
+ UpdateBootVolumeKmsKeyResponse updateBootVolumeKmsKey(UpdateBootVolumeKmsKeyRequest request);
+
/**
* Updates the specified volume's display name.
* Avoid entering confidential information.
@@ -404,6 +449,15 @@ ListVolumeBackupPoliciesResponse listVolumeBackupPolicies(
*/
UpdateVolumeGroupBackupResponse updateVolumeGroupBackup(UpdateVolumeGroupBackupRequest request);
+ /**
+ * Update kms key id for the specific volume.
+ *
+ * @param request The request object containing the details to send
+ * @return A response object containing details about the completed operation
+ * @throws BmcException when an error occurs.
+ */
+ UpdateVolumeKmsKeyResponse updateVolumeKmsKey(UpdateVolumeKmsKeyRequest request);
+
/**
* Gets the pre-configured waiters available for resources for this service.
*
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageAsync.java b/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageAsync.java
index 33cce1e0007..d59a7c2e572 100644
--- a/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageAsync.java
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageAsync.java
@@ -225,6 +225,23 @@ java.util.concurrent.Future deleteBootVolumeBack
DeleteBootVolumeBackupRequest, DeleteBootVolumeBackupResponse>
handler);
+ /**
+ * Remove kms for the specific boot volume. If the volume doesn't use KMS, then do nothing.
+ *
+ *
+ * @param request The request object containing the details to send
+ * @param handler The request handler to invoke upon completion, may be null.
+ * @return A Future that can be used to get the response if no AsyncHandler was
+ * provided. Note, if you provide an AsyncHandler and use the Future, some
+ * types of responses (like java.io.InputStream) may not be able to be read in
+ * both places as the underlying stream may only be consumed once.
+ */
+ java.util.concurrent.Future deleteBootVolumeKmsKey(
+ DeleteBootVolumeKmsKeyRequest request,
+ com.oracle.bmc.responses.AsyncHandler<
+ DeleteBootVolumeKmsKeyRequest, DeleteBootVolumeKmsKeyResponse>
+ handler);
+
/**
* Deletes the specified volume. The volume cannot have an active connection to an instance.
* To disconnect the volume from a connected instance, see
@@ -312,6 +329,23 @@ java.util.concurrent.Future deleteVolumeGroupBa
DeleteVolumeGroupBackupRequest, DeleteVolumeGroupBackupResponse>
handler);
+ /**
+ * Remove kms for the specific volume. If the volume doesn't use KMS, then do nothing.
+ *
+ *
+ * @param request The request object containing the details to send
+ * @param handler The request handler to invoke upon completion, may be null.
+ * @return A Future that can be used to get the response if no AsyncHandler was
+ * provided. Note, if you provide an AsyncHandler and use the Future, some
+ * types of responses (like java.io.InputStream) may not be able to be read in
+ * both places as the underlying stream may only be consumed once.
+ */
+ java.util.concurrent.Future deleteVolumeKmsKey(
+ DeleteVolumeKmsKeyRequest request,
+ com.oracle.bmc.responses.AsyncHandler<
+ DeleteVolumeKmsKeyRequest, DeleteVolumeKmsKeyResponse>
+ handler);
+
/**
* Gets information for the specified boot volume.
*
@@ -343,6 +377,23 @@ java.util.concurrent.Future getBootVolumeBackup(
GetBootVolumeBackupRequest, GetBootVolumeBackupResponse>
handler);
+ /**
+ * Gets kms key id for the specified boot volume.
+ *
+ *
+ * @param request The request object containing the details to send
+ * @param handler The request handler to invoke upon completion, may be null.
+ * @return A Future that can be used to get the response if no AsyncHandler was
+ * provided. Note, if you provide an AsyncHandler and use the Future, some
+ * types of responses (like java.io.InputStream) may not be able to be read in
+ * both places as the underlying stream may only be consumed once.
+ */
+ java.util.concurrent.Future getBootVolumeKmsKey(
+ GetBootVolumeKmsKeyRequest request,
+ com.oracle.bmc.responses.AsyncHandler<
+ GetBootVolumeKmsKeyRequest, GetBootVolumeKmsKeyResponse>
+ handler);
+
/**
* Gets information for the specified volume.
*
@@ -458,6 +509,22 @@ java.util.concurrent.Future getVolumeGroupBackup(
GetVolumeGroupBackupRequest, GetVolumeGroupBackupResponse>
handler);
+ /**
+ * Gets kms key id for the specified volume.
+ *
+ *
+ * @param request The request object containing the details to send
+ * @param handler The request handler to invoke upon completion, may be null.
+ * @return A Future that can be used to get the response if no AsyncHandler was
+ * provided. Note, if you provide an AsyncHandler and use the Future, some
+ * types of responses (like java.io.InputStream) may not be able to be read in
+ * both places as the underlying stream may only be consumed once.
+ */
+ java.util.concurrent.Future getVolumeKmsKey(
+ GetVolumeKmsKeyRequest request,
+ com.oracle.bmc.responses.AsyncHandler
+ handler);
+
/**
* Lists the boot volume backups in the specified compartment. You can filter the results by boot volume.
*
@@ -607,6 +674,23 @@ java.util.concurrent.Future updateBootVolumeBack
UpdateBootVolumeBackupRequest, UpdateBootVolumeBackupResponse>
handler);
+ /**
+ * Update kms key id for the specific volume.
+ *
+ *
+ * @param request The request object containing the details to send
+ * @param handler The request handler to invoke upon completion, may be null.
+ * @return A Future that can be used to get the response if no AsyncHandler was
+ * provided. Note, if you provide an AsyncHandler and use the Future, some
+ * types of responses (like java.io.InputStream) may not be able to be read in
+ * both places as the underlying stream may only be consumed once.
+ */
+ java.util.concurrent.Future updateBootVolumeKmsKey(
+ UpdateBootVolumeKmsKeyRequest request,
+ com.oracle.bmc.responses.AsyncHandler<
+ UpdateBootVolumeKmsKeyRequest, UpdateBootVolumeKmsKeyResponse>
+ handler);
+
/**
* Updates the specified volume's display name.
* Avoid entering confidential information.
@@ -679,4 +763,21 @@ java.util.concurrent.Future updateVolumeGroupBa
com.oracle.bmc.responses.AsyncHandler<
UpdateVolumeGroupBackupRequest, UpdateVolumeGroupBackupResponse>
handler);
+
+ /**
+ * Update kms key id for the specific volume.
+ *
+ *
+ * @param request The request object containing the details to send
+ * @param handler The request handler to invoke upon completion, may be null.
+ * @return A Future that can be used to get the response if no AsyncHandler was
+ * provided. Note, if you provide an AsyncHandler and use the Future, some
+ * types of responses (like java.io.InputStream) may not be able to be read in
+ * both places as the underlying stream may only be consumed once.
+ */
+ java.util.concurrent.Future updateVolumeKmsKey(
+ UpdateVolumeKmsKeyRequest request,
+ com.oracle.bmc.responses.AsyncHandler<
+ UpdateVolumeKmsKeyRequest, UpdateVolumeKmsKeyResponse>
+ handler);
}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageAsyncClient.java b/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageAsyncClient.java
index d330bf3d0e3..7ec5b89bb1a 100644
--- a/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageAsyncClient.java
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageAsyncClient.java
@@ -15,7 +15,10 @@ public class BlockstorageAsyncClient implements BlockstorageAsync {
* Service instance for Blockstorage.
*/
public static final com.oracle.bmc.Service SERVICE =
- com.oracle.bmc.Services.create("BLOCKSTORAGE", "iaas");
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("BLOCKSTORAGE")
+ .serviceEndpointPrefix("iaas")
+ .build();
@lombok.Getter(value = lombok.AccessLevel.PACKAGE)
private final com.oracle.bmc.http.internal.RestClient client;
@@ -1024,6 +1027,77 @@ public java.util.concurrent.Future get() {
}
}
+ @Override
+ public java.util.concurrent.Future deleteBootVolumeKmsKey(
+ final DeleteBootVolumeKmsKeyRequest request,
+ final com.oracle.bmc.responses.AsyncHandler<
+ DeleteBootVolumeKmsKeyRequest, DeleteBootVolumeKmsKeyResponse>
+ handler) {
+ LOG.trace("Called async deleteBootVolumeKmsKey");
+ final DeleteBootVolumeKmsKeyRequest interceptedRequest =
+ DeleteBootVolumeKmsKeyConverter.interceptRequest(request);
+ final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib =
+ DeleteBootVolumeKmsKeyConverter.fromRequest(client, interceptedRequest);
+ final com.google.common.base.Function<
+ javax.ws.rs.core.Response, DeleteBootVolumeKmsKeyResponse>
+ transformer = DeleteBootVolumeKmsKeyConverter.fromResponse();
+
+ com.oracle.bmc.responses.AsyncHandler<
+ DeleteBootVolumeKmsKeyRequest, DeleteBootVolumeKmsKeyResponse>
+ handlerToUse = handler;
+ if (handler != null
+ && this.authenticationDetailsProvider
+ instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
+ handlerToUse =
+ new com.oracle.bmc.util.internal.RefreshAuthTokenWrappingAsyncHandler<
+ DeleteBootVolumeKmsKeyRequest, DeleteBootVolumeKmsKeyResponse>(
+ (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
+ this.authenticationDetailsProvider,
+ handler) {
+ @Override
+ public void retryCall() {
+ final com.oracle.bmc.util.internal.Consumer
+ onSuccess =
+ new com.oracle.bmc.http.internal.SuccessConsumer<>(
+ this, transformer, interceptedRequest);
+ final com.oracle.bmc.util.internal.Consumer onError =
+ new com.oracle.bmc.http.internal.ErrorConsumer<>(
+ this, interceptedRequest);
+ client.delete(ib, interceptedRequest, onSuccess, onError);
+ }
+ };
+ }
+
+ final com.oracle.bmc.util.internal.Consumer onSuccess =
+ new com.oracle.bmc.http.internal.SuccessConsumer<>(
+ handlerToUse, transformer, interceptedRequest);
+ final com.oracle.bmc.util.internal.Consumer onError =
+ new com.oracle.bmc.http.internal.ErrorConsumer<>(handlerToUse, interceptedRequest);
+
+ java.util.concurrent.Future responseFuture =
+ client.delete(ib, interceptedRequest, onSuccess, onError);
+
+ if (this.authenticationDetailsProvider
+ instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
+ return new com.oracle.bmc.util.internal.RefreshAuthTokenTransformingFuture<
+ javax.ws.rs.core.Response, DeleteBootVolumeKmsKeyResponse>(
+ responseFuture,
+ transformer,
+ (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
+ this.authenticationDetailsProvider,
+ new com.google.common.base.Supplier<
+ java.util.concurrent.Future>() {
+ @Override
+ public java.util.concurrent.Future get() {
+ return client.delete(ib, interceptedRequest, onSuccess, onError);
+ }
+ });
+ } else {
+ return new com.oracle.bmc.util.internal.TransformingFuture<>(
+ responseFuture, transformer);
+ }
+ }
+
@Override
public java.util.concurrent.Future deleteVolume(
final DeleteVolumeRequest request,
@@ -1376,6 +1450,75 @@ public java.util.concurrent.Future get() {
}
}
+ @Override
+ public java.util.concurrent.Future deleteVolumeKmsKey(
+ final DeleteVolumeKmsKeyRequest request,
+ final com.oracle.bmc.responses.AsyncHandler<
+ DeleteVolumeKmsKeyRequest, DeleteVolumeKmsKeyResponse>
+ handler) {
+ LOG.trace("Called async deleteVolumeKmsKey");
+ final DeleteVolumeKmsKeyRequest interceptedRequest =
+ DeleteVolumeKmsKeyConverter.interceptRequest(request);
+ final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib =
+ DeleteVolumeKmsKeyConverter.fromRequest(client, interceptedRequest);
+ final com.google.common.base.Function
+ transformer = DeleteVolumeKmsKeyConverter.fromResponse();
+
+ com.oracle.bmc.responses.AsyncHandler
+ handlerToUse = handler;
+ if (handler != null
+ && this.authenticationDetailsProvider
+ instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
+ handlerToUse =
+ new com.oracle.bmc.util.internal.RefreshAuthTokenWrappingAsyncHandler<
+ DeleteVolumeKmsKeyRequest, DeleteVolumeKmsKeyResponse>(
+ (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
+ this.authenticationDetailsProvider,
+ handler) {
+ @Override
+ public void retryCall() {
+ final com.oracle.bmc.util.internal.Consumer
+ onSuccess =
+ new com.oracle.bmc.http.internal.SuccessConsumer<>(
+ this, transformer, interceptedRequest);
+ final com.oracle.bmc.util.internal.Consumer onError =
+ new com.oracle.bmc.http.internal.ErrorConsumer<>(
+ this, interceptedRequest);
+ client.delete(ib, interceptedRequest, onSuccess, onError);
+ }
+ };
+ }
+
+ final com.oracle.bmc.util.internal.Consumer onSuccess =
+ new com.oracle.bmc.http.internal.SuccessConsumer<>(
+ handlerToUse, transformer, interceptedRequest);
+ final com.oracle.bmc.util.internal.Consumer onError =
+ new com.oracle.bmc.http.internal.ErrorConsumer<>(handlerToUse, interceptedRequest);
+
+ java.util.concurrent.Future responseFuture =
+ client.delete(ib, interceptedRequest, onSuccess, onError);
+
+ if (this.authenticationDetailsProvider
+ instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
+ return new com.oracle.bmc.util.internal.RefreshAuthTokenTransformingFuture<
+ javax.ws.rs.core.Response, DeleteVolumeKmsKeyResponse>(
+ responseFuture,
+ transformer,
+ (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
+ this.authenticationDetailsProvider,
+ new com.google.common.base.Supplier<
+ java.util.concurrent.Future>() {
+ @Override
+ public java.util.concurrent.Future get() {
+ return client.delete(ib, interceptedRequest, onSuccess, onError);
+ }
+ });
+ } else {
+ return new com.oracle.bmc.util.internal.TransformingFuture<>(
+ responseFuture, transformer);
+ }
+ }
+
@Override
public java.util.concurrent.Future getBootVolume(
final GetBootVolumeRequest request,
@@ -1515,6 +1658,77 @@ public java.util.concurrent.Future get() {
}
}
+ @Override
+ public java.util.concurrent.Future getBootVolumeKmsKey(
+ final GetBootVolumeKmsKeyRequest request,
+ final com.oracle.bmc.responses.AsyncHandler<
+ GetBootVolumeKmsKeyRequest, GetBootVolumeKmsKeyResponse>
+ handler) {
+ LOG.trace("Called async getBootVolumeKmsKey");
+ final GetBootVolumeKmsKeyRequest interceptedRequest =
+ GetBootVolumeKmsKeyConverter.interceptRequest(request);
+ final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib =
+ GetBootVolumeKmsKeyConverter.fromRequest(client, interceptedRequest);
+ final com.google.common.base.Function<
+ javax.ws.rs.core.Response, GetBootVolumeKmsKeyResponse>
+ transformer = GetBootVolumeKmsKeyConverter.fromResponse();
+
+ com.oracle.bmc.responses.AsyncHandler<
+ GetBootVolumeKmsKeyRequest, GetBootVolumeKmsKeyResponse>
+ handlerToUse = handler;
+ if (handler != null
+ && this.authenticationDetailsProvider
+ instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
+ handlerToUse =
+ new com.oracle.bmc.util.internal.RefreshAuthTokenWrappingAsyncHandler<
+ GetBootVolumeKmsKeyRequest, GetBootVolumeKmsKeyResponse>(
+ (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
+ this.authenticationDetailsProvider,
+ handler) {
+ @Override
+ public void retryCall() {
+ final com.oracle.bmc.util.internal.Consumer
+ onSuccess =
+ new com.oracle.bmc.http.internal.SuccessConsumer<>(
+ this, transformer, interceptedRequest);
+ final com.oracle.bmc.util.internal.Consumer onError =
+ new com.oracle.bmc.http.internal.ErrorConsumer<>(
+ this, interceptedRequest);
+ client.get(ib, interceptedRequest, onSuccess, onError);
+ }
+ };
+ }
+
+ final com.oracle.bmc.util.internal.Consumer onSuccess =
+ new com.oracle.bmc.http.internal.SuccessConsumer<>(
+ handlerToUse, transformer, interceptedRequest);
+ final com.oracle.bmc.util.internal.Consumer onError =
+ new com.oracle.bmc.http.internal.ErrorConsumer<>(handlerToUse, interceptedRequest);
+
+ java.util.concurrent.Future responseFuture =
+ client.get(ib, interceptedRequest, onSuccess, onError);
+
+ if (this.authenticationDetailsProvider
+ instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
+ return new com.oracle.bmc.util.internal.RefreshAuthTokenTransformingFuture<
+ javax.ws.rs.core.Response, GetBootVolumeKmsKeyResponse>(
+ responseFuture,
+ transformer,
+ (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
+ this.authenticationDetailsProvider,
+ new com.google.common.base.Supplier<
+ java.util.concurrent.Future>() {
+ @Override
+ public java.util.concurrent.Future get() {
+ return client.get(ib, interceptedRequest, onSuccess, onError);
+ }
+ });
+ } else {
+ return new com.oracle.bmc.util.internal.TransformingFuture<>(
+ responseFuture, transformer);
+ }
+ }
+
@Override
public java.util.concurrent.Future getVolume(
final GetVolumeRequest request,
@@ -2013,6 +2227,75 @@ public java.util.concurrent.Future get() {
}
}
+ @Override
+ public java.util.concurrent.Future getVolumeKmsKey(
+ final GetVolumeKmsKeyRequest request,
+ final com.oracle.bmc.responses.AsyncHandler<
+ GetVolumeKmsKeyRequest, GetVolumeKmsKeyResponse>
+ handler) {
+ LOG.trace("Called async getVolumeKmsKey");
+ final GetVolumeKmsKeyRequest interceptedRequest =
+ GetVolumeKmsKeyConverter.interceptRequest(request);
+ final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib =
+ GetVolumeKmsKeyConverter.fromRequest(client, interceptedRequest);
+ final com.google.common.base.Function
+ transformer = GetVolumeKmsKeyConverter.fromResponse();
+
+ com.oracle.bmc.responses.AsyncHandler
+ handlerToUse = handler;
+ if (handler != null
+ && this.authenticationDetailsProvider
+ instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
+ handlerToUse =
+ new com.oracle.bmc.util.internal.RefreshAuthTokenWrappingAsyncHandler<
+ GetVolumeKmsKeyRequest, GetVolumeKmsKeyResponse>(
+ (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
+ this.authenticationDetailsProvider,
+ handler) {
+ @Override
+ public void retryCall() {
+ final com.oracle.bmc.util.internal.Consumer
+ onSuccess =
+ new com.oracle.bmc.http.internal.SuccessConsumer<>(
+ this, transformer, interceptedRequest);
+ final com.oracle.bmc.util.internal.Consumer onError =
+ new com.oracle.bmc.http.internal.ErrorConsumer<>(
+ this, interceptedRequest);
+ client.get(ib, interceptedRequest, onSuccess, onError);
+ }
+ };
+ }
+
+ final com.oracle.bmc.util.internal.Consumer onSuccess =
+ new com.oracle.bmc.http.internal.SuccessConsumer<>(
+ handlerToUse, transformer, interceptedRequest);
+ final com.oracle.bmc.util.internal.Consumer onError =
+ new com.oracle.bmc.http.internal.ErrorConsumer<>(handlerToUse, interceptedRequest);
+
+ java.util.concurrent.Future responseFuture =
+ client.get(ib, interceptedRequest, onSuccess, onError);
+
+ if (this.authenticationDetailsProvider
+ instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
+ return new com.oracle.bmc.util.internal.RefreshAuthTokenTransformingFuture<
+ javax.ws.rs.core.Response, GetVolumeKmsKeyResponse>(
+ responseFuture,
+ transformer,
+ (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
+ this.authenticationDetailsProvider,
+ new com.google.common.base.Supplier<
+ java.util.concurrent.Future>() {
+ @Override
+ public java.util.concurrent.Future get() {
+ return client.get(ib, interceptedRequest, onSuccess, onError);
+ }
+ });
+ } else {
+ return new com.oracle.bmc.util.internal.TransformingFuture<>(
+ responseFuture, transformer);
+ }
+ }
+
@Override
public java.util.concurrent.Future listBootVolumeBackups(
final ListBootVolumeBackupsRequest request,
@@ -2671,6 +2954,92 @@ public java.util.concurrent.Future get() {
}
}
+ @Override
+ public java.util.concurrent.Future updateBootVolumeKmsKey(
+ final UpdateBootVolumeKmsKeyRequest request,
+ final com.oracle.bmc.responses.AsyncHandler<
+ UpdateBootVolumeKmsKeyRequest, UpdateBootVolumeKmsKeyResponse>
+ handler) {
+ LOG.trace("Called async updateBootVolumeKmsKey");
+ final UpdateBootVolumeKmsKeyRequest interceptedRequest =
+ UpdateBootVolumeKmsKeyConverter.interceptRequest(request);
+ final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib =
+ UpdateBootVolumeKmsKeyConverter.fromRequest(client, interceptedRequest);
+ final com.google.common.base.Function<
+ javax.ws.rs.core.Response, UpdateBootVolumeKmsKeyResponse>
+ transformer = UpdateBootVolumeKmsKeyConverter.fromResponse();
+
+ com.oracle.bmc.responses.AsyncHandler<
+ UpdateBootVolumeKmsKeyRequest, UpdateBootVolumeKmsKeyResponse>
+ handlerToUse = handler;
+ if (handler != null
+ && this.authenticationDetailsProvider
+ instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
+ handlerToUse =
+ new com.oracle.bmc.util.internal.RefreshAuthTokenWrappingAsyncHandler<
+ UpdateBootVolumeKmsKeyRequest, UpdateBootVolumeKmsKeyResponse>(
+ (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
+ this.authenticationDetailsProvider,
+ handler) {
+ @Override
+ public void retryCall() {
+ final com.oracle.bmc.util.internal.Consumer
+ onSuccess =
+ new com.oracle.bmc.http.internal.SuccessConsumer<>(
+ this, transformer, interceptedRequest);
+ final com.oracle.bmc.util.internal.Consumer onError =
+ new com.oracle.bmc.http.internal.ErrorConsumer<>(
+ this, interceptedRequest);
+ client.put(
+ ib,
+ interceptedRequest.getUpdateBootVolumeKmsKeyDetails(),
+ interceptedRequest,
+ onSuccess,
+ onError);
+ }
+ };
+ }
+
+ final com.oracle.bmc.util.internal.Consumer onSuccess =
+ new com.oracle.bmc.http.internal.SuccessConsumer<>(
+ handlerToUse, transformer, interceptedRequest);
+ final com.oracle.bmc.util.internal.Consumer onError =
+ new com.oracle.bmc.http.internal.ErrorConsumer<>(handlerToUse, interceptedRequest);
+
+ java.util.concurrent.Future responseFuture =
+ client.put(
+ ib,
+ interceptedRequest.getUpdateBootVolumeKmsKeyDetails(),
+ interceptedRequest,
+ onSuccess,
+ onError);
+
+ if (this.authenticationDetailsProvider
+ instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
+ return new com.oracle.bmc.util.internal.RefreshAuthTokenTransformingFuture<
+ javax.ws.rs.core.Response, UpdateBootVolumeKmsKeyResponse>(
+ responseFuture,
+ transformer,
+ (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
+ this.authenticationDetailsProvider,
+ new com.google.common.base.Supplier<
+ java.util.concurrent.Future>() {
+ @Override
+ public java.util.concurrent.Future get() {
+ return client.put(
+ ib,
+ interceptedRequest.getUpdateBootVolumeKmsKeyDetails(),
+ interceptedRequest,
+ onSuccess,
+ onError);
+ }
+ });
+ } else {
+ return new com.oracle.bmc.util.internal.TransformingFuture<>(
+ responseFuture, transformer);
+ }
+ }
+
@Override
public java.util.concurrent.Future updateVolume(
final UpdateVolumeRequest request,
@@ -3007,4 +3376,88 @@ public java.util.concurrent.Future get() {
responseFuture, transformer);
}
}
+
+ @Override
+ public java.util.concurrent.Future updateVolumeKmsKey(
+ final UpdateVolumeKmsKeyRequest request,
+ final com.oracle.bmc.responses.AsyncHandler<
+ UpdateVolumeKmsKeyRequest, UpdateVolumeKmsKeyResponse>
+ handler) {
+ LOG.trace("Called async updateVolumeKmsKey");
+ final UpdateVolumeKmsKeyRequest interceptedRequest =
+ UpdateVolumeKmsKeyConverter.interceptRequest(request);
+ final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib =
+ UpdateVolumeKmsKeyConverter.fromRequest(client, interceptedRequest);
+ final com.google.common.base.Function
+ transformer = UpdateVolumeKmsKeyConverter.fromResponse();
+
+ com.oracle.bmc.responses.AsyncHandler
+ handlerToUse = handler;
+ if (handler != null
+ && this.authenticationDetailsProvider
+ instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
+ handlerToUse =
+ new com.oracle.bmc.util.internal.RefreshAuthTokenWrappingAsyncHandler<
+ UpdateVolumeKmsKeyRequest, UpdateVolumeKmsKeyResponse>(
+ (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
+ this.authenticationDetailsProvider,
+ handler) {
+ @Override
+ public void retryCall() {
+ final com.oracle.bmc.util.internal.Consumer
+ onSuccess =
+ new com.oracle.bmc.http.internal.SuccessConsumer<>(
+ this, transformer, interceptedRequest);
+ final com.oracle.bmc.util.internal.Consumer onError =
+ new com.oracle.bmc.http.internal.ErrorConsumer<>(
+ this, interceptedRequest);
+ client.put(
+ ib,
+ interceptedRequest.getUpdateVolumeKmsKeyDetails(),
+ interceptedRequest,
+ onSuccess,
+ onError);
+ }
+ };
+ }
+
+ final com.oracle.bmc.util.internal.Consumer onSuccess =
+ new com.oracle.bmc.http.internal.SuccessConsumer<>(
+ handlerToUse, transformer, interceptedRequest);
+ final com.oracle.bmc.util.internal.Consumer onError =
+ new com.oracle.bmc.http.internal.ErrorConsumer<>(handlerToUse, interceptedRequest);
+
+ java.util.concurrent.Future responseFuture =
+ client.put(
+ ib,
+ interceptedRequest.getUpdateVolumeKmsKeyDetails(),
+ interceptedRequest,
+ onSuccess,
+ onError);
+
+ if (this.authenticationDetailsProvider
+ instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
+ return new com.oracle.bmc.util.internal.RefreshAuthTokenTransformingFuture<
+ javax.ws.rs.core.Response, UpdateVolumeKmsKeyResponse>(
+ responseFuture,
+ transformer,
+ (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
+ this.authenticationDetailsProvider,
+ new com.google.common.base.Supplier<
+ java.util.concurrent.Future>() {
+ @Override
+ public java.util.concurrent.Future get() {
+ return client.put(
+ ib,
+ interceptedRequest.getUpdateVolumeKmsKeyDetails(),
+ interceptedRequest,
+ onSuccess,
+ onError);
+ }
+ });
+ } else {
+ return new com.oracle.bmc.util.internal.TransformingFuture<>(
+ responseFuture, transformer);
+ }
+ }
}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageClient.java b/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageClient.java
index 5529e47fba6..18759169728 100644
--- a/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageClient.java
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageClient.java
@@ -15,7 +15,10 @@ public class BlockstorageClient implements Blockstorage {
* Service instance for Blockstorage.
*/
public static final com.oracle.bmc.Service SERVICE =
- com.oracle.bmc.Services.create("BLOCKSTORAGE", "iaas");
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("BLOCKSTORAGE")
+ .serviceEndpointPrefix("iaas")
+ .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;
@@ -548,6 +551,32 @@ && canRetryRequestIfRefreshableAuthTokenUsed(e)) {
}
}
+ @Override
+ public DeleteBootVolumeKmsKeyResponse deleteBootVolumeKmsKey(
+ DeleteBootVolumeKmsKeyRequest request) {
+ LOG.trace("Called deleteBootVolumeKmsKey");
+ request = DeleteBootVolumeKmsKeyConverter.interceptRequest(request);
+ com.oracle.bmc.http.internal.WrappedInvocationBuilder ib =
+ DeleteBootVolumeKmsKeyConverter.fromRequest(client, request);
+ com.google.common.base.Function
+ transformer = DeleteBootVolumeKmsKeyConverter.fromResponse();
+
+ int attempts = 0;
+ while (true) {
+ try {
+ javax.ws.rs.core.Response response = client.delete(ib, request);
+ return transformer.apply(response);
+ } catch (com.oracle.bmc.model.BmcException e) {
+ if (++attempts < MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS
+ && canRetryRequestIfRefreshableAuthTokenUsed(e)) {
+ continue;
+ } else {
+ throw e;
+ }
+ }
+ }
+ }
+
@Override
public DeleteVolumeResponse deleteVolume(DeleteVolumeRequest request) {
LOG.trace("Called deleteVolume");
@@ -676,6 +705,31 @@ && canRetryRequestIfRefreshableAuthTokenUsed(e)) {
}
}
+ @Override
+ public DeleteVolumeKmsKeyResponse deleteVolumeKmsKey(DeleteVolumeKmsKeyRequest request) {
+ LOG.trace("Called deleteVolumeKmsKey");
+ request = DeleteVolumeKmsKeyConverter.interceptRequest(request);
+ com.oracle.bmc.http.internal.WrappedInvocationBuilder ib =
+ DeleteVolumeKmsKeyConverter.fromRequest(client, request);
+ com.google.common.base.Function
+ transformer = DeleteVolumeKmsKeyConverter.fromResponse();
+
+ int attempts = 0;
+ while (true) {
+ try {
+ javax.ws.rs.core.Response response = client.delete(ib, request);
+ return transformer.apply(response);
+ } catch (com.oracle.bmc.model.BmcException e) {
+ if (++attempts < MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS
+ && canRetryRequestIfRefreshableAuthTokenUsed(e)) {
+ continue;
+ } else {
+ throw e;
+ }
+ }
+ }
+ }
+
@Override
public GetBootVolumeResponse getBootVolume(GetBootVolumeRequest request) {
LOG.trace("Called getBootVolume");
@@ -726,6 +780,31 @@ && canRetryRequestIfRefreshableAuthTokenUsed(e)) {
}
}
+ @Override
+ public GetBootVolumeKmsKeyResponse getBootVolumeKmsKey(GetBootVolumeKmsKeyRequest request) {
+ LOG.trace("Called getBootVolumeKmsKey");
+ request = GetBootVolumeKmsKeyConverter.interceptRequest(request);
+ com.oracle.bmc.http.internal.WrappedInvocationBuilder ib =
+ GetBootVolumeKmsKeyConverter.fromRequest(client, request);
+ com.google.common.base.Function
+ transformer = GetBootVolumeKmsKeyConverter.fromResponse();
+
+ int attempts = 0;
+ while (true) {
+ try {
+ javax.ws.rs.core.Response response = client.get(ib, request);
+ return transformer.apply(response);
+ } catch (com.oracle.bmc.model.BmcException e) {
+ if (++attempts < MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS
+ && canRetryRequestIfRefreshableAuthTokenUsed(e)) {
+ continue;
+ } else {
+ throw e;
+ }
+ }
+ }
+ }
+
@Override
public GetVolumeResponse getVolume(GetVolumeRequest request) {
LOG.trace("Called getVolume");
@@ -906,6 +985,31 @@ && canRetryRequestIfRefreshableAuthTokenUsed(e)) {
}
}
+ @Override
+ public GetVolumeKmsKeyResponse getVolumeKmsKey(GetVolumeKmsKeyRequest request) {
+ LOG.trace("Called getVolumeKmsKey");
+ request = GetVolumeKmsKeyConverter.interceptRequest(request);
+ com.oracle.bmc.http.internal.WrappedInvocationBuilder ib =
+ GetVolumeKmsKeyConverter.fromRequest(client, request);
+ com.google.common.base.Function
+ transformer = GetVolumeKmsKeyConverter.fromResponse();
+
+ int attempts = 0;
+ while (true) {
+ try {
+ javax.ws.rs.core.Response response = client.get(ib, request);
+ return transformer.apply(response);
+ } catch (com.oracle.bmc.model.BmcException e) {
+ if (++attempts < MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS
+ && canRetryRequestIfRefreshableAuthTokenUsed(e)) {
+ continue;
+ } else {
+ throw e;
+ }
+ }
+ }
+ }
+
@Override
public ListBootVolumeBackupsResponse listBootVolumeBackups(
ListBootVolumeBackupsRequest request) {
@@ -1137,6 +1241,33 @@ && canRetryRequestIfRefreshableAuthTokenUsed(e)) {
}
}
+ @Override
+ public UpdateBootVolumeKmsKeyResponse updateBootVolumeKmsKey(
+ UpdateBootVolumeKmsKeyRequest request) {
+ LOG.trace("Called updateBootVolumeKmsKey");
+ request = UpdateBootVolumeKmsKeyConverter.interceptRequest(request);
+ com.oracle.bmc.http.internal.WrappedInvocationBuilder ib =
+ UpdateBootVolumeKmsKeyConverter.fromRequest(client, request);
+ com.google.common.base.Function
+ transformer = UpdateBootVolumeKmsKeyConverter.fromResponse();
+
+ int attempts = 0;
+ while (true) {
+ try {
+ javax.ws.rs.core.Response response =
+ client.put(ib, request.getUpdateBootVolumeKmsKeyDetails(), request);
+ return transformer.apply(response);
+ } catch (com.oracle.bmc.model.BmcException e) {
+ if (++attempts < MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS
+ && canRetryRequestIfRefreshableAuthTokenUsed(e)) {
+ continue;
+ } else {
+ throw e;
+ }
+ }
+ }
+ }
+
@Override
public UpdateVolumeResponse updateVolume(UpdateVolumeRequest request) {
LOG.trace("Called updateVolume");
@@ -1242,6 +1373,32 @@ && canRetryRequestIfRefreshableAuthTokenUsed(e)) {
}
}
+ @Override
+ public UpdateVolumeKmsKeyResponse updateVolumeKmsKey(UpdateVolumeKmsKeyRequest request) {
+ LOG.trace("Called updateVolumeKmsKey");
+ request = UpdateVolumeKmsKeyConverter.interceptRequest(request);
+ com.oracle.bmc.http.internal.WrappedInvocationBuilder ib =
+ UpdateVolumeKmsKeyConverter.fromRequest(client, request);
+ com.google.common.base.Function
+ transformer = UpdateVolumeKmsKeyConverter.fromResponse();
+
+ int attempts = 0;
+ while (true) {
+ try {
+ javax.ws.rs.core.Response response =
+ client.put(ib, request.getUpdateVolumeKmsKeyDetails(), request);
+ return transformer.apply(response);
+ } catch (com.oracle.bmc.model.BmcException e) {
+ if (++attempts < MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS
+ && canRetryRequestIfRefreshableAuthTokenUsed(e)) {
+ continue;
+ } else {
+ throw e;
+ }
+ }
+ }
+ }
+
private boolean canRetryRequestIfRefreshableAuthTokenUsed(com.oracle.bmc.model.BmcException e) {
if (e.getStatusCode() == 401
&& this.authenticationDetailsProvider
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/ComputeAsyncClient.java b/bmc-core/src/main/java/com/oracle/bmc/core/ComputeAsyncClient.java
index 2a65122ccd9..89d6174da05 100644
--- a/bmc-core/src/main/java/com/oracle/bmc/core/ComputeAsyncClient.java
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/ComputeAsyncClient.java
@@ -15,7 +15,10 @@ public class ComputeAsyncClient implements ComputeAsync {
* Service instance for Compute.
*/
public static final com.oracle.bmc.Service SERVICE =
- com.oracle.bmc.Services.create("COMPUTE", "iaas");
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("COMPUTE")
+ .serviceEndpointPrefix("iaas")
+ .build();
@lombok.Getter(value = lombok.AccessLevel.PACKAGE)
private final com.oracle.bmc.http.internal.RestClient client;
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/ComputeClient.java b/bmc-core/src/main/java/com/oracle/bmc/core/ComputeClient.java
index 40cc6b09f96..2909063debd 100644
--- a/bmc-core/src/main/java/com/oracle/bmc/core/ComputeClient.java
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/ComputeClient.java
@@ -15,7 +15,10 @@ public class ComputeClient implements Compute {
* Service instance for Compute.
*/
public static final com.oracle.bmc.Service SERVICE =
- com.oracle.bmc.Services.create("COMPUTE", "iaas");
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("COMPUTE")
+ .serviceEndpointPrefix("iaas")
+ .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;
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkAsyncClient.java b/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkAsyncClient.java
index 8d528f2eb45..79acb8dfca6 100644
--- a/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkAsyncClient.java
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkAsyncClient.java
@@ -15,7 +15,10 @@ public class VirtualNetworkAsyncClient implements VirtualNetworkAsync {
* Service instance for VirtualNetwork.
*/
public static final com.oracle.bmc.Service SERVICE =
- com.oracle.bmc.Services.create("VIRTUALNETWORK", "iaas");
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("VIRTUALNETWORK")
+ .serviceEndpointPrefix("iaas")
+ .build();
@lombok.Getter(value = lombok.AccessLevel.PACKAGE)
private final com.oracle.bmc.http.internal.RestClient client;
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkClient.java b/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkClient.java
index eb184728974..6d1f4941417 100644
--- a/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkClient.java
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkClient.java
@@ -15,7 +15,10 @@ public class VirtualNetworkClient implements VirtualNetwork {
* Service instance for VirtualNetwork.
*/
public static final com.oracle.bmc.Service SERVICE =
- com.oracle.bmc.Services.create("VIRTUALNETWORK", "iaas");
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("VIRTUALNETWORK")
+ .serviceEndpointPrefix("iaas")
+ .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;
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/DeleteBootVolumeKmsKeyConverter.java b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/DeleteBootVolumeKmsKeyConverter.java
new file mode 100644
index 00000000000..8562f6685ba
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/DeleteBootVolumeKmsKeyConverter.java
@@ -0,0 +1,94 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.internal.http;
+
+import com.oracle.bmc.core.model.*;
+import com.oracle.bmc.core.requests.*;
+import com.oracle.bmc.core.responses.*;
+import org.apache.commons.lang3.Validate;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.extern.slf4j.Slf4j
+public class DeleteBootVolumeKmsKeyConverter {
+ private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory
+ RESPONSE_CONVERSION_FACTORY =
+ new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory();
+
+ public static DeleteBootVolumeKmsKeyRequest interceptRequest(
+ DeleteBootVolumeKmsKeyRequest request) {
+
+ return request;
+ }
+
+ public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest(
+ com.oracle.bmc.http.internal.RestClient client, DeleteBootVolumeKmsKeyRequest request) {
+ Validate.notNull(request, "request instance is required");
+ Validate.notBlank(request.getBootVolumeId(), "bootVolumeId must not be blank");
+
+ com.oracle.bmc.http.internal.WrappedWebTarget target =
+ client.getBaseTarget()
+ .path("/20160918")
+ .path("bootVolumes")
+ .path(
+ com.oracle.bmc.util.internal.HttpUtils.encodePathSegment(
+ request.getBootVolumeId()))
+ .path("kmsKey");
+
+ com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request();
+
+ ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON);
+
+ if (request.getIfMatch() != null) {
+ ib.header("if-match", request.getIfMatch());
+ }
+
+ return ib;
+ }
+
+ public static com.google.common.base.Function<
+ javax.ws.rs.core.Response, DeleteBootVolumeKmsKeyResponse>
+ fromResponse() {
+ final com.google.common.base.Function<
+ javax.ws.rs.core.Response, DeleteBootVolumeKmsKeyResponse>
+ transformer =
+ new com.google.common.base.Function<
+ javax.ws.rs.core.Response, DeleteBootVolumeKmsKeyResponse>() {
+ @Override
+ public DeleteBootVolumeKmsKeyResponse apply(
+ javax.ws.rs.core.Response rawResponse) {
+ LOG.trace(
+ "Transform function invoked for DeleteBootVolumeKmsKeyResponse");
+ com.google.common.base.Function<
+ javax.ws.rs.core.Response,
+ com.oracle.bmc.http.internal.WithHeaders>
+ responseFn = RESPONSE_CONVERSION_FACTORY.create();
+
+ com.oracle.bmc.http.internal.WithHeaders response =
+ responseFn.apply(rawResponse);
+ javax.ws.rs.core.MultivaluedMap headers =
+ response.getHeaders();
+
+ DeleteBootVolumeKmsKeyResponse.Builder builder =
+ DeleteBootVolumeKmsKeyResponse.builder();
+
+ com.google.common.base.Optional>
+ opcRequestIdHeader =
+ com.oracle.bmc.http.internal.HeaderUtils.get(
+ headers, "opc-request-id");
+ if (opcRequestIdHeader.isPresent()) {
+ builder.opcRequestId(
+ com.oracle.bmc.http.internal.HeaderUtils.toValue(
+ "opc-request-id",
+ opcRequestIdHeader.get().get(0),
+ String.class));
+ }
+
+ DeleteBootVolumeKmsKeyResponse responseWrapper = builder.build();
+
+ return responseWrapper;
+ }
+ };
+ return transformer;
+ }
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/DeleteVolumeKmsKeyConverter.java b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/DeleteVolumeKmsKeyConverter.java
new file mode 100644
index 00000000000..2eed6c04a10
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/DeleteVolumeKmsKeyConverter.java
@@ -0,0 +1,92 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.internal.http;
+
+import com.oracle.bmc.core.model.*;
+import com.oracle.bmc.core.requests.*;
+import com.oracle.bmc.core.responses.*;
+import org.apache.commons.lang3.Validate;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.extern.slf4j.Slf4j
+public class DeleteVolumeKmsKeyConverter {
+ private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory
+ RESPONSE_CONVERSION_FACTORY =
+ new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory();
+
+ public static DeleteVolumeKmsKeyRequest interceptRequest(DeleteVolumeKmsKeyRequest request) {
+
+ return request;
+ }
+
+ public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest(
+ com.oracle.bmc.http.internal.RestClient client, DeleteVolumeKmsKeyRequest request) {
+ Validate.notNull(request, "request instance is required");
+ Validate.notBlank(request.getVolumeId(), "volumeId must not be blank");
+
+ com.oracle.bmc.http.internal.WrappedWebTarget target =
+ client.getBaseTarget()
+ .path("/20160918")
+ .path("volumes")
+ .path(
+ com.oracle.bmc.util.internal.HttpUtils.encodePathSegment(
+ request.getVolumeId()))
+ .path("kmsKey");
+
+ com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request();
+
+ ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON);
+
+ if (request.getIfMatch() != null) {
+ ib.header("if-match", request.getIfMatch());
+ }
+
+ return ib;
+ }
+
+ public static com.google.common.base.Function<
+ javax.ws.rs.core.Response, DeleteVolumeKmsKeyResponse>
+ fromResponse() {
+ final com.google.common.base.Function
+ transformer =
+ new com.google.common.base.Function<
+ javax.ws.rs.core.Response, DeleteVolumeKmsKeyResponse>() {
+ @Override
+ public DeleteVolumeKmsKeyResponse apply(
+ javax.ws.rs.core.Response rawResponse) {
+ LOG.trace(
+ "Transform function invoked for DeleteVolumeKmsKeyResponse");
+ com.google.common.base.Function<
+ javax.ws.rs.core.Response,
+ com.oracle.bmc.http.internal.WithHeaders>
+ responseFn = RESPONSE_CONVERSION_FACTORY.create();
+
+ com.oracle.bmc.http.internal.WithHeaders response =
+ responseFn.apply(rawResponse);
+ javax.ws.rs.core.MultivaluedMap headers =
+ response.getHeaders();
+
+ DeleteVolumeKmsKeyResponse.Builder builder =
+ DeleteVolumeKmsKeyResponse.builder();
+
+ com.google.common.base.Optional>
+ opcRequestIdHeader =
+ com.oracle.bmc.http.internal.HeaderUtils.get(
+ headers, "opc-request-id");
+ if (opcRequestIdHeader.isPresent()) {
+ builder.opcRequestId(
+ com.oracle.bmc.http.internal.HeaderUtils.toValue(
+ "opc-request-id",
+ opcRequestIdHeader.get().get(0),
+ String.class));
+ }
+
+ DeleteVolumeKmsKeyResponse responseWrapper = builder.build();
+
+ return responseWrapper;
+ }
+ };
+ return transformer;
+ }
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/GetBootVolumeKmsKeyConverter.java b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/GetBootVolumeKmsKeyConverter.java
new file mode 100644
index 00000000000..cd08acc2747
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/GetBootVolumeKmsKeyConverter.java
@@ -0,0 +1,107 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.internal.http;
+
+import com.oracle.bmc.core.model.*;
+import com.oracle.bmc.core.requests.*;
+import com.oracle.bmc.core.responses.*;
+import org.apache.commons.lang3.Validate;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.extern.slf4j.Slf4j
+public class GetBootVolumeKmsKeyConverter {
+ private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory
+ RESPONSE_CONVERSION_FACTORY =
+ new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory();
+
+ public static GetBootVolumeKmsKeyRequest interceptRequest(GetBootVolumeKmsKeyRequest request) {
+
+ return request;
+ }
+
+ public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest(
+ com.oracle.bmc.http.internal.RestClient client, GetBootVolumeKmsKeyRequest request) {
+ Validate.notNull(request, "request instance is required");
+ Validate.notBlank(request.getBootVolumeId(), "bootVolumeId must not be blank");
+
+ com.oracle.bmc.http.internal.WrappedWebTarget target =
+ client.getBaseTarget()
+ .path("/20160918")
+ .path("bootVolumes")
+ .path(
+ com.oracle.bmc.util.internal.HttpUtils.encodePathSegment(
+ request.getBootVolumeId()))
+ .path("kmsKey");
+
+ com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request();
+
+ ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON);
+
+ if (request.getIfMatch() != null) {
+ ib.header("if-match", request.getIfMatch());
+ }
+
+ return ib;
+ }
+
+ public static com.google.common.base.Function<
+ javax.ws.rs.core.Response, GetBootVolumeKmsKeyResponse>
+ fromResponse() {
+ final com.google.common.base.Function<
+ javax.ws.rs.core.Response, GetBootVolumeKmsKeyResponse>
+ transformer =
+ new com.google.common.base.Function<
+ javax.ws.rs.core.Response, GetBootVolumeKmsKeyResponse>() {
+ @Override
+ public GetBootVolumeKmsKeyResponse apply(
+ javax.ws.rs.core.Response rawResponse) {
+ LOG.trace(
+ "Transform function invoked for GetBootVolumeKmsKeyResponse");
+ com.google.common.base.Function<
+ javax.ws.rs.core.Response,
+ com.oracle.bmc.http.internal.WithHeaders<
+ BootVolumeKmsKey>>
+ responseFn =
+ RESPONSE_CONVERSION_FACTORY.create(
+ BootVolumeKmsKey.class);
+
+ com.oracle.bmc.http.internal.WithHeaders
+ response = responseFn.apply(rawResponse);
+ javax.ws.rs.core.MultivaluedMap headers =
+ response.getHeaders();
+
+ GetBootVolumeKmsKeyResponse.Builder builder =
+ GetBootVolumeKmsKeyResponse.builder();
+
+ builder.bootVolumeKmsKey(response.getItem());
+
+ com.google.common.base.Optional> etagHeader =
+ com.oracle.bmc.http.internal.HeaderUtils.get(
+ headers, "etag");
+ if (etagHeader.isPresent()) {
+ builder.etag(
+ com.oracle.bmc.http.internal.HeaderUtils.toValue(
+ "etag", etagHeader.get().get(0), String.class));
+ }
+
+ com.google.common.base.Optional>
+ opcRequestIdHeader =
+ com.oracle.bmc.http.internal.HeaderUtils.get(
+ headers, "opc-request-id");
+ if (opcRequestIdHeader.isPresent()) {
+ builder.opcRequestId(
+ com.oracle.bmc.http.internal.HeaderUtils.toValue(
+ "opc-request-id",
+ opcRequestIdHeader.get().get(0),
+ String.class));
+ }
+
+ GetBootVolumeKmsKeyResponse responseWrapper = builder.build();
+
+ return responseWrapper;
+ }
+ };
+ return transformer;
+ }
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/GetVolumeKmsKeyConverter.java b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/GetVolumeKmsKeyConverter.java
new file mode 100644
index 00000000000..444a41f7bae
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/GetVolumeKmsKeyConverter.java
@@ -0,0 +1,105 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.internal.http;
+
+import com.oracle.bmc.core.model.*;
+import com.oracle.bmc.core.requests.*;
+import com.oracle.bmc.core.responses.*;
+import org.apache.commons.lang3.Validate;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.extern.slf4j.Slf4j
+public class GetVolumeKmsKeyConverter {
+ private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory
+ RESPONSE_CONVERSION_FACTORY =
+ new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory();
+
+ public static GetVolumeKmsKeyRequest interceptRequest(GetVolumeKmsKeyRequest request) {
+
+ return request;
+ }
+
+ public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest(
+ com.oracle.bmc.http.internal.RestClient client, GetVolumeKmsKeyRequest request) {
+ Validate.notNull(request, "request instance is required");
+ Validate.notBlank(request.getVolumeId(), "volumeId must not be blank");
+
+ com.oracle.bmc.http.internal.WrappedWebTarget target =
+ client.getBaseTarget()
+ .path("/20160918")
+ .path("volumes")
+ .path(
+ com.oracle.bmc.util.internal.HttpUtils.encodePathSegment(
+ request.getVolumeId()))
+ .path("kmsKey");
+
+ com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request();
+
+ ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON);
+
+ if (request.getIfMatch() != null) {
+ ib.header("if-match", request.getIfMatch());
+ }
+
+ return ib;
+ }
+
+ public static com.google.common.base.Function<
+ javax.ws.rs.core.Response, GetVolumeKmsKeyResponse>
+ fromResponse() {
+ final com.google.common.base.Function
+ transformer =
+ new com.google.common.base.Function<
+ javax.ws.rs.core.Response, GetVolumeKmsKeyResponse>() {
+ @Override
+ public GetVolumeKmsKeyResponse apply(
+ javax.ws.rs.core.Response rawResponse) {
+ LOG.trace("Transform function invoked for GetVolumeKmsKeyResponse");
+ com.google.common.base.Function<
+ javax.ws.rs.core.Response,
+ com.oracle.bmc.http.internal.WithHeaders<
+ VolumeKmsKey>>
+ responseFn =
+ RESPONSE_CONVERSION_FACTORY.create(
+ VolumeKmsKey.class);
+
+ com.oracle.bmc.http.internal.WithHeaders response =
+ responseFn.apply(rawResponse);
+ javax.ws.rs.core.MultivaluedMap headers =
+ response.getHeaders();
+
+ GetVolumeKmsKeyResponse.Builder builder =
+ GetVolumeKmsKeyResponse.builder();
+
+ builder.volumeKmsKey(response.getItem());
+
+ com.google.common.base.Optional> etagHeader =
+ com.oracle.bmc.http.internal.HeaderUtils.get(
+ headers, "etag");
+ if (etagHeader.isPresent()) {
+ builder.etag(
+ com.oracle.bmc.http.internal.HeaderUtils.toValue(
+ "etag", etagHeader.get().get(0), String.class));
+ }
+
+ com.google.common.base.Optional>
+ opcRequestIdHeader =
+ com.oracle.bmc.http.internal.HeaderUtils.get(
+ headers, "opc-request-id");
+ if (opcRequestIdHeader.isPresent()) {
+ builder.opcRequestId(
+ com.oracle.bmc.http.internal.HeaderUtils.toValue(
+ "opc-request-id",
+ opcRequestIdHeader.get().get(0),
+ String.class));
+ }
+
+ GetVolumeKmsKeyResponse responseWrapper = builder.build();
+
+ return responseWrapper;
+ }
+ };
+ return transformer;
+ }
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/UpdateBootVolumeKmsKeyConverter.java b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/UpdateBootVolumeKmsKeyConverter.java
new file mode 100644
index 00000000000..c3f08e15995
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/UpdateBootVolumeKmsKeyConverter.java
@@ -0,0 +1,111 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.internal.http;
+
+import com.oracle.bmc.core.model.*;
+import com.oracle.bmc.core.requests.*;
+import com.oracle.bmc.core.responses.*;
+import org.apache.commons.lang3.Validate;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.extern.slf4j.Slf4j
+public class UpdateBootVolumeKmsKeyConverter {
+ private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory
+ RESPONSE_CONVERSION_FACTORY =
+ new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory();
+
+ public static UpdateBootVolumeKmsKeyRequest interceptRequest(
+ UpdateBootVolumeKmsKeyRequest request) {
+
+ return request;
+ }
+
+ public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest(
+ com.oracle.bmc.http.internal.RestClient client, UpdateBootVolumeKmsKeyRequest request) {
+ Validate.notNull(request, "request instance is required");
+ Validate.notBlank(request.getBootVolumeId(), "bootVolumeId must not be blank");
+ Validate.notNull(
+ request.getUpdateBootVolumeKmsKeyDetails(),
+ "updateBootVolumeKmsKeyDetails is required");
+
+ com.oracle.bmc.http.internal.WrappedWebTarget target =
+ client.getBaseTarget()
+ .path("/20160918")
+ .path("bootVolumes")
+ .path(
+ com.oracle.bmc.util.internal.HttpUtils.encodePathSegment(
+ request.getBootVolumeId()))
+ .path("kmsKey");
+
+ com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request();
+
+ ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON);
+
+ if (request.getIfMatch() != null) {
+ ib.header("if-match", request.getIfMatch());
+ }
+
+ return ib;
+ }
+
+ public static com.google.common.base.Function<
+ javax.ws.rs.core.Response, UpdateBootVolumeKmsKeyResponse>
+ fromResponse() {
+ final com.google.common.base.Function<
+ javax.ws.rs.core.Response, UpdateBootVolumeKmsKeyResponse>
+ transformer =
+ new com.google.common.base.Function<
+ javax.ws.rs.core.Response, UpdateBootVolumeKmsKeyResponse>() {
+ @Override
+ public UpdateBootVolumeKmsKeyResponse apply(
+ javax.ws.rs.core.Response rawResponse) {
+ LOG.trace(
+ "Transform function invoked for UpdateBootVolumeKmsKeyResponse");
+ com.google.common.base.Function<
+ javax.ws.rs.core.Response,
+ com.oracle.bmc.http.internal.WithHeaders<
+ BootVolumeKmsKey>>
+ responseFn =
+ RESPONSE_CONVERSION_FACTORY.create(
+ BootVolumeKmsKey.class);
+
+ com.oracle.bmc.http.internal.WithHeaders
+ response = responseFn.apply(rawResponse);
+ javax.ws.rs.core.MultivaluedMap headers =
+ response.getHeaders();
+
+ UpdateBootVolumeKmsKeyResponse.Builder builder =
+ UpdateBootVolumeKmsKeyResponse.builder();
+
+ builder.bootVolumeKmsKey(response.getItem());
+
+ com.google.common.base.Optional> etagHeader =
+ com.oracle.bmc.http.internal.HeaderUtils.get(
+ headers, "etag");
+ if (etagHeader.isPresent()) {
+ builder.etag(
+ com.oracle.bmc.http.internal.HeaderUtils.toValue(
+ "etag", etagHeader.get().get(0), String.class));
+ }
+
+ com.google.common.base.Optional>
+ opcRequestIdHeader =
+ com.oracle.bmc.http.internal.HeaderUtils.get(
+ headers, "opc-request-id");
+ if (opcRequestIdHeader.isPresent()) {
+ builder.opcRequestId(
+ com.oracle.bmc.http.internal.HeaderUtils.toValue(
+ "opc-request-id",
+ opcRequestIdHeader.get().get(0),
+ String.class));
+ }
+
+ UpdateBootVolumeKmsKeyResponse responseWrapper = builder.build();
+
+ return responseWrapper;
+ }
+ };
+ return transformer;
+ }
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/UpdateVolumeKmsKeyConverter.java b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/UpdateVolumeKmsKeyConverter.java
new file mode 100644
index 00000000000..e9f04f5ce00
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/UpdateVolumeKmsKeyConverter.java
@@ -0,0 +1,108 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.internal.http;
+
+import com.oracle.bmc.core.model.*;
+import com.oracle.bmc.core.requests.*;
+import com.oracle.bmc.core.responses.*;
+import org.apache.commons.lang3.Validate;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.extern.slf4j.Slf4j
+public class UpdateVolumeKmsKeyConverter {
+ private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory
+ RESPONSE_CONVERSION_FACTORY =
+ new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory();
+
+ public static UpdateVolumeKmsKeyRequest interceptRequest(UpdateVolumeKmsKeyRequest request) {
+
+ return request;
+ }
+
+ public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest(
+ com.oracle.bmc.http.internal.RestClient client, UpdateVolumeKmsKeyRequest request) {
+ Validate.notNull(request, "request instance is required");
+ Validate.notBlank(request.getVolumeId(), "volumeId must not be blank");
+ Validate.notNull(
+ request.getUpdateVolumeKmsKeyDetails(), "updateVolumeKmsKeyDetails is required");
+
+ com.oracle.bmc.http.internal.WrappedWebTarget target =
+ client.getBaseTarget()
+ .path("/20160918")
+ .path("volumes")
+ .path(
+ com.oracle.bmc.util.internal.HttpUtils.encodePathSegment(
+ request.getVolumeId()))
+ .path("kmsKey");
+
+ com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request();
+
+ ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON);
+
+ if (request.getIfMatch() != null) {
+ ib.header("if-match", request.getIfMatch());
+ }
+
+ return ib;
+ }
+
+ public static com.google.common.base.Function<
+ javax.ws.rs.core.Response, UpdateVolumeKmsKeyResponse>
+ fromResponse() {
+ final com.google.common.base.Function
+ transformer =
+ new com.google.common.base.Function<
+ javax.ws.rs.core.Response, UpdateVolumeKmsKeyResponse>() {
+ @Override
+ public UpdateVolumeKmsKeyResponse apply(
+ javax.ws.rs.core.Response rawResponse) {
+ LOG.trace(
+ "Transform function invoked for UpdateVolumeKmsKeyResponse");
+ com.google.common.base.Function<
+ javax.ws.rs.core.Response,
+ com.oracle.bmc.http.internal.WithHeaders<
+ VolumeKmsKey>>
+ responseFn =
+ RESPONSE_CONVERSION_FACTORY.create(
+ VolumeKmsKey.class);
+
+ com.oracle.bmc.http.internal.WithHeaders response =
+ responseFn.apply(rawResponse);
+ javax.ws.rs.core.MultivaluedMap headers =
+ response.getHeaders();
+
+ UpdateVolumeKmsKeyResponse.Builder builder =
+ UpdateVolumeKmsKeyResponse.builder();
+
+ builder.volumeKmsKey(response.getItem());
+
+ com.google.common.base.Optional> etagHeader =
+ com.oracle.bmc.http.internal.HeaderUtils.get(
+ headers, "etag");
+ if (etagHeader.isPresent()) {
+ builder.etag(
+ com.oracle.bmc.http.internal.HeaderUtils.toValue(
+ "etag", etagHeader.get().get(0), String.class));
+ }
+
+ com.google.common.base.Optional>
+ opcRequestIdHeader =
+ com.oracle.bmc.http.internal.HeaderUtils.get(
+ headers, "opc-request-id");
+ if (opcRequestIdHeader.isPresent()) {
+ builder.opcRequestId(
+ com.oracle.bmc.http.internal.HeaderUtils.toValue(
+ "opc-request-id",
+ opcRequestIdHeader.get().get(0),
+ String.class));
+ }
+
+ UpdateVolumeKmsKeyResponse responseWrapper = builder.build();
+
+ return responseWrapper;
+ }
+ };
+ return transformer;
+ }
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/BootVolume.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/BootVolume.java
index c20b46f0751..67e8cdcfc19 100644
--- a/bmc-core/src/main/java/com/oracle/bmc/core/model/BootVolume.java
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/BootVolume.java
@@ -158,6 +158,15 @@ public Builder volumeGroupId(String volumeGroupId) {
return this;
}
+ @com.fasterxml.jackson.annotation.JsonProperty("kmsKeyId")
+ private String kmsKeyId;
+
+ public Builder kmsKeyId(String kmsKeyId) {
+ this.kmsKeyId = kmsKeyId;
+ this.__explicitlySet__.add("kmsKeyId");
+ return this;
+ }
+
@com.fasterxml.jackson.annotation.JsonIgnore
private final java.util.Set __explicitlySet__ = new java.util.HashSet();
@@ -177,7 +186,8 @@ public BootVolume build() {
sizeInMBs,
sourceDetails,
timeCreated,
- volumeGroupId);
+ volumeGroupId,
+ kmsKeyId);
__instance__.__explicitlySet__.addAll(__explicitlySet__);
return __instance__;
}
@@ -198,7 +208,8 @@ public Builder copy(BootVolume o) {
.sizeInMBs(o.getSizeInMBs())
.sourceDetails(o.getSourceDetails())
.timeCreated(o.getTimeCreated())
- .volumeGroupId(o.getVolumeGroupId());
+ .volumeGroupId(o.getVolumeGroupId())
+ .kmsKeyId(o.getKmsKeyId());
copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__);
return copiedBuilder;
@@ -363,6 +374,12 @@ public static LifecycleState create(String key) {
@com.fasterxml.jackson.annotation.JsonProperty("volumeGroupId")
String volumeGroupId;
+ /**
+ * The OCID of the KMS key which is the master encryption key for the boot volume.
+ **/
+ @com.fasterxml.jackson.annotation.JsonProperty("kmsKeyId")
+ String kmsKeyId;
+
@com.fasterxml.jackson.annotation.JsonIgnore
private final java.util.Set __explicitlySet__ = new java.util.HashSet();
}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/BootVolumeKmsKey.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/BootVolumeKmsKey.java
new file mode 100644
index 00000000000..49003ac6f1b
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/BootVolumeKmsKey.java
@@ -0,0 +1,69 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.model;
+
+/**
+ * Kms key id associated with this volume.
+ *
+ *
+ * Note: Objects should always be created or deserialized using the {@link Builder}. This model distinguishes fields
+ * that are {@code null} because they are unset from fields that are explicitly set to {@code null}. This is done in
+ * the setter methods of the {@link Builder}, which maintain a set of all explicitly set fields called
+ * {@link #__explicitlySet__}. The {@link #hashCode()} and {@link #equals(Object)} methods are implemented to take
+ * {@link #__explicitlySet__} into account. The constructor, on the other hand, does not set {@link #__explicitlySet__}
+ * (since the constructor cannot distinguish explicit {@code null} from unset {@code null}).
+ **/
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.AllArgsConstructor(onConstructor = @__({@Deprecated}))
+@lombok.Value
+@com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = BootVolumeKmsKey.Builder.class)
+@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME)
+public class BootVolumeKmsKey {
+ @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "")
+ @lombok.experimental.Accessors(fluent = true)
+ public static class Builder {
+ @com.fasterxml.jackson.annotation.JsonProperty("kmsKeyId")
+ private String kmsKeyId;
+
+ public Builder kmsKeyId(String kmsKeyId) {
+ this.kmsKeyId = kmsKeyId;
+ this.__explicitlySet__.add("kmsKeyId");
+ return this;
+ }
+
+ @com.fasterxml.jackson.annotation.JsonIgnore
+ private final java.util.Set __explicitlySet__ = new java.util.HashSet();
+
+ public BootVolumeKmsKey build() {
+ BootVolumeKmsKey __instance__ = new BootVolumeKmsKey(kmsKeyId);
+ __instance__.__explicitlySet__.addAll(__explicitlySet__);
+ return __instance__;
+ }
+
+ @com.fasterxml.jackson.annotation.JsonIgnore
+ public Builder copy(BootVolumeKmsKey o) {
+ Builder copiedBuilder = kmsKeyId(o.getKmsKeyId());
+
+ copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__);
+ return copiedBuilder;
+ }
+ }
+
+ /**
+ * Create a new builder.
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * Kms key id associated with this volume. If volume is not using KMS, then kmsKeyId will be null string.
+ *
+ **/
+ @com.fasterxml.jackson.annotation.JsonProperty("kmsKeyId")
+ String kmsKeyId;
+
+ @com.fasterxml.jackson.annotation.JsonIgnore
+ private final java.util.Set __explicitlySet__ = new java.util.HashSet();
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/CreateBootVolumeDetails.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/CreateBootVolumeDetails.java
index b665752aba3..9dc84e9d97b 100644
--- a/bmc-core/src/main/java/com/oracle/bmc/core/model/CreateBootVolumeDetails.java
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/CreateBootVolumeDetails.java
@@ -79,6 +79,15 @@ public Builder freeformTags(java.util.Map freeformTags) {
return this;
}
+ @com.fasterxml.jackson.annotation.JsonProperty("kmsKeyId")
+ private String kmsKeyId;
+
+ public Builder kmsKeyId(String kmsKeyId) {
+ this.kmsKeyId = kmsKeyId;
+ this.__explicitlySet__.add("kmsKeyId");
+ return this;
+ }
+
@com.fasterxml.jackson.annotation.JsonProperty("sizeInGBs")
private Long sizeInGBs;
@@ -109,6 +118,7 @@ public CreateBootVolumeDetails build() {
definedTags,
displayName,
freeformTags,
+ kmsKeyId,
sizeInGBs,
sourceDetails);
__instance__.__explicitlySet__.addAll(__explicitlySet__);
@@ -124,6 +134,7 @@ public Builder copy(CreateBootVolumeDetails o) {
.definedTags(o.getDefinedTags())
.displayName(o.getDisplayName())
.freeformTags(o.getFreeformTags())
+ .kmsKeyId(o.getKmsKeyId())
.sizeInGBs(o.getSizeInGBs())
.sourceDetails(o.getSourceDetails());
@@ -191,6 +202,12 @@ public static Builder builder() {
@com.fasterxml.jackson.annotation.JsonProperty("freeformTags")
java.util.Map freeformTags;
+ /**
+ * The OCID of the KMS key to be used as the master encryption key for the boot volume.
+ **/
+ @com.fasterxml.jackson.annotation.JsonProperty("kmsKeyId")
+ String kmsKeyId;
+
/**
* The size of the volume in GBs.
**/
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/CreateImageDetails.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/CreateImageDetails.java
index 76c9cf4b5fe..3b1ff90d93b 100644
--- a/bmc-core/src/main/java/com/oracle/bmc/core/model/CreateImageDetails.java
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/CreateImageDetails.java
@@ -182,12 +182,14 @@ public static Builder builder() {
* Specifies the configuration mode for launching virtual machine (VM) instances. The configuration modes are:
* * `NATIVE` - VM instances launch with iSCSI boot and VFIO devices. The default value for Oracle-provided images.
* * `EMULATED` - VM instances launch with emulated devices, such as the E1000 network driver and emulated SCSI disk controller.
+ * * `PARAVIRTUALIZED` - VM instances launch with paravirtualized devices using virtio drivers.
* * `CUSTOM` - VM instances launch with custom configuration settings specified in the `LaunchOptions` parameter.
*
**/
public enum LaunchMode {
Native("NATIVE"),
Emulated("EMULATED"),
+ Paravirtualized("PARAVIRTUALIZED"),
Custom("CUSTOM"),
;
@@ -222,6 +224,7 @@ public static LaunchMode create(String key) {
* Specifies the configuration mode for launching virtual machine (VM) instances. The configuration modes are:
* * `NATIVE` - VM instances launch with iSCSI boot and VFIO devices. The default value for Oracle-provided images.
* * `EMULATED` - VM instances launch with emulated devices, such as the E1000 network driver and emulated SCSI disk controller.
+ * * `PARAVIRTUALIZED` - VM instances launch with paravirtualized devices using virtio drivers.
* * `CUSTOM` - VM instances launch with custom configuration settings specified in the `LaunchOptions` parameter.
*
**/
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/CreateVolumeDetails.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/CreateVolumeDetails.java
index 7c6908f11c3..131c5fa644e 100644
--- a/bmc-core/src/main/java/com/oracle/bmc/core/model/CreateVolumeDetails.java
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/CreateVolumeDetails.java
@@ -79,6 +79,15 @@ public Builder freeformTags(java.util.Map freeformTags) {
return this;
}
+ @com.fasterxml.jackson.annotation.JsonProperty("kmsKeyId")
+ private String kmsKeyId;
+
+ public Builder kmsKeyId(String kmsKeyId) {
+ this.kmsKeyId = kmsKeyId;
+ this.__explicitlySet__.add("kmsKeyId");
+ return this;
+ }
+
@com.fasterxml.jackson.annotation.JsonProperty("sizeInGBs")
private Long sizeInGBs;
@@ -127,6 +136,7 @@ public CreateVolumeDetails build() {
definedTags,
displayName,
freeformTags,
+ kmsKeyId,
sizeInGBs,
sizeInMBs,
sourceDetails,
@@ -144,6 +154,7 @@ public Builder copy(CreateVolumeDetails o) {
.definedTags(o.getDefinedTags())
.displayName(o.getDisplayName())
.freeformTags(o.getFreeformTags())
+ .kmsKeyId(o.getKmsKeyId())
.sizeInGBs(o.getSizeInGBs())
.sizeInMBs(o.getSizeInMBs())
.sourceDetails(o.getSourceDetails())
@@ -213,6 +224,12 @@ public static Builder builder() {
@com.fasterxml.jackson.annotation.JsonProperty("freeformTags")
java.util.Map freeformTags;
+ /**
+ * The OCID of the KMS key to be used as the master encryption key for the volume.
+ **/
+ @com.fasterxml.jackson.annotation.JsonProperty("kmsKeyId")
+ String kmsKeyId;
+
/**
* The size of the volume in GBs.
**/
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/Image.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/Image.java
index 15e9d6bc27a..827c5e8f029 100644
--- a/bmc-core/src/main/java/com/oracle/bmc/core/model/Image.java
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/Image.java
@@ -275,6 +275,7 @@ public static Builder builder() {
* Specifies the configuration mode for launching virtual machine (VM) instances. The configuration modes are:
* * `NATIVE` - VM instances launch with iSCSI boot and VFIO devices. The default value for Oracle-provided images.
* * `EMULATED` - VM instances launch with emulated devices, such as the E1000 network driver and emulated SCSI disk controller.
+ * * `PARAVIRTUALIZED` - VM instances launch with paravirtualized devices using virtio drivers.
* * `CUSTOM` - VM instances launch with custom configuration settings specified in the `LaunchOptions` parameter.
*
**/
@@ -282,6 +283,7 @@ public static Builder builder() {
public enum LaunchMode {
Native("NATIVE"),
Emulated("EMULATED"),
+ Paravirtualized("PARAVIRTUALIZED"),
Custom("CUSTOM"),
/**
@@ -326,6 +328,7 @@ public static LaunchMode create(String key) {
* Specifies the configuration mode for launching virtual machine (VM) instances. The configuration modes are:
* * `NATIVE` - VM instances launch with iSCSI boot and VFIO devices. The default value for Oracle-provided images.
* * `EMULATED` - VM instances launch with emulated devices, such as the E1000 network driver and emulated SCSI disk controller.
+ * * `PARAVIRTUALIZED` - VM instances launch with paravirtualized devices using virtio drivers.
* * `CUSTOM` - VM instances launch with custom configuration settings specified in the `LaunchOptions` parameter.
*
**/
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/Instance.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/Instance.java
index 69c921aed66..db7874c5973 100644
--- a/bmc-core/src/main/java/com/oracle/bmc/core/model/Instance.java
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/Instance.java
@@ -375,6 +375,7 @@ public static Builder builder() {
* Specifies the configuration mode for launching virtual machine (VM) instances. The configuration modes are:
* * `NATIVE` - VM instances launch with iSCSI boot and VFIO devices. The default value for Oracle-provided images.
* * `EMULATED` - VM instances launch with emulated devices, such as the E1000 network driver and emulated SCSI disk controller.
+ * * `PARAVIRTUALIZED` - VM instances launch with paravirtualized devices using virtio drivers.
* * `CUSTOM` - VM instances launch with custom configuration settings specified in the `LaunchOptions` parameter.
*
**/
@@ -382,6 +383,7 @@ public static Builder builder() {
public enum LaunchMode {
Native("NATIVE"),
Emulated("EMULATED"),
+ Paravirtualized("PARAVIRTUALIZED"),
Custom("CUSTOM"),
/**
@@ -426,6 +428,7 @@ public static LaunchMode create(String key) {
* Specifies the configuration mode for launching virtual machine (VM) instances. The configuration modes are:
* * `NATIVE` - VM instances launch with iSCSI boot and VFIO devices. The default value for Oracle-provided images.
* * `EMULATED` - VM instances launch with emulated devices, such as the E1000 network driver and emulated SCSI disk controller.
+ * * `PARAVIRTUALIZED` - VM instances launch with paravirtualized devices using virtio drivers.
* * `CUSTOM` - VM instances launch with custom configuration settings specified in the `LaunchOptions` parameter.
*
**/
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/InstanceSourceViaImageDetails.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/InstanceSourceViaImageDetails.java
index 62bff5b8535..9edd686761d 100644
--- a/bmc-core/src/main/java/com/oracle/bmc/core/model/InstanceSourceViaImageDetails.java
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/InstanceSourceViaImageDetails.java
@@ -48,12 +48,21 @@ public Builder imageId(String imageId) {
return this;
}
+ @com.fasterxml.jackson.annotation.JsonProperty("kmsKeyId")
+ private String kmsKeyId;
+
+ public Builder kmsKeyId(String kmsKeyId) {
+ this.kmsKeyId = kmsKeyId;
+ this.__explicitlySet__.add("kmsKeyId");
+ return this;
+ }
+
@com.fasterxml.jackson.annotation.JsonIgnore
private final java.util.Set __explicitlySet__ = new java.util.HashSet();
public InstanceSourceViaImageDetails build() {
InstanceSourceViaImageDetails __instance__ =
- new InstanceSourceViaImageDetails(bootVolumeSizeInGBs, imageId);
+ new InstanceSourceViaImageDetails(bootVolumeSizeInGBs, imageId, kmsKeyId);
__instance__.__explicitlySet__.addAll(__explicitlySet__);
return __instance__;
}
@@ -61,7 +70,9 @@ public InstanceSourceViaImageDetails build() {
@com.fasterxml.jackson.annotation.JsonIgnore
public Builder copy(InstanceSourceViaImageDetails o) {
Builder copiedBuilder =
- bootVolumeSizeInGBs(o.getBootVolumeSizeInGBs()).imageId(o.getImageId());
+ bootVolumeSizeInGBs(o.getBootVolumeSizeInGBs())
+ .imageId(o.getImageId())
+ .kmsKeyId(o.getKmsKeyId());
copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__);
return copiedBuilder;
@@ -76,10 +87,12 @@ public static Builder builder() {
}
@Deprecated
- public InstanceSourceViaImageDetails(Long bootVolumeSizeInGBs, String imageId) {
+ public InstanceSourceViaImageDetails(
+ Long bootVolumeSizeInGBs, String imageId, String kmsKeyId) {
super();
this.bootVolumeSizeInGBs = bootVolumeSizeInGBs;
this.imageId = imageId;
+ this.kmsKeyId = kmsKeyId;
}
/**
@@ -94,6 +107,12 @@ public InstanceSourceViaImageDetails(Long bootVolumeSizeInGBs, String imageId) {
@com.fasterxml.jackson.annotation.JsonProperty("imageId")
String imageId;
+ /**
+ * The OCID of the KMS key to be used as the master encryption key for the boot volume.
+ **/
+ @com.fasterxml.jackson.annotation.JsonProperty("kmsKeyId")
+ String kmsKeyId;
+
@com.fasterxml.jackson.annotation.JsonIgnore
private final java.util.Set __explicitlySet__ = new java.util.HashSet();
}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/LaunchOptions.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/LaunchOptions.java
index 836fb48b436..e6b1d14a217 100644
--- a/bmc-core/src/main/java/com/oracle/bmc/core/model/LaunchOptions.java
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/LaunchOptions.java
@@ -224,12 +224,14 @@ public static Firmware create(String key) {
* Emulation type for NIC.
* * `E1000` - Emulated Gigabit ethernet controller. Compatible with Linux e1000 network driver.
* * `VFIO` - Direct attached Virtual Function network controller. Default for Oracle provided images.
+ * * `PARAVIRTUALIZED` - VM instances launch with paravirtualized devices using virtio drivers.
*
**/
@lombok.extern.slf4j.Slf4j
public enum NetworkType {
E1000("E1000"),
Vfio("VFIO"),
+ Paravirtualized("PARAVIRTUALIZED"),
/**
* This value is used if a service returns a value for this enum that is not recognized by this
@@ -273,6 +275,7 @@ public static NetworkType create(String key) {
* Emulation type for NIC.
* * `E1000` - Emulated Gigabit ethernet controller. Compatible with Linux e1000 network driver.
* * `VFIO` - Direct attached Virtual Function network controller. Default for Oracle provided images.
+ * * `PARAVIRTUALIZED` - VM instances launch with paravirtualized devices using virtio drivers.
*
**/
@com.fasterxml.jackson.annotation.JsonProperty("networkType")
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/UpdateBootVolumeKmsKeyDetails.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/UpdateBootVolumeKmsKeyDetails.java
new file mode 100644
index 00000000000..939e678d1ac
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/UpdateBootVolumeKmsKeyDetails.java
@@ -0,0 +1,74 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.model;
+
+/**
+ *
+ *
+ * Note: Objects should always be created or deserialized using the {@link Builder}. This model distinguishes fields
+ * that are {@code null} because they are unset from fields that are explicitly set to {@code null}. This is done in
+ * the setter methods of the {@link Builder}, which maintain a set of all explicitly set fields called
+ * {@link #__explicitlySet__}. The {@link #hashCode()} and {@link #equals(Object)} methods are implemented to take
+ * {@link #__explicitlySet__} into account. The constructor, on the other hand, does not set {@link #__explicitlySet__}
+ * (since the constructor cannot distinguish explicit {@code null} from unset {@code null}).
+ **/
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.AllArgsConstructor(onConstructor = @__({@Deprecated}))
+@lombok.Value
+@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
+ builder = UpdateBootVolumeKmsKeyDetails.Builder.class
+)
+@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME)
+public class UpdateBootVolumeKmsKeyDetails {
+ @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "")
+ @lombok.experimental.Accessors(fluent = true)
+ public static class Builder {
+ @com.fasterxml.jackson.annotation.JsonProperty("kmsKeyId")
+ private String kmsKeyId;
+
+ public Builder kmsKeyId(String kmsKeyId) {
+ this.kmsKeyId = kmsKeyId;
+ this.__explicitlySet__.add("kmsKeyId");
+ return this;
+ }
+
+ @com.fasterxml.jackson.annotation.JsonIgnore
+ private final java.util.Set __explicitlySet__ = new java.util.HashSet();
+
+ public UpdateBootVolumeKmsKeyDetails build() {
+ UpdateBootVolumeKmsKeyDetails __instance__ =
+ new UpdateBootVolumeKmsKeyDetails(kmsKeyId);
+ __instance__.__explicitlySet__.addAll(__explicitlySet__);
+ return __instance__;
+ }
+
+ @com.fasterxml.jackson.annotation.JsonIgnore
+ public Builder copy(UpdateBootVolumeKmsKeyDetails o) {
+ Builder copiedBuilder = kmsKeyId(o.getKmsKeyId());
+
+ copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__);
+ return copiedBuilder;
+ }
+ }
+
+ /**
+ * Create a new builder.
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * The new kms key which will be used to protect the specific volume.
+ * This key has to be a valid kms key ocid, and user must have key delegation policy to allow them to access this key.
+ * Even if this new kms key is the same as the previous kms key id, block storage service will use it to regenerate a new volume encryption key.
+ * Example: `{\"kmsKeyId\": \"ocid1.key.region1.sea.afnl2n7daag4s.abzwkljs6uevhlgcznhmh7oiatyrxngrywc3tje3uk3g77hzmewqiieuk75f\"}`
+ *
+ **/
+ @com.fasterxml.jackson.annotation.JsonProperty("kmsKeyId")
+ String kmsKeyId;
+
+ @com.fasterxml.jackson.annotation.JsonIgnore
+ private final java.util.Set __explicitlySet__ = new java.util.HashSet();
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/UpdateVolumeKmsKeyDetails.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/UpdateVolumeKmsKeyDetails.java
new file mode 100644
index 00000000000..d8028fb7fbe
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/UpdateVolumeKmsKeyDetails.java
@@ -0,0 +1,73 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.model;
+
+/**
+ *
+ *
+ * Note: Objects should always be created or deserialized using the {@link Builder}. This model distinguishes fields
+ * that are {@code null} because they are unset from fields that are explicitly set to {@code null}. This is done in
+ * the setter methods of the {@link Builder}, which maintain a set of all explicitly set fields called
+ * {@link #__explicitlySet__}. The {@link #hashCode()} and {@link #equals(Object)} methods are implemented to take
+ * {@link #__explicitlySet__} into account. The constructor, on the other hand, does not set {@link #__explicitlySet__}
+ * (since the constructor cannot distinguish explicit {@code null} from unset {@code null}).
+ **/
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.AllArgsConstructor(onConstructor = @__({@Deprecated}))
+@lombok.Value
+@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
+ builder = UpdateVolumeKmsKeyDetails.Builder.class
+)
+@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME)
+public class UpdateVolumeKmsKeyDetails {
+ @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "")
+ @lombok.experimental.Accessors(fluent = true)
+ public static class Builder {
+ @com.fasterxml.jackson.annotation.JsonProperty("kmsKeyId")
+ private String kmsKeyId;
+
+ public Builder kmsKeyId(String kmsKeyId) {
+ this.kmsKeyId = kmsKeyId;
+ this.__explicitlySet__.add("kmsKeyId");
+ return this;
+ }
+
+ @com.fasterxml.jackson.annotation.JsonIgnore
+ private final java.util.Set __explicitlySet__ = new java.util.HashSet();
+
+ public UpdateVolumeKmsKeyDetails build() {
+ UpdateVolumeKmsKeyDetails __instance__ = new UpdateVolumeKmsKeyDetails(kmsKeyId);
+ __instance__.__explicitlySet__.addAll(__explicitlySet__);
+ return __instance__;
+ }
+
+ @com.fasterxml.jackson.annotation.JsonIgnore
+ public Builder copy(UpdateVolumeKmsKeyDetails o) {
+ Builder copiedBuilder = kmsKeyId(o.getKmsKeyId());
+
+ copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__);
+ return copiedBuilder;
+ }
+ }
+
+ /**
+ * Create a new builder.
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * The new kms key which will be used to protect the specific volume.
+ * This key has to be a valid kms key ocid, and user must have key delegation policy to allow them to access this key.
+ * Even if this new kms key is the same as the previous kms key id, block storage service will use it to regenerate a new volume encryption key.
+ * Example: `{\"kmsKeyId\": \"ocid1.key.region1.sea.afnl2n7daag4s.abzwkljs6uevhlgcznhmh7oiatyrxngrywc3tje3uk3g77hzmewqiieuk75f\"}`
+ *
+ **/
+ @com.fasterxml.jackson.annotation.JsonProperty("kmsKeyId")
+ String kmsKeyId;
+
+ @com.fasterxml.jackson.annotation.JsonIgnore
+ private final java.util.Set __explicitlySet__ = new java.util.HashSet();
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/Volume.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/Volume.java
index bfeb8a1aa25..0ab32247dc3 100644
--- a/bmc-core/src/main/java/com/oracle/bmc/core/model/Volume.java
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/Volume.java
@@ -96,6 +96,15 @@ public Builder isHydrated(Boolean isHydrated) {
return this;
}
+ @com.fasterxml.jackson.annotation.JsonProperty("kmsKeyId")
+ private String kmsKeyId;
+
+ public Builder kmsKeyId(String kmsKeyId) {
+ this.kmsKeyId = kmsKeyId;
+ this.__explicitlySet__.add("kmsKeyId");
+ return this;
+ }
+
@com.fasterxml.jackson.annotation.JsonProperty("lifecycleState")
private LifecycleState lifecycleState;
@@ -163,6 +172,7 @@ public Volume build() {
freeformTags,
id,
isHydrated,
+ kmsKeyId,
lifecycleState,
sizeInGBs,
sizeInMBs,
@@ -183,6 +193,7 @@ public Builder copy(Volume o) {
.freeformTags(o.getFreeformTags())
.id(o.getId())
.isHydrated(o.getIsHydrated())
+ .kmsKeyId(o.getKmsKeyId())
.lifecycleState(o.getLifecycleState())
.sizeInGBs(o.getSizeInGBs())
.sizeInMBs(o.getSizeInMBs())
@@ -257,6 +268,12 @@ public static Builder builder() {
**/
@com.fasterxml.jackson.annotation.JsonProperty("isHydrated")
Boolean isHydrated;
+
+ /**
+ * The OCID of the KMS key which is the master encryption key for the volume.
+ **/
+ @com.fasterxml.jackson.annotation.JsonProperty("kmsKeyId")
+ String kmsKeyId;
/**
* The current state of a volume.
**/
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/VolumeKmsKey.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/VolumeKmsKey.java
new file mode 100644
index 00000000000..a8c3fabef32
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/VolumeKmsKey.java
@@ -0,0 +1,69 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.model;
+
+/**
+ * Kms key id associated with this volume.
+ *
+ *
+ * Note: Objects should always be created or deserialized using the {@link Builder}. This model distinguishes fields
+ * that are {@code null} because they are unset from fields that are explicitly set to {@code null}. This is done in
+ * the setter methods of the {@link Builder}, which maintain a set of all explicitly set fields called
+ * {@link #__explicitlySet__}. The {@link #hashCode()} and {@link #equals(Object)} methods are implemented to take
+ * {@link #__explicitlySet__} into account. The constructor, on the other hand, does not set {@link #__explicitlySet__}
+ * (since the constructor cannot distinguish explicit {@code null} from unset {@code null}).
+ **/
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.AllArgsConstructor(onConstructor = @__({@Deprecated}))
+@lombok.Value
+@com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = VolumeKmsKey.Builder.class)
+@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME)
+public class VolumeKmsKey {
+ @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "")
+ @lombok.experimental.Accessors(fluent = true)
+ public static class Builder {
+ @com.fasterxml.jackson.annotation.JsonProperty("kmsKeyId")
+ private String kmsKeyId;
+
+ public Builder kmsKeyId(String kmsKeyId) {
+ this.kmsKeyId = kmsKeyId;
+ this.__explicitlySet__.add("kmsKeyId");
+ return this;
+ }
+
+ @com.fasterxml.jackson.annotation.JsonIgnore
+ private final java.util.Set __explicitlySet__ = new java.util.HashSet();
+
+ public VolumeKmsKey build() {
+ VolumeKmsKey __instance__ = new VolumeKmsKey(kmsKeyId);
+ __instance__.__explicitlySet__.addAll(__explicitlySet__);
+ return __instance__;
+ }
+
+ @com.fasterxml.jackson.annotation.JsonIgnore
+ public Builder copy(VolumeKmsKey o) {
+ Builder copiedBuilder = kmsKeyId(o.getKmsKeyId());
+
+ copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__);
+ return copiedBuilder;
+ }
+ }
+
+ /**
+ * Create a new builder.
+ */
+ public static Builder builder() {
+ return new Builder();
+ }
+
+ /**
+ * Kms key id associated with this volume. If volume is not using KMS, then kmsKeyId will be null string.
+ *
+ **/
+ @com.fasterxml.jackson.annotation.JsonProperty("kmsKeyId")
+ String kmsKeyId;
+
+ @com.fasterxml.jackson.annotation.JsonIgnore
+ private final java.util.Set __explicitlySet__ = new java.util.HashSet();
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/requests/DeleteBootVolumeKmsKeyRequest.java b/bmc-core/src/main/java/com/oracle/bmc/core/requests/DeleteBootVolumeKmsKeyRequest.java
new file mode 100644
index 00000000000..a5d1b90bd43
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/requests/DeleteBootVolumeKmsKeyRequest.java
@@ -0,0 +1,69 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.requests;
+
+import com.oracle.bmc.core.model.*;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback")
+@lombok.Getter
+public class DeleteBootVolumeKmsKeyRequest extends com.oracle.bmc.requests.BmcRequest {
+
+ /**
+ * The OCID of the boot volume.
+ */
+ private String bootVolumeId;
+
+ /**
+ * For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
+ * parameter to the value of the etag from a previous GET or POST response for that resource. The resource
+ * will be updated or deleted only if the etag you provide matches the resource's current etag value.
+ *
+ */
+ private String ifMatch;
+
+ public static class Builder {
+ private com.oracle.bmc.util.internal.Consumer
+ invocationCallback = null;
+
+ /**
+ * Set the invocation callback for the request to be built.
+ * @param invocationCallback the invocation callback to be set for the request
+ * @return this builder instance
+ */
+ public Builder invocationCallback(
+ com.oracle.bmc.util.internal.Consumer
+ invocationCallback) {
+ this.invocationCallback = invocationCallback;
+ return this;
+ }
+
+ /**
+ * Copy method to populate the builder with values from the given instance.
+ * @return this builder instance
+ */
+ public Builder copy(DeleteBootVolumeKmsKeyRequest o) {
+ bootVolumeId(o.getBootVolumeId());
+ ifMatch(o.getIfMatch());
+ invocationCallback(o.getInvocationCallback());
+ return this;
+ }
+
+ /**
+ * Build the instance of DeleteBootVolumeKmsKeyRequest as configured by this builder
+ *
+ * Note that this method takes calls to {@link Builder#invocationCallback(com.oracle.bmc.util.internal.Consumer)} into account,
+ * while the method {@link Builder#buildWithoutInvocationCallback} does not.
+ *
+ * This is the preferred method to build an instance.
+ *
+ * @return instance of DeleteBootVolumeKmsKeyRequest
+ */
+ public DeleteBootVolumeKmsKeyRequest build() {
+ DeleteBootVolumeKmsKeyRequest request = buildWithoutInvocationCallback();
+ request.setInvocationCallback(invocationCallback);
+ return request;
+ }
+ }
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/requests/DeleteVolumeKmsKeyRequest.java b/bmc-core/src/main/java/com/oracle/bmc/core/requests/DeleteVolumeKmsKeyRequest.java
new file mode 100644
index 00000000000..4234332eeb0
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/requests/DeleteVolumeKmsKeyRequest.java
@@ -0,0 +1,69 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.requests;
+
+import com.oracle.bmc.core.model.*;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback")
+@lombok.Getter
+public class DeleteVolumeKmsKeyRequest extends com.oracle.bmc.requests.BmcRequest {
+
+ /**
+ * The OCID of the volume.
+ */
+ private String volumeId;
+
+ /**
+ * For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
+ * parameter to the value of the etag from a previous GET or POST response for that resource. The resource
+ * will be updated or deleted only if the etag you provide matches the resource's current etag value.
+ *
+ */
+ private String ifMatch;
+
+ public static class Builder {
+ private com.oracle.bmc.util.internal.Consumer
+ invocationCallback = null;
+
+ /**
+ * Set the invocation callback for the request to be built.
+ * @param invocationCallback the invocation callback to be set for the request
+ * @return this builder instance
+ */
+ public Builder invocationCallback(
+ com.oracle.bmc.util.internal.Consumer
+ invocationCallback) {
+ this.invocationCallback = invocationCallback;
+ return this;
+ }
+
+ /**
+ * Copy method to populate the builder with values from the given instance.
+ * @return this builder instance
+ */
+ public Builder copy(DeleteVolumeKmsKeyRequest o) {
+ volumeId(o.getVolumeId());
+ ifMatch(o.getIfMatch());
+ invocationCallback(o.getInvocationCallback());
+ return this;
+ }
+
+ /**
+ * Build the instance of DeleteVolumeKmsKeyRequest as configured by this builder
+ *
+ * Note that this method takes calls to {@link Builder#invocationCallback(com.oracle.bmc.util.internal.Consumer)} into account,
+ * while the method {@link Builder#buildWithoutInvocationCallback} does not.
+ *
+ * This is the preferred method to build an instance.
+ *
+ * @return instance of DeleteVolumeKmsKeyRequest
+ */
+ public DeleteVolumeKmsKeyRequest build() {
+ DeleteVolumeKmsKeyRequest request = buildWithoutInvocationCallback();
+ request.setInvocationCallback(invocationCallback);
+ return request;
+ }
+ }
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/requests/GetBootVolumeKmsKeyRequest.java b/bmc-core/src/main/java/com/oracle/bmc/core/requests/GetBootVolumeKmsKeyRequest.java
new file mode 100644
index 00000000000..87a7a9b1ac7
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/requests/GetBootVolumeKmsKeyRequest.java
@@ -0,0 +1,69 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.requests;
+
+import com.oracle.bmc.core.model.*;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback")
+@lombok.Getter
+public class GetBootVolumeKmsKeyRequest extends com.oracle.bmc.requests.BmcRequest {
+
+ /**
+ * The OCID of the boot volume.
+ */
+ private String bootVolumeId;
+
+ /**
+ * For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
+ * parameter to the value of the etag from a previous GET or POST response for that resource. The resource
+ * will be updated or deleted only if the etag you provide matches the resource's current etag value.
+ *
+ */
+ private String ifMatch;
+
+ public static class Builder {
+ private com.oracle.bmc.util.internal.Consumer
+ invocationCallback = null;
+
+ /**
+ * Set the invocation callback for the request to be built.
+ * @param invocationCallback the invocation callback to be set for the request
+ * @return this builder instance
+ */
+ public Builder invocationCallback(
+ com.oracle.bmc.util.internal.Consumer
+ invocationCallback) {
+ this.invocationCallback = invocationCallback;
+ return this;
+ }
+
+ /**
+ * Copy method to populate the builder with values from the given instance.
+ * @return this builder instance
+ */
+ public Builder copy(GetBootVolumeKmsKeyRequest o) {
+ bootVolumeId(o.getBootVolumeId());
+ ifMatch(o.getIfMatch());
+ invocationCallback(o.getInvocationCallback());
+ return this;
+ }
+
+ /**
+ * Build the instance of GetBootVolumeKmsKeyRequest as configured by this builder
+ *
+ * Note that this method takes calls to {@link Builder#invocationCallback(com.oracle.bmc.util.internal.Consumer)} into account,
+ * while the method {@link Builder#buildWithoutInvocationCallback} does not.
+ *
+ * This is the preferred method to build an instance.
+ *
+ * @return instance of GetBootVolumeKmsKeyRequest
+ */
+ public GetBootVolumeKmsKeyRequest build() {
+ GetBootVolumeKmsKeyRequest request = buildWithoutInvocationCallback();
+ request.setInvocationCallback(invocationCallback);
+ return request;
+ }
+ }
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/requests/GetVolumeKmsKeyRequest.java b/bmc-core/src/main/java/com/oracle/bmc/core/requests/GetVolumeKmsKeyRequest.java
new file mode 100644
index 00000000000..21f46d213c8
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/requests/GetVolumeKmsKeyRequest.java
@@ -0,0 +1,69 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.requests;
+
+import com.oracle.bmc.core.model.*;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback")
+@lombok.Getter
+public class GetVolumeKmsKeyRequest extends com.oracle.bmc.requests.BmcRequest {
+
+ /**
+ * The OCID of the volume.
+ */
+ private String volumeId;
+
+ /**
+ * For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
+ * parameter to the value of the etag from a previous GET or POST response for that resource. The resource
+ * will be updated or deleted only if the etag you provide matches the resource's current etag value.
+ *
+ */
+ private String ifMatch;
+
+ public static class Builder {
+ private com.oracle.bmc.util.internal.Consumer
+ invocationCallback = null;
+
+ /**
+ * Set the invocation callback for the request to be built.
+ * @param invocationCallback the invocation callback to be set for the request
+ * @return this builder instance
+ */
+ public Builder invocationCallback(
+ com.oracle.bmc.util.internal.Consumer
+ invocationCallback) {
+ this.invocationCallback = invocationCallback;
+ return this;
+ }
+
+ /**
+ * Copy method to populate the builder with values from the given instance.
+ * @return this builder instance
+ */
+ public Builder copy(GetVolumeKmsKeyRequest o) {
+ volumeId(o.getVolumeId());
+ ifMatch(o.getIfMatch());
+ invocationCallback(o.getInvocationCallback());
+ return this;
+ }
+
+ /**
+ * Build the instance of GetVolumeKmsKeyRequest as configured by this builder
+ *
+ * Note that this method takes calls to {@link Builder#invocationCallback(com.oracle.bmc.util.internal.Consumer)} into account,
+ * while the method {@link Builder#buildWithoutInvocationCallback} does not.
+ *
+ * This is the preferred method to build an instance.
+ *
+ * @return instance of GetVolumeKmsKeyRequest
+ */
+ public GetVolumeKmsKeyRequest build() {
+ GetVolumeKmsKeyRequest request = buildWithoutInvocationCallback();
+ request.setInvocationCallback(invocationCallback);
+ return request;
+ }
+ }
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/requests/UpdateBootVolumeKmsKeyRequest.java b/bmc-core/src/main/java/com/oracle/bmc/core/requests/UpdateBootVolumeKmsKeyRequest.java
new file mode 100644
index 00000000000..21a6253f988
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/requests/UpdateBootVolumeKmsKeyRequest.java
@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.requests;
+
+import com.oracle.bmc.core.model.*;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback")
+@lombok.Getter
+public class UpdateBootVolumeKmsKeyRequest extends com.oracle.bmc.requests.BmcRequest {
+
+ /**
+ * The OCID of the boot volume.
+ */
+ private String bootVolumeId;
+
+ /**
+ * Update kms key id for the specific boot volume.
+ */
+ private UpdateBootVolumeKmsKeyDetails updateBootVolumeKmsKeyDetails;
+
+ /**
+ * For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
+ * parameter to the value of the etag from a previous GET or POST response for that resource. The resource
+ * will be updated or deleted only if the etag you provide matches the resource's current etag value.
+ *
+ */
+ private String ifMatch;
+
+ public static class Builder {
+ private com.oracle.bmc.util.internal.Consumer
+ invocationCallback = null;
+
+ /**
+ * Set the invocation callback for the request to be built.
+ * @param invocationCallback the invocation callback to be set for the request
+ * @return this builder instance
+ */
+ public Builder invocationCallback(
+ com.oracle.bmc.util.internal.Consumer
+ invocationCallback) {
+ this.invocationCallback = invocationCallback;
+ return this;
+ }
+
+ /**
+ * Copy method to populate the builder with values from the given instance.
+ * @return this builder instance
+ */
+ public Builder copy(UpdateBootVolumeKmsKeyRequest o) {
+ bootVolumeId(o.getBootVolumeId());
+ updateBootVolumeKmsKeyDetails(o.getUpdateBootVolumeKmsKeyDetails());
+ ifMatch(o.getIfMatch());
+ invocationCallback(o.getInvocationCallback());
+ return this;
+ }
+
+ /**
+ * Build the instance of UpdateBootVolumeKmsKeyRequest as configured by this builder
+ *
+ * Note that this method takes calls to {@link Builder#invocationCallback(com.oracle.bmc.util.internal.Consumer)} into account,
+ * while the method {@link Builder#buildWithoutInvocationCallback} does not.
+ *
+ * This is the preferred method to build an instance.
+ *
+ * @return instance of UpdateBootVolumeKmsKeyRequest
+ */
+ public UpdateBootVolumeKmsKeyRequest build() {
+ UpdateBootVolumeKmsKeyRequest request = buildWithoutInvocationCallback();
+ request.setInvocationCallback(invocationCallback);
+ return request;
+ }
+ }
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/requests/UpdateVolumeKmsKeyRequest.java b/bmc-core/src/main/java/com/oracle/bmc/core/requests/UpdateVolumeKmsKeyRequest.java
new file mode 100644
index 00000000000..df803baeb13
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/requests/UpdateVolumeKmsKeyRequest.java
@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.requests;
+
+import com.oracle.bmc.core.model.*;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback")
+@lombok.Getter
+public class UpdateVolumeKmsKeyRequest extends com.oracle.bmc.requests.BmcRequest {
+
+ /**
+ * The OCID of the volume.
+ */
+ private String volumeId;
+
+ /**
+ * Update kms key id for the specific volume.
+ */
+ private UpdateVolumeKmsKeyDetails updateVolumeKmsKeyDetails;
+
+ /**
+ * For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match`
+ * parameter to the value of the etag from a previous GET or POST response for that resource. The resource
+ * will be updated or deleted only if the etag you provide matches the resource's current etag value.
+ *
+ */
+ private String ifMatch;
+
+ public static class Builder {
+ private com.oracle.bmc.util.internal.Consumer
+ invocationCallback = null;
+
+ /**
+ * Set the invocation callback for the request to be built.
+ * @param invocationCallback the invocation callback to be set for the request
+ * @return this builder instance
+ */
+ public Builder invocationCallback(
+ com.oracle.bmc.util.internal.Consumer
+ invocationCallback) {
+ this.invocationCallback = invocationCallback;
+ return this;
+ }
+
+ /**
+ * Copy method to populate the builder with values from the given instance.
+ * @return this builder instance
+ */
+ public Builder copy(UpdateVolumeKmsKeyRequest o) {
+ volumeId(o.getVolumeId());
+ updateVolumeKmsKeyDetails(o.getUpdateVolumeKmsKeyDetails());
+ ifMatch(o.getIfMatch());
+ invocationCallback(o.getInvocationCallback());
+ return this;
+ }
+
+ /**
+ * Build the instance of UpdateVolumeKmsKeyRequest as configured by this builder
+ *
+ * Note that this method takes calls to {@link Builder#invocationCallback(com.oracle.bmc.util.internal.Consumer)} into account,
+ * while the method {@link Builder#buildWithoutInvocationCallback} does not.
+ *
+ * This is the preferred method to build an instance.
+ *
+ * @return instance of UpdateVolumeKmsKeyRequest
+ */
+ public UpdateVolumeKmsKeyRequest build() {
+ UpdateVolumeKmsKeyRequest request = buildWithoutInvocationCallback();
+ request.setInvocationCallback(invocationCallback);
+ return request;
+ }
+ }
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/responses/DeleteBootVolumeKmsKeyResponse.java b/bmc-core/src/main/java/com/oracle/bmc/core/responses/DeleteBootVolumeKmsKeyResponse.java
new file mode 100644
index 00000000000..f698f0f6b15
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/responses/DeleteBootVolumeKmsKeyResponse.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.responses;
+
+import com.oracle.bmc.core.model.*;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.Builder(builderClassName = "Builder")
+@lombok.Getter
+public class DeleteBootVolumeKmsKeyResponse {
+
+ /**
+ * Unique Oracle-assigned identifier for the request. If you need to contact Oracle about
+ * a particular request, please provide the request ID.
+ *
+ */
+ private String opcRequestId;
+
+ public static class Builder {
+ /**
+ * Copy method to populate the builder with values from the given instance.
+ * @return this builder instance
+ */
+ public Builder copy(DeleteBootVolumeKmsKeyResponse o) {
+ opcRequestId(o.getOpcRequestId());
+
+ return this;
+ }
+ }
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/responses/DeleteVolumeKmsKeyResponse.java b/bmc-core/src/main/java/com/oracle/bmc/core/responses/DeleteVolumeKmsKeyResponse.java
new file mode 100644
index 00000000000..947f0b8b301
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/responses/DeleteVolumeKmsKeyResponse.java
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.responses;
+
+import com.oracle.bmc.core.model.*;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.Builder(builderClassName = "Builder")
+@lombok.Getter
+public class DeleteVolumeKmsKeyResponse {
+
+ /**
+ * Unique Oracle-assigned identifier for the request. If you need to contact Oracle about
+ * a particular request, please provide the request ID.
+ *
+ */
+ private String opcRequestId;
+
+ public static class Builder {
+ /**
+ * Copy method to populate the builder with values from the given instance.
+ * @return this builder instance
+ */
+ public Builder copy(DeleteVolumeKmsKeyResponse o) {
+ opcRequestId(o.getOpcRequestId());
+
+ return this;
+ }
+ }
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/responses/GetBootVolumeKmsKeyResponse.java b/bmc-core/src/main/java/com/oracle/bmc/core/responses/GetBootVolumeKmsKeyResponse.java
new file mode 100644
index 00000000000..954879c3e08
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/responses/GetBootVolumeKmsKeyResponse.java
@@ -0,0 +1,43 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.responses;
+
+import com.oracle.bmc.core.model.*;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.Builder(builderClassName = "Builder")
+@lombok.Getter
+public class GetBootVolumeKmsKeyResponse {
+
+ /**
+ * For optimistic concurrency control. See `if-match`.
+ */
+ private String etag;
+
+ /**
+ * Unique Oracle-assigned identifier for the request. If you need to contact Oracle about
+ * a particular request, please provide the request ID.
+ *
+ */
+ private String opcRequestId;
+
+ /**
+ * The returned BootVolumeKmsKey instance.
+ */
+ private BootVolumeKmsKey bootVolumeKmsKey;
+
+ public static class Builder {
+ /**
+ * Copy method to populate the builder with values from the given instance.
+ * @return this builder instance
+ */
+ public Builder copy(GetBootVolumeKmsKeyResponse o) {
+ etag(o.getEtag());
+ opcRequestId(o.getOpcRequestId());
+ bootVolumeKmsKey(o.getBootVolumeKmsKey());
+
+ return this;
+ }
+ }
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/responses/GetVolumeKmsKeyResponse.java b/bmc-core/src/main/java/com/oracle/bmc/core/responses/GetVolumeKmsKeyResponse.java
new file mode 100644
index 00000000000..a8bc1aef0e2
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/responses/GetVolumeKmsKeyResponse.java
@@ -0,0 +1,43 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.responses;
+
+import com.oracle.bmc.core.model.*;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.Builder(builderClassName = "Builder")
+@lombok.Getter
+public class GetVolumeKmsKeyResponse {
+
+ /**
+ * For optimistic concurrency control. See `if-match`.
+ */
+ private String etag;
+
+ /**
+ * Unique Oracle-assigned identifier for the request. If you need to contact Oracle about
+ * a particular request, please provide the request ID.
+ *
+ */
+ private String opcRequestId;
+
+ /**
+ * The returned VolumeKmsKey instance.
+ */
+ private VolumeKmsKey volumeKmsKey;
+
+ public static class Builder {
+ /**
+ * Copy method to populate the builder with values from the given instance.
+ * @return this builder instance
+ */
+ public Builder copy(GetVolumeKmsKeyResponse o) {
+ etag(o.getEtag());
+ opcRequestId(o.getOpcRequestId());
+ volumeKmsKey(o.getVolumeKmsKey());
+
+ return this;
+ }
+ }
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/responses/UpdateBootVolumeKmsKeyResponse.java b/bmc-core/src/main/java/com/oracle/bmc/core/responses/UpdateBootVolumeKmsKeyResponse.java
new file mode 100644
index 00000000000..e6a5ec1097c
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/responses/UpdateBootVolumeKmsKeyResponse.java
@@ -0,0 +1,43 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.responses;
+
+import com.oracle.bmc.core.model.*;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.Builder(builderClassName = "Builder")
+@lombok.Getter
+public class UpdateBootVolumeKmsKeyResponse {
+
+ /**
+ * For optimistic concurrency control. See `if-match`.
+ */
+ private String etag;
+
+ /**
+ * Unique Oracle-assigned identifier for the request. If you need to contact Oracle about
+ * a particular request, please provide the request ID.
+ *
+ */
+ private String opcRequestId;
+
+ /**
+ * The returned BootVolumeKmsKey instance.
+ */
+ private BootVolumeKmsKey bootVolumeKmsKey;
+
+ public static class Builder {
+ /**
+ * Copy method to populate the builder with values from the given instance.
+ * @return this builder instance
+ */
+ public Builder copy(UpdateBootVolumeKmsKeyResponse o) {
+ etag(o.getEtag());
+ opcRequestId(o.getOpcRequestId());
+ bootVolumeKmsKey(o.getBootVolumeKmsKey());
+
+ return this;
+ }
+ }
+}
diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/responses/UpdateVolumeKmsKeyResponse.java b/bmc-core/src/main/java/com/oracle/bmc/core/responses/UpdateVolumeKmsKeyResponse.java
new file mode 100644
index 00000000000..db3cbeac614
--- /dev/null
+++ b/bmc-core/src/main/java/com/oracle/bmc/core/responses/UpdateVolumeKmsKeyResponse.java
@@ -0,0 +1,43 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.core.responses;
+
+import com.oracle.bmc.core.model.*;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918")
+@lombok.Builder(builderClassName = "Builder")
+@lombok.Getter
+public class UpdateVolumeKmsKeyResponse {
+
+ /**
+ * For optimistic concurrency control. See `if-match`.
+ */
+ private String etag;
+
+ /**
+ * Unique Oracle-assigned identifier for the request. If you need to contact Oracle about
+ * a particular request, please provide the request ID.
+ *
+ */
+ private String opcRequestId;
+
+ /**
+ * The returned VolumeKmsKey instance.
+ */
+ private VolumeKmsKey volumeKmsKey;
+
+ public static class Builder {
+ /**
+ * Copy method to populate the builder with values from the given instance.
+ * @return this builder instance
+ */
+ public Builder copy(UpdateVolumeKmsKeyResponse o) {
+ etag(o.getEtag());
+ opcRequestId(o.getOpcRequestId());
+ volumeKmsKey(o.getVolumeKmsKey());
+
+ return this;
+ }
+ }
+}
diff --git a/bmc-database/pom.xml b/bmc-database/pom.xml
index d94ad535169..22f09eb0010 100644
--- a/bmc-database/pom.xml
+++ b/bmc-database/pom.xml
@@ -5,7 +5,7 @@
com.oracle.oci.sdk
oci-java-sdk
- 1.2.46
+ 1.2.47
../pom.xml
@@ -18,7 +18,7 @@
com.oracle.oci.sdk
oci-java-sdk-common
- 1.2.46
+ 1.2.47
diff --git a/bmc-database/src/main/java/com/oracle/bmc/database/DatabaseAsyncClient.java b/bmc-database/src/main/java/com/oracle/bmc/database/DatabaseAsyncClient.java
index 77555727378..f9b0d3e4a34 100644
--- a/bmc-database/src/main/java/com/oracle/bmc/database/DatabaseAsyncClient.java
+++ b/bmc-database/src/main/java/com/oracle/bmc/database/DatabaseAsyncClient.java
@@ -15,7 +15,10 @@ public class DatabaseAsyncClient implements DatabaseAsync {
* Service instance for Database.
*/
public static final com.oracle.bmc.Service SERVICE =
- com.oracle.bmc.Services.create("DATABASE", "database");
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("DATABASE")
+ .serviceEndpointPrefix("database")
+ .build();
@lombok.Getter(value = lombok.AccessLevel.PACKAGE)
private final com.oracle.bmc.http.internal.RestClient client;
diff --git a/bmc-database/src/main/java/com/oracle/bmc/database/DatabaseClient.java b/bmc-database/src/main/java/com/oracle/bmc/database/DatabaseClient.java
index 8af676f1f99..00a3b3e4b49 100644
--- a/bmc-database/src/main/java/com/oracle/bmc/database/DatabaseClient.java
+++ b/bmc-database/src/main/java/com/oracle/bmc/database/DatabaseClient.java
@@ -15,7 +15,10 @@ public class DatabaseClient implements Database {
* Service instance for Database.
*/
public static final com.oracle.bmc.Service SERVICE =
- com.oracle.bmc.Services.create("DATABASE", "database");
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("DATABASE")
+ .serviceEndpointPrefix("database")
+ .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;
diff --git a/bmc-dns/pom.xml b/bmc-dns/pom.xml
index 3a6ed521f35..edeaba5829e 100644
--- a/bmc-dns/pom.xml
+++ b/bmc-dns/pom.xml
@@ -5,7 +5,7 @@
com.oracle.oci.sdk
oci-java-sdk
- 1.2.46
+ 1.2.47
../pom.xml
@@ -18,7 +18,7 @@
com.oracle.oci.sdk
oci-java-sdk-common
- 1.2.46
+ 1.2.47
diff --git a/bmc-dns/src/main/java/com/oracle/bmc/dns/DnsAsyncClient.java b/bmc-dns/src/main/java/com/oracle/bmc/dns/DnsAsyncClient.java
index 47eea611220..7c9704e84b0 100644
--- a/bmc-dns/src/main/java/com/oracle/bmc/dns/DnsAsyncClient.java
+++ b/bmc-dns/src/main/java/com/oracle/bmc/dns/DnsAsyncClient.java
@@ -15,7 +15,10 @@ public class DnsAsyncClient implements DnsAsync {
* Service instance for Dns.
*/
public static final com.oracle.bmc.Service SERVICE =
- com.oracle.bmc.Services.create("DNS", "dns");
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("DNS")
+ .serviceEndpointPrefix("dns")
+ .build();
@lombok.Getter(value = lombok.AccessLevel.PACKAGE)
private final com.oracle.bmc.http.internal.RestClient client;
diff --git a/bmc-dns/src/main/java/com/oracle/bmc/dns/DnsClient.java b/bmc-dns/src/main/java/com/oracle/bmc/dns/DnsClient.java
index bf4ca09694f..b1f6ff81ea1 100644
--- a/bmc-dns/src/main/java/com/oracle/bmc/dns/DnsClient.java
+++ b/bmc-dns/src/main/java/com/oracle/bmc/dns/DnsClient.java
@@ -15,7 +15,10 @@ public class DnsClient implements Dns {
* Service instance for Dns.
*/
public static final com.oracle.bmc.Service SERVICE =
- com.oracle.bmc.Services.create("DNS", "dns");
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("DNS")
+ .serviceEndpointPrefix("dns")
+ .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;
diff --git a/bmc-email/pom.xml b/bmc-email/pom.xml
index c5b98093973..cc09a48313d 100644
--- a/bmc-email/pom.xml
+++ b/bmc-email/pom.xml
@@ -5,7 +5,7 @@
com.oracle.oci.sdk
oci-java-sdk
- 1.2.46
+ 1.2.47
../pom.xml
@@ -18,7 +18,7 @@
com.oracle.oci.sdk
oci-java-sdk-common
- 1.2.46
+ 1.2.47
diff --git a/bmc-email/src/main/java/com/oracle/bmc/email/EmailAsyncClient.java b/bmc-email/src/main/java/com/oracle/bmc/email/EmailAsyncClient.java
index bb757582776..05cfa7ddfad 100644
--- a/bmc-email/src/main/java/com/oracle/bmc/email/EmailAsyncClient.java
+++ b/bmc-email/src/main/java/com/oracle/bmc/email/EmailAsyncClient.java
@@ -15,7 +15,10 @@ public class EmailAsyncClient implements EmailAsync {
* Service instance for Email.
*/
public static final com.oracle.bmc.Service SERVICE =
- com.oracle.bmc.Services.create("EMAIL", "email");
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("EMAIL")
+ .serviceEndpointPrefix("email")
+ .build();
@lombok.Getter(value = lombok.AccessLevel.PACKAGE)
private final com.oracle.bmc.http.internal.RestClient client;
diff --git a/bmc-email/src/main/java/com/oracle/bmc/email/EmailClient.java b/bmc-email/src/main/java/com/oracle/bmc/email/EmailClient.java
index f032d345d35..f01f91e8f52 100644
--- a/bmc-email/src/main/java/com/oracle/bmc/email/EmailClient.java
+++ b/bmc-email/src/main/java/com/oracle/bmc/email/EmailClient.java
@@ -15,7 +15,10 @@ public class EmailClient implements Email {
* Service instance for Email.
*/
public static final com.oracle.bmc.Service SERVICE =
- com.oracle.bmc.Services.create("EMAIL", "email");
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("EMAIL")
+ .serviceEndpointPrefix("email")
+ .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;
diff --git a/bmc-examples/pom.xml b/bmc-examples/pom.xml
index 24e9c648905..555be6f62c8 100644
--- a/bmc-examples/pom.xml
+++ b/bmc-examples/pom.xml
@@ -5,7 +5,7 @@
com.oracle.oci.sdk
oci-java-sdk
- 1.2.46
+ 1.2.47
../pom.xml
@@ -19,7 +19,7 @@
com.oracle.oci.sdk
oci-java-sdk-bom
- 1.2.46
+ 1.2.47
pom
import
@@ -58,7 +58,6 @@
com.oracle.oci.sdk
oci-java-sdk-objectstorage
- pom
com.oracle.oci.sdk
@@ -72,6 +71,10 @@
com.oracle.oci.sdk
oci-java-sdk-addons-apache
+
+ com.oracle.oci.sdk
+ oci-java-sdk-keymanagement
+
diff --git a/bmc-examples/src/main/java/CreateInstanceExample.java b/bmc-examples/src/main/java/CreateInstanceExample.java
index acd442df057..0a3e23c0ba4 100644
--- a/bmc-examples/src/main/java/CreateInstanceExample.java
+++ b/bmc-examples/src/main/java/CreateInstanceExample.java
@@ -6,18 +6,26 @@
import java.util.List;
import java.util.Map;
+import com.google.common.base.Strings;
import com.oracle.bmc.Region;
import com.oracle.bmc.auth.AuthenticationDetailsProvider;
import com.oracle.bmc.auth.ConfigFileAuthenticationDetailsProvider;
+import com.oracle.bmc.core.BlockstorageClient;
+import com.oracle.bmc.core.BlockstorageWaiters;
import com.oracle.bmc.core.ComputeClient;
import com.oracle.bmc.core.ComputeWaiters;
import com.oracle.bmc.core.VirtualNetworkClient;
+import com.oracle.bmc.core.model.BootVolume;
+import com.oracle.bmc.core.model.BootVolumeSourceDetails;
+import com.oracle.bmc.core.model.BootVolumeSourceFromBootVolumeDetails;
+import com.oracle.bmc.core.model.CreateBootVolumeDetails;
import com.oracle.bmc.core.model.CreateInternetGatewayDetails;
import com.oracle.bmc.core.model.CreateSubnetDetails;
import com.oracle.bmc.core.model.CreateVcnDetails;
import com.oracle.bmc.core.model.CreateVnicDetails;
import com.oracle.bmc.core.model.Image;
import com.oracle.bmc.core.model.Instance;
+import com.oracle.bmc.core.model.InstanceSourceViaBootVolumeDetails;
import com.oracle.bmc.core.model.InstanceSourceViaImageDetails;
import com.oracle.bmc.core.model.InternetGateway;
import com.oracle.bmc.core.model.LaunchInstanceDetails;
@@ -26,18 +34,22 @@
import com.oracle.bmc.core.model.Subnet;
import com.oracle.bmc.core.model.UpdateRouteTableDetails;
import com.oracle.bmc.core.model.Vcn;
+import com.oracle.bmc.core.requests.CreateBootVolumeRequest;
import com.oracle.bmc.core.requests.CreateInternetGatewayRequest;
import com.oracle.bmc.core.requests.CreateSubnetRequest;
import com.oracle.bmc.core.requests.CreateVcnRequest;
+import com.oracle.bmc.core.requests.GetBootVolumeRequest;
import com.oracle.bmc.core.requests.GetInstanceRequest;
import com.oracle.bmc.core.requests.GetSubnetRequest;
import com.oracle.bmc.core.requests.LaunchInstanceRequest;
+import com.oracle.bmc.core.requests.ListBootVolumesRequest;
import com.oracle.bmc.core.requests.ListImagesRequest;
import com.oracle.bmc.core.requests.ListShapesRequest;
import com.oracle.bmc.core.requests.UpdateRouteTableRequest;
import com.oracle.bmc.core.responses.CreateInternetGatewayResponse;
import com.oracle.bmc.core.responses.CreateSubnetResponse;
import com.oracle.bmc.core.responses.CreateVcnResponse;
+import com.oracle.bmc.core.responses.GetBootVolumeResponse;
import com.oracle.bmc.core.responses.GetInstanceResponse;
import com.oracle.bmc.core.responses.LaunchInstanceResponse;
import com.oracle.bmc.core.responses.ListImagesResponse;
@@ -49,7 +61,16 @@
import com.oracle.bmc.identity.responses.ListAvailabilityDomainsResponse;
public class CreateInstanceExample {
-
+ /**
+ * Please refer to https://docs.cloud.oracle.com/iaas/Content/Compute/Tasks/launchinginstance.htm to get information about what is necessary for using API to launch a VM instance.
+ * This sample will do following things:
+ * 1) Prepare VCN, GateWay for VMs.
+ * 2) create an instance in VCN from image id and kms key Id.
+ * 3) Create a new boot volume based on existing boot volume.
+ * 4) Launch another instance based on the newly created boot volume.
+ * @param args
+ * @throws Exception
+ */
public static void main(String[] args) throws Exception {
// TODO: Fill in these values
@@ -63,15 +84,23 @@ public static void main(String[] args) throws Exception {
String subnetDisplayName = instanceDisplayName + "-subnet";
String vcnDisplayName = instanceDisplayName + "-vcn";
String internetGatewayDisplayName = instanceDisplayName + "-internet-gateway";
+ String bootVolumeDisplayName = instanceDisplayName + "-bootVolume";
String configurationFilePath = "~/.oci/config";
String profile = "DEFAULT";
+ // When an instance is created, a boot volume is created at the same time. User could choose to use their own kms key to encrypt the data.
+ // fill out necessary kms key information to use your own key to protect kms. More information of volume security please refer to https://cloud.oracle.com/storage/block-volume/faq
+ // If you dont't need kmsKeyId, then simply set it to null. Refer to the commented out line below.
+ String kmsKeyId = "SOME VALID KMS Key OCID";
+ // String kmsKeyId = null;
+
AuthenticationDetailsProvider provider =
new ConfigFileAuthenticationDetailsProvider(configurationFilePath, profile);
ComputeClient computeClient = new ComputeClient(provider);
VirtualNetworkClient vcnClient = new VirtualNetworkClient(provider);
+ BlockstorageClient blockstorageClient = new BlockstorageClient(provider);
vcnClient.setRegion(Region.US_PHOENIX_1);
computeClient.setRegion(Region.US_PHOENIX_1);
@@ -145,17 +174,50 @@ public static void main(String[] args) throws Exception {
image,
shape,
subnet,
- sshPublicKey);
+ sshPublicKey,
+ kmsKeyId);
- System.out.println("Instance is provisioning...");
+ System.out.println("Instance is being created via image id and kms key id...");
instance = waitForInstanceProvisioningToComplete(computeClient, instance.getId());
+ System.out.println("Instance is provisioned.");
+
+ InstanceSourceViaImageDetails sourceDetails =
+ (InstanceSourceViaImageDetails) instance.getSourceDetails();
+
+ BootVolume bootVolume =
+ createBootVolume(
+ blockstorageClient,
+ adToUse,
+ sourceDetails,
+ instance.getImageId(),
+ bootVolumeDisplayName,
+ compartmentId,
+ kmsKeyId);
+
+ System.out.println("New bootVolume is provisioning...");
+
+ bootVolume = waitForBootVolumeToBeReady(blockstorageClient, bootVolume.getId());
+
+ System.out.println("New bootVolume is provisioned...");
+
+ System.out.println("Provisioning a new instance via boot volume");
+ Instance instance2 =
+ createInstanceFromBootVolume(
+ computeClient,
+ compartmentId,
+ adToUse,
+ instanceDisplayName + "2",
+ bootVolume.getId(),
+ shapes.get(0),
+ subnet,
+ sshPublicKey);
+
+ System.out.println("Instance 2 is provisioned.");
+ blockstorageClient.close();
computeClient.close();
vcnClient.close();
-
- System.out.println("Instance is provisioned:");
- System.out.println(instance);
}
public static Vcn createVcn(
@@ -255,11 +317,20 @@ public static Instance createInstance(
Image image,
Shape shape,
Subnet subnet,
- String sshPublicKey) {
+ String sshPublicKey,
+ String kmsKeyId) {
Map metadata = new HashMap<>();
metadata.put("ssh_authorized_keys", sshPublicKey);
+ InstanceSourceViaImageDetails details =
+ (Strings.isNullOrEmpty(kmsKeyId))
+ ? InstanceSourceViaImageDetails.builder().imageId(image.getId()).build()
+ : InstanceSourceViaImageDetails.builder()
+ .imageId(image.getId())
+ .kmsKeyId(kmsKeyId)
+ .build();
+
LaunchInstanceResponse response =
computeClient.launchInstance(
LaunchInstanceRequest.builder()
@@ -271,10 +342,7 @@ public static Instance createInstance(
.faultDomain("FAULT-DOMAIN-1") // optional parameter
.metadata(metadata)
.shape(shape.getShape())
- .sourceDetails(
- InstanceSourceViaImageDetails.builder()
- .imageId(image.getId())
- .build())
+ .sourceDetails(details)
.createVnicDetails(
CreateVnicDetails.builder()
.subnetId(subnet.getId())
@@ -340,4 +408,94 @@ public static Instance waitForInstanceProvisioningToComplete(
return response.getInstance();
}
+
+ private static BootVolume createBootVolume(
+ BlockstorageClient blockstorageClient,
+ AvailabilityDomain adToUse,
+ InstanceSourceViaImageDetails sourceDetails,
+ String imageId,
+ String displayName,
+ String compartmentId,
+ String kmsKeyId) {
+ List bootVolumes =
+ blockstorageClient
+ .listBootVolumes(
+ ListBootVolumesRequest.builder()
+ .availabilityDomain(adToUse.getName())
+ .compartmentId(compartmentId)
+ .build())
+ .getItems();
+ String bootVolumeId = null;
+ for (BootVolume bootVolume : bootVolumes) {
+ if (bootVolume.getLifecycleState().equals(BootVolume.LifecycleState.Available)
+ && bootVolume.getImageId() != null
+ && bootVolume.getImageId().equals(imageId)) {
+ bootVolumeId = bootVolume.getId();
+ break;
+ }
+ }
+
+ BootVolumeSourceDetails bootVolumeSourceDetails =
+ BootVolumeSourceFromBootVolumeDetails.builder().id(bootVolumeId).build();
+ CreateBootVolumeDetails details =
+ CreateBootVolumeDetails.builder()
+ .availabilityDomain(adToUse.getName())
+ .compartmentId(compartmentId)
+ .displayName(displayName)
+ .sourceDetails(bootVolumeSourceDetails)
+ .kmsKeyId(kmsKeyId)
+ .build();
+
+ return blockstorageClient
+ .createBootVolume(
+ CreateBootVolumeRequest.builder().createBootVolumeDetails(details).build())
+ .getBootVolume();
+ }
+
+ private static BootVolume waitForBootVolumeToBeReady(
+ BlockstorageClient blockStorage, String bootVolumeId) throws Exception {
+
+ BlockstorageWaiters waiter = blockStorage.getWaiters();
+ GetBootVolumeResponse response =
+ waiter.forBootVolume(
+ GetBootVolumeRequest.builder().bootVolumeId(bootVolumeId).build(),
+ BootVolume.LifecycleState.Available)
+ .execute();
+
+ return response.getBootVolume();
+ }
+
+ private static Instance createInstanceFromBootVolume(
+ ComputeClient computeClient,
+ String compartmentId,
+ AvailabilityDomain adToUse,
+ String instanceName,
+ String bootVolumeId,
+ Shape shape,
+ Subnet subnet,
+ String sshPublicKey) {
+ Map metadata = new HashMap<>();
+ metadata.put("ssh_authorized_keys", sshPublicKey);
+
+ InstanceSourceViaBootVolumeDetails details =
+ InstanceSourceViaBootVolumeDetails.builder().bootVolumeId(bootVolumeId).build();
+
+ LaunchInstanceResponse response =
+ computeClient.launchInstance(
+ LaunchInstanceRequest.builder()
+ .launchInstanceDetails(
+ LaunchInstanceDetails.builder()
+ .availabilityDomain(adToUse.getName())
+ .compartmentId(compartmentId)
+ .displayName(instanceName)
+ .faultDomain("FAULT-DOMAIN-1") // optional parameter
+ .sourceDetails(details)
+ .metadata(metadata)
+ .shape(shape.getShape())
+ .subnetId(subnet.getId())
+ .build())
+ .build());
+
+ return response.getInstance();
+ }
}
diff --git a/bmc-examples/src/main/java/KmsExample.java b/bmc-examples/src/main/java/KmsExample.java
new file mode 100644
index 00000000000..8dec8a2e649
--- /dev/null
+++ b/bmc-examples/src/main/java/KmsExample.java
@@ -0,0 +1,388 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+import com.oracle.bmc.Region;
+import com.oracle.bmc.auth.AuthenticationDetailsProvider;
+import com.oracle.bmc.auth.ConfigFileAuthenticationDetailsProvider;
+import com.oracle.bmc.keymanagement.KmsCryptoClient;
+import com.oracle.bmc.keymanagement.KmsManagementClient;
+import com.oracle.bmc.keymanagement.KmsVaultClient;
+import com.oracle.bmc.keymanagement.model.CreateKeyDetails;
+import com.oracle.bmc.keymanagement.model.CreateVaultDetails;
+import com.oracle.bmc.keymanagement.model.DecryptDataDetails;
+import com.oracle.bmc.keymanagement.model.EncryptDataDetails;
+import com.oracle.bmc.keymanagement.model.GenerateKeyDetails;
+import com.oracle.bmc.keymanagement.model.KeyShape;
+import com.oracle.bmc.keymanagement.model.KeySummary;
+import com.oracle.bmc.keymanagement.model.KeyVersionSummary;
+import com.oracle.bmc.keymanagement.model.ScheduleVaultDeletionDetails;
+import com.oracle.bmc.keymanagement.model.UpdateKeyDetails;
+import com.oracle.bmc.keymanagement.model.UpdateVaultDetails;
+import com.oracle.bmc.keymanagement.model.Vault;
+import com.oracle.bmc.keymanagement.model.VaultSummary;
+import com.oracle.bmc.keymanagement.requests.CancelVaultDeletionRequest;
+import com.oracle.bmc.keymanagement.requests.CreateKeyRequest;
+import com.oracle.bmc.keymanagement.requests.CreateKeyVersionRequest;
+import com.oracle.bmc.keymanagement.requests.CreateVaultRequest;
+import com.oracle.bmc.keymanagement.requests.DecryptRequest;
+import com.oracle.bmc.keymanagement.requests.DisableKeyRequest;
+import com.oracle.bmc.keymanagement.requests.EnableKeyRequest;
+import com.oracle.bmc.keymanagement.requests.EncryptRequest;
+import com.oracle.bmc.keymanagement.requests.GenerateDataEncryptionKeyRequest;
+import com.oracle.bmc.keymanagement.requests.GetKeyRequest;
+import com.oracle.bmc.keymanagement.requests.GetVaultRequest;
+import com.oracle.bmc.keymanagement.requests.ListKeyVersionsRequest;
+import com.oracle.bmc.keymanagement.requests.ListKeysRequest;
+import com.oracle.bmc.keymanagement.requests.ListVaultsRequest;
+import com.oracle.bmc.keymanagement.requests.ScheduleVaultDeletionRequest;
+import com.oracle.bmc.keymanagement.requests.UpdateKeyRequest;
+import com.oracle.bmc.keymanagement.requests.UpdateVaultRequest;
+import com.oracle.bmc.keymanagement.responses.CancelVaultDeletionResponse;
+import com.oracle.bmc.keymanagement.responses.CreateKeyResponse;
+import com.oracle.bmc.keymanagement.responses.CreateKeyVersionResponse;
+import com.oracle.bmc.keymanagement.responses.CreateVaultResponse;
+import com.oracle.bmc.keymanagement.responses.DecryptResponse;
+import com.oracle.bmc.keymanagement.responses.DisableKeyResponse;
+import com.oracle.bmc.keymanagement.responses.EnableKeyResponse;
+import com.oracle.bmc.keymanagement.responses.EncryptResponse;
+import com.oracle.bmc.keymanagement.responses.GenerateDataEncryptionKeyResponse;
+import com.oracle.bmc.keymanagement.responses.GetKeyResponse;
+import com.oracle.bmc.keymanagement.responses.GetVaultResponse;
+import com.oracle.bmc.keymanagement.responses.ListKeyVersionsResponse;
+import com.oracle.bmc.keymanagement.responses.ListKeysResponse;
+import com.oracle.bmc.keymanagement.responses.ListVaultsResponse;
+import com.oracle.bmc.keymanagement.responses.ScheduleVaultDeletionResponse;
+import com.oracle.bmc.keymanagement.responses.UpdateKeyResponse;
+import com.oracle.bmc.keymanagement.responses.UpdateVaultResponse;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang3.StringUtils;
+
+/**
+ * This class contains examples which cover basic KMS usage.
+ *
+ * These examples assume you already have a Vault in ACTIVE state. If you need to create a new Vault, please
+ * refer to the createVaultTest method in this class. Please keep in mind that KMS does not support immediate
+ * deletion of Vaults because of the high risk; instead, you need to schedule the deletion of a Vault and a
+ * retention period of 7-30 days will be enforced before the Vault is deleted. During the retention period, you
+ * can cancel the deletion and the Vault will be ACTIVE again. Be careful before creating a Vault to avoid
+ * unnecessary expenses.
+ */
+public class KmsExample {
+
+ private static final int DEFAULT_KEY_LENGTH = 32;
+ private static final long TRANSIENT_STATE_WAIT_TIME_MS = 1000L * 30L;
+
+ // The KeyShape used for testing
+ private static final KeyShape TEST_KEY_SHAPE =
+ KeyShape.builder().algorithm(KeyShape.Algorithm.Aes).length(DEFAULT_KEY_LENGTH).build();
+
+ // Please pass in the compartmentId and the vaultId as the first and second argument
+ public static void main(final String[] args) throws Exception {
+
+ // Read in compartmentId and vaultId and perform basic validations.
+ final String compartmentId = args[0];
+ final String vaultId = args[1];
+ if (StringUtils.isBlank(compartmentId) || StringUtils.isBlank(vaultId)) {
+ System.out.println("compartmentId and vaultId cannot be empty or null");
+ return;
+ }
+
+ // Configuring the AuthenticationDetailsProvider. It's assuming there is a default OCI config file
+ // "", and a profile in that config with the name "DEFAULT". Make changes to the following
+ // line if needed.
+ final String configurationFilePath = "~/.oci/config";
+ final String profile = "DEFAULT";
+
+ final AuthenticationDetailsProvider provider =
+ new ConfigFileAuthenticationDetailsProvider(configurationFilePath, profile);
+
+ // Initialize the KMS Clients. KMS has three clients as following:
+ // * KmsVaultClient: The client for Vault management
+ // * KmsManagementClient: The client for Key management (ControlPlane)
+ // * KmsCryptoClient: The client for data encryption and decryption (DataPlane)
+ KmsVaultClient kmsVaultClient = new KmsVaultClient(provider);
+
+ // Using the us-ashburn-1 in this example, choose a different region if needed
+ kmsVaultClient.setRegion(Region.US_ASHBURN_1);
+
+ KmsManagementClient kmsManagementClient = new KmsManagementClient(provider);
+ KmsCryptoClient kmsCryptoClient = new KmsCryptoClient(provider);
+
+ // Get the details of the given Vault
+ Vault vault = getVaultTest(kmsVaultClient, vaultId);
+
+ // The ManagementClient and CryptoClient use Vault specific endpoints; Set them now.
+ kmsManagementClient.setEndpoint(vault.getManagementEndpoint());
+ kmsCryptoClient.setEndpoint(vault.getCryptoEndpoint());
+
+ // Vault Operations
+ updateVaultTest(kmsVaultClient, vault.getId());
+ listVaultsTest(kmsVaultClient, compartmentId);
+ scheduleVaultDeletionTest(kmsVaultClient, vault.getId());
+ // After scheduling deletion, the Vault will stay in SCHEDULING_DELETION state shortly and then
+ // transit to PENDING_DELETION state. Wait a bit for the transition to happen.
+ System.out.println("Wait a bit for the deletion scheduling to finish");
+ Thread.sleep(TRANSIENT_STATE_WAIT_TIME_MS);
+
+ cancelVaultDeletionTest(kmsVaultClient, vault.getId());
+ // After cancelling deletion, the Vault will stay in CANCELLING_DELETION state shortly and then
+ // transit to ACTIVE state. Wait a bit for the transition to happen.
+ System.out.println("Wait a bit for the deletion cancelling to finish");
+ Thread.sleep(TRANSIENT_STATE_WAIT_TIME_MS);
+
+ // Management / Key Operations
+ String keyId = createKeyTest(kmsManagementClient, compartmentId);
+ // After creating a Key, the Key will stay in CREATING state shortly and then
+ // transit to ENABLED state. Wait a bit for the transition to happen.
+ System.out.println("Wait a bit for Key creation to finish");
+ Thread.sleep(TRANSIENT_STATE_WAIT_TIME_MS);
+
+ getKeyTest(kmsManagementClient, keyId);
+ updateKeyTest(kmsManagementClient, keyId);
+ listKeysTest(kmsManagementClient, compartmentId);
+ disableKeyTest(kmsManagementClient, keyId);
+ // After disabling a Key, the Key will stay in DISABLING state shortly and then
+ // transit to DISABLED state. Wait a bit for the transition to happen.
+ System.out.println("Wait a bit for Key disabling to finish");
+ Thread.sleep(TRANSIENT_STATE_WAIT_TIME_MS);
+
+ enableKeyTest(kmsManagementClient, keyId);
+ // After enabling a Key, the Key will stay in ENABLING state shortly and then
+ // transit to ENABLED state. Wait a bit for the transition to happen.
+ System.out.println("Wait a bit for Key enabling to finish");
+ Thread.sleep(TRANSIENT_STATE_WAIT_TIME_MS);
+
+ createKeyVersionTest(kmsManagementClient, keyId);
+ listKeyVersionsTest(kmsManagementClient, keyId);
+
+ // Crypto Operations
+ String ciphertext = encryptTest(kmsCryptoClient, keyId);
+ decryptTest(kmsCryptoClient, keyId, ciphertext);
+ generateDataEncryptionKeyTest(kmsCryptoClient, keyId);
+ }
+
+ public static Vault createVaultTest(KmsVaultClient kmsVaultClient, String compartmentId) {
+ System.out.println("CreateVault Test: ");
+ CreateVaultDetails createVaultDetails =
+ CreateVaultDetails.builder()
+ .compartmentId(compartmentId)
+ .displayName("Test-Vault-V1")
+ .vaultType(CreateVaultDetails.VaultType.VirtualPrivate)
+ .build();
+
+ CreateVaultRequest request =
+ CreateVaultRequest.builder().createVaultDetails(createVaultDetails).build();
+
+ CreateVaultResponse response = kmsVaultClient.createVault(request);
+ System.out.println("Newly Created Vault: ");
+ System.out.println(response.getVault());
+ return response.getVault();
+ }
+
+ public static Vault getVaultTest(KmsVaultClient kmsVaultClient, String vaultId) {
+ System.out.println("GetVault Test: ");
+ GetVaultRequest getVaultRequest = GetVaultRequest.builder().vaultId(vaultId).build();
+ GetVaultResponse response = kmsVaultClient.getVault(getVaultRequest);
+ System.out.println("Vault Retrieved: ");
+ System.out.println(response.getVault());
+ return response.getVault();
+ }
+
+ public static void listVaultsTest(KmsVaultClient kmsVaultClient, String compartmentId) {
+ System.out.println("ListVaults Test: ");
+ ListVaultsRequest listVaultsRequest =
+ ListVaultsRequest.builder().compartmentId(compartmentId).build();
+ ListVaultsResponse response = kmsVaultClient.listVaults(listVaultsRequest);
+
+ System.out.println("ListVaults Response: ");
+ for (VaultSummary vault : response.getItems()) {
+ System.out.println(vault);
+ }
+ System.out.println();
+ }
+
+ public static void updateVaultTest(KmsVaultClient kmsVaultClient, String vaultId) {
+ System.out.println("UpdateVault Test: ");
+ UpdateVaultDetails updateVaultDetails =
+ UpdateVaultDetails.builder().displayName("Test-Vault-V2").build();
+ UpdateVaultRequest updateVaultRequest =
+ UpdateVaultRequest.builder()
+ .updateVaultDetails(updateVaultDetails)
+ .vaultId(vaultId)
+ .build();
+ UpdateVaultResponse response = kmsVaultClient.updateVault(updateVaultRequest);
+ System.out.println("Updated Vault: ");
+ System.out.println(response.getVault());
+ System.out.println();
+ }
+
+ public static void scheduleVaultDeletionTest(KmsVaultClient kmsVaultClient, String vaultId) {
+ System.out.println("ScheduleVaultDeletion Test: ");
+ ScheduleVaultDeletionDetails scheduleVaultDeletionDetails =
+ ScheduleVaultDeletionDetails.builder().timeOfDeletion(null).build();
+ ScheduleVaultDeletionRequest scheduleVaultDeletionRequest =
+ ScheduleVaultDeletionRequest.builder()
+ .scheduleVaultDeletionDetails(scheduleVaultDeletionDetails)
+ .vaultId(vaultId)
+ .build();
+ ScheduleVaultDeletionResponse response =
+ kmsVaultClient.scheduleVaultDeletion(scheduleVaultDeletionRequest);
+ System.out.println("Deletion Scheduled Successfully, Updated Vault: ");
+ System.out.println(response.getVault());
+ System.out.println();
+ }
+
+ public static void cancelVaultDeletionTest(KmsVaultClient kmsVaultClient, String vaultId) {
+ System.out.println("CancelVaultDeletion Test: ");
+ CancelVaultDeletionRequest cancelVaultDeletionRequest =
+ CancelVaultDeletionRequest.builder().vaultId(vaultId).build();
+ CancelVaultDeletionResponse response =
+ kmsVaultClient.cancelVaultDeletion(cancelVaultDeletionRequest);
+ System.out.println("Deletion Cancelled Successfully, Updated Vault: ");
+ System.out.println(response.getVault());
+ System.out.println();
+ }
+
+ public static String createKeyTest(
+ KmsManagementClient kmsManagementClient, String compartmentId) {
+ System.out.println("CreateKey Test: ");
+ CreateKeyDetails createKeyDetails =
+ CreateKeyDetails.builder()
+ .keyShape(TEST_KEY_SHAPE)
+ .compartmentId(compartmentId)
+ .displayName("Test_Key_V1")
+ .build();
+ CreateKeyRequest createKeyRequest =
+ CreateKeyRequest.builder().createKeyDetails(createKeyDetails).build();
+ CreateKeyResponse response = kmsManagementClient.createKey(createKeyRequest);
+ System.out.println("Newly Created Key: ");
+ System.out.println(response.getKey());
+ System.out.println();
+ return response.getKey().getId();
+ }
+
+ public static void getKeyTest(KmsManagementClient kmsManagementClient, String keyId) {
+ System.out.println("GetKey Test: ");
+ GetKeyRequest getKeyRequest = GetKeyRequest.builder().keyId(keyId).build();
+ GetKeyResponse response = kmsManagementClient.getKey(getKeyRequest);
+ System.out.println("Key Retrieved: ");
+ System.out.println(response.getKey());
+ }
+
+ public static void listKeysTest(KmsManagementClient kmsManagementClient, String compartmentId) {
+ System.out.println("ListKeys Test: ");
+ ListKeysRequest listKeysRequest =
+ ListKeysRequest.builder().compartmentId(compartmentId).build();
+ ListKeysResponse response = kmsManagementClient.listKeys(listKeysRequest);
+
+ System.out.println("ListKeys Response: ");
+ for (KeySummary key : response.getItems()) {
+ System.out.println(key);
+ }
+ System.out.println();
+ }
+
+ public static void updateKeyTest(KmsManagementClient kmsManagementClient, String keyId) {
+ System.out.println("UpdateKey Test: ");
+ UpdateKeyDetails updateKeyDetails =
+ UpdateKeyDetails.builder().displayName("Test_Key_V2").build();
+ UpdateKeyRequest updateKeyRequest =
+ UpdateKeyRequest.builder().updateKeyDetails(updateKeyDetails).keyId(keyId).build();
+ UpdateKeyResponse response = kmsManagementClient.updateKey(updateKeyRequest);
+ System.out.println("Updated Key: ");
+ System.out.println(response.getKey());
+ System.out.println();
+ }
+
+ public static void disableKeyTest(KmsManagementClient kmsManagementClient, String keyId) {
+ System.out.println("DisableKey Test: ");
+ DisableKeyRequest disableKeyRequest = DisableKeyRequest.builder().keyId(keyId).build();
+ DisableKeyResponse response = kmsManagementClient.disableKey(disableKeyRequest);
+ System.out.println("Key Disabled Successfully, Updated Key: ");
+ System.out.println(response.getKey());
+ System.out.println();
+ }
+
+ public static void enableKeyTest(KmsManagementClient kmsManagementClient, String keyId) {
+ System.out.println("EnableKey Test: ");
+ EnableKeyRequest enableKeyRequest = EnableKeyRequest.builder().keyId(keyId).build();
+ EnableKeyResponse response = kmsManagementClient.enableKey(enableKeyRequest);
+ System.out.println("Key Enabled Successfully, Updated Key: ");
+ System.out.println(response.getKey());
+ System.out.println();
+ }
+
+ public static void createKeyVersionTest(KmsManagementClient kmsManagementClient, String keyId) {
+ System.out.println("CreateKeyVersion Test: ");
+ CreateKeyVersionRequest createKeyVersionRequest =
+ CreateKeyVersionRequest.builder().keyId(keyId).build();
+ CreateKeyVersionResponse response =
+ kmsManagementClient.createKeyVersion(createKeyVersionRequest);
+ System.out.println("Newly Created KeyVersion: ");
+ System.out.println(response.getKeyVersion());
+ System.out.println();
+ }
+
+ public static void listKeyVersionsTest(KmsManagementClient kmsManagementClient, String keyId) {
+ System.out.println("ListKeyVersions Test: ");
+ ListKeyVersionsRequest listKeyVersionsRequest =
+ ListKeyVersionsRequest.builder().keyId(keyId).build();
+ ListKeyVersionsResponse response =
+ kmsManagementClient.listKeyVersions(listKeyVersionsRequest);
+ System.out.println("ListKeyVersions Response: ");
+ for (KeyVersionSummary keyVersion : response.getItems()) {
+ System.out.println(keyVersion);
+ }
+ System.out.println();
+ }
+
+ public static String encryptTest(KmsCryptoClient kmsCryptoClient, String keyId) {
+ System.out.println("Encrypt Test: ");
+ String plaintext = "I love OCI!";
+ EncryptDataDetails encryptDataDetails =
+ EncryptDataDetails.builder()
+ .keyId(keyId)
+ .plaintext(Base64.encodeBase64String(plaintext.getBytes()))
+ .build();
+ EncryptRequest encryptRequest =
+ EncryptRequest.builder().encryptDataDetails(encryptDataDetails).build();
+ EncryptResponse response = kmsCryptoClient.encrypt(encryptRequest);
+
+ System.out.println("Plaintext: " + plaintext);
+ System.out.println("Cipheretext: " + response.getEncryptedData().getCiphertext());
+ System.out.println();
+ return response.getEncryptedData().getCiphertext();
+ }
+
+ public static void decryptTest(
+ KmsCryptoClient kmsCryptoClient, String keyId, String cipherText) {
+ System.out.println("Decrypt Test: ");
+ DecryptDataDetails decryptDataDetails =
+ DecryptDataDetails.builder().ciphertext(cipherText).keyId(keyId).build();
+ DecryptRequest decryptRequest =
+ DecryptRequest.builder().decryptDataDetails(decryptDataDetails).build();
+ DecryptResponse response = kmsCryptoClient.decrypt(decryptRequest);
+ System.out.println("Plaintext: " + response.getDecryptedData().getPlaintext());
+ System.out.println();
+ }
+
+ public static void generateDataEncryptionKeyTest(
+ KmsCryptoClient kmsCryptoClient, String keyId) {
+ System.out.println("GenerateDataEncryptionKey Test: ");
+ GenerateKeyDetails generateKeyDetails =
+ GenerateKeyDetails.builder()
+ .keyId(keyId)
+ .keyShape(TEST_KEY_SHAPE)
+ .includePlaintextKey(true)
+ .build();
+ GenerateDataEncryptionKeyRequest generateDataEncryptionKeyRequest =
+ GenerateDataEncryptionKeyRequest.builder()
+ .generateKeyDetails(generateKeyDetails)
+ .build();
+ GenerateDataEncryptionKeyResponse response =
+ kmsCryptoClient.generateDataEncryptionKey(generateDataEncryptionKeyRequest);
+ System.out.println("GenerateDataEncryptionKey Response: ");
+ System.out.println(response.getGeneratedKey());
+ System.out.println();
+ }
+}
diff --git a/bmc-examples/src/main/java/ObjectStorageUpdateBucketKmsKeyExample.java b/bmc-examples/src/main/java/ObjectStorageUpdateBucketKmsKeyExample.java
new file mode 100644
index 00000000000..364c02f6dbb
--- /dev/null
+++ b/bmc-examples/src/main/java/ObjectStorageUpdateBucketKmsKeyExample.java
@@ -0,0 +1,122 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+import com.google.common.collect.ImmutableMap;
+import com.oracle.bmc.ConfigFileReader;
+import com.oracle.bmc.Region;
+import com.oracle.bmc.auth.AuthenticationDetailsProvider;
+import com.oracle.bmc.auth.ConfigFileAuthenticationDetailsProvider;
+import com.oracle.bmc.objectstorage.ObjectStorageClient;
+import com.oracle.bmc.objectstorage.model.CreateBucketDetails;
+import com.oracle.bmc.objectstorage.model.UpdateBucketDetails;
+import com.oracle.bmc.objectstorage.requests.CreateBucketRequest;
+import com.oracle.bmc.objectstorage.requests.GetNamespaceRequest;
+import com.oracle.bmc.objectstorage.requests.UpdateBucketRequest;
+import com.oracle.bmc.objectstorage.responses.CreateBucketResponse;
+import com.oracle.bmc.objectstorage.responses.UpdateBucketResponse;
+
+public class ObjectStorageUpdateBucketKmsKeyExample {
+
+ private static final String CONFIG_LOCATION = "~/.oci/config";
+ private static final String CONFIG_PROFILE = "DEFAULT";
+
+ /**
+ * The entry point for the example.
+ *
+ * @param args Arguments to provide to the example. The following arguments are expected:
+ *
+ * - The first argument is the OCID of the compartment where we'll create a bucket
+ * - The second is the name of bucket to create
+ * - The third is the kmsKey OCID used to create bucket
+ * - The forth is the kmsKey OCID used to update bucket kmsKeyId
+ *
+ */
+ public static void main(String[] args) throws Exception {
+ if (args.length != 4) {
+ throw new IllegalArgumentException(
+ "Unexpected number of arguments received. Consult the script header comments for expected arguments");
+ }
+ final String compartmentId = args[0];
+ final String bucketName = args[1];
+ final String kmsKeyOcid = args[2];
+ final String kmsKeyUpdateOcid = args[3];
+
+ final ConfigFileReader.ConfigFile configFile =
+ ConfigFileReader.parse(CONFIG_LOCATION, CONFIG_PROFILE);
+ final AuthenticationDetailsProvider provider =
+ new ConfigFileAuthenticationDetailsProvider(configFile);
+ ObjectStorageClient objectStorageClient = new ObjectStorageClient(provider);
+ objectStorageClient.setRegion(Region.US_PHOENIX_1);
+
+ final String namespace =
+ objectStorageClient.getNamespace(GetNamespaceRequest.builder().build()).getValue();
+
+ // create bucket with kmsKeyId
+ final CreateBucketDetails createBucketDetails =
+ CreateBucketDetails.builder()
+ .compartmentId(compartmentId)
+ .name(bucketName)
+ .kmsKeyId(kmsKeyOcid)
+ .build();
+ final CreateBucketResponse createResponse =
+ objectStorageClient.createBucket(
+ CreateBucketRequest.builder()
+ .namespaceName(namespace)
+ .createBucketDetails(createBucketDetails)
+ .build());
+ System.out.println("Created a bucket with kmsKey:\n " + createResponse.getBucket());
+
+ // update bucket kmsKeyId to a new kmsKeyId
+ final UpdateBucketDetails updateBucketkmsKeyId =
+ UpdateBucketDetails.builder()
+ .namespace(namespace)
+ .name(bucketName)
+ .kmsKeyId(kmsKeyUpdateOcid)
+ .build();
+ UpdateBucketResponse updateResponse =
+ objectStorageClient.updateBucket(
+ UpdateBucketRequest.builder()
+ .namespaceName(namespace)
+ .bucketName(bucketName)
+ .updateBucketDetails(updateBucketkmsKeyId)
+ .build());
+ System.out.println("Updated kmsKeyId of a to " + updateResponse.getBucket().getKmsKeyId());
+
+ // update bucket metadata without touching kmsKeyId
+ final UpdateBucketDetails updateBucketMetadata =
+ UpdateBucketDetails.builder()
+ .namespace(namespace)
+ .name(bucketName)
+ .metadata(ImmutableMap.of("a", "b"))
+ .build();
+ updateResponse =
+ objectStorageClient.updateBucket(
+ UpdateBucketRequest.builder()
+ .namespaceName(namespace)
+ .bucketName(bucketName)
+ .updateBucketDetails(updateBucketMetadata)
+ .build());
+ System.out.println(
+ "Update bucket without touching kmsKeyId "
+ + updateResponse.getBucket().getKmsKeyId());
+
+ // remove kmsKeyId from bucket
+ final UpdateBucketDetails removeBucketKmsKeyId =
+ UpdateBucketDetails.builder()
+ .namespace(namespace)
+ .name(bucketName)
+ .kmsKeyId(
+ "") // "" means remove the current kmsKeyId of the bucket if it has one
+ .build();
+ updateResponse =
+ objectStorageClient.updateBucket(
+ UpdateBucketRequest.builder()
+ .namespaceName(namespace)
+ .bucketName(bucketName)
+ .updateBucketDetails(removeBucketKmsKeyId)
+ .build());
+ System.out.println(
+ "Removed kmsKey from a bucket, now the kmsKey is "
+ + updateResponse.getBucket().getKmsKeyId());
+ }
+}
diff --git a/bmc-examples/src/main/java/UpdateVolumeKmsKeyIdExample.java b/bmc-examples/src/main/java/UpdateVolumeKmsKeyIdExample.java
new file mode 100644
index 00000000000..496b4a16fee
--- /dev/null
+++ b/bmc-examples/src/main/java/UpdateVolumeKmsKeyIdExample.java
@@ -0,0 +1,143 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+import com.oracle.bmc.Region;
+import com.oracle.bmc.auth.AuthenticationDetailsProvider;
+import com.oracle.bmc.auth.ConfigFileAuthenticationDetailsProvider;
+import com.oracle.bmc.core.Blockstorage;
+import com.oracle.bmc.core.BlockstorageClient;
+import com.oracle.bmc.core.BlockstorageWaiters;
+import com.oracle.bmc.core.model.CreateVolumeDetails;
+import com.oracle.bmc.core.model.Instance;
+import com.oracle.bmc.core.model.UpdateVolumeKmsKeyDetails;
+import com.oracle.bmc.core.model.Volume;
+import com.oracle.bmc.core.requests.CreateVolumeRequest;
+import com.oracle.bmc.core.requests.DeleteVolumeKmsKeyRequest;
+import com.oracle.bmc.core.requests.GetInstanceRequest;
+import com.oracle.bmc.core.requests.GetVolumeRequest;
+import com.oracle.bmc.core.requests.UpdateVolumeKmsKeyRequest;
+import com.oracle.bmc.core.responses.GetInstanceResponse;
+import com.oracle.bmc.core.responses.GetVolumeResponse;
+import com.oracle.bmc.identity.Identity;
+import com.oracle.bmc.identity.IdentityClient;
+import com.oracle.bmc.identity.model.AvailabilityDomain;
+import com.oracle.bmc.identity.requests.ListAvailabilityDomainsRequest;
+import com.oracle.bmc.identity.responses.ListAvailabilityDomainsResponse;
+
+import java.io.IOException;
+import java.util.List;
+
+/**
+ * This example will demo how to use CRUD API to manipulate volume's KMS key.
+ * It will do follow things:
+ * 1) Create a volume with Oracle default encryption key.
+ * 2) User provide their own kms key to protect the volume.
+ * 3) User delete kms key and use default encryption key to protect the volume.
+ */
+public class UpdateVolumeKmsKeyIdExample {
+ public static void main(String[] args) throws Exception {
+
+ // TODO: Fill in these values
+ String compartmentId = "A valid compartment OCID";
+ String blockStorageDisplayName = "blockStorageDisplayName";
+ String configurationFilePath = "~/.oci/config";
+ String profile = "DEFAULT";
+
+ // When an instance is created, a boot volume is created at the same time. User could choose to use their own kms key to encrypt the data.
+ // fill out necessary kms key information to use your own key to protect kms. More information of volume security please refer to https://cloud.oracle.com/storage/block-volume/faq
+ String kmsKeyId = "SOME VALID KEY OCID";
+
+ AuthenticationDetailsProvider provider =
+ new ConfigFileAuthenticationDetailsProvider(configurationFilePath, profile);
+
+ BlockstorageClient client = new BlockstorageClient(provider);
+
+ // TODO: For this example we're just using the first AD returned.
+ // You'll probably want different logic around which AD to use
+ List availabilityDomains =
+ getAvailabilityDomains(provider, compartmentId);
+ AvailabilityDomain adToUse = availabilityDomains.get(1);
+
+ CreateVolumeDetails createVolumeDetails =
+ CreateVolumeDetails.builder()
+ .availabilityDomain(adToUse.getName())
+ .displayName(blockStorageDisplayName)
+ .compartmentId(compartmentId)
+ .build();
+ CreateVolumeRequest createVolumeRequest =
+ CreateVolumeRequest.builder().createVolumeDetails(createVolumeDetails).build();
+ System.out.println("started to create volume.");
+ Volume volume = client.createVolume(createVolumeRequest).getVolume();
+
+ System.out.println("checking if the volume is ready.");
+ BlockstorageWaiters waiter = client.getWaiters();
+ GetVolumeResponse response =
+ waiter.forVolume(
+ GetVolumeRequest.builder().volumeId(volume.getId()).build(),
+ Volume.LifecycleState.Available)
+ .execute();
+
+ System.out.println("volume is ready.");
+
+ UpdateVolumeKmsKeyDetails updateVolumeKmsKeyDetails =
+ UpdateVolumeKmsKeyDetails.builder().kmsKeyId(kmsKeyId).build();
+
+ UpdateVolumeKmsKeyRequest updateVolumeKmsKeyRequest =
+ UpdateVolumeKmsKeyRequest.builder()
+ .updateVolumeKmsKeyDetails(updateVolumeKmsKeyDetails)
+ .volumeId(volume.getId())
+ .build();
+
+ System.out.println("started to update volume kms key.");
+ client.updateVolumeKmsKey(updateVolumeKmsKeyRequest);
+ System.out.println("checking if the volume is ready.");
+ // Data will remain the same, but now protected by the new key. Old key (if any) could be removed safely if the volume is marked as ready and if is ONLY used to protect this volume.
+
+ GetVolumeResponse updateKeyResponse =
+ waiter.forVolume(
+ GetVolumeRequest.builder().volumeId(volume.getId()).build(),
+ Volume.LifecycleState.Available)
+ .execute();
+
+ System.out.println(
+ "Finished updating volume kms key. Now the kms key is :"
+ + updateKeyResponse.getVolume().getKmsKeyId());
+
+ System.out.println("started to delete volume kms key.");
+
+ DeleteVolumeKmsKeyRequest deleteVolumeKmsKeyRequest =
+ DeleteVolumeKmsKeyRequest.builder().volumeId(volume.getId()).build();
+ client.deleteVolumeKmsKey(deleteVolumeKmsKeyRequest);
+ System.out.println("checking if the volume is ready.");
+ GetVolumeResponse deleteKeyResponse =
+ waiter.forVolume(
+ GetVolumeRequest.builder().volumeId(volume.getId()).build(),
+ Volume.LifecycleState.Available)
+ .execute();
+
+ System.out.println(
+ "Finished updating volume kms key. Now the kms key is :"
+ + deleteKeyResponse.getVolume().getKmsKeyId());
+
+ System.out.println("This is the example for update/delete volume's kms key.");
+
+ client.close();
+ }
+
+ private static List getAvailabilityDomains(
+ AuthenticationDetailsProvider provider, String compartmentId) throws Exception {
+
+ Identity identityClient = new IdentityClient(provider);
+ identityClient.setRegion(Region.US_ASHBURN_1);
+
+ ListAvailabilityDomainsResponse listAvailabilityDomainsResponse =
+ identityClient.listAvailabilityDomains(
+ ListAvailabilityDomainsRequest.builder()
+ .compartmentId(compartmentId)
+ .build());
+
+ identityClient.close();
+
+ return listAvailabilityDomainsResponse.getItems();
+ }
+}
diff --git a/bmc-examples/src/main/java/VolumeAttachmentExample.java b/bmc-examples/src/main/java/VolumeAttachmentExample.java
index 4d674ae4b77..ef370522142 100644
--- a/bmc-examples/src/main/java/VolumeAttachmentExample.java
+++ b/bmc-examples/src/main/java/VolumeAttachmentExample.java
@@ -93,7 +93,7 @@ public class VolumeAttachmentExample {
private static final String INSTANCE_SHAPE = "VM.Standard1.1";
private static final String INSTANCE_OS = "Oracle Linux";
- private static final String INSTANCE_OS_VERSION = "7.4";
+ private static final String INSTANCE_OS_VERSION = "7.5";
private static final String INSTANCE_DISPLAY_NAME = "VolAttachExampleInstance";
/**
@@ -102,6 +102,7 @@ public class VolumeAttachmentExample {
* @param args Arguments to provide to the example. The following arguments are expected:
*
* - The OCID of the compartment where the volumes and associated resources will be created
+ * - Optional. The OCID of the KMS key used to generated volume's data encryption key.
*
*/
public static void main(String[] args) throws Exception {
@@ -111,7 +112,7 @@ public static void main(String[] args) throws Exception {
}
final String compartmentId = args[0];
-
+ final String kmsKeyId = args.length == 1 ? null : args[2];
final AuthenticationDetailsProvider provider =
new ConfigFileAuthenticationDetailsProvider(CONFIG_LOCATION, CONFIG_PROFILE);
final BlockstorageClient blockStorageClient = new BlockstorageClient(provider);
@@ -145,9 +146,19 @@ public static void main(String[] args) throws Exception {
System.out.println();
volumeOne =
- createVolume(blockStorageClient, compartmentId, adToUse, VOL_ONE_DISPLAY_NAME);
+ createVolume(
+ blockStorageClient,
+ compartmentId,
+ adToUse,
+ kmsKeyId,
+ VOL_ONE_DISPLAY_NAME);
volumeTwo =
- createVolume(blockStorageClient, compartmentId, adToUse, VOL_TWO_DISPLAY_NAME);
+ createVolume(
+ blockStorageClient,
+ compartmentId,
+ adToUse,
+ kmsKeyId,
+ VOL_TWO_DISPLAY_NAME);
final VolumeAttachment iscsiAttachment =
attachIscsiVolume(computeClient, volumeOne, instance);
@@ -214,6 +225,7 @@ private static Volume createVolume(
final BlockstorageClient blockStorageClient,
final String compartmentId,
final AvailabilityDomain availabilityDomain,
+ final String kmsKeyId,
final String displayName)
throws Exception {
@@ -224,11 +236,11 @@ private static Volume createVolume(
blockStorageClient.createVolume(
CreateVolumeRequest.builder()
.createVolumeDetails(
- CreateVolumeDetails.builder()
- .availabilityDomain(availabilityDomain.getName())
- .compartmentId(compartmentId)
- .displayName(displayName)
- .build())
+ getCreateVolumeDetails(
+ compartmentId,
+ availabilityDomain,
+ displayName,
+ kmsKeyId))
.build());
System.out.println("Created volume: " + createResponse.getVolume().toString());
@@ -247,6 +259,27 @@ private static Volume createVolume(
return getResponse.getVolume();
}
+ private static CreateVolumeDetails getCreateVolumeDetails(
+ final String compartmentId,
+ final AvailabilityDomain availabilityDomain,
+ final String displayName,
+ final String kmsKeyId) {
+ if (kmsKeyId == null) {
+ return CreateVolumeDetails.builder()
+ .availabilityDomain(availabilityDomain.getName())
+ .compartmentId(compartmentId)
+ .displayName(displayName)
+ .build();
+ }
+
+ return CreateVolumeDetails.builder()
+ .availabilityDomain(availabilityDomain.getName())
+ .compartmentId(compartmentId)
+ .kmsKeyId(kmsKeyId)
+ .displayName(displayName)
+ .build();
+ }
+
/**
* Deletes a volume and waits for it to be deleted
*
diff --git a/bmc-filestorage/pom.xml b/bmc-filestorage/pom.xml
index ed223d08276..5094a6474ac 100644
--- a/bmc-filestorage/pom.xml
+++ b/bmc-filestorage/pom.xml
@@ -5,7 +5,7 @@
com.oracle.oci.sdk
oci-java-sdk
- 1.2.46
+ 1.2.47
../pom.xml
@@ -18,7 +18,7 @@
com.oracle.oci.sdk
oci-java-sdk-common
- 1.2.46
+ 1.2.47
diff --git a/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageAsyncClient.java b/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageAsyncClient.java
index c0b8f7e01cc..31db98562d5 100644
--- a/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageAsyncClient.java
+++ b/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageAsyncClient.java
@@ -15,7 +15,10 @@ public class FileStorageAsyncClient implements FileStorageAsync {
* Service instance for FileStorage.
*/
public static final com.oracle.bmc.Service SERVICE =
- com.oracle.bmc.Services.create("FILESTORAGE", "filestorage");
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("FILESTORAGE")
+ .serviceEndpointPrefix("filestorage")
+ .build();
@lombok.Getter(value = lombok.AccessLevel.PACKAGE)
private final com.oracle.bmc.http.internal.RestClient client;
diff --git a/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageClient.java b/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageClient.java
index ac6853b5d7c..c5751463acc 100644
--- a/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageClient.java
+++ b/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageClient.java
@@ -15,7 +15,10 @@ public class FileStorageClient implements FileStorage {
* Service instance for FileStorage.
*/
public static final com.oracle.bmc.Service SERVICE =
- com.oracle.bmc.Services.create("FILESTORAGE", "filestorage");
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("FILESTORAGE")
+ .serviceEndpointPrefix("filestorage")
+ .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;
diff --git a/bmc-full/pom.xml b/bmc-full/pom.xml
index 42a65fb7a14..50b31d8a65e 100644
--- a/bmc-full/pom.xml
+++ b/bmc-full/pom.xml
@@ -4,7 +4,7 @@
com.oracle.oci.sdk
oci-java-sdk
- 1.2.46
+ 1.2.47
../pom.xml
oci-java-sdk-full
@@ -16,7 +16,7 @@
com.oracle.oci.sdk
oci-java-sdk-bom
- 1.2.46
+ 1.2.47
pom
import
@@ -62,7 +62,6 @@
com.oracle.oci.sdk
oci-java-sdk-objectstorage
- pom
com.oracle.oci.sdk
@@ -72,5 +71,9 @@
com.oracle.oci.sdk
oci-java-sdk-resourcesearch
+
+ com.oracle.oci.sdk
+ oci-java-sdk-keymanagement
+
\ No newline at end of file
diff --git a/bmc-identity/pom.xml b/bmc-identity/pom.xml
index eb43373ec54..7b09dcbedfb 100644
--- a/bmc-identity/pom.xml
+++ b/bmc-identity/pom.xml
@@ -5,7 +5,7 @@
com.oracle.oci.sdk
oci-java-sdk
- 1.2.46
+ 1.2.47
../pom.xml
@@ -18,7 +18,7 @@
com.oracle.oci.sdk
oci-java-sdk-common
- 1.2.46
+ 1.2.47
diff --git a/bmc-identity/src/main/java/com/oracle/bmc/identity/IdentityAsyncClient.java b/bmc-identity/src/main/java/com/oracle/bmc/identity/IdentityAsyncClient.java
index 1e02080490c..13ee4d34cf1 100644
--- a/bmc-identity/src/main/java/com/oracle/bmc/identity/IdentityAsyncClient.java
+++ b/bmc-identity/src/main/java/com/oracle/bmc/identity/IdentityAsyncClient.java
@@ -15,7 +15,10 @@ public class IdentityAsyncClient implements IdentityAsync {
* Service instance for Identity.
*/
public static final com.oracle.bmc.Service SERVICE =
- com.oracle.bmc.Services.create("IDENTITY", "identity");
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("IDENTITY")
+ .serviceEndpointPrefix("identity")
+ .build();
@lombok.Getter(value = lombok.AccessLevel.PACKAGE)
private final com.oracle.bmc.http.internal.RestClient client;
diff --git a/bmc-identity/src/main/java/com/oracle/bmc/identity/IdentityClient.java b/bmc-identity/src/main/java/com/oracle/bmc/identity/IdentityClient.java
index 0a94b1c2dc3..b07e8d76b99 100644
--- a/bmc-identity/src/main/java/com/oracle/bmc/identity/IdentityClient.java
+++ b/bmc-identity/src/main/java/com/oracle/bmc/identity/IdentityClient.java
@@ -15,7 +15,10 @@ public class IdentityClient implements Identity {
* Service instance for Identity.
*/
public static final com.oracle.bmc.Service SERVICE =
- com.oracle.bmc.Services.create("IDENTITY", "identity");
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("IDENTITY")
+ .serviceEndpointPrefix("identity")
+ .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;
diff --git a/bmc-keymanagement/pom.xml b/bmc-keymanagement/pom.xml
new file mode 100644
index 00000000000..f1552977178
--- /dev/null
+++ b/bmc-keymanagement/pom.xml
@@ -0,0 +1,21 @@
+
+
+ 4.0.0
+
+ com.oracle.oci.sdk
+ oci-java-sdk
+ 1.2.47
+ ../pom.xml
+
+ oci-java-sdk-keymanagement
+ Oracle Cloud Infrastructure SDK - Key Management
+ This project contains the SDK used for Oracle Cloud Infrastructure Key Management
+ https://docs.us-phoenix-1.oraclecloud.com/Content/API/SDKDocs/javasdk.htm
+
+
+ com.oracle.oci.sdk
+ oci-java-sdk-common
+ 1.2.47
+
+
+
\ No newline at end of file
diff --git a/bmc-keymanagement/src/main/java/com/oracle/bmc/keymanagement/AbstractKmsCryptoClientBuilder.java b/bmc-keymanagement/src/main/java/com/oracle/bmc/keymanagement/AbstractKmsCryptoClientBuilder.java
new file mode 100644
index 00000000000..e3913e77996
--- /dev/null
+++ b/bmc-keymanagement/src/main/java/com/oracle/bmc/keymanagement/AbstractKmsCryptoClientBuilder.java
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.keymanagement;
+
+import com.oracle.bmc.Service;
+
+/**
+ * An abstract client builder for clients that need the cryptoEndpoint
+ * @param actual builder class
+ * @param client class
+ */
+public abstract class AbstractKmsCryptoClientBuilder
+ extends AbstractVaultBasedClientBuilder {
+ public AbstractKmsCryptoClientBuilder(Service service) {
+ super(service);
+ }
+
+ protected String getEndpoint() {
+ String cryptoEndpoint = null;
+
+ // vault and vault summary are exclusive
+ int endpointsProvided = 0;
+ if (vault != null) {
+ ++endpointsProvided;
+ }
+ if (vaultSummary != null) {
+ ++endpointsProvided;
+ }
+ if (endpoint != null) {
+ ++endpointsProvided;
+ }
+ if (endpointsProvided != 1) {
+ throw new IllegalArgumentException(
+ "Must provide exactly one of vault, vault summary, or endpoint");
+ }
+
+ if (vault != null) {
+ cryptoEndpoint = vault.getCryptoEndpoint();
+ }
+ if (vaultSummary != null) {
+ cryptoEndpoint = vaultSummary.getCryptoEndpoint();
+ }
+ if (endpoint != null) {
+ cryptoEndpoint = endpoint;
+ }
+ return cryptoEndpoint;
+ }
+}
diff --git a/bmc-keymanagement/src/main/java/com/oracle/bmc/keymanagement/AbstractKmsManagementClientBuilder.java b/bmc-keymanagement/src/main/java/com/oracle/bmc/keymanagement/AbstractKmsManagementClientBuilder.java
new file mode 100644
index 00000000000..e626890fe59
--- /dev/null
+++ b/bmc-keymanagement/src/main/java/com/oracle/bmc/keymanagement/AbstractKmsManagementClientBuilder.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.keymanagement;
+
+import com.oracle.bmc.Service;
+
+/**
+ * An abstract client builder for clients that need the managementEndpoint
+ * @param actual builder class
+ * @param client class
+ */
+public abstract class AbstractKmsManagementClientBuilder<
+ B extends AbstractKmsManagementClientBuilder, C>
+ extends AbstractVaultBasedClientBuilder {
+ public AbstractKmsManagementClientBuilder(Service service) {
+ super(service);
+ }
+
+ protected String getEndpoint() {
+ String managementEndpoint = null;
+
+ // vault and vault summary are exclusive
+ int endpointsProvided = 0;
+ if (vault != null) {
+ ++endpointsProvided;
+ }
+ if (vaultSummary != null) {
+ ++endpointsProvided;
+ }
+ if (endpoint != null) {
+ ++endpointsProvided;
+ }
+ if (endpointsProvided != 1) {
+ throw new IllegalArgumentException(
+ "Must provide exactly one of vault, vault summary, or endpoint");
+ }
+
+ if (vault != null) {
+ managementEndpoint = vault.getManagementEndpoint();
+ }
+ if (vaultSummary != null) {
+ managementEndpoint = vaultSummary.getManagementEndpoint();
+ }
+ if (endpoint != null) {
+ managementEndpoint = endpoint;
+ }
+ return managementEndpoint;
+ }
+}
diff --git a/bmc-keymanagement/src/main/java/com/oracle/bmc/keymanagement/AbstractVaultBasedClientBuilder.java b/bmc-keymanagement/src/main/java/com/oracle/bmc/keymanagement/AbstractVaultBasedClientBuilder.java
new file mode 100644
index 00000000000..d041ba0820b
--- /dev/null
+++ b/bmc-keymanagement/src/main/java/com/oracle/bmc/keymanagement/AbstractVaultBasedClientBuilder.java
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.keymanagement;
+
+import com.oracle.bmc.Service;
+import com.oracle.bmc.common.ClientBuilderBase;
+import com.oracle.bmc.keymanagement.model.Vault;
+import com.oracle.bmc.keymanagement.model.VaultSummary;
+
+/**
+ * A builder for a client that requires a vault.
+ * @param actual class of the builder
+ * @param client class
+ */
+public abstract class AbstractVaultBasedClientBuilder
+ extends ClientBuilderBase {
+ protected Vault vault = null;
+ protected VaultSummary vaultSummary = null;
+
+ /**
+ * Set the vault. May be null
+ * @param vault the vault to use. May be null.
+ * @return this builder
+ */
+ public B vault(Vault vault) {
+ this.vault = vault;
+ return (B) this;
+ }
+
+ /**
+ * Set the vault summary. May be null
+ * @param vaultSummary the vault summary to use. May be null
+ * @return this builder
+ */
+ public B vaultSummary(VaultSummary vaultSummary) {
+ this.vaultSummary = vaultSummary;
+ return (B) this;
+ }
+
+ public AbstractVaultBasedClientBuilder(Service service) {
+ super(service);
+ }
+}
diff --git a/bmc-keymanagement/src/main/java/com/oracle/bmc/keymanagement/KmsCrypto.java b/bmc-keymanagement/src/main/java/com/oracle/bmc/keymanagement/KmsCrypto.java
new file mode 100644
index 00000000000..01e5446856d
--- /dev/null
+++ b/bmc-keymanagement/src/main/java/com/oracle/bmc/keymanagement/KmsCrypto.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.keymanagement;
+
+import com.oracle.bmc.keymanagement.requests.*;
+import com.oracle.bmc.keymanagement.responses.*;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20180608")
+public interface KmsCrypto extends AutoCloseable {
+
+ /**
+ * Sets the endpoint to call (ex, https://www.example.com).
+ * @param endpoint The endpoint of the service.
+ */
+ void setEndpoint(String endpoint);
+
+ /**
+ * Decrypts data using the given DecryptDataDetails resource.
+ *
+ * @param request The request object containing the details to send
+ * @return A response object containing details about the completed operation
+ * @throws BmcException when an error occurs.
+ */
+ DecryptResponse decrypt(DecryptRequest request);
+
+ /**
+ * Encrypts data using the given EncryptDataDetails resource.
+ * Plaintext included in the example request is a base64-encoded value
+ * of a UTF-8 string.
+ *
+ * @param request The request object containing the details to send
+ * @return A response object containing details about the completed operation
+ * @throws BmcException when an error occurs.
+ */
+ EncryptResponse encrypt(EncryptRequest request);
+
+ /**
+ * Generates a key that you can use to encrypt or decrypt data.
+ *
+ * @param request The request object containing the details to send
+ * @return A response object containing details about the completed operation
+ * @throws BmcException when an error occurs.
+ */
+ GenerateDataEncryptionKeyResponse generateDataEncryptionKey(
+ GenerateDataEncryptionKeyRequest request);
+}
diff --git a/bmc-keymanagement/src/main/java/com/oracle/bmc/keymanagement/KmsCryptoAsync.java b/bmc-keymanagement/src/main/java/com/oracle/bmc/keymanagement/KmsCryptoAsync.java
new file mode 100644
index 00000000000..461135d43b0
--- /dev/null
+++ b/bmc-keymanagement/src/main/java/com/oracle/bmc/keymanagement/KmsCryptoAsync.java
@@ -0,0 +1,66 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.keymanagement;
+
+import com.oracle.bmc.keymanagement.requests.*;
+import com.oracle.bmc.keymanagement.responses.*;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20180608")
+public interface KmsCryptoAsync extends AutoCloseable {
+
+ /**
+ * Sets the endpoint to call (ex, https://www.example.com).
+ * @param endpoint The endpoint of the serice.
+ */
+ void setEndpoint(String endpoint);
+
+ /**
+ * Decrypts data using the given DecryptDataDetails resource.
+ *
+ *
+ * @param request The request object containing the details to send
+ * @param handler The request handler to invoke upon completion, may be null.
+ * @return A Future that can be used to get the response if no AsyncHandler was
+ * provided. Note, if you provide an AsyncHandler and use the Future, some
+ * types of responses (like java.io.InputStream) may not be able to be read in
+ * both places as the underlying stream may only be consumed once.
+ */
+ java.util.concurrent.Future decrypt(
+ DecryptRequest request,
+ com.oracle.bmc.responses.AsyncHandler handler);
+
+ /**
+ * Encrypts data using the given EncryptDataDetails resource.
+ * Plaintext included in the example request is a base64-encoded value
+ * of a UTF-8 string.
+ *
+ *
+ * @param request The request object containing the details to send
+ * @param handler The request handler to invoke upon completion, may be null.
+ * @return A Future that can be used to get the response if no AsyncHandler was
+ * provided. Note, if you provide an AsyncHandler and use the Future, some
+ * types of responses (like java.io.InputStream) may not be able to be read in
+ * both places as the underlying stream may only be consumed once.
+ */
+ java.util.concurrent.Future encrypt(
+ EncryptRequest request,
+ com.oracle.bmc.responses.AsyncHandler handler);
+
+ /**
+ * Generates a key that you can use to encrypt or decrypt data.
+ *
+ *
+ * @param request The request object containing the details to send
+ * @param handler The request handler to invoke upon completion, may be null.
+ * @return A Future that can be used to get the response if no AsyncHandler was
+ * provided. Note, if you provide an AsyncHandler and use the Future, some
+ * types of responses (like java.io.InputStream) may not be able to be read in
+ * both places as the underlying stream may only be consumed once.
+ */
+ java.util.concurrent.Future generateDataEncryptionKey(
+ GenerateDataEncryptionKeyRequest request,
+ com.oracle.bmc.responses.AsyncHandler<
+ GenerateDataEncryptionKeyRequest, GenerateDataEncryptionKeyResponse>
+ handler);
+}
diff --git a/bmc-keymanagement/src/main/java/com/oracle/bmc/keymanagement/KmsCryptoAsyncClient.java b/bmc-keymanagement/src/main/java/com/oracle/bmc/keymanagement/KmsCryptoAsyncClient.java
new file mode 100644
index 00000000000..4d9c0cfada7
--- /dev/null
+++ b/bmc-keymanagement/src/main/java/com/oracle/bmc/keymanagement/KmsCryptoAsyncClient.java
@@ -0,0 +1,468 @@
+/**
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ */
+package com.oracle.bmc.keymanagement;
+
+import java.util.Locale;
+import com.oracle.bmc.keymanagement.internal.http.*;
+import com.oracle.bmc.keymanagement.requests.*;
+import com.oracle.bmc.keymanagement.responses.*;
+
+@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20180608")
+@lombok.extern.slf4j.Slf4j
+public class KmsCryptoAsyncClient implements KmsCryptoAsync {
+ /**
+ * Service instance for KmsCrypto.
+ */
+ public static final com.oracle.bmc.Service SERVICE =
+ com.oracle.bmc.Services.serviceBuilder()
+ .serviceName("KMSCRYPTO")
+ .serviceEndpointPrefix("kms")
+ .build();
+
+ @lombok.Getter(value = lombok.AccessLevel.PACKAGE)
+ private final com.oracle.bmc.http.internal.RestClient client;
+
+ private final com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider
+ authenticationDetailsProvider;
+
+ /**
+ * Creates a new service instance using the given authentication provider.
+ * @param authenticationDetailsProvider The authentication details provider, required.
+ */
+ public KmsCryptoAsyncClient(
+ com.oracle.bmc.auth.BasicAuthenticationDetailsProvider authenticationDetailsProvider) {
+ this(authenticationDetailsProvider, null);
+ }
+
+ /**
+ * Creates a new service instance using the given authentication provider and client configuration.
+ * @param authenticationDetailsProvider The authentication details provider, required.
+ * @param configuration The client configuration, optional.
+ */
+ public KmsCryptoAsyncClient(
+ com.oracle.bmc.auth.BasicAuthenticationDetailsProvider authenticationDetailsProvider,
+ com.oracle.bmc.ClientConfiguration configuration) {
+ this(authenticationDetailsProvider, configuration, null);
+ }
+
+ /**
+ * Creates a new service instance using the given authentication provider and client configuration. Additionally,
+ * a Consumer can be provided that will be invoked whenever a REST Client is created to allow for additional configuration/customization.
+ * @param authenticationDetailsProvider The authentication details provider, required.
+ * @param configuration The client configuration, optional.
+ * @param clientConfigurator ClientConfigurator that will be invoked for additional configuration of a REST client, optional.
+ */
+ public KmsCryptoAsyncClient(
+ com.oracle.bmc.auth.BasicAuthenticationDetailsProvider authenticationDetailsProvider,
+ com.oracle.bmc.ClientConfiguration configuration,
+ com.oracle.bmc.http.ClientConfigurator clientConfigurator) {
+ this(
+ authenticationDetailsProvider,
+ configuration,
+ clientConfigurator,
+ new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory(
+ com.oracle.bmc.http.signing.SigningStrategy.STANDARD));
+ }
+
+ /**
+ * Creates a new service instance using the given authentication provider and client configuration. Additionally,
+ * a Consumer can be provided that will be invoked whenever a REST Client is created to allow for additional configuration/customization.
+ *
+ * This is an advanced constructor for clients that want to take control over how requests are signed.
+ * @param authenticationDetailsProvider The authentication details provider, required.
+ * @param configuration The client configuration, optional.
+ * @param clientConfigurator ClientConfigurator that will be invoked for additional configuration of a REST client, optional.
+ * @param defaultRequestSignerFactory The request signer factory used to create the request signer for this service.
+ */
+ public KmsCryptoAsyncClient(
+ com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider,
+ com.oracle.bmc.ClientConfiguration configuration,
+ com.oracle.bmc.http.ClientConfigurator clientConfigurator,
+ com.oracle.bmc.http.signing.RequestSignerFactory defaultRequestSignerFactory) {
+ this(
+ authenticationDetailsProvider,
+ configuration,
+ clientConfigurator,
+ defaultRequestSignerFactory,
+ new java.util.ArrayList());
+ }
+
+ /**
+ * Creates a new service instance using the given authentication provider and client configuration. Additionally,
+ * a Consumer can be provided that will be invoked whenever a REST Client is created to allow for additional configuration/customization.
+ *
+ * This is an advanced constructor for clients that want to take control over how requests are signed.
+ * @param authenticationDetailsProvider The authentication details provider, required.
+ * @param configuration The client configuration, optional.
+ * @param clientConfigurator ClientConfigurator that will be invoked for additional configuration of a REST client, optional.
+ * @param defaultRequestSignerFactory The request signer factory used to create the request signer for this service.
+ * @param additionalClientConfigurators Additional client configurators to be run after the primary configurator.
+ */
+ public KmsCryptoAsyncClient(
+ com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider,
+ com.oracle.bmc.ClientConfiguration configuration,
+ com.oracle.bmc.http.ClientConfigurator clientConfigurator,
+ com.oracle.bmc.http.signing.RequestSignerFactory defaultRequestSignerFactory,
+ java.util.List additionalClientConfigurators) {
+ this(
+ authenticationDetailsProvider,
+ configuration,
+ clientConfigurator,
+ defaultRequestSignerFactory,
+ additionalClientConfigurators,
+ null);
+ }
+
+ /**
+ * Creates a new service instance using the given authentication provider and client configuration. Additionally,
+ * a Consumer can be provided that will be invoked whenever a REST Client is created to allow for additional configuration/customization.
+ *
+ * This is an advanced constructor for clients that want to take control over how requests are signed.
+ * @param authenticationDetailsProvider The authentication details provider, required.
+ * @param configuration The client configuration, optional.
+ * @param clientConfigurator ClientConfigurator that will be invoked for additional configuration of a REST client, optional.
+ * @param defaultRequestSignerFactory The request signer factory used to create the request signer for this service.
+ * @param additionalClientConfigurators Additional client configurators to be run after the primary configurator.
+ * @param endpoint Endpoint, or null to leave unset (note, may be overridden by {@code authenticationDetailsProvider})
+ */
+ public KmsCryptoAsyncClient(
+ com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider,
+ com.oracle.bmc.ClientConfiguration configuration,
+ com.oracle.bmc.http.ClientConfigurator clientConfigurator,
+ com.oracle.bmc.http.signing.RequestSignerFactory defaultRequestSignerFactory,
+ java.util.List additionalClientConfigurators,
+ String endpoint) {
+ this(
+ authenticationDetailsProvider,
+ configuration,
+ clientConfigurator,
+ defaultRequestSignerFactory,
+ com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory
+ .createDefaultRequestSignerFactories(),
+ additionalClientConfigurators,
+ endpoint);
+ }
+
+ /**
+ * Creates a new service instance using the given authentication provider and client configuration. Additionally,
+ * a Consumer can be provided that will be invoked whenever a REST Client is created to allow for additional configuration/customization.
+ *
+ * This is an advanced constructor for clients that want to take control over how requests are signed.
+ * @param authenticationDetailsProvider The authentication details provider, required.
+ * @param configuration The client configuration, optional.
+ * @param clientConfigurator ClientConfigurator that will be invoked for additional configuration of a REST client, optional.
+ * @param defaultRequestSignerFactory The request signer factory used to create the request signer for this service.
+ * @param signingStrategyRequestSignerFactories The request signer factories for each signing strategy used to create the request signer
+ * @param additionalClientConfigurators Additional client configurators to be run after the primary configurator.
+ * @param endpoint Endpoint, or null to leave unset (note, may be overridden by {@code authenticationDetailsProvider})
+ */
+ public KmsCryptoAsyncClient(
+ com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider,
+ com.oracle.bmc.ClientConfiguration configuration,
+ com.oracle.bmc.http.ClientConfigurator clientConfigurator,
+ com.oracle.bmc.http.signing.RequestSignerFactory defaultRequestSignerFactory,
+ java.util.Map<
+ com.oracle.bmc.http.signing.SigningStrategy,
+ com.oracle.bmc.http.signing.RequestSignerFactory>
+ signingStrategyRequestSignerFactories,
+ java.util.List additionalClientConfigurators,
+ String endpoint) {
+ this.authenticationDetailsProvider = authenticationDetailsProvider;
+ com.oracle.bmc.http.internal.RestClientFactory restClientFactory =
+ com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder()
+ .clientConfigurator(clientConfigurator)
+ .additionalClientConfigurators(additionalClientConfigurators)
+ .build();
+ com.oracle.bmc.http.signing.RequestSigner defaultRequestSigner =
+ defaultRequestSignerFactory.createRequestSigner(
+ SERVICE, this.authenticationDetailsProvider);
+ java.util.Map<
+ com.oracle.bmc.http.signing.SigningStrategy,
+ com.oracle.bmc.http.signing.RequestSigner>
+ requestSigners = new java.util.HashMap<>();
+ if (this.authenticationDetailsProvider
+ instanceof com.oracle.bmc.auth.BasicAuthenticationDetailsProvider) {
+ for (com.oracle.bmc.http.signing.SigningStrategy s :
+ com.oracle.bmc.http.signing.SigningStrategy.values()) {
+ requestSigners.put(
+ s,
+ signingStrategyRequestSignerFactories
+ .get(s)
+ .createRequestSigner(SERVICE, authenticationDetailsProvider));
+ }
+ }
+ this.client = restClientFactory.create(defaultRequestSigner, requestSigners, configuration);
+
+ if (endpoint != null) {
+ setEndpoint(endpoint);
+ }
+ }
+
+ /**
+ * Create a builder for this client.
+ * @return builder
+ */
+ public static com.oracle.bmc.keymanagement.KmsCryptoAsyncClientBuilder builder() {
+ return new com.oracle.bmc.keymanagement.KmsCryptoAsyncClientBuilder(SERVICE);
+ }
+
+ @Override
+ public void setEndpoint(String endpoint) {
+ LOG.info("Setting endpoint to {}", endpoint);
+ client.setEndpoint(endpoint);
+ }
+
+ @Override
+ public void close() {
+ client.close();
+ }
+
+ @Override
+ public java.util.concurrent.Future decrypt(
+ final DecryptRequest request,
+ final com.oracle.bmc.responses.AsyncHandler handler) {
+ LOG.trace("Called async decrypt");
+ final DecryptRequest interceptedRequest = DecryptConverter.interceptRequest(request);
+ final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib =
+ DecryptConverter.fromRequest(client, interceptedRequest);
+ final com.google.common.base.Function
+ transformer = DecryptConverter.fromResponse();
+
+ com.oracle.bmc.responses.AsyncHandler handlerToUse =
+ handler;
+ if (handler != null
+ && this.authenticationDetailsProvider
+ instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
+ handlerToUse =
+ new com.oracle.bmc.util.internal.RefreshAuthTokenWrappingAsyncHandler<
+ DecryptRequest, DecryptResponse>(
+ (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
+ this.authenticationDetailsProvider,
+ handler) {
+ @Override
+ public void retryCall() {
+ final com.oracle.bmc.util.internal.Consumer
+ onSuccess =
+ new com.oracle.bmc.http.internal.SuccessConsumer<>(
+ this, transformer, interceptedRequest);
+ final com.oracle.bmc.util.internal.Consumer onError =
+ new com.oracle.bmc.http.internal.ErrorConsumer<>(
+ this, interceptedRequest);
+ client.post(
+ ib,
+ interceptedRequest.getDecryptDataDetails(),
+ interceptedRequest,
+ onSuccess,
+ onError);
+ }
+ };
+ }
+
+ final com.oracle.bmc.util.internal.Consumer onSuccess =
+ new com.oracle.bmc.http.internal.SuccessConsumer<>(
+ handlerToUse, transformer, interceptedRequest);
+ final com.oracle.bmc.util.internal.Consumer onError =
+ new com.oracle.bmc.http.internal.ErrorConsumer<>(handlerToUse, interceptedRequest);
+
+ java.util.concurrent.Future responseFuture =
+ client.post(
+ ib,
+ interceptedRequest.getDecryptDataDetails(),
+ interceptedRequest,
+ onSuccess,
+ onError);
+
+ if (this.authenticationDetailsProvider
+ instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
+ return new com.oracle.bmc.util.internal.RefreshAuthTokenTransformingFuture<
+ javax.ws.rs.core.Response, DecryptResponse>(
+ responseFuture,
+ transformer,
+ (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
+ this.authenticationDetailsProvider,
+ new com.google.common.base.Supplier<
+ java.util.concurrent.Future>() {
+ @Override
+ public java.util.concurrent.Future get() {
+ return client.post(
+ ib,
+ interceptedRequest.getDecryptDataDetails(),
+ interceptedRequest,
+ onSuccess,
+ onError);
+ }
+ });
+ } else {
+ return new com.oracle.bmc.util.internal.TransformingFuture<>(
+ responseFuture, transformer);
+ }
+ }
+
+ @Override
+ public java.util.concurrent.Future encrypt(
+ final EncryptRequest request,
+ final com.oracle.bmc.responses.AsyncHandler handler) {
+ LOG.trace("Called async encrypt");
+ final EncryptRequest interceptedRequest = EncryptConverter.interceptRequest(request);
+ final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib =
+ EncryptConverter.fromRequest(client, interceptedRequest);
+ final com.google.common.base.Function
+ transformer = EncryptConverter.fromResponse();
+
+ com.oracle.bmc.responses.AsyncHandler handlerToUse =
+ handler;
+ if (handler != null
+ && this.authenticationDetailsProvider
+ instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
+ handlerToUse =
+ new com.oracle.bmc.util.internal.RefreshAuthTokenWrappingAsyncHandler<
+ EncryptRequest, EncryptResponse>(
+ (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
+ this.authenticationDetailsProvider,
+ handler) {
+ @Override
+ public void retryCall() {
+ final com.oracle.bmc.util.internal.Consumer
+ onSuccess =
+ new com.oracle.bmc.http.internal.SuccessConsumer<>(
+ this, transformer, interceptedRequest);
+ final com.oracle.bmc.util.internal.Consumer onError =
+ new com.oracle.bmc.http.internal.ErrorConsumer<>(
+ this, interceptedRequest);
+ client.post(
+ ib,
+ interceptedRequest.getEncryptDataDetails(),
+ interceptedRequest,
+ onSuccess,
+ onError);
+ }
+ };
+ }
+
+ final com.oracle.bmc.util.internal.Consumer onSuccess =
+ new com.oracle.bmc.http.internal.SuccessConsumer<>(
+ handlerToUse, transformer, interceptedRequest);
+ final com.oracle.bmc.util.internal.Consumer onError =
+ new com.oracle.bmc.http.internal.ErrorConsumer<>(handlerToUse, interceptedRequest);
+
+ java.util.concurrent.Future responseFuture =
+ client.post(
+ ib,
+ interceptedRequest.getEncryptDataDetails(),
+ interceptedRequest,
+ onSuccess,
+ onError);
+
+ if (this.authenticationDetailsProvider
+ instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
+ return new com.oracle.bmc.util.internal.RefreshAuthTokenTransformingFuture<
+ javax.ws.rs.core.Response, EncryptResponse>(
+ responseFuture,
+ transformer,
+ (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
+ this.authenticationDetailsProvider,
+ new com.google.common.base.Supplier<
+ java.util.concurrent.Future>() {
+ @Override
+ public java.util.concurrent.Future get() {
+ return client.post(
+ ib,
+ interceptedRequest.getEncryptDataDetails(),
+ interceptedRequest,
+ onSuccess,
+ onError);
+ }
+ });
+ } else {
+ return new com.oracle.bmc.util.internal.TransformingFuture<>(
+ responseFuture, transformer);
+ }
+ }
+
+ @Override
+ public java.util.concurrent.Future generateDataEncryptionKey(
+ final GenerateDataEncryptionKeyRequest request,
+ final com.oracle.bmc.responses.AsyncHandler<
+ GenerateDataEncryptionKeyRequest, GenerateDataEncryptionKeyResponse>
+ handler) {
+ LOG.trace("Called async generateDataEncryptionKey");
+ final GenerateDataEncryptionKeyRequest interceptedRequest =
+ GenerateDataEncryptionKeyConverter.interceptRequest(request);
+ final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib =
+ GenerateDataEncryptionKeyConverter.fromRequest(client, interceptedRequest);
+ final com.google.common.base.Function<
+ javax.ws.rs.core.Response, GenerateDataEncryptionKeyResponse>
+ transformer = GenerateDataEncryptionKeyConverter.fromResponse();
+
+ com.oracle.bmc.responses.AsyncHandler<
+ GenerateDataEncryptionKeyRequest, GenerateDataEncryptionKeyResponse>
+ handlerToUse = handler;
+ if (handler != null
+ && this.authenticationDetailsProvider
+ instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) {
+ handlerToUse =
+ new com.oracle.bmc.util.internal.RefreshAuthTokenWrappingAsyncHandler<
+ GenerateDataEncryptionKeyRequest, GenerateDataEncryptionKeyResponse>(
+ (com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider)
+ this.authenticationDetailsProvider,
+ handler) {
+ @Override
+ public void retryCall() {
+ final com.oracle.bmc.util.internal.Consumer