diff --git a/CHANGELOG.md b/CHANGELOG.md index 229d948c28e..46e0ad7a97f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). ### Added - N/A +## 1.2.43 - 2018-07-26 +### Added +- Support for the OCI Search service. An example of how to call this service is available [here](https://github.com/oracle/oci-java-sdk/blob/master/bmc-examples/src/main/java/ResourceSearchExample.java) +- Support for specifying a backup policy when creating a boot volume in the Block Storage service +- Support for using the Java SDK in a FIPS compliant environment. Details available [here](https://docs.cloud.oracle.com/iaas/Content/API/SDKDocs/javasdk.htm#download) + ## 1.2.42 - 2018-07-12 ### Added - Support for tagging Load Balancers in the Load Balancing service diff --git a/bmc-audit/pom.xml b/bmc-audit/pom.xml index d623bccc9f7..fbe583d7f3e 100644 --- a/bmc-audit/pom.xml +++ b/bmc-audit/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.42 + 1.2.43 ../pom.xml @@ -18,7 +18,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.42 + 1.2.43 diff --git a/bmc-bom/pom.xml b/bmc-bom/pom.xml index 6ecd1917ce4..d107d838d51 100644 --- a/bmc-bom/pom.xml +++ b/bmc-bom/pom.xml @@ -1,11 +1,11 @@ - + 4.0.0 com.oracle.oci.sdk oci-java-sdk - 1.2.42 + 1.2.43 ../pom.xml oci-java-sdk-bom @@ -19,71 +19,77 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.42 + 1.2.43 false com.oracle.oci.sdk oci-java-sdk-audit - 1.2.42 + 1.2.43 false com.oracle.oci.sdk oci-java-sdk-containerengine - 1.2.42 + 1.2.43 false com.oracle.oci.sdk oci-java-sdk-core - 1.2.42 + 1.2.43 false com.oracle.oci.sdk oci-java-sdk-database - 1.2.42 + 1.2.43 false com.oracle.oci.sdk oci-java-sdk-dns - 1.2.42 + 1.2.43 false com.oracle.oci.sdk oci-java-sdk-email - 1.2.42 + 1.2.43 false com.oracle.oci.sdk oci-java-sdk-filestorage - 1.2.42 + 1.2.43 false com.oracle.oci.sdk oci-java-sdk-identity - 1.2.42 + 1.2.43 false com.oracle.oci.sdk oci-java-sdk-loadbalancer - 1.2.42 + 1.2.43 false com.oracle.oci.sdk oci-java-sdk-objectstorage - 1.2.42 + 1.2.43 false pom + + com.oracle.oci.sdk + oci-java-sdk-resourcesearch + false + 1.2.43 + - + \ No newline at end of file diff --git a/bmc-common/pom.xml b/bmc-common/pom.xml index 87b01a497e8..feed956ebb3 100644 --- a/bmc-common/pom.xml +++ b/bmc-common/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.42 + 1.2.43 ../pom.xml diff --git a/bmc-common/src/main/java/com/oracle/bmc/auth/internal/AuthUtils.java b/bmc-common/src/main/java/com/oracle/bmc/auth/internal/AuthUtils.java index 49edad3f86c..ff384c5ed25 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/auth/internal/AuthUtils.java +++ b/bmc-common/src/main/java/com/oracle/bmc/auth/internal/AuthUtils.java @@ -25,7 +25,6 @@ import org.bouncycastle.asn1.x500.RDN; import org.bouncycastle.asn1.x500.X500Name; import org.bouncycastle.asn1.x500.style.BCStyle; -import org.bouncycastle.jce.PrincipalUtil; import org.bouncycastle.openssl.jcajce.JcaPEMWriter; import com.fasterxml.jackson.databind.ObjectMapper; @@ -211,21 +210,15 @@ public static String base64EncodeNoChunking(X509Certificate certificate) public static String getTenantIdFromCertificate(X509Certificate certificate) { Preconditions.checkNotNull(certificate); - try { - X500Name name = - X500Name.getInstance(PrincipalUtil.getSubjectX509Principal(certificate)); - - for (RDN rdn : name.getRDNs(BCStyle.OU)) { - for (AttributeTypeAndValue typeAndValue : rdn.getTypesAndValues()) { - String value = typeAndValue.getValue().toString(); - if (value.startsWith("opc-tenant:")) { - return value.substring("opc-tenant:".length()); - } + X500Name name = new X500Name(certificate.getSubjectX500Principal().getName()); + + for (RDN rdn : name.getRDNs(BCStyle.OU)) { + for (AttributeTypeAndValue typeAndValue : rdn.getTypesAndValues()) { + String value = typeAndValue.getValue().toString(); + if (value.startsWith("opc-tenant:")) { + return value.substring("opc-tenant:".length()); } } - } catch (CertificateEncodingException ex) { - throw new InstancePrincipalUnavailableException( - "The certificate is not valid one.", ex); } throw new InstancePrincipalUnavailableException( 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 8b0f7725b3c..8acae680112 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,7 @@ */ package com.oracle.bmc.http.signing.internal; +import java.io.IOException; import java.io.InputStream; import java.net.URI; import java.nio.charset.StandardCharsets; @@ -22,6 +23,7 @@ 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 org.apache.commons.codec.binary.Base64; import org.apache.commons.lang3.StringUtils; @@ -143,7 +145,12 @@ private Map signRequest( // 3) calculate any required headers that are missing final Map missingHeaders = calculateMissingHeaders( - lowerHttpMethod, uri, existingHeaders, body, requiredHeaders); + lowerHttpMethod, + uri, + existingHeaders, + body, + requiredHeaders, + signingConfiguration); // 4) create a map containing both existing + missing headers final Map allHeaders = new HashMap<>(); @@ -247,12 +254,14 @@ private static String extractPath(URI uri) { return path; } - private Map calculateMissingHeaders( + static Map calculateMissingHeaders( final String httpMethod, final URI uri, final Map existingHeaders, final Object body, - final List requiredHeaders) { + final List requiredHeaders, + final SigningConfiguration signingConfiguration) + throws IOException { // all of the required headers that are currently missing Map missingHeaders = new HashMap<>(); @@ -301,21 +310,10 @@ private 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 if (!existingHeaders - .get(Constants.CONTENT_TYPE) - .toLowerCase(Locale.ROOT) - .equals(Constants.JSON_CONTENT_TYPE)) { - throw new IllegalArgumentException( - "Only 'application/json' supported for content type"); } } - byte[] bodyBytes; - try { - bodyBytes = getJsonBody(body); - } catch (JsonProcessingException e) { - throw new IllegalArgumentException("Unable to process JSON body", e); - } + final byte[] bodyBytes = readBodyBytes(body); if (isRequiredHeaderMissing(Constants.CONTENT_LENGTH, requiredHeaders, existingHeaders)) { missingHeaders.put(Constants.CONTENT_LENGTH, Integer.toString(bodyBytes.length)); } @@ -398,7 +396,7 @@ private List getRequiredSigningHeaders(final String httpMethod) { // JSON is the only accepted format for message bodies that need to be // signed. - private static byte[] getJsonBody(Object body) throws JsonProcessingException { + private static byte[] readBodyBytes(Object body) throws IOException { // empty body is OK if (body == null) { return "".getBytes(StandardCharsets.UTF_8); @@ -406,9 +404,11 @@ private static byte[] getJsonBody(Object body) throws JsonProcessingException { // if already a string, just use it unchanged if (body instanceof String) { return ((String) body).getBytes(StandardCharsets.UTF_8); + } else if (body instanceof InputStream) { + return ByteStreams.toByteArray((InputStream) body); } - throw new IllegalArgumentException("body must be a String"); + throw new IllegalArgumentException("Unexpected body type: " + body.getClass().getName()); } private static String base64Encode(byte[] bytes) { 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 1f3221ed2e9..10c2b4ba101 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,9 +4,11 @@ package com.oracle.bmc.http.signing.internal; import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.oracle.bmc.http.internal.RestClientFactory; import com.oracle.bmc.http.signing.RequestSignerException; +import com.oracle.bmc.http.signing.SigningStrategy; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; @@ -17,7 +19,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import javax.ws.rs.HttpMethod; +import javax.ws.rs.core.HttpHeaders; import javax.ws.rs.core.MediaType; +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.net.URI; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -37,6 +44,7 @@ @PrepareForTest({LoggerFactory.class, RestClientFactory.class, RequestSignerImpl.class}) public class RequestSignerImplTest { private static final String SERIALIZED_MAP_JSON_STRING = "{\"header\":[\"value1\",\"value2\"]}"; + private static final byte[] BYTE_BUFFER = new byte[8196]; @Mock private Logger mockLogger; @Mock private ObjectMapper mockObjectMapper; @@ -112,4 +120,76 @@ public void ignoreCaseHeaders_shouldThrowRequestSignerException_whenDuplicateHea actaulLogMessageValue.contains("More than one value for header [{}] found.")); } } + + @Test + public void calculateMissingHeaders_postStringContentAsJson() throws IOException { + calculateAndVerifyMissingHeaders( + MediaType.APPLICATION_JSON, + SERIALIZED_MAP_JSON_STRING, + SERIALIZED_MAP_JSON_STRING.length()); + } + + @Test + public void calculateMissingHeaders_postStringContentAsPlainText() throws IOException { + calculateAndVerifyMissingHeaders( + MediaType.TEXT_PLAIN, + SERIALIZED_MAP_JSON_STRING, + SERIALIZED_MAP_JSON_STRING.length()); + } + + @Test + public void calculateMissingHeaders_postInputStreamAsOctetStream() throws IOException { + calculateAndVerifyMissingHeaders( + MediaType.APPLICATION_OCTET_STREAM, + new ByteArrayInputStream(BYTE_BUFFER), + BYTE_BUFFER.length); + } + + @Test + public void calculateMissingHeaders_postInputStreamAsPlainText() throws IOException { + calculateAndVerifyMissingHeaders( + MediaType.TEXT_PLAIN, new ByteArrayInputStream(BYTE_BUFFER), BYTE_BUFFER.length); + } + + @Test(expected = IllegalArgumentException.class) + public void calculateMissingHeaders_invalidBody() throws IOException { + calculateAndVerifyMissingHeaders(MediaType.TEXT_PLAIN, BYTE_BUFFER, BYTE_BUFFER.length); + } + + 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( + HttpHeaders.CONTENT_TYPE.toLowerCase(), + contentType, + "opc-request-id", + "2F9BA4A30BB3452397A5BC1BFE447C5D", + HttpHeaders.ACCEPT.toLowerCase(), + MediaType.APPLICATION_JSON); + final RequestSignerImpl.SigningConfiguration signingConfiguration = + new RequestSignerImpl.SigningConfiguration( + SigningStrategy.STANDARD.getHeadersToSign(), + SigningStrategy.STANDARD.isSkipContentHeadersForStreamingPutRequests()); + final Map missingHeaders = + RequestSignerImpl.calculateMissingHeaders( + HttpMethod.POST.toLowerCase(), + uri, + existingHeaders, + body, + Constants.ALL_HEADERS, + signingConfiguration); + assertNotNull(missingHeaders); + assertEquals(4, missingHeaders.size()); + assertTrue(missingHeaders.containsKey(HttpHeaders.DATE.toLowerCase())); + assertTrue(missingHeaders.containsKey(HttpHeaders.CONTENT_LENGTH.toLowerCase())); + assertEquals( + Integer.toString(contentLength), + missingHeaders.get(HttpHeaders.CONTENT_LENGTH.toLowerCase())); + assertTrue(missingHeaders.containsKey("x-content-sha256")); + assertEquals( + "identity.us-phoenix-1.oraclecloud.com", + missingHeaders.get(HttpHeaders.HOST.toLowerCase())); + } } diff --git a/bmc-containerengine/pom.xml b/bmc-containerengine/pom.xml index d695afa8df2..ace097b5063 100644 --- a/bmc-containerengine/pom.xml +++ b/bmc-containerengine/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.42 + 1.2.43 ../pom.xml @@ -18,7 +18,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.42 + 1.2.43 diff --git a/bmc-core/pom.xml b/bmc-core/pom.xml index 43fa77f8305..851092a7e12 100644 --- a/bmc-core/pom.xml +++ b/bmc-core/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.42 + 1.2.43 ../pom.xml @@ -18,7 +18,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.42 + 1.2.43 diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/Compute.java b/bmc-core/src/main/java/com/oracle/bmc/core/Compute.java index 8ad9b11f776..644c2e26ae2 100644 --- a/bmc-core/src/main/java/com/oracle/bmc/core/Compute.java +++ b/bmc-core/src/main/java/com/oracle/bmc/core/Compute.java @@ -385,11 +385,13 @@ ListBootVolumeAttachmentsResponse listBootVolumeAttachments( ListConsoleHistoriesResponse listConsoleHistories(ListConsoleHistoriesRequest request); /** - * Lists the available images in the specified compartment. - * If you specify a value for the `sortBy` parameter, Oracle-provided images appear first in the list, followed by custom images. - * For more - * information about images, see - * [Managing Custom Images](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/managingcustomimages.htm). + * Lists the available images in the specified compartment, including both + * [Oracle-provided images](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/References/images.htm) and + * [custom images](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/managingcustomimages.htm) that have + * been created. The list of images returned is ordered to first show all + * Oracle-provided images, then all custom images. + *

+ * The order of images returned may change when new images are released. * * @param request The request object containing the details to send * @return A response object containing details about the completed operation diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/ComputeAsync.java b/bmc-core/src/main/java/com/oracle/bmc/core/ComputeAsync.java index 9d112878369..468c56690ed 100644 --- a/bmc-core/src/main/java/com/oracle/bmc/core/ComputeAsync.java +++ b/bmc-core/src/main/java/com/oracle/bmc/core/ComputeAsync.java @@ -574,11 +574,13 @@ java.util.concurrent.Future listConsoleHistories( handler); /** - * Lists the available images in the specified compartment. - * If you specify a value for the `sortBy` parameter, Oracle-provided images appear first in the list, followed by custom images. - * For more - * information about images, see - * [Managing Custom Images](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/managingcustomimages.htm). + * Lists the available images in the specified compartment, including both + * [Oracle-provided images](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/References/images.htm) and + * [custom images](https://docs.us-phoenix-1.oraclecloud.com/Content/Compute/Tasks/managingcustomimages.htm) that have + * been created. The list of images returned is ordered to first show all + * Oracle-provided images, then all custom images. + *

+ * The order of images returned may change when new images are released. * * * @param request The request object containing the details to send 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 ffbb136529d..2f651020ee0 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 @@ -32,6 +32,15 @@ public Builder availabilityDomain(String availabilityDomain) { return this; } + @com.fasterxml.jackson.annotation.JsonProperty("backupPolicyId") + private String backupPolicyId; + + public Builder backupPolicyId(String backupPolicyId) { + this.backupPolicyId = backupPolicyId; + this.__explicitlySet__.add("backupPolicyId"); + return this; + } + @com.fasterxml.jackson.annotation.JsonProperty("compartmentId") private String compartmentId; @@ -94,6 +103,7 @@ public CreateBootVolumeDetails build() { CreateBootVolumeDetails __instance__ = new CreateBootVolumeDetails( availabilityDomain, + backupPolicyId, compartmentId, definedTags, displayName, @@ -108,6 +118,7 @@ public CreateBootVolumeDetails build() { public Builder copy(CreateBootVolumeDetails o) { Builder copiedBuilder = availabilityDomain(o.getAvailabilityDomain()) + .backupPolicyId(o.getBackupPolicyId()) .compartmentId(o.getCompartmentId()) .definedTags(o.getDefinedTags()) .displayName(o.getDisplayName()) @@ -136,6 +147,14 @@ public static Builder builder() { @com.fasterxml.jackson.annotation.JsonProperty("availabilityDomain") String availabilityDomain; + /** + * If provided, specifies the ID of the boot volume backup policy to assign to the newly + * created boot volume. If omitted, no policy will be assigned. + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("backupPolicyId") + String backupPolicyId; + /** * The OCID of the compartment that contains the boot volume. **/ diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/EgressSecurityRule.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/EgressSecurityRule.java index 8221ceefa07..4bd4b72de9d 100644 --- a/bmc-core/src/main/java/com/oracle/bmc/core/model/EgressSecurityRule.java +++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/EgressSecurityRule.java @@ -127,16 +127,30 @@ public static Builder builder() { } /** - * The destination service cidrBlock or destination IP address range in CIDR notation for the egress rule. - * This is the range of IP addresses that a packet originating from the instance can go to. + * Conceptually, this is the range of IP addresses that a packet originating from the instance + * can go to. + *

+ * Allowed values: + *

+ * IP address range in CIDR notation. For example: `192.168.1.0/24` + *

+ * The `cidrBlock` value for a {@link Service}, if you're + * setting up a security list rule for traffic destined for a particular service through + * a service gateway. For example: `oci-phx-objectstorage` * **/ @com.fasterxml.jackson.annotation.JsonProperty("destination") String destination; /** - * Type of destination for EgressSecurityRule. SERVICE_CIDR_BLOCK should be used if destination is a service - * cidrBlock. CIDR_BLOCK should be used if destination is IP address range in CIDR notation. - * It defaults to CIDR_BLOCK, if not specified. + * Type of destination for the rule. The default is `CIDR_BLOCK`. + *

+ * Allowed values: + *

+ * `CIDR_BLOCK`: If the rule's `destination` is an IP address range in CIDR notation. + *

+ * `SERVICE_CIDR_BLOCK`: If the rule's `destination` is the `cidrBlock` value for a + * {@link Service} (the rule is for traffic destined for a + * particular service through a service gateway). * **/ @lombok.extern.slf4j.Slf4j @@ -183,9 +197,15 @@ public static DestinationType create(String key) { } }; /** - * Type of destination for EgressSecurityRule. SERVICE_CIDR_BLOCK should be used if destination is a service - * cidrBlock. CIDR_BLOCK should be used if destination is IP address range in CIDR notation. - * It defaults to CIDR_BLOCK, if not specified. + * Type of destination for the rule. The default is `CIDR_BLOCK`. + *

+ * Allowed values: + *

+ * `CIDR_BLOCK`: If the rule's `destination` is an IP address range in CIDR notation. + *

+ * `SERVICE_CIDR_BLOCK`: If the rule's `destination` is the `cidrBlock` value for a + * {@link Service} (the rule is for traffic destined for a + * particular service through a service gateway). * **/ @com.fasterxml.jackson.annotation.JsonProperty("destinationType") diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/FastConnectProviderService.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/FastConnectProviderService.java index 55c9e58e18f..d52b328529a 100644 --- a/bmc-core/src/main/java/com/oracle/bmc/core/model/FastConnectProviderService.java +++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/FastConnectProviderService.java @@ -156,7 +156,7 @@ public static Builder builder() { @com.fasterxml.jackson.annotation.JsonProperty("id") String id; /** - * Private peering BGP management. + * Who is responsible for managing the private peering BGP information. * **/ @lombok.extern.slf4j.Slf4j @@ -204,7 +204,7 @@ public static PrivatePeeringBgpManagement create(String key) { } }; /** - * Private peering BGP management. + * Who is responsible for managing the private peering BGP information. * **/ @com.fasterxml.jackson.annotation.JsonProperty("privatePeeringBgpManagement") @@ -224,7 +224,7 @@ public static PrivatePeeringBgpManagement create(String key) { @com.fasterxml.jackson.annotation.JsonProperty("providerServiceName") String providerServiceName; /** - * Public peering BGP management. + * Who is responsible for managing the public peering BGP information. * **/ @lombok.extern.slf4j.Slf4j @@ -272,7 +272,7 @@ public static PublicPeeringBgpManagement create(String key) { } }; /** - * Public peering BGP management. + * Who is responsible for managing the public peering BGP information. * **/ @com.fasterxml.jackson.annotation.JsonProperty("publicPeeringBgpManagement") diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/IngressSecurityRule.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/IngressSecurityRule.java index 1fa03ebf165..6331432e436 100644 --- a/bmc-core/src/main/java/com/oracle/bmc/core/model/IngressSecurityRule.java +++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/IngressSecurityRule.java @@ -162,19 +162,28 @@ public static Builder builder() { String protocol; /** - * The source service cidrBlock or source IP address range in CIDR notation for the ingress rule. This is the - * range of IP addresses that a packet coming into the instance can come from. + * Conceptually, this is the range of IP addresses that a packet coming into the instance + * can come from. *

- * Examples: `10.12.0.0/16` - * `oci-phx-objectstorage` + * Allowed values: + *

+ * IP address range in CIDR notation. For example: `192.168.1.0/24` + *

+ * The `cidrBlock` value for a {@link Service}, if you're + * setting up a security list rule for traffic coming from a particular service through + * a service gateway. For example: `oci-phx-objectstorage` * **/ @com.fasterxml.jackson.annotation.JsonProperty("source") String source; /** - * Type of source for IngressSecurityRule. SERVICE_CIDR_BLOCK should be used if source is a service cidrBlock. - * CIDR_BLOCK should be used if source is IP address range in CIDR notation. It defaults to CIDR_BLOCK, if - * not specified. + * Type of source for the rule. The default is `CIDR_BLOCK`. + *

+ * `CIDR_BLOCK`: If the rule's `source` is an IP address range in CIDR notation. + *

+ * `SERVICE_CIDR_BLOCK`: If the rule's `source` is the `cidrBlock` value for a + * {@link Service} (the rule is for traffic coming from a + * particular service through a service gateway). * **/ @lombok.extern.slf4j.Slf4j @@ -221,9 +230,13 @@ public static SourceType create(String key) { } }; /** - * Type of source for IngressSecurityRule. SERVICE_CIDR_BLOCK should be used if source is a service cidrBlock. - * CIDR_BLOCK should be used if source is IP address range in CIDR notation. It defaults to CIDR_BLOCK, if - * not specified. + * Type of source for the rule. The default is `CIDR_BLOCK`. + *

+ * `CIDR_BLOCK`: If the rule's `source` is an IP address range in CIDR notation. + *

+ * `SERVICE_CIDR_BLOCK`: If the rule's `source` is the `cidrBlock` value for a + * {@link Service} (the rule is for traffic coming from a + * particular service through a service gateway). * **/ @com.fasterxml.jackson.annotation.JsonProperty("sourceType") 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 825cd526507..dd35144e3c2 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 @@ -282,8 +282,6 @@ public static Builder builder() { * Additional metadata key/value pairs that you provide. They serve a similar purpose and functionality from fields in the 'metadata' object. *

* They are distinguished from 'metadata' fields in that these can be nested JSON objects (whereas 'metadata' fields are string/string maps only). - *

- * If you don't need nested metadata values, it is strongly advised to avoid using this object and use the Metadata object instead. * **/ @com.fasterxml.jackson.annotation.JsonProperty("extendedMetadata") diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/LaunchInstanceDetails.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/LaunchInstanceDetails.java index e5e11a6360b..ea1540ef910 100644 --- a/bmc-core/src/main/java/com/oracle/bmc/core/model/LaunchInstanceDetails.java +++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/LaunchInstanceDetails.java @@ -253,8 +253,6 @@ public static Builder builder() { * Additional metadata key/value pairs that you provide. They serve a similar purpose and functionality from fields in the 'metadata' object. *

* They are distinguished from 'metadata' fields in that these can be nested JSON objects (whereas 'metadata' fields are string/string maps only). - *

- * If you don't need nested metadata values, it is strongly advised to avoid using this object and use the Metadata object instead. * **/ @com.fasterxml.jackson.annotation.JsonProperty("extendedMetadata") diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/RouteRule.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/RouteRule.java index 86839047924..247d6e9ad18 100644 --- a/bmc-core/src/main/java/com/oracle/bmc/core/model/RouteRule.java +++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/RouteRule.java @@ -90,7 +90,9 @@ public static Builder builder() { } /** - * Deprecated, Destination and DestinationType should be used instead; request including both fields will be rejected. + * Deprecated. Instead use `destination` and `destinationType`. Requests that include both + * `cidrBlock` and `destination` will be rejected. + *

* A destination IP address range in CIDR notation. Matching packets will * be routed to the indicated network entity (the target). *

@@ -101,19 +103,28 @@ public static Builder builder() { String cidrBlock; /** - * The destination service cidrBlock or destination IP address range in CIDR notation. Matching packets will - * be routed to the indicated network entity (the target). + * Conceptually, this is the range of IP addresses used for matching when routing + * traffic. Required if you provide a `destinationType`. + *

+ * Allowed values: + *

+ * IP address range in CIDR notation. For example: `192.168.1.0/24` *

- * Examples: `10.12.0.0/16` - * `oci-phx-objectstorage` + * The `cidrBlock` value for a {@link Service}, if you're + * setting up a route rule for traffic destined for a particular service through + * a service gateway. For example: `oci-phx-objectstorage` * **/ @com.fasterxml.jackson.annotation.JsonProperty("destination") String destination; /** - * Type of destination for the route rule. SERVICE_CIDR_BLOCK should be used if destination is a service - * cidrBlock. CIDR_BLOCK should be used if destination is IP address range in CIDR notation. It must be provided - * along with `destination`. + * Type of destination for the rule. Required if you provide a `destination`. + *

+ * `CIDR_BLOCK`: If the rule's `destination` is an IP address range in CIDR notation. + *

+ * `SERVICE_CIDR_BLOCK`: If the rule's `destination` is the `cidrBlock` value for a + * {@link Service} (the rule is for traffic destined for a + * particular service through a service gateway). * **/ @lombok.extern.slf4j.Slf4j @@ -160,9 +171,13 @@ public static DestinationType create(String key) { } }; /** - * Type of destination for the route rule. SERVICE_CIDR_BLOCK should be used if destination is a service - * cidrBlock. CIDR_BLOCK should be used if destination is IP address range in CIDR notation. It must be provided - * along with `destination`. + * Type of destination for the rule. Required if you provide a `destination`. + *

+ * `CIDR_BLOCK`: If the rule's `destination` is an IP address range in CIDR notation. + *

+ * `SERVICE_CIDR_BLOCK`: If the rule's `destination` is the `cidrBlock` value for a + * {@link Service} (the rule is for traffic destined for a + * particular service through a service gateway). * **/ @com.fasterxml.jackson.annotation.JsonProperty("destinationType") diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/VirtualCircuit.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/VirtualCircuit.java index 3c536cdda36..bb7d9d16594 100644 --- a/bmc-core/src/main/java/com/oracle/bmc/core/model/VirtualCircuit.java +++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/VirtualCircuit.java @@ -299,7 +299,12 @@ public static Builder builder() { } /** - * The provisioned data rate of the connection. + * The provisioned data rate of the connection. To get a list of the + * available bandwidth levels (that is, shapes), see + * {@link #listFastConnectProviderVirtualCircuitBandwidthShapes(ListFastConnectProviderVirtualCircuitBandwidthShapesRequest) listFastConnectProviderVirtualCircuitBandwidthShapes}. + *

+ * Example: `10 Gbps` + * **/ @com.fasterxml.jackson.annotation.JsonProperty("bandwidthShapeName") String bandwidthShapeName; diff --git a/bmc-database/pom.xml b/bmc-database/pom.xml index 94d55752a71..00fadf9385a 100644 --- a/bmc-database/pom.xml +++ b/bmc-database/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.42 + 1.2.43 ../pom.xml @@ -18,7 +18,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.42 + 1.2.43 diff --git a/bmc-dns/pom.xml b/bmc-dns/pom.xml index 34bbd38f211..854f3d9102b 100644 --- a/bmc-dns/pom.xml +++ b/bmc-dns/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.42 + 1.2.43 ../pom.xml @@ -18,7 +18,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.42 + 1.2.43 diff --git a/bmc-email/pom.xml b/bmc-email/pom.xml index b965bd9d8ff..add8a899290 100644 --- a/bmc-email/pom.xml +++ b/bmc-email/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.42 + 1.2.43 ../pom.xml @@ -18,7 +18,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.42 + 1.2.43 diff --git a/bmc-examples/pom.xml b/bmc-examples/pom.xml index bbfc2d4d4f8..ce04975cc6f 100644 --- a/bmc-examples/pom.xml +++ b/bmc-examples/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.42 + 1.2.43 ../pom.xml @@ -19,7 +19,7 @@ com.oracle.oci.sdk oci-java-sdk-bom - 1.2.42 + 1.2.43 pom import @@ -64,6 +64,10 @@ com.oracle.oci.sdk oci-java-sdk-containerengine + + com.oracle.oci.sdk + oci-java-sdk-resourcesearch + diff --git a/bmc-examples/src/main/java/ResourceSearchExample.java b/bmc-examples/src/main/java/ResourceSearchExample.java new file mode 100644 index 00000000000..0d2c924adcc --- /dev/null +++ b/bmc-examples/src/main/java/ResourceSearchExample.java @@ -0,0 +1,98 @@ + +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ + +import com.oracle.bmc.ConfigFileReader; +import com.oracle.bmc.auth.AuthenticationDetailsProvider; +import com.oracle.bmc.auth.ConfigFileAuthenticationDetailsProvider; +import com.oracle.bmc.resourcesearch.ResourceSearch; +import com.oracle.bmc.resourcesearch.ResourceSearchClient; +import com.oracle.bmc.resourcesearch.model.*; +import com.oracle.bmc.resourcesearch.requests.GetResourceTypeRequest; +import com.oracle.bmc.resourcesearch.requests.ListResourceTypesRequest; +import com.oracle.bmc.resourcesearch.requests.SearchResourcesRequest; +import com.oracle.bmc.resourcesearch.responses.GetResourceTypeResponse; +import com.oracle.bmc.resourcesearch.responses.ListResourceTypesResponse; +import com.oracle.bmc.resourcesearch.responses.SearchResourcesResponse; + +/** + * This class provides an example on how to use resource-search in the Java SDK to: + * 1. List searchable types. + * 2. Get detail of searchable type. + * 3. Search resources cross type. + */ +public class ResourceSearchExample { + private static final String CONFIG_LOCATION = "~/.oci/config"; + private static final String CONFIG_PROFILE = "DEFAULT"; + + /** + * The entry point for the example. + */ + public static void main(String[] args) throws Exception { + + final ConfigFileReader.ConfigFile configFile = + ConfigFileReader.parse(CONFIG_LOCATION, CONFIG_PROFILE); + final AuthenticationDetailsProvider provider = + new ConfigFileAuthenticationDetailsProvider(configFile); + + ResourceSearch client = ResourceSearchClient.builder().build(provider); + + System.out.println("List all resource types........."); + listTypes(client); + + System.out.println("Get Group type detail.........."); + getTypeDetails(client, "Group"); + + System.out.println("Search for resource by freetext search ............"); + freetextSearch(client, "displayname"); + + System.out.println("Search for resource by structured query search............"); + structuredQuerySearch(client); + } + + private static void listTypes(ResourceSearch client) { + ListResourceTypesRequest listTypesRequest = ListResourceTypesRequest.builder().build(); + + ListResourceTypesResponse listTypesResp = client.listResourceTypes(listTypesRequest); + + for (ResourceType type : listTypesResp.getItems()) { + System.out.println("Resource : " + type.getName()); + } + } + + private static void getTypeDetails(ResourceSearch client, String typeName) { + GetResourceTypeRequest getTypeRequest = GetResourceTypeRequest.builder().name(typeName).build(); + + GetResourceTypeResponse getTypeResp = client.getResourceType(getTypeRequest); + + System.out.println(getTypeResp.getResourceType()); + } + + private static void freetextSearch(ResourceSearch client, String text) { + SearchResourcesRequest req = SearchResourcesRequest.builder().searchDetails( + FreeTextSearchDetails.builder().text(text).build() + ).build(); + + SearchResourcesResponse resp = client.searchResources(req); + + for (ResourceSummary resource : resp.getResourceSummaryCollection().getItems()) { + System.out.println(resource); + } + } + + private static void structuredQuerySearch(ResourceSearch client) { + SearchResourcesRequest req = SearchResourcesRequest.builder().searchDetails( + StructuredSearchDetails + .builder() + .matchingContextType(SearchDetails.MatchingContextType.Highlights) + .query("query all resources").build() + ).build(); + + SearchResourcesResponse resp = client.searchResources(req); + + for (ResourceSummary resource : resp.getResourceSummaryCollection().getItems()) { + System.out.println(resource); + } + } +} \ No newline at end of file diff --git a/bmc-filestorage/pom.xml b/bmc-filestorage/pom.xml index 52d08a99e3c..546fdab63fb 100644 --- a/bmc-filestorage/pom.xml +++ b/bmc-filestorage/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.42 + 1.2.43 ../pom.xml @@ -18,7 +18,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.42 + 1.2.43 diff --git a/bmc-full/pom.xml b/bmc-full/pom.xml index d4df9381848..a35e6c49e01 100644 --- a/bmc-full/pom.xml +++ b/bmc-full/pom.xml @@ -1,10 +1,10 @@ - + 4.0.0 com.oracle.oci.sdk oci-java-sdk - 1.2.42 + 1.2.43 ../pom.xml oci-java-sdk-full @@ -16,7 +16,7 @@ com.oracle.oci.sdk oci-java-sdk-bom - 1.2.42 + 1.2.43 pom import @@ -68,5 +68,9 @@ com.oracle.oci.sdk oci-java-sdk-containerengine + + com.oracle.oci.sdk + oci-java-sdk-resourcesearch + - + \ No newline at end of file diff --git a/bmc-identity/pom.xml b/bmc-identity/pom.xml index 4dd8fe3d20a..f3ab058189b 100644 --- a/bmc-identity/pom.xml +++ b/bmc-identity/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.42 + 1.2.43 ../pom.xml @@ -18,7 +18,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.42 + 1.2.43 diff --git a/bmc-loadbalancer/pom.xml b/bmc-loadbalancer/pom.xml index 7e3c9a2f3ce..73631f7def7 100644 --- a/bmc-loadbalancer/pom.xml +++ b/bmc-loadbalancer/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.42 + 1.2.43 ../pom.xml @@ -18,7 +18,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.42 + 1.2.43 diff --git a/bmc-objectstorage/bmc-objectstorage-extensions/pom.xml b/bmc-objectstorage/bmc-objectstorage-extensions/pom.xml index c6a3df42ea1..e53f4be603e 100644 --- a/bmc-objectstorage/bmc-objectstorage-extensions/pom.xml +++ b/bmc-objectstorage/bmc-objectstorage-extensions/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.42 + 1.2.43 ../../pom.xml @@ -18,12 +18,12 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.42 + 1.2.43 com.oracle.oci.sdk oci-java-sdk-objectstorage-generated - 1.2.42 + 1.2.43 diff --git a/bmc-objectstorage/bmc-objectstorage-generated/pom.xml b/bmc-objectstorage/bmc-objectstorage-generated/pom.xml index 2565e7f12e7..c88393b8778 100644 --- a/bmc-objectstorage/bmc-objectstorage-generated/pom.xml +++ b/bmc-objectstorage/bmc-objectstorage-generated/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.42 + 1.2.43 ../../pom.xml @@ -18,7 +18,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.42 + 1.2.43 diff --git a/bmc-objectstorage/pom.xml b/bmc-objectstorage/pom.xml index eaf64ded3ca..d35838572fb 100644 --- a/bmc-objectstorage/pom.xml +++ b/bmc-objectstorage/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.42 + 1.2.43 ../pom.xml @@ -19,17 +19,17 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.42 + 1.2.43 com.oracle.oci.sdk oci-java-sdk-objectstorage-generated - 1.2.42 + 1.2.43 com.oracle.oci.sdk oci-java-sdk-objectstorage-extensions - 1.2.42 + 1.2.43 diff --git a/bmc-resourcesearch/pom.xml b/bmc-resourcesearch/pom.xml new file mode 100644 index 00000000000..83cd65b2e44 --- /dev/null +++ b/bmc-resourcesearch/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + com.oracle.oci.sdk + oci-java-sdk + 1.2.43 + ../pom.xml + + oci-java-sdk-resourcesearch + Oracle Cloud Infrastructure SDK - Resource Search + This project contains the SDK used for Oracle Cloud Infrastructure Resource Search + https://docs.us-phoenix-1.oraclecloud.com/Content/API/SDKDocs/javasdk.htm + + + com.oracle.oci.sdk + oci-java-sdk-common + 1.2.43 + + + \ No newline at end of file diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/ResourceSearch.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/ResourceSearch.java new file mode 100644 index 00000000000..ea6e1e9378a --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/ResourceSearch.java @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch; + +import com.oracle.bmc.resourcesearch.requests.*; +import com.oracle.bmc.resourcesearch.responses.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +public interface ResourceSearch extends AutoCloseable { + + /** + * Sets the endpoint to call (ex, https://www.example.com). + * @param endpoint The endpoint of the service. + */ + void setEndpoint(String endpoint); + + /** + * Sets the region to call (ex, Region.US_PHOENIX_1). + *

+ * Note, this will call {@link #setEndpoint(String) setEndpoint} after resolving the endpoint. If the service is not available in this Region, however, an IllegalArgumentException will be raised. + * @param region The region of the service. + */ + void setRegion(com.oracle.bmc.Region region); + + /** + * Sets the region to call (ex, 'us-phoenix-1'). + *

+ * Note, this will first try to map the region ID to a known Region and call + * {@link #setRegion(Region) setRegion}. + *

+ * If no known Region could be determined, it will create an endpoint based on the + * default endpoint format ({@link Region#formatDefaultRegionEndpoint(Service, String)} + * and then call {@link #setEndpoint(String) setEndpoint}. + * @param regionId The public region ID. + */ + void setRegion(String regionId); + + /** + * Gets detailed information about a resource type by using the resource type name. + * + * @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. + */ + GetResourceTypeResponse getResourceType(GetResourceTypeRequest request); + + /** + * Lists all resource types that you can search or query for. + * + * @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. + */ + ListResourceTypesResponse listResourceTypes(ListResourceTypesRequest request); + + /** + * Queries any and all compartments in the tenancy to find resources that match the specified criteria. + * Results include resources that you have permission to view and can span different resource types. + * You can also sort results based on a specified resource attribute. + * + * @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. + */ + SearchResourcesResponse searchResources(SearchResourcesRequest request); +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/ResourceSearchAsync.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/ResourceSearchAsync.java new file mode 100644 index 00000000000..b9c65260309 --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/ResourceSearchAsync.java @@ -0,0 +1,89 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch; + +import com.oracle.bmc.resourcesearch.requests.*; +import com.oracle.bmc.resourcesearch.responses.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +public interface ResourceSearchAsync extends AutoCloseable { + + /** + * Sets the endpoint to call (ex, https://www.example.com). + * @param endpoint The endpoint of the serice. + */ + void setEndpoint(String endpoint); + + /** + * Sets the region to call (ex, Region.US_PHOENIX_1). + *

+ * Note, this will call {@link #setEndpoint(String) setEndpoint} after resolving the endpoint. If the service is not available in this region, however, an IllegalArgumentException will be raised. + * @param region The region of the service. + */ + void setRegion(com.oracle.bmc.Region region); + + /** + * Sets the region to call (ex, 'us-phoenix-1'). + *

+ * Note, this will first try to map the region ID to a known Region and call + * {@link #setRegion(Region) setRegion}. + *

+ * If no known Region could be determined, it will create an endpoint based on the + * default endpoint format ({@link Region#formatDefaultRegionEndpoint(Service, String)} + * and then call {@link #setEndpoint(String) setEndpoint}. + * @param regionId The public region ID. + */ + void setRegion(String regionId); + + /** + * Gets detailed information about a resource type by using the resource type name. + * + * + * @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 getResourceType( + GetResourceTypeRequest request, + com.oracle.bmc.responses.AsyncHandler + handler); + + /** + * Lists all resource types that you can search or query for. + * + * + * @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 listResourceTypes( + ListResourceTypesRequest request, + com.oracle.bmc.responses.AsyncHandler< + ListResourceTypesRequest, ListResourceTypesResponse> + handler); + + /** + * Queries any and all compartments in the tenancy to find resources that match the specified criteria. + * Results include resources that you have permission to view and can span different resource types. + * You can also sort results based on a specified resource attribute. + * + * + * @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 searchResources( + SearchResourcesRequest request, + com.oracle.bmc.responses.AsyncHandler + handler); +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/ResourceSearchAsyncClient.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/ResourceSearchAsyncClient.java new file mode 100644 index 00000000000..68f5e33a656 --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/ResourceSearchAsyncClient.java @@ -0,0 +1,510 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch; + +import java.util.Locale; +import com.oracle.bmc.resourcesearch.internal.http.*; +import com.oracle.bmc.resourcesearch.requests.*; +import com.oracle.bmc.resourcesearch.responses.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.extern.slf4j.Slf4j +public class ResourceSearchAsyncClient implements ResourceSearchAsync { + /** + * Service instance for ResourceSearch. + */ + public static final com.oracle.bmc.Service SERVICE = + com.oracle.bmc.Services.create("RESOURCESEARCH", "query"); + + @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 ResourceSearchAsyncClient( + 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 ResourceSearchAsyncClient( + 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 ResourceSearchAsyncClient( + 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 ResourceSearchAsyncClient( + 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 ResourceSearchAsyncClient( + 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 ResourceSearchAsyncClient( + 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 ResourceSearchAsyncClient( + 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 (this.authenticationDetailsProvider instanceof com.oracle.bmc.auth.RegionProvider) { + com.oracle.bmc.auth.RegionProvider provider = + (com.oracle.bmc.auth.RegionProvider) this.authenticationDetailsProvider; + + if (provider.getRegion() != null) { + this.setRegion(provider.getRegion()); + if (endpoint != null) { + LOG.info( + "Authentication details provider configured for region '{}', but endpoint specifically set to '{}'. Using endpoint setting instead of region.", + provider.getRegion(), + endpoint); + } + } + } + if (endpoint != null) { + setEndpoint(endpoint); + } + } + + /** + * Create a builder for this client. + * @return builder + */ + public static Builder builder() { + return new Builder(SERVICE); + } + + /** + * Builder class for this client. The "authenticationDetailsProvider" is required and must be passed to the + * {@link #build(AbstractAuthenticationDetailsProvider)} or {@link #buildAsync(AbstractAuthenticationDetailsProvider)} method. + */ + public static class Builder + extends com.oracle.bmc.common.RegionalClientBuilder< + Builder, ResourceSearchAsyncClient> { + private Builder(com.oracle.bmc.Service service) { + super(service); + requestSignerFactory = + new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( + com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + } + + /** + * Build the client. + * @param authenticationDetailsProvider authentication details provider + * @return the client + */ + public ResourceSearchAsyncClient build( + @lombok.NonNull + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider + authenticationDetailsProvider) { + return new ResourceSearchAsyncClient( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + additionalClientConfigurators, + endpoint); + } + } + + @Override + public void setEndpoint(String endpoint) { + LOG.info("Setting endpoint to {}", endpoint); + client.setEndpoint(endpoint); + } + + @Override + public void setRegion(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + setEndpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + } + + @Override + public void setRegion(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + setRegion(region); + } catch (IllegalArgumentException e) { + LOG.info("Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + setEndpoint(endpoint); + } + } + + @Override + public void close() { + client.close(); + } + + @Override + public java.util.concurrent.Future getResourceType( + final GetResourceTypeRequest request, + final com.oracle.bmc.responses.AsyncHandler< + GetResourceTypeRequest, GetResourceTypeResponse> + handler) { + LOG.trace("Called async getResourceType"); + final GetResourceTypeRequest interceptedRequest = + GetResourceTypeConverter.interceptRequest(request); + final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + GetResourceTypeConverter.fromRequest(client, interceptedRequest); + final com.google.common.base.Function + transformer = GetResourceTypeConverter.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< + GetResourceTypeRequest, GetResourceTypeResponse>( + (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, GetResourceTypeResponse>( + 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 listResourceTypes( + final ListResourceTypesRequest request, + final com.oracle.bmc.responses.AsyncHandler< + ListResourceTypesRequest, ListResourceTypesResponse> + handler) { + LOG.trace("Called async listResourceTypes"); + final ListResourceTypesRequest interceptedRequest = + ListResourceTypesConverter.interceptRequest(request); + final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + ListResourceTypesConverter.fromRequest(client, interceptedRequest); + final com.google.common.base.Function + transformer = ListResourceTypesConverter.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< + ListResourceTypesRequest, ListResourceTypesResponse>( + (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, ListResourceTypesResponse>( + 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 searchResources( + final SearchResourcesRequest request, + final com.oracle.bmc.responses.AsyncHandler< + SearchResourcesRequest, SearchResourcesResponse> + handler) { + LOG.trace("Called async searchResources"); + final SearchResourcesRequest interceptedRequest = + SearchResourcesConverter.interceptRequest(request); + final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + SearchResourcesConverter.fromRequest(client, interceptedRequest); + final com.google.common.base.Function + transformer = SearchResourcesConverter.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< + SearchResourcesRequest, SearchResourcesResponse>( + (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.getSearchDetails(), + 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.getSearchDetails(), + 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, SearchResourcesResponse>( + 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.getSearchDetails(), + interceptedRequest, + onSuccess, + onError); + } + }); + } else { + return new com.oracle.bmc.util.internal.TransformingFuture<>( + responseFuture, transformer); + } + } +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/ResourceSearchClient.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/ResourceSearchClient.java new file mode 100644 index 00000000000..0f00486b4ef --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/ResourceSearchClient.java @@ -0,0 +1,378 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch; + +import java.util.Locale; +import com.oracle.bmc.resourcesearch.internal.http.*; +import com.oracle.bmc.resourcesearch.requests.*; +import com.oracle.bmc.resourcesearch.responses.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.extern.slf4j.Slf4j +public class ResourceSearchClient implements ResourceSearch { + /** + * Service instance for ResourceSearch. + */ + public static final com.oracle.bmc.Service SERVICE = + com.oracle.bmc.Services.create("RESOURCESEARCH", "query"); + // 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; + + @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 ResourceSearchClient( + 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 ResourceSearchClient( + 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 ResourceSearchClient( + 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 ResourceSearchClient( + 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 ResourceSearchClient( + 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 ResourceSearchClient( + 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 ResourceSearchClient( + 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 (this.authenticationDetailsProvider instanceof com.oracle.bmc.auth.RegionProvider) { + com.oracle.bmc.auth.RegionProvider provider = + (com.oracle.bmc.auth.RegionProvider) this.authenticationDetailsProvider; + + if (provider.getRegion() != null) { + this.setRegion(provider.getRegion()); + if (endpoint != null) { + LOG.info( + "Authentication details provider configured for region '{}', but endpoint specifically set to '{}'. Using endpoint setting instead of region.", + provider.getRegion(), + endpoint); + } + } + } + if (endpoint != null) { + setEndpoint(endpoint); + } + } + + /** + * Create a builder for this client. + * @return builder + */ + public static Builder builder() { + return new Builder(SERVICE); + } + + /** + * Builder class for this client. The "authenticationDetailsProvider" is required and must be passed to the + * {@link #build(AbstractAuthenticationDetailsProvider)} or {@link #buildAsync(AbstractAuthenticationDetailsProvider)} method. + */ + public static class Builder + extends com.oracle.bmc.common.RegionalClientBuilder { + private Builder(com.oracle.bmc.Service service) { + super(service); + requestSignerFactory = + new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( + com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + } + + /** + * Build the client. + * @param authenticationDetailsProvider authentication details provider + * @return the client + */ + public ResourceSearchClient build( + @lombok.NonNull + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider + authenticationDetailsProvider) { + return new ResourceSearchClient( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + signingStrategyRequestSignerFactories, + additionalClientConfigurators, + endpoint); + } + } + + @Override + public void setEndpoint(String endpoint) { + LOG.info("Setting endpoint to {}", endpoint); + client.setEndpoint(endpoint); + } + + @Override + public void setRegion(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + setEndpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + } + + @Override + public void setRegion(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + setRegion(region); + } catch (IllegalArgumentException e) { + LOG.info("Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + setEndpoint(endpoint); + } + } + + @Override + public void close() { + client.close(); + } + + @Override + public GetResourceTypeResponse getResourceType(GetResourceTypeRequest request) { + LOG.trace("Called getResourceType"); + request = GetResourceTypeConverter.interceptRequest(request); + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + GetResourceTypeConverter.fromRequest(client, request); + com.google.common.base.Function + transformer = GetResourceTypeConverter.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 ListResourceTypesResponse listResourceTypes(ListResourceTypesRequest request) { + LOG.trace("Called listResourceTypes"); + request = ListResourceTypesConverter.interceptRequest(request); + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + ListResourceTypesConverter.fromRequest(client, request); + com.google.common.base.Function + transformer = ListResourceTypesConverter.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 SearchResourcesResponse searchResources(SearchResourcesRequest request) { + LOG.trace("Called searchResources"); + request = SearchResourcesConverter.interceptRequest(request); + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + SearchResourcesConverter.fromRequest(client, request); + com.google.common.base.Function + transformer = SearchResourcesConverter.fromResponse(); + + int attempts = 0; + while (true) { + try { + javax.ws.rs.core.Response response = + client.post(ib, request.getSearchDetails(), 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 + instanceof com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) { + ((com.oracle.bmc.auth.RefreshableOnNotAuthenticatedProvider) + this.authenticationDetailsProvider) + .refresh(); + return true; + } + return false; + } +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/internal/http/GetResourceTypeConverter.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/internal/http/GetResourceTypeConverter.java new file mode 100644 index 00000000000..f69d2f39048 --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/internal/http/GetResourceTypeConverter.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch.internal.http; + +import com.oracle.bmc.resourcesearch.model.*; +import com.oracle.bmc.resourcesearch.requests.*; +import com.oracle.bmc.resourcesearch.responses.*; +import org.apache.commons.lang3.Validate; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.extern.slf4j.Slf4j +public class GetResourceTypeConverter { + private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory + RESPONSE_CONVERSION_FACTORY = + new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory(); + + public static GetResourceTypeRequest interceptRequest(GetResourceTypeRequest request) { + + return request; + } + + public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest( + com.oracle.bmc.http.internal.RestClient client, GetResourceTypeRequest request) { + Validate.notNull(request, "request instance is required"); + Validate.notBlank(request.getName(), "name must not be blank"); + + com.oracle.bmc.http.internal.WrappedWebTarget target = + client.getBaseTarget() + .path("/20180409") + .path("resourceTypes") + .path( + com.oracle.bmc.util.internal.HttpUtils.encodePathSegment( + request.getName())); + + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request(); + + ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON); + + if (request.getOpcRequestId() != null) { + ib.header("opc-request-id", request.getOpcRequestId()); + } + + return ib; + } + + public static com.google.common.base.Function< + javax.ws.rs.core.Response, GetResourceTypeResponse> + fromResponse() { + final com.google.common.base.Function + transformer = + new com.google.common.base.Function< + javax.ws.rs.core.Response, GetResourceTypeResponse>() { + @Override + public GetResourceTypeResponse apply( + javax.ws.rs.core.Response rawResponse) { + LOG.trace("Transform function invoked for GetResourceTypeResponse"); + com.google.common.base.Function< + javax.ws.rs.core.Response, + com.oracle.bmc.http.internal.WithHeaders< + ResourceType>> + responseFn = + RESPONSE_CONVERSION_FACTORY.create( + ResourceType.class); + + com.oracle.bmc.http.internal.WithHeaders response = + responseFn.apply(rawResponse); + javax.ws.rs.core.MultivaluedMap headers = + response.getHeaders(); + + GetResourceTypeResponse.Builder builder = + GetResourceTypeResponse.builder(); + + builder.resourceType(response.getItem()); + + 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)); + } + + GetResourceTypeResponse responseWrapper = builder.build(); + + return responseWrapper; + } + }; + return transformer; + } +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/internal/http/ListResourceTypesConverter.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/internal/http/ListResourceTypesConverter.java new file mode 100644 index 00000000000..d76c32b2193 --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/internal/http/ListResourceTypesConverter.java @@ -0,0 +1,120 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch.internal.http; + +import com.oracle.bmc.resourcesearch.model.*; +import com.oracle.bmc.resourcesearch.requests.*; +import com.oracle.bmc.resourcesearch.responses.*; +import org.apache.commons.lang3.Validate; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.extern.slf4j.Slf4j +public class ListResourceTypesConverter { + private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory + RESPONSE_CONVERSION_FACTORY = + new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory(); + + public static ListResourceTypesRequest interceptRequest(ListResourceTypesRequest request) { + + return request; + } + + public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest( + com.oracle.bmc.http.internal.RestClient client, ListResourceTypesRequest request) { + Validate.notNull(request, "request instance is required"); + + com.oracle.bmc.http.internal.WrappedWebTarget target = + client.getBaseTarget().path("/20180409").path("resourceTypes"); + + if (request.getLimit() != null) { + target = + target.queryParam( + "limit", + com.oracle.bmc.util.internal.HttpUtils.attemptEncodeQueryParam( + request.getLimit())); + } + + if (request.getPage() != null) { + target = + target.queryParam( + "page", + com.oracle.bmc.util.internal.HttpUtils.attemptEncodeQueryParam( + request.getPage())); + } + + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request(); + + ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON); + + if (request.getOpcRequestId() != null) { + ib.header("opc-request-id", request.getOpcRequestId()); + } + + return ib; + } + + public static com.google.common.base.Function< + javax.ws.rs.core.Response, ListResourceTypesResponse> + fromResponse() { + final com.google.common.base.Function + transformer = + new com.google.common.base.Function< + javax.ws.rs.core.Response, ListResourceTypesResponse>() { + @Override + public ListResourceTypesResponse apply( + javax.ws.rs.core.Response rawResponse) { + LOG.trace( + "Transform function invoked for ListResourceTypesResponse"); + com.google.common.base.Function< + javax.ws.rs.core.Response, + com.oracle.bmc.http.internal.WithHeaders< + java.util.List>> + responseFn = + RESPONSE_CONVERSION_FACTORY.create( + new javax.ws.rs.core.GenericType< + java.util.List>() {}); + + com.oracle.bmc.http.internal.WithHeaders< + java.util.List> + response = responseFn.apply(rawResponse); + javax.ws.rs.core.MultivaluedMap headers = + response.getHeaders(); + + ListResourceTypesResponse.Builder builder = + ListResourceTypesResponse.builder(); + + builder.items(response.getItem()); + + com.google.common.base.Optional> + opcNextPageHeader = + com.oracle.bmc.http.internal.HeaderUtils.get( + headers, "opc-next-page"); + if (opcNextPageHeader.isPresent()) { + builder.opcNextPage( + com.oracle.bmc.http.internal.HeaderUtils.toValue( + "opc-next-page", + opcNextPageHeader.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)); + } + + ListResourceTypesResponse responseWrapper = builder.build(); + + return responseWrapper; + } + }; + return transformer; + } +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/internal/http/SearchResourcesConverter.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/internal/http/SearchResourcesConverter.java new file mode 100644 index 00000000000..b67ce071d3c --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/internal/http/SearchResourcesConverter.java @@ -0,0 +1,118 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch.internal.http; + +import com.oracle.bmc.resourcesearch.model.*; +import com.oracle.bmc.resourcesearch.requests.*; +import com.oracle.bmc.resourcesearch.responses.*; +import org.apache.commons.lang3.Validate; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.extern.slf4j.Slf4j +public class SearchResourcesConverter { + private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory + RESPONSE_CONVERSION_FACTORY = + new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory(); + + public static SearchResourcesRequest interceptRequest(SearchResourcesRequest request) { + + return request; + } + + public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest( + com.oracle.bmc.http.internal.RestClient client, SearchResourcesRequest request) { + Validate.notNull(request, "request instance is required"); + Validate.notNull(request.getSearchDetails(), "searchDetails is required"); + + com.oracle.bmc.http.internal.WrappedWebTarget target = + client.getBaseTarget().path("/20180409").path("resources"); + + if (request.getLimit() != null) { + target = + target.queryParam( + "limit", + com.oracle.bmc.util.internal.HttpUtils.attemptEncodeQueryParam( + request.getLimit())); + } + + if (request.getPage() != null) { + target = + target.queryParam( + "page", + com.oracle.bmc.util.internal.HttpUtils.attemptEncodeQueryParam( + request.getPage())); + } + + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request(); + + ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON); + + if (request.getOpcRequestId() != null) { + ib.header("opc-request-id", request.getOpcRequestId()); + } + + return ib; + } + + public static com.google.common.base.Function< + javax.ws.rs.core.Response, SearchResourcesResponse> + fromResponse() { + final com.google.common.base.Function + transformer = + new com.google.common.base.Function< + javax.ws.rs.core.Response, SearchResourcesResponse>() { + @Override + public SearchResourcesResponse apply( + javax.ws.rs.core.Response rawResponse) { + LOG.trace("Transform function invoked for SearchResourcesResponse"); + com.google.common.base.Function< + javax.ws.rs.core.Response, + com.oracle.bmc.http.internal.WithHeaders< + ResourceSummaryCollection>> + responseFn = + RESPONSE_CONVERSION_FACTORY.create( + ResourceSummaryCollection.class); + + com.oracle.bmc.http.internal.WithHeaders + response = responseFn.apply(rawResponse); + javax.ws.rs.core.MultivaluedMap headers = + response.getHeaders(); + + SearchResourcesResponse.Builder builder = + SearchResourcesResponse.builder(); + + builder.resourceSummaryCollection(response.getItem()); + + com.google.common.base.Optional> + opcNextPageHeader = + com.oracle.bmc.http.internal.HeaderUtils.get( + headers, "opc-next-page"); + if (opcNextPageHeader.isPresent()) { + builder.opcNextPage( + com.oracle.bmc.http.internal.HeaderUtils.toValue( + "opc-next-page", + opcNextPageHeader.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)); + } + + SearchResourcesResponse responseWrapper = builder.build(); + + return responseWrapper; + } + }; + return transformer; + } +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/FreeTextSearchDetails.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/FreeTextSearchDetails.java new file mode 100644 index 00000000000..d772f350972 --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/FreeTextSearchDetails.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch.model; + +/** + * A request containing arbitrary text that must be present in the resource. + *
+ * Note: 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}). As a consequence, objects should always be created or deserialized using the {@link Builder}. + **/ +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.Value +@com.fasterxml.jackson.databind.annotation.JsonDeserialize( + builder = FreeTextSearchDetails.Builder.class +) +@lombok.ToString(callSuper = true) +@lombok.EqualsAndHashCode(callSuper = true) +@com.fasterxml.jackson.annotation.JsonTypeInfo( + use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, + include = com.fasterxml.jackson.annotation.JsonTypeInfo.As.PROPERTY, + property = "type" +) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class FreeTextSearchDetails extends SearchDetails { + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") + @lombok.experimental.Accessors(fluent = true) + public static class Builder { + @com.fasterxml.jackson.annotation.JsonProperty("matchingContextType") + private MatchingContextType matchingContextType; + + public Builder matchingContextType(MatchingContextType matchingContextType) { + this.matchingContextType = matchingContextType; + this.__explicitlySet__.add("matchingContextType"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("text") + private String text; + + public Builder text(String text) { + this.text = text; + this.__explicitlySet__.add("text"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); + + public FreeTextSearchDetails build() { + FreeTextSearchDetails __instance__ = + new FreeTextSearchDetails(matchingContextType, text); + __instance__.__explicitlySet__.addAll(__explicitlySet__); + return __instance__; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + public Builder copy(FreeTextSearchDetails o) { + Builder copiedBuilder = + matchingContextType(o.getMatchingContextType()).text(o.getText()); + + copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); + return copiedBuilder; + } + } + + /** + * Create a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + public FreeTextSearchDetails(MatchingContextType matchingContextType, String text) { + super(matchingContextType); + this.text = text; + } + + /** + * The text to search for. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("text") + String text; + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/QueryableFieldDescription.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/QueryableFieldDescription.java new file mode 100644 index 00000000000..2760ffc9338 --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/QueryableFieldDescription.java @@ -0,0 +1,177 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch.model; + +/** + * An individual field that can be used as part of a query filter. + *
+ * Note: 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}). As a consequence, objects should always be created or deserialized using the {@link Builder}. + **/ +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.Value +@com.fasterxml.jackson.databind.annotation.JsonDeserialize( + builder = QueryableFieldDescription.Builder.class +) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class QueryableFieldDescription { + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") + @lombok.experimental.Accessors(fluent = true) + public static class Builder { + @com.fasterxml.jackson.annotation.JsonProperty("fieldType") + private FieldType fieldType; + + public Builder fieldType(FieldType fieldType) { + this.fieldType = fieldType; + this.__explicitlySet__.add("fieldType"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("fieldName") + private String fieldName; + + public Builder fieldName(String fieldName) { + this.fieldName = fieldName; + this.__explicitlySet__.add("fieldName"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("isArray") + private Boolean isArray; + + public Builder isArray(Boolean isArray) { + this.isArray = isArray; + this.__explicitlySet__.add("isArray"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("objectProperties") + private java.util.List objectProperties; + + public Builder objectProperties( + java.util.List objectProperties) { + this.objectProperties = objectProperties; + this.__explicitlySet__.add("objectProperties"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); + + public QueryableFieldDescription build() { + QueryableFieldDescription __instance__ = + new QueryableFieldDescription(fieldType, fieldName, isArray, objectProperties); + __instance__.__explicitlySet__.addAll(__explicitlySet__); + return __instance__; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + public Builder copy(QueryableFieldDescription o) { + Builder copiedBuilder = + fieldType(o.getFieldType()) + .fieldName(o.getFieldName()) + .isArray(o.getIsArray()) + .objectProperties(o.getObjectProperties()); + + copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); + return copiedBuilder; + } + } + + /** + * Create a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * The type of the field, which dictates what semantics and query constraints you can use when searching or querying. + * + **/ + @lombok.extern.slf4j.Slf4j + public enum FieldType { + Identifier("IDENTIFIER"), + String("STRING"), + Integer("INTEGER"), + Rational("RATIONAL"), + Boolean("BOOLEAN"), + Datetime("DATETIME"), + Ip("IP"), + Object("OBJECT"), + + /** + * This value is used if a service returns a value for this enum that is not recognized by this + * version of the SDK. + */ + UnknownEnumValue(null); + + private final String value; + private static java.util.Map map; + + static { + map = new java.util.HashMap<>(); + for (FieldType v : FieldType.values()) { + if (v != UnknownEnumValue) { + map.put(v.getValue(), v); + } + } + } + + FieldType(String value) { + this.value = value; + } + + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { + return value; + } + + @com.fasterxml.jackson.annotation.JsonCreator + public static FieldType create(String key) { + if (map.containsKey(key)) { + return map.get(key); + } + LOG.warn( + "Received unknown value '{}' for enum 'FieldType', returning UnknownEnumValue", + key); + return UnknownEnumValue; + } + }; + /** + * The type of the field, which dictates what semantics and query constraints you can use when searching or querying. + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("fieldType") + FieldType fieldType; + + /** + * The name of the field to use when constructing the query. Field names are present for all types except `OBJECT`. + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("fieldName") + String fieldName; + + /** + * Indicates this field is actually an array of the specified field type. + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("isArray") + Boolean isArray; + + /** + * If the field type is `OBJECT`, then this property will provide all the individual properties on the object that can + * be queried. + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("objectProperties") + java.util.List objectProperties; + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/ResourceSummary.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/ResourceSummary.java new file mode 100644 index 00000000000..398cb63023a --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/ResourceSummary.java @@ -0,0 +1,223 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch.model; + +/** + * A resource that exists in the user's cloud network. + *
+ * Note: 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}). As a consequence, objects should always be created or deserialized using the {@link Builder}. + **/ +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.Value +@com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = ResourceSummary.Builder.class) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class ResourceSummary { + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") + @lombok.experimental.Accessors(fluent = true) + public static class Builder { + @com.fasterxml.jackson.annotation.JsonProperty("resourceType") + private String resourceType; + + public Builder resourceType(String resourceType) { + this.resourceType = resourceType; + this.__explicitlySet__.add("resourceType"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("identifier") + private String identifier; + + public Builder identifier(String identifier) { + this.identifier = identifier; + this.__explicitlySet__.add("identifier"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("compartmentId") + private String compartmentId; + + public Builder compartmentId(String compartmentId) { + this.compartmentId = compartmentId; + this.__explicitlySet__.add("compartmentId"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("timeCreated") + private java.util.Date timeCreated; + + public Builder timeCreated(java.util.Date timeCreated) { + this.timeCreated = timeCreated; + this.__explicitlySet__.add("timeCreated"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("displayName") + private String displayName; + + public Builder displayName(String displayName) { + this.displayName = displayName; + this.__explicitlySet__.add("displayName"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("availabilityDomain") + private String availabilityDomain; + + public Builder availabilityDomain(String availabilityDomain) { + this.availabilityDomain = availabilityDomain; + this.__explicitlySet__.add("availabilityDomain"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("lifecycleState") + private String lifecycleState; + + public Builder lifecycleState(String lifecycleState) { + this.lifecycleState = lifecycleState; + this.__explicitlySet__.add("lifecycleState"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("freeformTags") + private java.util.Map freeformTags; + + public Builder freeformTags(java.util.Map freeformTags) { + this.freeformTags = freeformTags; + this.__explicitlySet__.add("freeformTags"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("definedTags") + private java.util.Map> definedTags; + + public Builder definedTags( + java.util.Map> definedTags) { + this.definedTags = definedTags; + this.__explicitlySet__.add("definedTags"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("searchContext") + private SearchContext searchContext; + + public Builder searchContext(SearchContext searchContext) { + this.searchContext = searchContext; + this.__explicitlySet__.add("searchContext"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); + + public ResourceSummary build() { + ResourceSummary __instance__ = + new ResourceSummary( + resourceType, + identifier, + compartmentId, + timeCreated, + displayName, + availabilityDomain, + lifecycleState, + freeformTags, + definedTags, + searchContext); + __instance__.__explicitlySet__.addAll(__explicitlySet__); + return __instance__; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + public Builder copy(ResourceSummary o) { + Builder copiedBuilder = + resourceType(o.getResourceType()) + .identifier(o.getIdentifier()) + .compartmentId(o.getCompartmentId()) + .timeCreated(o.getTimeCreated()) + .displayName(o.getDisplayName()) + .availabilityDomain(o.getAvailabilityDomain()) + .lifecycleState(o.getLifecycleState()) + .freeformTags(o.getFreeformTags()) + .definedTags(o.getDefinedTags()) + .searchContext(o.getSearchContext()); + + copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); + return copiedBuilder; + } + } + + /** + * Create a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * The resource type name. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("resourceType") + String resourceType; + + /** + * The unique identifier for this particular resource, usually an OCID. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("identifier") + String identifier; + + /** + * The OCID of the compartment that contains this resource. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("compartmentId") + String compartmentId; + + /** + * The time this resource was created. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("timeCreated") + java.util.Date timeCreated; + + /** + * The display name (or name) of this resource, if one exists. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("displayName") + String displayName; + + /** + * The availability domain this resource is located in, if applicable. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("availabilityDomain") + String availabilityDomain; + + /** + * The lifecycle state of this resource, if applicable. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("lifecycleState") + String lifecycleState; + + /** + * The freeform tags associated with this resource, if any. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("freeformTags") + java.util.Map freeformTags; + + /** + * The defined tags associated with this resource, if any. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("definedTags") + java.util.Map> definedTags; + + /** + * Contains search context, such as highlighting, for found resources. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("searchContext") + SearchContext searchContext; + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/ResourceSummaryCollection.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/ResourceSummaryCollection.java new file mode 100644 index 00000000000..5740b49ef12 --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/ResourceSummaryCollection.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch.model; + +/** + * Summary representation of resources that matched the search criteria. + *
+ * Note: 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}). As a consequence, objects should always be created or deserialized using the {@link Builder}. + **/ +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.Value +@com.fasterxml.jackson.databind.annotation.JsonDeserialize( + builder = ResourceSummaryCollection.Builder.class +) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class ResourceSummaryCollection { + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") + @lombok.experimental.Accessors(fluent = true) + public static class Builder { + @com.fasterxml.jackson.annotation.JsonProperty("items") + private java.util.List items; + + public Builder items(java.util.List items) { + this.items = items; + this.__explicitlySet__.add("items"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); + + public ResourceSummaryCollection build() { + ResourceSummaryCollection __instance__ = new ResourceSummaryCollection(items); + __instance__.__explicitlySet__.addAll(__explicitlySet__); + return __instance__; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + public Builder copy(ResourceSummaryCollection o) { + Builder copiedBuilder = items(o.getItems()); + + copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); + return copiedBuilder; + } + } + + /** + * Create a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * A list of resources. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("items") + java.util.List items; + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/ResourceType.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/ResourceType.java new file mode 100644 index 00000000000..a643315801a --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/ResourceType.java @@ -0,0 +1,83 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch.model; + +/** + * Defines a type of resource that you can find with a search or query. + *
+ * Note: 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}). As a consequence, objects should always be created or deserialized using the {@link Builder}. + **/ +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.Value +@com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = ResourceType.Builder.class) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class ResourceType { + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") + @lombok.experimental.Accessors(fluent = true) + public static class Builder { + @com.fasterxml.jackson.annotation.JsonProperty("name") + private String name; + + public Builder name(String name) { + this.name = name; + this.__explicitlySet__.add("name"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("fields") + private java.util.List fields; + + public Builder fields(java.util.List fields) { + this.fields = fields; + this.__explicitlySet__.add("fields"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); + + public ResourceType build() { + ResourceType __instance__ = new ResourceType(name, fields); + __instance__.__explicitlySet__.addAll(__explicitlySet__); + return __instance__; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + public Builder copy(ResourceType o) { + Builder copiedBuilder = name(o.getName()).fields(o.getFields()); + + copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); + return copiedBuilder; + } + } + + /** + * Create a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * The unique name of the resource type, which matches the value returned as part of the ResourceSummary object. + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("name") + String name; + + /** + * List of all the fields and their value type that are indexed for querying. + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("fields") + java.util.List fields; + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/SearchContext.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/SearchContext.java new file mode 100644 index 00000000000..1fb3fe5a3c3 --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/SearchContext.java @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch.model; + +/** + * Contains search context, such as highlighting, for found resources. + *
+ * Note: 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}). As a consequence, objects should always be created or deserialized using the {@link Builder}. + **/ +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.Value +@com.fasterxml.jackson.databind.annotation.JsonDeserialize(builder = SearchContext.Builder.class) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class SearchContext { + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") + @lombok.experimental.Accessors(fluent = true) + public static class Builder { + @com.fasterxml.jackson.annotation.JsonProperty("highlights") + private java.util.Map> highlights; + + public Builder highlights(java.util.Map> highlights) { + this.highlights = highlights; + this.__explicitlySet__.add("highlights"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); + + public SearchContext build() { + SearchContext __instance__ = new SearchContext(highlights); + __instance__.__explicitlySet__.addAll(__explicitlySet__); + return __instance__; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + public Builder copy(SearchContext o) { + Builder copiedBuilder = highlights(o.getHighlights()); + + copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); + return copiedBuilder; + } + } + + /** + * Create a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Describes what in each field matched the search criteria by showing highlighted values, but only for free text searches or for structured + * queries that use a MATCHING clause. The list of strings represents fragments of values that matched the query conditions. Highlighted + * values are wrapped with .. tags. All values are HTML-encoded (except tags). + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("highlights") + java.util.Map> highlights; + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/SearchDetails.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/SearchDetails.java new file mode 100644 index 00000000000..8c560f7d5b1 --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/SearchDetails.java @@ -0,0 +1,81 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch.model; + +/** + * A base request type containing common criteria for searching for resources. + *
+ * Note: 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}). As a consequence, objects should always be created or deserialized using the {@link Builder}. + **/ +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.Value +@lombok.experimental.NonFinal +@lombok.AllArgsConstructor(access = lombok.AccessLevel.PROTECTED) +@com.fasterxml.jackson.annotation.JsonTypeInfo( + use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, + include = com.fasterxml.jackson.annotation.JsonTypeInfo.As.PROPERTY, + property = "type", + defaultImpl = SearchDetails.class +) +@com.fasterxml.jackson.annotation.JsonSubTypes({ + @com.fasterxml.jackson.annotation.JsonSubTypes.Type( + value = StructuredSearchDetails.class, + name = "Structured" + ), + @com.fasterxml.jackson.annotation.JsonSubTypes.Type( + value = FreeTextSearchDetails.class, + name = "FreeText" + ) +}) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class SearchDetails { + + /** + * The type of matching context returned in the response. If you specify `HIGHLIGHTS`, then the service will highlight fragments in its response. (See ResourceSummary.searchContext and SearchContext for more information.) The default setting is `NONE`. + * + **/ + public enum MatchingContextType { + None("NONE"), + Highlights("HIGHLIGHTS"), + ; + + private final String value; + private static java.util.Map map; + + static { + map = new java.util.HashMap<>(); + for (MatchingContextType v : MatchingContextType.values()) { + map.put(v.getValue(), v); + } + } + + MatchingContextType(String value) { + this.value = value; + } + + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { + return value; + } + + @com.fasterxml.jackson.annotation.JsonCreator + public static MatchingContextType create(String key) { + if (map.containsKey(key)) { + return map.get(key); + } + throw new RuntimeException("Invalid MatchingContextType: " + key); + } + }; + /** + * The type of matching context returned in the response. If you specify `HIGHLIGHTS`, then the service will highlight fragments in its response. (See ResourceSummary.searchContext and SearchContext for more information.) The default setting is `NONE`. + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("matchingContextType") + MatchingContextType matchingContextType; +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/StructuredSearchDetails.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/StructuredSearchDetails.java new file mode 100644 index 00000000000..293147731a6 --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/model/StructuredSearchDetails.java @@ -0,0 +1,91 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch.model; + +/** + * A request containing search filters using the structured search query language. + *
+ * Note: 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}). As a consequence, objects should always be created or deserialized using the {@link Builder}. + **/ +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.Value +@com.fasterxml.jackson.databind.annotation.JsonDeserialize( + builder = StructuredSearchDetails.Builder.class +) +@lombok.ToString(callSuper = true) +@lombok.EqualsAndHashCode(callSuper = true) +@com.fasterxml.jackson.annotation.JsonTypeInfo( + use = com.fasterxml.jackson.annotation.JsonTypeInfo.Id.NAME, + include = com.fasterxml.jackson.annotation.JsonTypeInfo.As.PROPERTY, + property = "type" +) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class StructuredSearchDetails extends SearchDetails { + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") + @lombok.experimental.Accessors(fluent = true) + public static class Builder { + @com.fasterxml.jackson.annotation.JsonProperty("matchingContextType") + private MatchingContextType matchingContextType; + + public Builder matchingContextType(MatchingContextType matchingContextType) { + this.matchingContextType = matchingContextType; + this.__explicitlySet__.add("matchingContextType"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("query") + private String query; + + public Builder query(String query) { + this.query = query; + this.__explicitlySet__.add("query"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); + + public StructuredSearchDetails build() { + StructuredSearchDetails __instance__ = + new StructuredSearchDetails(matchingContextType, query); + __instance__.__explicitlySet__.addAll(__explicitlySet__); + return __instance__; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + public Builder copy(StructuredSearchDetails o) { + Builder copiedBuilder = + matchingContextType(o.getMatchingContextType()).query(o.getQuery()); + + copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); + return copiedBuilder; + } + } + + /** + * Create a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + public StructuredSearchDetails(MatchingContextType matchingContextType, String query) { + super(matchingContextType); + this.query = query; + } + + /** + * The structured query describing which resources to search for. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("query") + String query; + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/requests/GetResourceTypeRequest.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/requests/GetResourceTypeRequest.java new file mode 100644 index 00000000000..517ea2a70f7 --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/requests/GetResourceTypeRequest.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch.requests; + +import com.oracle.bmc.resourcesearch.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback") +@lombok.Getter +public class GetResourceTypeRequest extends com.oracle.bmc.requests.BmcRequest { + + /** + * The name of the resource type. + */ + private String name; + + /** + * The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + * request, please provide the complete request ID. + * + */ + private String opcRequestId; + + 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(GetResourceTypeRequest o) { + name(o.getName()); + opcRequestId(o.getOpcRequestId()); + invocationCallback(o.getInvocationCallback()); + return this; + } + + /** + * Build the instance of GetResourceTypeRequest 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 GetResourceTypeRequest + */ + public GetResourceTypeRequest build() { + GetResourceTypeRequest request = buildWithoutInvocationCallback(); + request.setInvocationCallback(invocationCallback); + return request; + } + } +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/requests/ListResourceTypesRequest.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/requests/ListResourceTypesRequest.java new file mode 100644 index 00000000000..22aec22b5f6 --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/requests/ListResourceTypesRequest.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch.requests; + +import com.oracle.bmc.resourcesearch.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback") +@lombok.Getter +public class ListResourceTypesRequest extends com.oracle.bmc.requests.BmcRequest { + + /** + * The maximum number of items to return. The value must be between 1 and 1000. + */ + private Integer limit; + + /** + * The page at which to start retrieving results. + */ + private String page; + + /** + * The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + * request, please provide the complete request ID. + * + */ + private String opcRequestId; + + 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(ListResourceTypesRequest o) { + limit(o.getLimit()); + page(o.getPage()); + opcRequestId(o.getOpcRequestId()); + invocationCallback(o.getInvocationCallback()); + return this; + } + + /** + * Build the instance of ListResourceTypesRequest 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 ListResourceTypesRequest + */ + public ListResourceTypesRequest build() { + ListResourceTypesRequest request = buildWithoutInvocationCallback(); + request.setInvocationCallback(invocationCallback); + return request; + } + } +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/requests/SearchResourcesRequest.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/requests/SearchResourcesRequest.java new file mode 100644 index 00000000000..c8c975cd9de --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/requests/SearchResourcesRequest.java @@ -0,0 +1,80 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch.requests; + +import com.oracle.bmc.resourcesearch.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback") +@lombok.Getter +public class SearchResourcesRequest extends com.oracle.bmc.requests.BmcRequest { + + /** + * Request parameters that describe query criteria. + */ + private SearchDetails searchDetails; + + /** + * The maximum number of items to return. The value must be between 1 and 1000. + */ + private Integer limit; + + /** + * The page at which to start retrieving results. + */ + private String page; + + /** + * The unique Oracle-assigned identifier for the request. If you need to contact Oracle about a particular + * request, please provide the complete request ID. + * + */ + private String opcRequestId; + + 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(SearchResourcesRequest o) { + searchDetails(o.getSearchDetails()); + limit(o.getLimit()); + page(o.getPage()); + opcRequestId(o.getOpcRequestId()); + invocationCallback(o.getInvocationCallback()); + return this; + } + + /** + * Build the instance of SearchResourcesRequest 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 SearchResourcesRequest + */ + public SearchResourcesRequest build() { + SearchResourcesRequest request = buildWithoutInvocationCallback(); + request.setInvocationCallback(invocationCallback); + return request; + } + } +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/responses/GetResourceTypeResponse.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/responses/GetResourceTypeResponse.java new file mode 100644 index 00000000000..0c4aaaf26f5 --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/responses/GetResourceTypeResponse.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch.responses; + +import com.oracle.bmc.resourcesearch.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.Builder(builderClassName = "Builder") +@lombok.Getter +public class GetResourceTypeResponse { + + /** + * 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 ResourceType instance. + */ + private ResourceType resourceType; + + public static class Builder { + /** + * Copy method to populate the builder with values from the given instance. + * @return this builder instance + */ + public Builder copy(GetResourceTypeResponse o) { + opcRequestId(o.getOpcRequestId()); + resourceType(o.getResourceType()); + + return this; + } + } +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/responses/ListResourceTypesResponse.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/responses/ListResourceTypesResponse.java new file mode 100644 index 00000000000..22af518d0f1 --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/responses/ListResourceTypesResponse.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch.responses; + +import com.oracle.bmc.resourcesearch.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.Builder(builderClassName = "Builder") +@lombok.Getter +public class ListResourceTypesResponse { + + /** + * Pagination token + */ + private String opcNextPage; + + /** + * 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; + + /** + * A list of ResourceType instances. + */ + private java.util.List items; + + public static class Builder { + /** + * Copy method to populate the builder with values from the given instance. + * @return this builder instance + */ + public Builder copy(ListResourceTypesResponse o) { + opcNextPage(o.getOpcNextPage()); + opcRequestId(o.getOpcRequestId()); + items(o.getItems()); + + return this; + } + } +} diff --git a/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/responses/SearchResourcesResponse.java b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/responses/SearchResourcesResponse.java new file mode 100644 index 00000000000..354b37ee265 --- /dev/null +++ b/bmc-resourcesearch/src/main/java/com/oracle/bmc/resourcesearch/responses/SearchResourcesResponse.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.resourcesearch.responses; + +import com.oracle.bmc.resourcesearch.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 0.0.4") +@lombok.Builder(builderClassName = "Builder") +@lombok.Getter +public class SearchResourcesResponse { + + /** + * Pagination token + */ + private String opcNextPage; + + /** + * 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 ResourceSummaryCollection instance. + */ + private ResourceSummaryCollection resourceSummaryCollection; + + public static class Builder { + /** + * Copy method to populate the builder with values from the given instance. + * @return this builder instance + */ + public Builder copy(SearchResourcesResponse o) { + opcNextPage(o.getOpcNextPage()); + opcRequestId(o.getOpcRequestId()); + resourceSummaryCollection(o.getResourceSummaryCollection()); + + return this; + } + } +} diff --git a/bmc-shaded/bmc-shaded-full/pom.xml b/bmc-shaded/bmc-shaded-full/pom.xml index d24b1c7ee3e..4b2c7ca525c 100644 --- a/bmc-shaded/bmc-shaded-full/pom.xml +++ b/bmc-shaded/bmc-shaded-full/pom.xml @@ -4,7 +4,7 @@ com.oracle.oci.sdk oci-java-sdk-shaded - 1.2.42 + 1.2.43 ../pom.xml oci-java-sdk-shaded-full diff --git a/bmc-shaded/pom.xml b/bmc-shaded/pom.xml index 0bfbd427ced..2fc83a20fc4 100644 --- a/bmc-shaded/pom.xml +++ b/bmc-shaded/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.42 + 1.2.43 ../pom.xml diff --git a/pom.xml b/pom.xml index 3f75beb005b..425ac72820d 100644 --- a/pom.xml +++ b/pom.xml @@ -1,9 +1,9 @@ - + 4.0.0 com.oracle.oci.sdk oci-java-sdk - 1.2.42 + 1.2.43 pom Oracle Cloud Infrastructure SDK This project contains the SDK used for Oracle Cloud Infrastructure @@ -36,8 +36,9 @@ 1.10 3.4 2.5 + 3.1.1 - 1.52 @@ -125,7 +126,7 @@ process-sources - + false @@ -512,7 +513,8 @@ bmc-objectstorage/bmc-objectstorage-extensions bmc-objectstorage bmc-containerengine + bmc-resourcesearch bmc-full bmc-shaded - + \ No newline at end of file