diff --git a/CHANGELOG.md b/CHANGELOG.md index df14cb9d064..ac3f9b18f38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). ### Added - N/A +## 1.2.33 - 2018-03-27 + +### Added +- Added support for remote VCN peering across regions. See [here](https://github.com/oracle/oci-java-sdk/blob/master/bmc-examples/src/main/java/RemotePeeringConnectionExample.java) for a sample +- Added support for calling Oracle Cloud Infrastructure services in the uk-london-1 (LHR) region +- Added a version of the Java SDK library that bundles several of its dependencies in shaded form + ## 1.2.29 - 2018-03-08 ### Added diff --git a/bmc-audit/pom.xml b/bmc-audit/pom.xml index febafb2c0cf..0086b17367a 100644 --- a/bmc-audit/pom.xml +++ b/bmc-audit/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.29 + 1.2.33 ../pom.xml @@ -18,7 +18,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.29 + 1.2.33 diff --git a/bmc-audit/src/main/java/com/oracle/bmc/audit/AuditAsyncClient.java b/bmc-audit/src/main/java/com/oracle/bmc/audit/AuditAsyncClient.java index a55a23e4705..406d08f9204 100644 --- a/bmc-audit/src/main/java/com/oracle/bmc/audit/AuditAsyncClient.java +++ b/bmc-audit/src/main/java/com/oracle/bmc/audit/AuditAsyncClient.java @@ -102,6 +102,34 @@ public AuditAsyncClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 AuditAsyncClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -119,8 +147,17 @@ public AuditAsyncClient( 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); + } } /** @@ -143,6 +180,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -207,6 +245,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Build the client, with the authentication details provider. * @param authenticationDetailsProvider authentication details provider @@ -221,7 +304,8 @@ public AuditAsyncClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-audit/src/main/java/com/oracle/bmc/audit/AuditClient.java b/bmc-audit/src/main/java/com/oracle/bmc/audit/AuditClient.java index dac4bf8f208..8b3b1331baa 100644 --- a/bmc-audit/src/main/java/com/oracle/bmc/audit/AuditClient.java +++ b/bmc-audit/src/main/java/com/oracle/bmc/audit/AuditClient.java @@ -106,6 +106,34 @@ public AuditClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 AuditClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -125,8 +153,17 @@ public AuditClient( 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); + } } /** @@ -149,6 +186,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -213,6 +251,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Set the authentication details provider. Once this is called, the builder can build the client. * @param authenticationDetailsProvider authentication details provider @@ -227,7 +310,8 @@ public AuditClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-bom/pom.xml b/bmc-bom/pom.xml index 2944692a3df..4e4fb28856d 100644 --- a/bmc-bom/pom.xml +++ b/bmc-bom/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.29 + 1.2.33 ../pom.xml oci-java-sdk-bom @@ -19,62 +19,62 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.29 + 1.2.33 false com.oracle.oci.sdk oci-java-sdk-audit - 1.2.29 + 1.2.33 false com.oracle.oci.sdk oci-java-sdk-core - 1.2.29 + 1.2.33 false com.oracle.oci.sdk oci-java-sdk-database - 1.2.29 + 1.2.33 false com.oracle.oci.sdk oci-java-sdk-dns - 1.2.29 + 1.2.33 false com.oracle.oci.sdk oci-java-sdk-email - 1.2.29 + 1.2.33 false com.oracle.oci.sdk oci-java-sdk-filestorage - 1.2.29 + 1.2.33 false com.oracle.oci.sdk oci-java-sdk-identity - 1.2.29 + 1.2.33 false com.oracle.oci.sdk oci-java-sdk-loadbalancer - 1.2.29 + 1.2.33 false com.oracle.oci.sdk oci-java-sdk-objectstorage - 1.2.29 + 1.2.33 false diff --git a/bmc-common/pom.xml b/bmc-common/pom.xml index 16810db57eb..eb57dcab8f9 100644 --- a/bmc-common/pom.xml +++ b/bmc-common/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.29 + 1.2.33 ../pom.xml @@ -84,11 +84,6 @@ nimbus-jose-jwt 4.9 - - com.nimbusds - nimbus-jose-jwt - 4.9 - diff --git a/bmc-common/src/main/java/com/oracle/bmc/Region.java b/bmc-common/src/main/java/com/oracle/bmc/Region.java index 5d69e6a726f..668b36d0a3c 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/Region.java +++ b/bmc-common/src/main/java/com/oracle/bmc/Region.java @@ -24,7 +24,8 @@ public enum Region { US_PHOENIX_1("us-phoenix-1", "phx"), US_ASHBURN_1("us-ashburn-1", "iad"), - EU_FRANKFURT_1("eu-frankfurt-1", "fra"); + EU_FRANKFURT_1("eu-frankfurt-1", "fra"), + UK_LONDON_1("uk-london-1", "lhr"); private static final Map> SERVICE_TO_REGION_ENDPOINTS = new HashMap<>(); @@ -133,4 +134,22 @@ public static Region fromRegionCode(String regionCode) { } throw new IllegalArgumentException("Unknown regionId: " + regionCode); } + + /** + * Returns the region enum from the public region code or id. Throws + * IllegalArgumentException if the region code or id is not known. + * + * @param regionCodeOrId + * The region code or id. + * @return The enum value. + */ + public static Region fromRegionCodeOrId(String regionCodeOrId) { + for (Region region : Region.values()) { + if (region.regionCode.compareToIgnoreCase(regionCodeOrId) == 0 + || region.regionId.compareToIgnoreCase(regionCodeOrId) == 0) { + return region; + } + } + throw new IllegalArgumentException("Unknown region: " + regionCodeOrId); + } } diff --git a/bmc-common/src/main/java/com/oracle/bmc/auth/InstancePrincipalsAuthenticationDetailsProvider.java b/bmc-common/src/main/java/com/oracle/bmc/auth/InstancePrincipalsAuthenticationDetailsProvider.java index 6514ce375de..45de7fd60b9 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/auth/InstancePrincipalsAuthenticationDetailsProvider.java +++ b/bmc-common/src/main/java/com/oracle/bmc/auth/InstancePrincipalsAuthenticationDetailsProvider.java @@ -113,7 +113,7 @@ public InstancePrincipalsAuthenticationDetailsProvider build() { String regionStr = base.path("region").request(MediaType.TEXT_PLAIN).get(String.class); - region = Region.fromRegionCode(regionStr); + region = Region.fromRegionCodeOrId(regionStr); Optional endpoint = region.getEndpoint(SERVICE); diff --git a/bmc-common/src/main/java/com/oracle/bmc/http/internal/EntityFactory.java b/bmc-common/src/main/java/com/oracle/bmc/http/internal/EntityFactory.java index 8007d14cc8d..1d7d4e39d27 100644 --- a/bmc-common/src/main/java/com/oracle/bmc/http/internal/EntityFactory.java +++ b/bmc-common/src/main/java/com/oracle/bmc/http/internal/EntityFactory.java @@ -47,8 +47,23 @@ Entity forPost(Object request, Object body) { if (body == null) { return null; } - // POST only supports JSON bodies - return Entity.json(getBodyAsString(body)); + + Entity requestBody = null; + // only json payloads or raw input streams allowed. + // in the latter case, allow caller to be able to specify content-type + // by inspecting the request for common 'getContent*' methods. + // NOTE: this is necessary because using an Entity to put data will overwrite + // any content-* headers already set on the Invocation.Builder request, and there + // doesn't seem to be a way to set the entity content (payload) without attempting + // to overwrite/set the content-* headers. + // You also cannot set the variant to null (to try to preserve any existing headers) + // as that will remove them altogether or set them explicitly to null. + if (body instanceof InputStream) { + requestBody = Entity.entity(body, InputStreamVariantCreator.create(request)); + } else { + requestBody = Entity.json(body); + } + return requestBody; } /** diff --git a/bmc-common/src/test/java/com/oracle/bmc/RegionTest.java b/bmc-common/src/test/java/com/oracle/bmc/RegionTest.java new file mode 100644 index 00000000000..f7bed711103 --- /dev/null +++ b/bmc-common/src/test/java/com/oracle/bmc/RegionTest.java @@ -0,0 +1,34 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc; + +import org.junit.Test; + +import static junit.framework.TestCase.assertEquals; +import static junit.framework.TestCase.assertNotNull; +import static junit.framework.TestCase.assertTrue; +import static junit.framework.TestCase.fail; + +public class RegionTest { + @Test + public void validRegion() { + assertEquals(Region.US_PHOENIX_1, Region.fromRegionCodeOrId("phx")); + + assertEquals(Region.US_ASHBURN_1, Region.fromRegionCodeOrId("iad")); + assertEquals(Region.EU_FRANKFURT_1, Region.fromRegionCodeOrId("fra")); + assertEquals(Region.EU_FRANKFURT_1, Region.fromRegionCodeOrId("eu-frankfurt-1")); + assertEquals(Region.UK_LONDON_1, Region.fromRegionCodeOrId("lhr")); + assertEquals(Region.UK_LONDON_1, Region.fromRegionCodeOrId("uk-london-1")); + } + + @Test + public void invalidRegion() { + try { + assertNotNull(Region.fromRegionCodeOrId(("foo"))); + fail("should have thrown"); + } catch (IllegalArgumentException e) { + assertTrue(e.getMessage().contains("foo")); + } + } +} diff --git a/bmc-core/pom.xml b/bmc-core/pom.xml index 88562af7f7f..859758f1ac4 100644 --- a/bmc-core/pom.xml +++ b/bmc-core/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.29 + 1.2.33 ../pom.xml @@ -18,7 +18,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.29 + 1.2.33 diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageAsyncClient.java b/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageAsyncClient.java index 77e1a8cbb26..3777e996422 100644 --- a/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageAsyncClient.java +++ b/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageAsyncClient.java @@ -102,6 +102,34 @@ public BlockstorageAsyncClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 BlockstorageAsyncClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -119,8 +147,17 @@ public BlockstorageAsyncClient( 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); + } } /** @@ -143,6 +180,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -207,6 +245,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Build the client, with the authentication details provider. * @param authenticationDetailsProvider authentication details provider @@ -221,7 +304,8 @@ public BlockstorageAsyncClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageClient.java b/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageClient.java index cdd219f8f6d..4261475d149 100644 --- a/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageClient.java +++ b/bmc-core/src/main/java/com/oracle/bmc/core/BlockstorageClient.java @@ -107,6 +107,34 @@ public BlockstorageClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 BlockstorageClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -141,8 +169,17 @@ public BlockstorageClient( 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); + } } /** @@ -165,6 +202,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -229,6 +267,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Set the authentication details provider. Once this is called, the builder can build the client. * @param authenticationDetailsProvider authentication details provider @@ -243,7 +326,8 @@ public BlockstorageClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/ComputeAsyncClient.java b/bmc-core/src/main/java/com/oracle/bmc/core/ComputeAsyncClient.java index f67f0919946..10dac211f25 100644 --- a/bmc-core/src/main/java/com/oracle/bmc/core/ComputeAsyncClient.java +++ b/bmc-core/src/main/java/com/oracle/bmc/core/ComputeAsyncClient.java @@ -102,6 +102,34 @@ public ComputeAsyncClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 ComputeAsyncClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -119,8 +147,17 @@ public ComputeAsyncClient( 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); + } } /** @@ -143,6 +180,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -207,6 +245,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Build the client, with the authentication details provider. * @param authenticationDetailsProvider authentication details provider @@ -221,7 +304,8 @@ public ComputeAsyncClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/ComputeClient.java b/bmc-core/src/main/java/com/oracle/bmc/core/ComputeClient.java index 1d952234772..db0a7ac218b 100644 --- a/bmc-core/src/main/java/com/oracle/bmc/core/ComputeClient.java +++ b/bmc-core/src/main/java/com/oracle/bmc/core/ComputeClient.java @@ -107,6 +107,34 @@ public ComputeClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 ComputeClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -141,8 +169,17 @@ public ComputeClient( 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); + } } /** @@ -165,6 +202,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -229,6 +267,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Set the authentication details provider. Once this is called, the builder can build the client. * @param authenticationDetailsProvider authentication details provider @@ -243,7 +326,8 @@ public ComputeClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetwork.java b/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetwork.java index e53f1b57aaf..b2b7e708fd7 100644 --- a/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetwork.java +++ b/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetwork.java @@ -79,6 +79,23 @@ BulkDeleteVirtualCircuitPublicPrefixesResponse bulkDeleteVirtualCircuitPublicPre ConnectLocalPeeringGatewaysResponse connectLocalPeeringGateways( ConnectLocalPeeringGatewaysRequest request); + /** + * Connects this RPC to another one in a different region. + *

+ * This operation must be called by the VCN administrator who is designated as + * the *requestor* in the peering relationship. The *acceptor* must implement + * an Identity and Access Management (IAM) policy that gives the requestor permission + * to connect to RPCs in the acceptor's compartment. Without that permission, this + * operation will fail. For more information, see + * [VCN Peering](https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/VCNpeering.htm). + * + * @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. + */ + ConnectRemotePeeringConnectionsResponse connectRemotePeeringConnections( + ConnectRemotePeeringConnectionsRequest request); + /** * Creates a new virtual Customer-Premises Equipment (CPE) object in the specified compartment. For * more information, see [IPSec VPNs](https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingIPsec.htm). @@ -323,6 +340,16 @@ CreateLocalPeeringGatewayResponse createLocalPeeringGateway( */ CreatePublicIpResponse createPublicIp(CreatePublicIpRequest request); + /** + * Creates a new remote peering connection (RPC) for the specified DRG. + * + * @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. + */ + CreateRemotePeeringConnectionResponse createRemotePeeringConnection( + CreateRemotePeeringConnectionRequest request); + /** * Creates a new route table for the specified VCN. In the request you must also include at least one route * rule for the new route table. For information on the number of rules you can have in a route table, see @@ -621,6 +648,19 @@ DeleteLocalPeeringGatewayResponse deleteLocalPeeringGateway( */ DeletePublicIpResponse deletePublicIp(DeletePublicIpRequest request); + /** + * Deletes the remote peering connection (RPC). + *

+ * This is an asynchronous operation; the RPC's `lifecycleState` changes to TERMINATING temporarily + * until the RPC is completely removed. + * + * @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. + */ + DeleteRemotePeeringConnectionResponse deleteRemotePeeringConnection( + DeleteRemotePeeringConnectionRequest request); + /** * Deletes the specified route table, but only if it's not associated with a subnet. You can't delete a * VCN's default route table. @@ -871,6 +911,16 @@ GetIPSecConnectionDeviceStatusResponse getIPSecConnectionDeviceStatus( GetPublicIpByPrivateIpIdResponse getPublicIpByPrivateIpId( GetPublicIpByPrivateIpIdRequest request); + /** + * Get the specified remote peering connection's information. + * + * @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. + */ + GetRemotePeeringConnectionResponse getRemotePeeringConnection( + GetRemotePeeringConnectionRequest request); + /** * Gets the specified route table's information. * @param request The request object containing the details to send @@ -923,6 +973,17 @@ GetPublicIpByPrivateIpIdResponse getPublicIpByPrivateIpId( */ GetVnicResponse getVnic(GetVnicRequest request); + /** + * Lists the regions that support remote VCN peering (which is peering across regions). + * For more information, see [VCN Peering](https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/VCNpeering.htm). + * + * @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. + */ + ListAllowedPeerRegionsForRemotePeeringResponse listAllowedPeerRegionsForRemotePeering( + ListAllowedPeerRegionsForRemotePeeringRequest request); + /** * Lists the Customer-Premises Equipment objects (CPEs) in the specified compartment. * @@ -1102,6 +1163,17 @@ ListLocalPeeringGatewaysResponse listLocalPeeringGateways( */ ListPublicIpsResponse listPublicIps(ListPublicIpsRequest request); + /** + * Lists the remote peering connections (RPCs) for the specified DRG and compartment + * (the RPC's compartment). + * + * @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. + */ + ListRemotePeeringConnectionsResponse listRemotePeeringConnections( + ListRemotePeeringConnectionsRequest request); + /** * Lists the route tables in the specified VCN and specified compartment. The response * includes the default route table that automatically comes with each VCN, plus any route tables @@ -1327,6 +1399,16 @@ UpdateLocalPeeringGatewayResponse updateLocalPeeringGateway( */ UpdatePublicIpResponse updatePublicIp(UpdatePublicIpRequest request); + /** + * Updates the specified remote peering connection (RPC). + * + * @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. + */ + UpdateRemotePeeringConnectionResponse updateRemotePeeringConnection( + UpdateRemotePeeringConnectionRequest request); + /** * Updates the specified route table's display name or route rules. * Avoid entering confidential information. diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkAsync.java b/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkAsync.java index 974037ec2c1..3e885cf5cb2 100644 --- a/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkAsync.java +++ b/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkAsync.java @@ -104,6 +104,32 @@ java.util.concurrent.Future connectLocalPee ConnectLocalPeeringGatewaysRequest, ConnectLocalPeeringGatewaysResponse> handler); + /** + * Connects this RPC to another one in a different region. + *

+ * This operation must be called by the VCN administrator who is designated as + * the *requestor* in the peering relationship. The *acceptor* must implement + * an Identity and Access Management (IAM) policy that gives the requestor permission + * to connect to RPCs in the acceptor's compartment. Without that permission, this + * operation will fail. For more information, see + * [VCN Peering](https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/VCNpeering.htm). + * + * + * @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 + connectRemotePeeringConnections( + ConnectRemotePeeringConnectionsRequest request, + com.oracle.bmc.responses.AsyncHandler< + ConnectRemotePeeringConnectionsRequest, + ConnectRemotePeeringConnectionsResponse> + handler); + /** * Creates a new virtual Customer-Premises Equipment (CPE) object in the specified compartment. For * more information, see [IPSec VPNs](https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/managingIPsec.htm). @@ -429,6 +455,25 @@ java.util.concurrent.Future createPublicIp( com.oracle.bmc.responses.AsyncHandler handler); + /** + * Creates a new remote peering connection (RPC) for the specified DRG. + * + * + * @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 + createRemotePeeringConnection( + CreateRemotePeeringConnectionRequest request, + com.oracle.bmc.responses.AsyncHandler< + CreateRemotePeeringConnectionRequest, + CreateRemotePeeringConnectionResponse> + handler); + /** * Creates a new route table for the specified VCN. In the request you must also include at least one route * rule for the new route table. For information on the number of rules you can have in a route table, see @@ -844,6 +889,28 @@ java.util.concurrent.Future deletePublicIp( com.oracle.bmc.responses.AsyncHandler handler); + /** + * Deletes the remote peering connection (RPC). + *

+ * This is an asynchronous operation; the RPC's `lifecycleState` changes to TERMINATING temporarily + * until the RPC is completely removed. + * + * + * @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 + deleteRemotePeeringConnection( + DeleteRemotePeeringConnectionRequest request, + com.oracle.bmc.responses.AsyncHandler< + DeleteRemotePeeringConnectionRequest, + DeleteRemotePeeringConnectionResponse> + handler); + /** * Deletes the specified route table, but only if it's not associated with a subnet. You can't delete a * VCN's default route table. @@ -1267,6 +1334,23 @@ java.util.concurrent.Future getPublicIpByPriva GetPublicIpByPrivateIpIdRequest, GetPublicIpByPrivateIpIdResponse> handler); + /** + * Get the specified remote peering connection's information. + * + * + * @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 getRemotePeeringConnection( + GetRemotePeeringConnectionRequest request, + com.oracle.bmc.responses.AsyncHandler< + GetRemotePeeringConnectionRequest, GetRemotePeeringConnectionResponse> + handler); + /** * Gets the specified route table's information. * @@ -1359,6 +1443,26 @@ java.util.concurrent.Future getVnic( GetVnicRequest request, com.oracle.bmc.responses.AsyncHandler handler); + /** + * Lists the regions that support remote VCN peering (which is peering across regions). + * For more information, see [VCN Peering](https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/VCNpeering.htm). + * + * + * @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 + listAllowedPeerRegionsForRemotePeering( + ListAllowedPeerRegionsForRemotePeeringRequest request, + com.oracle.bmc.responses.AsyncHandler< + ListAllowedPeerRegionsForRemotePeeringRequest, + ListAllowedPeerRegionsForRemotePeeringResponse> + handler); + /** * Lists the Customer-Premises Equipment objects (CPEs) in the specified compartment. * @@ -1651,6 +1755,25 @@ java.util.concurrent.Future listPublicIps( com.oracle.bmc.responses.AsyncHandler handler); + /** + * Lists the remote peering connections (RPCs) for the specified DRG and compartment + * (the RPC's compartment). + * + * + * @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 listRemotePeeringConnections( + ListRemotePeeringConnectionsRequest request, + com.oracle.bmc.responses.AsyncHandler< + ListRemotePeeringConnectionsRequest, + ListRemotePeeringConnectionsResponse> + handler); + /** * Lists the route tables in the specified VCN and specified compartment. The response * includes the default route table that automatically comes with each VCN, plus any route tables @@ -2010,6 +2133,25 @@ java.util.concurrent.Future updatePublicIp( com.oracle.bmc.responses.AsyncHandler handler); + /** + * Updates the specified remote peering connection (RPC). + * + * + * @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 + updateRemotePeeringConnection( + UpdateRemotePeeringConnectionRequest request, + com.oracle.bmc.responses.AsyncHandler< + UpdateRemotePeeringConnectionRequest, + UpdateRemotePeeringConnectionResponse> + handler); + /** * Updates the specified route table's display name or route rules. * Avoid entering confidential information. diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkAsyncClient.java b/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkAsyncClient.java index fc2c5a1448d..1e4c109bded 100644 --- a/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkAsyncClient.java +++ b/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkAsyncClient.java @@ -102,6 +102,34 @@ public VirtualNetworkAsyncClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 VirtualNetworkAsyncClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -119,8 +147,17 @@ public VirtualNetworkAsyncClient( 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); + } } /** @@ -143,6 +180,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -207,6 +245,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Build the client, with the authentication details provider. * @param authenticationDetailsProvider authentication details provider @@ -221,7 +304,8 @@ public VirtualNetworkAsyncClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } @@ -538,6 +622,97 @@ public java.util.concurrent.Future get() { } } + @Override + public java.util.concurrent.Future + connectRemotePeeringConnections( + final ConnectRemotePeeringConnectionsRequest request, + final com.oracle.bmc.responses.AsyncHandler< + ConnectRemotePeeringConnectionsRequest, + ConnectRemotePeeringConnectionsResponse> + handler) { + LOG.trace("Called async connectRemotePeeringConnections"); + final ConnectRemotePeeringConnectionsRequest interceptedRequest = + ConnectRemotePeeringConnectionsConverter.interceptRequest(request); + final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + ConnectRemotePeeringConnectionsConverter.fromRequest(client, interceptedRequest); + final com.google.common.base.Function< + javax.ws.rs.core.Response, ConnectRemotePeeringConnectionsResponse> + transformer = ConnectRemotePeeringConnectionsConverter.fromResponse(); + + com.oracle.bmc.responses.AsyncHandler< + ConnectRemotePeeringConnectionsRequest, + ConnectRemotePeeringConnectionsResponse> + handlerToUse = handler; + if (handler != null + && this.authenticationDetailsProvider + instanceof + com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) { + handlerToUse = + new com.oracle.bmc.util.internal.InstancePrincipalsWrappingAsyncHandler< + ConnectRemotePeeringConnectionsRequest, + ConnectRemotePeeringConnectionsResponse>( + (com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) + 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.getConnectRemotePeeringConnectionsDetails(), + 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.getConnectRemotePeeringConnectionsDetails(), + interceptedRequest, + onSuccess, + onError); + + if (this.authenticationDetailsProvider + instanceof com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) { + return new com.oracle.bmc.util.internal.InstancePrincipalsBasedTransformingFuture< + javax.ws.rs.core.Response, ConnectRemotePeeringConnectionsResponse>( + responseFuture, + transformer, + (com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) + this.authenticationDetailsProvider, + new com.google.common.base.Supplier< + java.util.concurrent.Future>() { + @Override + public java.util.concurrent.Future get() { + return client.post( + ib, + interceptedRequest.getConnectRemotePeeringConnectionsDetails(), + interceptedRequest, + onSuccess, + onError); + } + }); + } else { + return new com.oracle.bmc.util.internal.TransformingFuture<>( + responseFuture, transformer); + } + } + @Override public java.util.concurrent.Future createCpe( final CreateCpeRequest request, @@ -1479,6 +1654,96 @@ public java.util.concurrent.Future get() { } } + @Override + public java.util.concurrent.Future + createRemotePeeringConnection( + final CreateRemotePeeringConnectionRequest request, + final com.oracle.bmc.responses.AsyncHandler< + CreateRemotePeeringConnectionRequest, + CreateRemotePeeringConnectionResponse> + handler) { + LOG.trace("Called async createRemotePeeringConnection"); + final CreateRemotePeeringConnectionRequest interceptedRequest = + CreateRemotePeeringConnectionConverter.interceptRequest(request); + final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + CreateRemotePeeringConnectionConverter.fromRequest(client, interceptedRequest); + final com.google.common.base.Function< + javax.ws.rs.core.Response, CreateRemotePeeringConnectionResponse> + transformer = CreateRemotePeeringConnectionConverter.fromResponse(); + + com.oracle.bmc.responses.AsyncHandler< + CreateRemotePeeringConnectionRequest, CreateRemotePeeringConnectionResponse> + handlerToUse = handler; + if (handler != null + && this.authenticationDetailsProvider + instanceof + com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) { + handlerToUse = + new com.oracle.bmc.util.internal.InstancePrincipalsWrappingAsyncHandler< + CreateRemotePeeringConnectionRequest, + CreateRemotePeeringConnectionResponse>( + (com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) + 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.getCreateRemotePeeringConnectionDetails(), + 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.getCreateRemotePeeringConnectionDetails(), + interceptedRequest, + onSuccess, + onError); + + if (this.authenticationDetailsProvider + instanceof com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) { + return new com.oracle.bmc.util.internal.InstancePrincipalsBasedTransformingFuture< + javax.ws.rs.core.Response, CreateRemotePeeringConnectionResponse>( + responseFuture, + transformer, + (com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) + this.authenticationDetailsProvider, + new com.google.common.base.Supplier< + java.util.concurrent.Future>() { + @Override + public java.util.concurrent.Future get() { + return client.post( + ib, + interceptedRequest.getCreateRemotePeeringConnectionDetails(), + interceptedRequest, + onSuccess, + onError); + } + }); + } else { + return new com.oracle.bmc.util.internal.TransformingFuture<>( + responseFuture, transformer); + } + } + @Override public java.util.concurrent.Future createRouteTable( final CreateRouteTableRequest request, @@ -2679,6 +2944,81 @@ public java.util.concurrent.Future get() { } } + @Override + public java.util.concurrent.Future + deleteRemotePeeringConnection( + final DeleteRemotePeeringConnectionRequest request, + final com.oracle.bmc.responses.AsyncHandler< + DeleteRemotePeeringConnectionRequest, + DeleteRemotePeeringConnectionResponse> + handler) { + LOG.trace("Called async deleteRemotePeeringConnection"); + final DeleteRemotePeeringConnectionRequest interceptedRequest = + DeleteRemotePeeringConnectionConverter.interceptRequest(request); + final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + DeleteRemotePeeringConnectionConverter.fromRequest(client, interceptedRequest); + final com.google.common.base.Function< + javax.ws.rs.core.Response, DeleteRemotePeeringConnectionResponse> + transformer = DeleteRemotePeeringConnectionConverter.fromResponse(); + + com.oracle.bmc.responses.AsyncHandler< + DeleteRemotePeeringConnectionRequest, DeleteRemotePeeringConnectionResponse> + handlerToUse = handler; + if (handler != null + && this.authenticationDetailsProvider + instanceof + com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) { + handlerToUse = + new com.oracle.bmc.util.internal.InstancePrincipalsWrappingAsyncHandler< + DeleteRemotePeeringConnectionRequest, + DeleteRemotePeeringConnectionResponse>( + (com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) + this.authenticationDetailsProvider, + handler) { + @Override + public void retryCall() { + final com.oracle.bmc.util.internal.Consumer + onSuccess = + new com.oracle.bmc.http.internal.SuccessConsumer<>( + this, transformer, interceptedRequest); + final com.oracle.bmc.util.internal.Consumer onError = + new com.oracle.bmc.http.internal.ErrorConsumer<>( + this, interceptedRequest); + client.delete(ib, interceptedRequest, onSuccess, onError); + } + }; + } + + final com.oracle.bmc.util.internal.Consumer onSuccess = + new com.oracle.bmc.http.internal.SuccessConsumer<>( + handlerToUse, transformer, interceptedRequest); + final com.oracle.bmc.util.internal.Consumer onError = + new com.oracle.bmc.http.internal.ErrorConsumer<>(handlerToUse, interceptedRequest); + + java.util.concurrent.Future responseFuture = + client.delete(ib, interceptedRequest, onSuccess, onError); + + if (this.authenticationDetailsProvider + instanceof com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) { + return new com.oracle.bmc.util.internal.InstancePrincipalsBasedTransformingFuture< + javax.ws.rs.core.Response, DeleteRemotePeeringConnectionResponse>( + responseFuture, + transformer, + (com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) + this.authenticationDetailsProvider, + new com.google.common.base.Supplier< + java.util.concurrent.Future>() { + @Override + public java.util.concurrent.Future get() { + return client.delete(ib, interceptedRequest, onSuccess, onError); + } + }); + } else { + return new com.oracle.bmc.util.internal.TransformingFuture<>( + responseFuture, transformer); + } + } + @Override public java.util.concurrent.Future deleteRouteTable( final DeleteRouteTableRequest request, @@ -4341,6 +4681,80 @@ public java.util.concurrent.Future get() { } } + @Override + public java.util.concurrent.Future + getRemotePeeringConnection( + final GetRemotePeeringConnectionRequest request, + final com.oracle.bmc.responses.AsyncHandler< + GetRemotePeeringConnectionRequest, + GetRemotePeeringConnectionResponse> + handler) { + LOG.trace("Called async getRemotePeeringConnection"); + final GetRemotePeeringConnectionRequest interceptedRequest = + GetRemotePeeringConnectionConverter.interceptRequest(request); + final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + GetRemotePeeringConnectionConverter.fromRequest(client, interceptedRequest); + final com.google.common.base.Function< + javax.ws.rs.core.Response, GetRemotePeeringConnectionResponse> + transformer = GetRemotePeeringConnectionConverter.fromResponse(); + + com.oracle.bmc.responses.AsyncHandler< + GetRemotePeeringConnectionRequest, GetRemotePeeringConnectionResponse> + handlerToUse = handler; + if (handler != null + && this.authenticationDetailsProvider + instanceof + com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) { + handlerToUse = + new com.oracle.bmc.util.internal.InstancePrincipalsWrappingAsyncHandler< + GetRemotePeeringConnectionRequest, GetRemotePeeringConnectionResponse>( + (com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) + 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.InstancePrincipalsAuthenticationDetailsProvider) { + return new com.oracle.bmc.util.internal.InstancePrincipalsBasedTransformingFuture< + javax.ws.rs.core.Response, GetRemotePeeringConnectionResponse>( + responseFuture, + transformer, + (com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) + 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 getRouteTable( final GetRouteTableRequest request, @@ -4751,6 +5165,83 @@ public java.util.concurrent.Future get() { } } + @Override + public java.util.concurrent.Future + listAllowedPeerRegionsForRemotePeering( + final ListAllowedPeerRegionsForRemotePeeringRequest request, + final com.oracle.bmc.responses.AsyncHandler< + ListAllowedPeerRegionsForRemotePeeringRequest, + ListAllowedPeerRegionsForRemotePeeringResponse> + handler) { + LOG.trace("Called async listAllowedPeerRegionsForRemotePeering"); + final ListAllowedPeerRegionsForRemotePeeringRequest interceptedRequest = + ListAllowedPeerRegionsForRemotePeeringConverter.interceptRequest(request); + final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + ListAllowedPeerRegionsForRemotePeeringConverter.fromRequest( + client, interceptedRequest); + final com.google.common.base.Function< + javax.ws.rs.core.Response, ListAllowedPeerRegionsForRemotePeeringResponse> + transformer = ListAllowedPeerRegionsForRemotePeeringConverter.fromResponse(); + + com.oracle.bmc.responses.AsyncHandler< + ListAllowedPeerRegionsForRemotePeeringRequest, + ListAllowedPeerRegionsForRemotePeeringResponse> + handlerToUse = handler; + if (handler != null + && this.authenticationDetailsProvider + instanceof + com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) { + handlerToUse = + new com.oracle.bmc.util.internal.InstancePrincipalsWrappingAsyncHandler< + ListAllowedPeerRegionsForRemotePeeringRequest, + ListAllowedPeerRegionsForRemotePeeringResponse>( + (com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) + 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.InstancePrincipalsAuthenticationDetailsProvider) { + return new com.oracle.bmc.util.internal.InstancePrincipalsBasedTransformingFuture< + javax.ws.rs.core.Response, ListAllowedPeerRegionsForRemotePeeringResponse>( + responseFuture, + transformer, + (com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) + 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 listCpes( final ListCpesRequest request, @@ -5830,6 +6321,81 @@ public java.util.concurrent.Future get() { } } + @Override + public java.util.concurrent.Future + listRemotePeeringConnections( + final ListRemotePeeringConnectionsRequest request, + final com.oracle.bmc.responses.AsyncHandler< + ListRemotePeeringConnectionsRequest, + ListRemotePeeringConnectionsResponse> + handler) { + LOG.trace("Called async listRemotePeeringConnections"); + final ListRemotePeeringConnectionsRequest interceptedRequest = + ListRemotePeeringConnectionsConverter.interceptRequest(request); + final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + ListRemotePeeringConnectionsConverter.fromRequest(client, interceptedRequest); + final com.google.common.base.Function< + javax.ws.rs.core.Response, ListRemotePeeringConnectionsResponse> + transformer = ListRemotePeeringConnectionsConverter.fromResponse(); + + com.oracle.bmc.responses.AsyncHandler< + ListRemotePeeringConnectionsRequest, ListRemotePeeringConnectionsResponse> + handlerToUse = handler; + if (handler != null + && this.authenticationDetailsProvider + instanceof + com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) { + handlerToUse = + new com.oracle.bmc.util.internal.InstancePrincipalsWrappingAsyncHandler< + ListRemotePeeringConnectionsRequest, + ListRemotePeeringConnectionsResponse>( + (com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) + 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.InstancePrincipalsAuthenticationDetailsProvider) { + return new com.oracle.bmc.util.internal.InstancePrincipalsBasedTransformingFuture< + javax.ws.rs.core.Response, ListRemotePeeringConnectionsResponse>( + responseFuture, + transformer, + (com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) + 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 listRouteTables( final ListRouteTablesRequest request, @@ -7272,6 +7838,96 @@ public java.util.concurrent.Future get() { } } + @Override + public java.util.concurrent.Future + updateRemotePeeringConnection( + final UpdateRemotePeeringConnectionRequest request, + final com.oracle.bmc.responses.AsyncHandler< + UpdateRemotePeeringConnectionRequest, + UpdateRemotePeeringConnectionResponse> + handler) { + LOG.trace("Called async updateRemotePeeringConnection"); + final UpdateRemotePeeringConnectionRequest interceptedRequest = + UpdateRemotePeeringConnectionConverter.interceptRequest(request); + final com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + UpdateRemotePeeringConnectionConverter.fromRequest(client, interceptedRequest); + final com.google.common.base.Function< + javax.ws.rs.core.Response, UpdateRemotePeeringConnectionResponse> + transformer = UpdateRemotePeeringConnectionConverter.fromResponse(); + + com.oracle.bmc.responses.AsyncHandler< + UpdateRemotePeeringConnectionRequest, UpdateRemotePeeringConnectionResponse> + handlerToUse = handler; + if (handler != null + && this.authenticationDetailsProvider + instanceof + com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) { + handlerToUse = + new com.oracle.bmc.util.internal.InstancePrincipalsWrappingAsyncHandler< + UpdateRemotePeeringConnectionRequest, + UpdateRemotePeeringConnectionResponse>( + (com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) + this.authenticationDetailsProvider, + handler) { + @Override + public void retryCall() { + final com.oracle.bmc.util.internal.Consumer + onSuccess = + new com.oracle.bmc.http.internal.SuccessConsumer<>( + this, transformer, interceptedRequest); + final com.oracle.bmc.util.internal.Consumer onError = + new com.oracle.bmc.http.internal.ErrorConsumer<>( + this, interceptedRequest); + client.put( + ib, + interceptedRequest.getUpdateRemotePeeringConnectionDetails(), + interceptedRequest, + onSuccess, + onError); + } + }; + } + + final com.oracle.bmc.util.internal.Consumer onSuccess = + new com.oracle.bmc.http.internal.SuccessConsumer<>( + handlerToUse, transformer, interceptedRequest); + final com.oracle.bmc.util.internal.Consumer onError = + new com.oracle.bmc.http.internal.ErrorConsumer<>(handlerToUse, interceptedRequest); + + java.util.concurrent.Future responseFuture = + client.put( + ib, + interceptedRequest.getUpdateRemotePeeringConnectionDetails(), + interceptedRequest, + onSuccess, + onError); + + if (this.authenticationDetailsProvider + instanceof com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) { + return new com.oracle.bmc.util.internal.InstancePrincipalsBasedTransformingFuture< + javax.ws.rs.core.Response, UpdateRemotePeeringConnectionResponse>( + responseFuture, + transformer, + (com.oracle.bmc.auth.InstancePrincipalsAuthenticationDetailsProvider) + this.authenticationDetailsProvider, + new com.google.common.base.Supplier< + java.util.concurrent.Future>() { + @Override + public java.util.concurrent.Future get() { + return client.put( + ib, + interceptedRequest.getUpdateRemotePeeringConnectionDetails(), + interceptedRequest, + onSuccess, + onError); + } + }); + } else { + return new com.oracle.bmc.util.internal.TransformingFuture<>( + responseFuture, transformer); + } + } + @Override public java.util.concurrent.Future updateRouteTable( final UpdateRouteTableRequest request, diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkClient.java b/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkClient.java index 99c002d79a5..0b09f351971 100644 --- a/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkClient.java +++ b/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkClient.java @@ -107,6 +107,34 @@ public VirtualNetworkClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 VirtualNetworkClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -141,8 +169,17 @@ public VirtualNetworkClient( 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); + } } /** @@ -165,6 +202,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -229,6 +267,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Set the authentication details provider. Once this is called, the builder can build the client. * @param authenticationDetailsProvider authentication details provider @@ -243,7 +326,8 @@ public VirtualNetworkClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } @@ -372,6 +456,35 @@ && canRetryRequestIfInstancePrincipalsUsed(e)) { } } + @Override + public ConnectRemotePeeringConnectionsResponse connectRemotePeeringConnections( + ConnectRemotePeeringConnectionsRequest request) { + LOG.trace("Called connectRemotePeeringConnections"); + request = ConnectRemotePeeringConnectionsConverter.interceptRequest(request); + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + ConnectRemotePeeringConnectionsConverter.fromRequest(client, request); + com.google.common.base.Function< + javax.ws.rs.core.Response, ConnectRemotePeeringConnectionsResponse> + transformer = ConnectRemotePeeringConnectionsConverter.fromResponse(); + + int attempts = 0; + while (true) { + try { + javax.ws.rs.core.Response response = + client.post( + ib, request.getConnectRemotePeeringConnectionsDetails(), request); + return transformer.apply(response); + } catch (com.oracle.bmc.model.BmcException e) { + if (++attempts < MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS + && canRetryRequestIfInstancePrincipalsUsed(e)) { + continue; + } else { + throw e; + } + } + } + } + @Override public CreateCpeResponse createCpe(CreateCpeRequest request) { LOG.trace("Called createCpe"); @@ -663,6 +776,34 @@ && canRetryRequestIfInstancePrincipalsUsed(e)) { } } + @Override + public CreateRemotePeeringConnectionResponse createRemotePeeringConnection( + CreateRemotePeeringConnectionRequest request) { + LOG.trace("Called createRemotePeeringConnection"); + request = CreateRemotePeeringConnectionConverter.interceptRequest(request); + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + CreateRemotePeeringConnectionConverter.fromRequest(client, request); + com.google.common.base.Function< + javax.ws.rs.core.Response, CreateRemotePeeringConnectionResponse> + transformer = CreateRemotePeeringConnectionConverter.fromResponse(); + + int attempts = 0; + while (true) { + try { + javax.ws.rs.core.Response response = + client.post(ib, request.getCreateRemotePeeringConnectionDetails(), request); + return transformer.apply(response); + } catch (com.oracle.bmc.model.BmcException e) { + if (++attempts < MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS + && canRetryRequestIfInstancePrincipalsUsed(e)) { + continue; + } else { + throw e; + } + } + } + } + @Override public CreateRouteTableResponse createRouteTable(CreateRouteTableRequest request) { LOG.trace("Called createRouteTable"); @@ -1073,6 +1214,33 @@ && canRetryRequestIfInstancePrincipalsUsed(e)) { } } + @Override + public DeleteRemotePeeringConnectionResponse deleteRemotePeeringConnection( + DeleteRemotePeeringConnectionRequest request) { + LOG.trace("Called deleteRemotePeeringConnection"); + request = DeleteRemotePeeringConnectionConverter.interceptRequest(request); + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + DeleteRemotePeeringConnectionConverter.fromRequest(client, request); + com.google.common.base.Function< + javax.ws.rs.core.Response, DeleteRemotePeeringConnectionResponse> + transformer = DeleteRemotePeeringConnectionConverter.fromResponse(); + + int attempts = 0; + while (true) { + try { + javax.ws.rs.core.Response response = client.delete(ib, request); + return transformer.apply(response); + } catch (com.oracle.bmc.model.BmcException e) { + if (++attempts < MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS + && canRetryRequestIfInstancePrincipalsUsed(e)) { + continue; + } else { + throw e; + } + } + } + } + @Override public DeleteRouteTableResponse deleteRouteTable(DeleteRouteTableRequest request) { LOG.trace("Called deleteRouteTable"); @@ -1662,6 +1830,33 @@ && canRetryRequestIfInstancePrincipalsUsed(e)) { } } + @Override + public GetRemotePeeringConnectionResponse getRemotePeeringConnection( + GetRemotePeeringConnectionRequest request) { + LOG.trace("Called getRemotePeeringConnection"); + request = GetRemotePeeringConnectionConverter.interceptRequest(request); + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + GetRemotePeeringConnectionConverter.fromRequest(client, request); + com.google.common.base.Function< + javax.ws.rs.core.Response, GetRemotePeeringConnectionResponse> + transformer = GetRemotePeeringConnectionConverter.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 + && canRetryRequestIfInstancePrincipalsUsed(e)) { + continue; + } else { + throw e; + } + } + } + } + @Override public GetRouteTableResponse getRouteTable(GetRouteTableRequest request) { LOG.trace("Called getRouteTable"); @@ -1812,6 +2007,33 @@ && canRetryRequestIfInstancePrincipalsUsed(e)) { } } + @Override + public ListAllowedPeerRegionsForRemotePeeringResponse listAllowedPeerRegionsForRemotePeering( + ListAllowedPeerRegionsForRemotePeeringRequest request) { + LOG.trace("Called listAllowedPeerRegionsForRemotePeering"); + request = ListAllowedPeerRegionsForRemotePeeringConverter.interceptRequest(request); + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + ListAllowedPeerRegionsForRemotePeeringConverter.fromRequest(client, request); + com.google.common.base.Function< + javax.ws.rs.core.Response, ListAllowedPeerRegionsForRemotePeeringResponse> + transformer = ListAllowedPeerRegionsForRemotePeeringConverter.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 + && canRetryRequestIfInstancePrincipalsUsed(e)) { + continue; + } else { + throw e; + } + } + } + } + @Override public ListCpesResponse listCpes(ListCpesRequest request) { LOG.trace("Called listCpes"); @@ -2204,6 +2426,33 @@ && canRetryRequestIfInstancePrincipalsUsed(e)) { } } + @Override + public ListRemotePeeringConnectionsResponse listRemotePeeringConnections( + ListRemotePeeringConnectionsRequest request) { + LOG.trace("Called listRemotePeeringConnections"); + request = ListRemotePeeringConnectionsConverter.interceptRequest(request); + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + ListRemotePeeringConnectionsConverter.fromRequest(client, request); + com.google.common.base.Function< + javax.ws.rs.core.Response, ListRemotePeeringConnectionsResponse> + transformer = ListRemotePeeringConnectionsConverter.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 + && canRetryRequestIfInstancePrincipalsUsed(e)) { + continue; + } else { + throw e; + } + } + } + } + @Override public ListRouteTablesResponse listRouteTables(ListRouteTablesRequest request) { LOG.trace("Called listRouteTables"); @@ -2674,6 +2923,34 @@ && canRetryRequestIfInstancePrincipalsUsed(e)) { } } + @Override + public UpdateRemotePeeringConnectionResponse updateRemotePeeringConnection( + UpdateRemotePeeringConnectionRequest request) { + LOG.trace("Called updateRemotePeeringConnection"); + request = UpdateRemotePeeringConnectionConverter.interceptRequest(request); + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = + UpdateRemotePeeringConnectionConverter.fromRequest(client, request); + com.google.common.base.Function< + javax.ws.rs.core.Response, UpdateRemotePeeringConnectionResponse> + transformer = UpdateRemotePeeringConnectionConverter.fromResponse(); + + int attempts = 0; + while (true) { + try { + javax.ws.rs.core.Response response = + client.put(ib, request.getUpdateRemotePeeringConnectionDetails(), request); + return transformer.apply(response); + } catch (com.oracle.bmc.model.BmcException e) { + if (++attempts < MAX_IMMEDIATE_RETRIES_IF_USING_INSTANCE_PRINCIPALS + && canRetryRequestIfInstancePrincipalsUsed(e)) { + continue; + } else { + throw e; + } + } + } + } + @Override public UpdateRouteTableResponse updateRouteTable(UpdateRouteTableRequest request) { LOG.trace("Called updateRouteTable"); diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkPaginators.java b/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkPaginators.java index 67c588b4335..b3b802562ac 100644 --- a/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkPaginators.java +++ b/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkPaginators.java @@ -1763,6 +1763,128 @@ public java.util.List apply( }); } + /** + * Creates a new iterable which will iterate over the responses received from the listRemotePeeringConnections operation. This iterable + * will fetch more data from the server as needed. + * + * @param request a request which can be sent to the service operation + * @return an {@link java.lang.Iterable} which can be used to iterate over the responses received from the service. + */ + public Iterable + listRemotePeeringConnectionsResponseIterator( + final ListRemotePeeringConnectionsRequest request) { + return new com.oracle.bmc.paginator.internal.ResponseIterable< + ListRemotePeeringConnectionsRequest.Builder, ListRemotePeeringConnectionsRequest, + ListRemotePeeringConnectionsResponse>( + new com.google.common.base.Supplier() { + @Override + public ListRemotePeeringConnectionsRequest.Builder get() { + return ListRemotePeeringConnectionsRequest.builder().copy(request); + } + }, + new com.google.common.base.Function< + ListRemotePeeringConnectionsResponse, String>() { + @Override + public String apply(ListRemotePeeringConnectionsResponse response) { + return response.getOpcNextPage(); + } + }, + new com.google.common.base.Function< + com.oracle.bmc.paginator.internal.RequestBuilderAndToken< + ListRemotePeeringConnectionsRequest.Builder>, + ListRemotePeeringConnectionsRequest>() { + @Override + public ListRemotePeeringConnectionsRequest apply( + com.oracle.bmc.paginator.internal.RequestBuilderAndToken< + ListRemotePeeringConnectionsRequest.Builder> + input) { + if (input.getToken() == null) { + return input.getRequestBuilder().build(); + } else { + return input.getRequestBuilder() + .page(input.getToken().orNull()) + .build(); + } + } + }, + new com.google.common.base.Function< + ListRemotePeeringConnectionsRequest, + ListRemotePeeringConnectionsResponse>() { + @Override + public ListRemotePeeringConnectionsResponse apply( + ListRemotePeeringConnectionsRequest request) { + return client.listRemotePeeringConnections(request); + } + }); + } + + /** + * Creates a new iterable which will iterate over the {@link com.oracle.bmc.core.model.RemotePeeringConnection} objects + * contained in responses from the listRemotePeeringConnections operation. This iterable will fetch more data from the + * server as needed. + * + * @param request a request which can be sent to the service operation + * @return an {@link java.lang.Iterable} which can be used to iterate over the {@link com.oracle.bmc.core.model.RemotePeeringConnection} objects + * contained in responses received from the service. + */ + public Iterable + listRemotePeeringConnectionsRecordIterator( + final ListRemotePeeringConnectionsRequest request) { + return new com.oracle.bmc.paginator.internal.ResponseRecordIterable< + ListRemotePeeringConnectionsRequest.Builder, ListRemotePeeringConnectionsRequest, + ListRemotePeeringConnectionsResponse, + com.oracle.bmc.core.model.RemotePeeringConnection>( + new com.google.common.base.Supplier() { + @Override + public ListRemotePeeringConnectionsRequest.Builder get() { + return ListRemotePeeringConnectionsRequest.builder().copy(request); + } + }, + new com.google.common.base.Function< + ListRemotePeeringConnectionsResponse, String>() { + @Override + public String apply(ListRemotePeeringConnectionsResponse response) { + return response.getOpcNextPage(); + } + }, + new com.google.common.base.Function< + com.oracle.bmc.paginator.internal.RequestBuilderAndToken< + ListRemotePeeringConnectionsRequest.Builder>, + ListRemotePeeringConnectionsRequest>() { + @Override + public ListRemotePeeringConnectionsRequest apply( + com.oracle.bmc.paginator.internal.RequestBuilderAndToken< + ListRemotePeeringConnectionsRequest.Builder> + input) { + if (input.getToken() == null) { + return input.getRequestBuilder().build(); + } else { + return input.getRequestBuilder() + .page(input.getToken().orNull()) + .build(); + } + } + }, + new com.google.common.base.Function< + ListRemotePeeringConnectionsRequest, + ListRemotePeeringConnectionsResponse>() { + @Override + public ListRemotePeeringConnectionsResponse apply( + ListRemotePeeringConnectionsRequest request) { + return client.listRemotePeeringConnections(request); + } + }, + new com.google.common.base.Function< + ListRemotePeeringConnectionsResponse, + java.util.List>() { + @Override + public java.util.List apply( + ListRemotePeeringConnectionsResponse response) { + return response.getItems(); + } + }); + } + /** * Creates a new iterable which will iterate over the responses received from the listRouteTables operation. This iterable * will fetch more data from the server as needed. diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkWaiters.java b/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkWaiters.java index 07d63918037..b20c30e67db 100644 --- a/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkWaiters.java +++ b/bmc-core/src/main/java/com/oracle/bmc/core/VirtualNetworkWaiters.java @@ -673,6 +673,150 @@ public boolean apply(GetPublicIpResponse response) { request); } + /** + * Creates a new {@link Waiter} using default configuration. + * + * @param request the request to send + * @param targetState the desired state to wait for + * @return a new {@code Waiter} instance + */ + public com.oracle.bmc.waiter.Waiter< + GetRemotePeeringConnectionRequest, GetRemotePeeringConnectionResponse> + forRemotePeeringConnection( + GetRemotePeeringConnectionRequest request, + com.oracle.bmc.core.model.RemotePeeringConnection.PeeringStatus targetState) { + return forRemotePeeringConnection( + com.oracle.bmc.waiter.Waiters.DEFAULT_POLLING_WAITER, request, targetState); + } + + /** + * Creates a new {@link Waiter} using the provided configuration. + * + * @param request the request to send + * @param targetState the desired state to wait for + * @param terminationStrategy the {@link TerminationStrategy} to use + * @param delayStrategy the {@link DelayStrategy} to use + * @return a new {@code Waiter} instance + */ + public com.oracle.bmc.waiter.Waiter< + GetRemotePeeringConnectionRequest, GetRemotePeeringConnectionResponse> + forRemotePeeringConnection( + GetRemotePeeringConnectionRequest request, + com.oracle.bmc.core.model.RemotePeeringConnection.PeeringStatus targetState, + com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, + com.oracle.bmc.waiter.DelayStrategy delayStrategy) { + return forRemotePeeringConnection( + com.oracle.bmc.waiter.Waiters.newWaiter(terminationStrategy, delayStrategy), + request, + targetState); + } + + // Helper method to create a new Waiter for RemotePeeringConnection. + private com.oracle.bmc.waiter.Waiter< + GetRemotePeeringConnectionRequest, GetRemotePeeringConnectionResponse> + forRemotePeeringConnection( + com.oracle.bmc.waiter.BmcGenericWaiter waiter, + final GetRemotePeeringConnectionRequest request, + final com.oracle.bmc.core.model.RemotePeeringConnection.PeeringStatus + targetState) { + return new com.oracle.bmc.waiter.internal.SimpleWaiterImpl<>( + executorService, + waiter.toCallable( + com.google.common.base.Suppliers.ofInstance(request), + new com.google.common.base.Function< + GetRemotePeeringConnectionRequest, + GetRemotePeeringConnectionResponse>() { + @Override + public GetRemotePeeringConnectionResponse apply( + GetRemotePeeringConnectionRequest request) { + return client.getRemotePeeringConnection(request); + } + }, + new com.google.common.base.Predicate() { + @Override + public boolean apply(GetRemotePeeringConnectionResponse response) { + return response.getRemotePeeringConnection().getPeeringStatus() + == targetState; + } + }, + targetState + == com.oracle.bmc.core.model.RemotePeeringConnection.PeeringStatus + .Revoked), + request); + } + + /** + * Creates a new {@link Waiter} using default configuration. + * + * @param request the request to send + * @param targetState the desired state to wait for + * @return a new {@code Waiter} instance + */ + public com.oracle.bmc.waiter.Waiter< + GetRemotePeeringConnectionRequest, GetRemotePeeringConnectionResponse> + forRemotePeeringConnection( + GetRemotePeeringConnectionRequest request, + com.oracle.bmc.core.model.RemotePeeringConnection.LifecycleState targetState) { + return forRemotePeeringConnection( + com.oracle.bmc.waiter.Waiters.DEFAULT_POLLING_WAITER, request, targetState); + } + + /** + * Creates a new {@link Waiter} using the provided configuration. + * + * @param request the request to send + * @param targetState the desired state to wait for + * @param terminationStrategy the {@link TerminationStrategy} to use + * @param delayStrategy the {@link DelayStrategy} to use + * @return a new {@code Waiter} instance + */ + public com.oracle.bmc.waiter.Waiter< + GetRemotePeeringConnectionRequest, GetRemotePeeringConnectionResponse> + forRemotePeeringConnection( + GetRemotePeeringConnectionRequest request, + com.oracle.bmc.core.model.RemotePeeringConnection.LifecycleState targetState, + com.oracle.bmc.waiter.TerminationStrategy terminationStrategy, + com.oracle.bmc.waiter.DelayStrategy delayStrategy) { + return forRemotePeeringConnection( + com.oracle.bmc.waiter.Waiters.newWaiter(terminationStrategy, delayStrategy), + request, + targetState); + } + + // Helper method to create a new Waiter for RemotePeeringConnection. + private com.oracle.bmc.waiter.Waiter< + GetRemotePeeringConnectionRequest, GetRemotePeeringConnectionResponse> + forRemotePeeringConnection( + com.oracle.bmc.waiter.BmcGenericWaiter waiter, + final GetRemotePeeringConnectionRequest request, + final com.oracle.bmc.core.model.RemotePeeringConnection.LifecycleState + targetState) { + return new com.oracle.bmc.waiter.internal.SimpleWaiterImpl<>( + executorService, + waiter.toCallable( + com.google.common.base.Suppliers.ofInstance(request), + new com.google.common.base.Function< + GetRemotePeeringConnectionRequest, + GetRemotePeeringConnectionResponse>() { + @Override + public GetRemotePeeringConnectionResponse apply( + GetRemotePeeringConnectionRequest request) { + return client.getRemotePeeringConnection(request); + } + }, + new com.google.common.base.Predicate() { + @Override + public boolean apply(GetRemotePeeringConnectionResponse response) { + return response.getRemotePeeringConnection().getLifecycleState() + == targetState; + } + }, + targetState + == com.oracle.bmc.core.model.RemotePeeringConnection.LifecycleState + .Terminated), + request); + } + /** * Creates a new {@link Waiter} using default configuration. * diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/ConnectRemotePeeringConnectionsConverter.java b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/ConnectRemotePeeringConnectionsConverter.java new file mode 100644 index 00000000000..2031bb5263f --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/ConnectRemotePeeringConnectionsConverter.java @@ -0,0 +1,102 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.internal.http; + +import com.oracle.bmc.core.model.*; +import com.oracle.bmc.core.requests.*; +import com.oracle.bmc.core.responses.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.extern.slf4j.Slf4j +public class ConnectRemotePeeringConnectionsConverter { + private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory + RESPONSE_CONVERSION_FACTORY = + new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory(); + + public static ConnectRemotePeeringConnectionsRequest interceptRequest( + ConnectRemotePeeringConnectionsRequest request) { + + return request; + } + + public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest( + com.oracle.bmc.http.internal.RestClient client, + ConnectRemotePeeringConnectionsRequest request) { + if (request == null) { + throw new NullPointerException("request instance is required"); + } + + if (request.getRemotePeeringConnectionId() == null) { + throw new NullPointerException("remotePeeringConnectionId is required"); + } + + if (request.getConnectRemotePeeringConnectionsDetails() == null) { + throw new NullPointerException("connectRemotePeeringConnectionsDetails is required"); + } + + com.oracle.bmc.http.internal.WrappedWebTarget target = + client.getBaseTarget() + .path("/20160918") + .path("remotePeeringConnections") + .path( + com.oracle.bmc.util.internal.HttpUtils.encodePathSegment( + request.getRemotePeeringConnectionId())) + .path("actions") + .path("connect"); + + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request(); + + ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON); + + return ib; + } + + public static com.google.common.base.Function< + javax.ws.rs.core.Response, ConnectRemotePeeringConnectionsResponse> + fromResponse() { + final com.google.common.base.Function< + javax.ws.rs.core.Response, ConnectRemotePeeringConnectionsResponse> + transformer = + new com.google.common.base.Function< + javax.ws.rs.core.Response, + ConnectRemotePeeringConnectionsResponse>() { + @Override + public ConnectRemotePeeringConnectionsResponse apply( + javax.ws.rs.core.Response rawResponse) { + LOG.trace( + "Transform function invoked for ConnectRemotePeeringConnectionsResponse"); + com.google.common.base.Function< + javax.ws.rs.core.Response, + com.oracle.bmc.http.internal.WithHeaders> + responseFn = RESPONSE_CONVERSION_FACTORY.create(); + + com.oracle.bmc.http.internal.WithHeaders response = + responseFn.apply(rawResponse); + javax.ws.rs.core.MultivaluedMap headers = + response.getHeaders(); + + ConnectRemotePeeringConnectionsResponse.Builder builder = + ConnectRemotePeeringConnectionsResponse.builder(); + + com.google.common.base.Optional> + opcRequestIdHeader = + com.oracle.bmc.http.internal.HeaderUtils.get( + headers, "opc-request-id"); + if (opcRequestIdHeader.isPresent()) { + builder.opcRequestId( + com.oracle.bmc.http.internal.HeaderUtils.toValue( + "opc-request-id", + opcRequestIdHeader.get().get(0), + String.class)); + } + + ConnectRemotePeeringConnectionsResponse responseWrapper = + builder.build(); + + return responseWrapper; + } + }; + return transformer; + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/CreateRemotePeeringConnectionConverter.java b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/CreateRemotePeeringConnectionConverter.java new file mode 100644 index 00000000000..e5e239b74d0 --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/CreateRemotePeeringConnectionConverter.java @@ -0,0 +1,109 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.internal.http; + +import com.oracle.bmc.core.model.*; +import com.oracle.bmc.core.requests.*; +import com.oracle.bmc.core.responses.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.extern.slf4j.Slf4j +public class CreateRemotePeeringConnectionConverter { + private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory + RESPONSE_CONVERSION_FACTORY = + new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory(); + + public static CreateRemotePeeringConnectionRequest interceptRequest( + CreateRemotePeeringConnectionRequest request) { + + return request; + } + + public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest( + com.oracle.bmc.http.internal.RestClient client, + CreateRemotePeeringConnectionRequest request) { + if (request == null) { + throw new NullPointerException("request instance is required"); + } + + if (request.getCreateRemotePeeringConnectionDetails() == null) { + throw new NullPointerException("createRemotePeeringConnectionDetails is required"); + } + + com.oracle.bmc.http.internal.WrappedWebTarget target = + client.getBaseTarget().path("/20160918").path("remotePeeringConnections"); + + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request(); + + ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON); + + if (request.getOpcRetryToken() != null) { + ib.header("opc-retry-token", request.getOpcRetryToken()); + } + + return ib; + } + + public static com.google.common.base.Function< + javax.ws.rs.core.Response, CreateRemotePeeringConnectionResponse> + fromResponse() { + final com.google.common.base.Function< + javax.ws.rs.core.Response, CreateRemotePeeringConnectionResponse> + transformer = + new com.google.common.base.Function< + javax.ws.rs.core.Response, + CreateRemotePeeringConnectionResponse>() { + @Override + public CreateRemotePeeringConnectionResponse apply( + javax.ws.rs.core.Response rawResponse) { + LOG.trace( + "Transform function invoked for CreateRemotePeeringConnectionResponse"); + com.google.common.base.Function< + javax.ws.rs.core.Response, + com.oracle.bmc.http.internal.WithHeaders< + RemotePeeringConnection>> + responseFn = + RESPONSE_CONVERSION_FACTORY.create( + RemotePeeringConnection.class); + + com.oracle.bmc.http.internal.WithHeaders + response = responseFn.apply(rawResponse); + javax.ws.rs.core.MultivaluedMap headers = + response.getHeaders(); + + CreateRemotePeeringConnectionResponse.Builder builder = + CreateRemotePeeringConnectionResponse.builder(); + + builder.remotePeeringConnection(response.getItem()); + + com.google.common.base.Optional> etagHeader = + com.oracle.bmc.http.internal.HeaderUtils.get( + headers, "etag"); + if (etagHeader.isPresent()) { + builder.etag( + com.oracle.bmc.http.internal.HeaderUtils.toValue( + "etag", etagHeader.get().get(0), String.class)); + } + + com.google.common.base.Optional> + opcRequestIdHeader = + com.oracle.bmc.http.internal.HeaderUtils.get( + headers, "opc-request-id"); + if (opcRequestIdHeader.isPresent()) { + builder.opcRequestId( + com.oracle.bmc.http.internal.HeaderUtils.toValue( + "opc-request-id", + opcRequestIdHeader.get().get(0), + String.class)); + } + + CreateRemotePeeringConnectionResponse responseWrapper = + builder.build(); + + return responseWrapper; + } + }; + return transformer; + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/DeleteRemotePeeringConnectionConverter.java b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/DeleteRemotePeeringConnectionConverter.java new file mode 100644 index 00000000000..087d87a9ba8 --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/DeleteRemotePeeringConnectionConverter.java @@ -0,0 +1,100 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.internal.http; + +import com.oracle.bmc.core.model.*; +import com.oracle.bmc.core.requests.*; +import com.oracle.bmc.core.responses.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.extern.slf4j.Slf4j +public class DeleteRemotePeeringConnectionConverter { + private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory + RESPONSE_CONVERSION_FACTORY = + new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory(); + + public static DeleteRemotePeeringConnectionRequest interceptRequest( + DeleteRemotePeeringConnectionRequest request) { + + return request; + } + + public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest( + com.oracle.bmc.http.internal.RestClient client, + DeleteRemotePeeringConnectionRequest request) { + if (request == null) { + throw new NullPointerException("request instance is required"); + } + + if (request.getRemotePeeringConnectionId() == null) { + throw new NullPointerException("remotePeeringConnectionId is required"); + } + + com.oracle.bmc.http.internal.WrappedWebTarget target = + client.getBaseTarget() + .path("/20160918") + .path("remotePeeringConnections") + .path( + com.oracle.bmc.util.internal.HttpUtils.encodePathSegment( + request.getRemotePeeringConnectionId())); + + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request(); + + ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON); + + if (request.getIfMatch() != null) { + ib.header("if-match", request.getIfMatch()); + } + + return ib; + } + + public static com.google.common.base.Function< + javax.ws.rs.core.Response, DeleteRemotePeeringConnectionResponse> + fromResponse() { + final com.google.common.base.Function< + javax.ws.rs.core.Response, DeleteRemotePeeringConnectionResponse> + transformer = + new com.google.common.base.Function< + javax.ws.rs.core.Response, + DeleteRemotePeeringConnectionResponse>() { + @Override + public DeleteRemotePeeringConnectionResponse apply( + javax.ws.rs.core.Response rawResponse) { + LOG.trace( + "Transform function invoked for DeleteRemotePeeringConnectionResponse"); + com.google.common.base.Function< + javax.ws.rs.core.Response, + com.oracle.bmc.http.internal.WithHeaders> + responseFn = RESPONSE_CONVERSION_FACTORY.create(); + + com.oracle.bmc.http.internal.WithHeaders response = + responseFn.apply(rawResponse); + javax.ws.rs.core.MultivaluedMap headers = + response.getHeaders(); + + DeleteRemotePeeringConnectionResponse.Builder builder = + DeleteRemotePeeringConnectionResponse.builder(); + + com.google.common.base.Optional> + opcRequestIdHeader = + com.oracle.bmc.http.internal.HeaderUtils.get( + headers, "opc-request-id"); + if (opcRequestIdHeader.isPresent()) { + builder.opcRequestId( + com.oracle.bmc.http.internal.HeaderUtils.toValue( + "opc-request-id", + opcRequestIdHeader.get().get(0), + String.class)); + } + + DeleteRemotePeeringConnectionResponse responseWrapper = + builder.build(); + + return responseWrapper; + } + }; + return transformer; + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/GetRemotePeeringConnectionConverter.java b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/GetRemotePeeringConnectionConverter.java new file mode 100644 index 00000000000..3929484c22f --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/GetRemotePeeringConnectionConverter.java @@ -0,0 +1,109 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.internal.http; + +import com.oracle.bmc.core.model.*; +import com.oracle.bmc.core.requests.*; +import com.oracle.bmc.core.responses.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.extern.slf4j.Slf4j +public class GetRemotePeeringConnectionConverter { + private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory + RESPONSE_CONVERSION_FACTORY = + new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory(); + + public static GetRemotePeeringConnectionRequest interceptRequest( + GetRemotePeeringConnectionRequest request) { + + return request; + } + + public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest( + com.oracle.bmc.http.internal.RestClient client, + GetRemotePeeringConnectionRequest request) { + if (request == null) { + throw new NullPointerException("request instance is required"); + } + + if (request.getRemotePeeringConnectionId() == null) { + throw new NullPointerException("remotePeeringConnectionId is required"); + } + + com.oracle.bmc.http.internal.WrappedWebTarget target = + client.getBaseTarget() + .path("/20160918") + .path("remotePeeringConnections") + .path( + com.oracle.bmc.util.internal.HttpUtils.encodePathSegment( + request.getRemotePeeringConnectionId())); + + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request(); + + ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON); + + return ib; + } + + public static com.google.common.base.Function< + javax.ws.rs.core.Response, GetRemotePeeringConnectionResponse> + fromResponse() { + final com.google.common.base.Function< + javax.ws.rs.core.Response, GetRemotePeeringConnectionResponse> + transformer = + new com.google.common.base.Function< + javax.ws.rs.core.Response, GetRemotePeeringConnectionResponse>() { + @Override + public GetRemotePeeringConnectionResponse apply( + javax.ws.rs.core.Response rawResponse) { + LOG.trace( + "Transform function invoked for GetRemotePeeringConnectionResponse"); + com.google.common.base.Function< + javax.ws.rs.core.Response, + com.oracle.bmc.http.internal.WithHeaders< + RemotePeeringConnection>> + responseFn = + RESPONSE_CONVERSION_FACTORY.create( + RemotePeeringConnection.class); + + com.oracle.bmc.http.internal.WithHeaders + response = responseFn.apply(rawResponse); + javax.ws.rs.core.MultivaluedMap headers = + response.getHeaders(); + + GetRemotePeeringConnectionResponse.Builder builder = + GetRemotePeeringConnectionResponse.builder(); + + builder.remotePeeringConnection(response.getItem()); + + com.google.common.base.Optional> etagHeader = + com.oracle.bmc.http.internal.HeaderUtils.get( + headers, "etag"); + if (etagHeader.isPresent()) { + builder.etag( + com.oracle.bmc.http.internal.HeaderUtils.toValue( + "etag", etagHeader.get().get(0), String.class)); + } + + com.google.common.base.Optional> + opcRequestIdHeader = + com.oracle.bmc.http.internal.HeaderUtils.get( + headers, "opc-request-id"); + if (opcRequestIdHeader.isPresent()) { + builder.opcRequestId( + com.oracle.bmc.http.internal.HeaderUtils.toValue( + "opc-request-id", + opcRequestIdHeader.get().get(0), + String.class)); + } + + GetRemotePeeringConnectionResponse responseWrapper = + builder.build(); + + return responseWrapper; + } + }; + return transformer; + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/ListAllowedPeerRegionsForRemotePeeringConverter.java b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/ListAllowedPeerRegionsForRemotePeeringConverter.java new file mode 100644 index 00000000000..07b125f17a6 --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/ListAllowedPeerRegionsForRemotePeeringConverter.java @@ -0,0 +1,95 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.internal.http; + +import com.oracle.bmc.core.model.*; +import com.oracle.bmc.core.requests.*; +import com.oracle.bmc.core.responses.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.extern.slf4j.Slf4j +public class ListAllowedPeerRegionsForRemotePeeringConverter { + private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory + RESPONSE_CONVERSION_FACTORY = + new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory(); + + public static ListAllowedPeerRegionsForRemotePeeringRequest interceptRequest( + ListAllowedPeerRegionsForRemotePeeringRequest request) { + + return request; + } + + public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest( + com.oracle.bmc.http.internal.RestClient client, + ListAllowedPeerRegionsForRemotePeeringRequest request) { + if (request == null) { + throw new NullPointerException("request instance is required"); + } + + com.oracle.bmc.http.internal.WrappedWebTarget target = + client.getBaseTarget().path("/20160918").path("allowedPeerRegionsForRemotePeering"); + + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request(); + + ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON); + + return ib; + } + + public static com.google.common.base.Function< + javax.ws.rs.core.Response, ListAllowedPeerRegionsForRemotePeeringResponse> + fromResponse() { + final com.google.common.base.Function< + javax.ws.rs.core.Response, ListAllowedPeerRegionsForRemotePeeringResponse> + transformer = + new com.google.common.base.Function< + javax.ws.rs.core.Response, + ListAllowedPeerRegionsForRemotePeeringResponse>() { + @Override + public ListAllowedPeerRegionsForRemotePeeringResponse apply( + javax.ws.rs.core.Response rawResponse) { + LOG.trace( + "Transform function invoked for ListAllowedPeerRegionsForRemotePeeringResponse"); + 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< + PeerRegionForRemotePeering>>() {}); + + com.oracle.bmc.http.internal.WithHeaders< + java.util.List> + response = responseFn.apply(rawResponse); + javax.ws.rs.core.MultivaluedMap headers = + response.getHeaders(); + + ListAllowedPeerRegionsForRemotePeeringResponse.Builder builder = + ListAllowedPeerRegionsForRemotePeeringResponse.builder(); + + builder.items(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)); + } + + ListAllowedPeerRegionsForRemotePeeringResponse responseWrapper = + builder.build(); + + return responseWrapper; + } + }; + return transformer; + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/ListRemotePeeringConnectionsConverter.java b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/ListRemotePeeringConnectionsConverter.java new file mode 100644 index 00000000000..cf7f7b17baa --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/ListRemotePeeringConnectionsConverter.java @@ -0,0 +1,140 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.internal.http; + +import com.oracle.bmc.core.model.*; +import com.oracle.bmc.core.requests.*; +import com.oracle.bmc.core.responses.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.extern.slf4j.Slf4j +public class ListRemotePeeringConnectionsConverter { + private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory + RESPONSE_CONVERSION_FACTORY = + new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory(); + + public static ListRemotePeeringConnectionsRequest interceptRequest( + ListRemotePeeringConnectionsRequest request) { + + return request; + } + + public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest( + com.oracle.bmc.http.internal.RestClient client, + ListRemotePeeringConnectionsRequest request) { + if (request == null) { + throw new NullPointerException("request instance is required"); + } + + if (request.getCompartmentId() == null) { + throw new NullPointerException("compartmentId is required"); + } + + com.oracle.bmc.http.internal.WrappedWebTarget target = + client.getBaseTarget().path("/20160918").path("remotePeeringConnections"); + + target = + target.queryParam( + "compartmentId", + com.oracle.bmc.util.internal.HttpUtils.attemptEncodeQueryParam( + request.getCompartmentId())); + + if (request.getDrgId() != null) { + target = + target.queryParam( + "drgId", + com.oracle.bmc.util.internal.HttpUtils.attemptEncodeQueryParam( + request.getDrgId())); + } + + 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); + + return ib; + } + + public static com.google.common.base.Function< + javax.ws.rs.core.Response, ListRemotePeeringConnectionsResponse> + fromResponse() { + final com.google.common.base.Function< + javax.ws.rs.core.Response, ListRemotePeeringConnectionsResponse> + transformer = + new com.google.common.base.Function< + javax.ws.rs.core.Response, ListRemotePeeringConnectionsResponse>() { + @Override + public ListRemotePeeringConnectionsResponse apply( + javax.ws.rs.core.Response rawResponse) { + LOG.trace( + "Transform function invoked for ListRemotePeeringConnectionsResponse"); + 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< + RemotePeeringConnection>>() {}); + + com.oracle.bmc.http.internal.WithHeaders< + java.util.List> + response = responseFn.apply(rawResponse); + javax.ws.rs.core.MultivaluedMap headers = + response.getHeaders(); + + ListRemotePeeringConnectionsResponse.Builder builder = + ListRemotePeeringConnectionsResponse.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)); + } + + ListRemotePeeringConnectionsResponse responseWrapper = + builder.build(); + + return responseWrapper; + } + }; + return transformer; + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/UpdateRemotePeeringConnectionConverter.java b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/UpdateRemotePeeringConnectionConverter.java new file mode 100644 index 00000000000..400dad9d2eb --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/internal/http/UpdateRemotePeeringConnectionConverter.java @@ -0,0 +1,118 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.internal.http; + +import com.oracle.bmc.core.model.*; +import com.oracle.bmc.core.requests.*; +import com.oracle.bmc.core.responses.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.extern.slf4j.Slf4j +public class UpdateRemotePeeringConnectionConverter { + private static final com.oracle.bmc.http.internal.ResponseConversionFunctionFactory + RESPONSE_CONVERSION_FACTORY = + new com.oracle.bmc.http.internal.ResponseConversionFunctionFactory(); + + public static UpdateRemotePeeringConnectionRequest interceptRequest( + UpdateRemotePeeringConnectionRequest request) { + + return request; + } + + public static com.oracle.bmc.http.internal.WrappedInvocationBuilder fromRequest( + com.oracle.bmc.http.internal.RestClient client, + UpdateRemotePeeringConnectionRequest request) { + if (request == null) { + throw new NullPointerException("request instance is required"); + } + + if (request.getRemotePeeringConnectionId() == null) { + throw new NullPointerException("remotePeeringConnectionId is required"); + } + + if (request.getUpdateRemotePeeringConnectionDetails() == null) { + throw new NullPointerException("updateRemotePeeringConnectionDetails is required"); + } + + com.oracle.bmc.http.internal.WrappedWebTarget target = + client.getBaseTarget() + .path("/20160918") + .path("remotePeeringConnections") + .path( + com.oracle.bmc.util.internal.HttpUtils.encodePathSegment( + request.getRemotePeeringConnectionId())); + + com.oracle.bmc.http.internal.WrappedInvocationBuilder ib = target.request(); + + ib.accept(javax.ws.rs.core.MediaType.APPLICATION_JSON); + + if (request.getIfMatch() != null) { + ib.header("if-match", request.getIfMatch()); + } + + return ib; + } + + public static com.google.common.base.Function< + javax.ws.rs.core.Response, UpdateRemotePeeringConnectionResponse> + fromResponse() { + final com.google.common.base.Function< + javax.ws.rs.core.Response, UpdateRemotePeeringConnectionResponse> + transformer = + new com.google.common.base.Function< + javax.ws.rs.core.Response, + UpdateRemotePeeringConnectionResponse>() { + @Override + public UpdateRemotePeeringConnectionResponse apply( + javax.ws.rs.core.Response rawResponse) { + LOG.trace( + "Transform function invoked for UpdateRemotePeeringConnectionResponse"); + com.google.common.base.Function< + javax.ws.rs.core.Response, + com.oracle.bmc.http.internal.WithHeaders< + RemotePeeringConnection>> + responseFn = + RESPONSE_CONVERSION_FACTORY.create( + RemotePeeringConnection.class); + + com.oracle.bmc.http.internal.WithHeaders + response = responseFn.apply(rawResponse); + javax.ws.rs.core.MultivaluedMap headers = + response.getHeaders(); + + UpdateRemotePeeringConnectionResponse.Builder builder = + UpdateRemotePeeringConnectionResponse.builder(); + + builder.remotePeeringConnection(response.getItem()); + + com.google.common.base.Optional> etagHeader = + com.oracle.bmc.http.internal.HeaderUtils.get( + headers, "etag"); + if (etagHeader.isPresent()) { + builder.etag( + com.oracle.bmc.http.internal.HeaderUtils.toValue( + "etag", etagHeader.get().get(0), String.class)); + } + + com.google.common.base.Optional> + opcRequestIdHeader = + com.oracle.bmc.http.internal.HeaderUtils.get( + headers, "opc-request-id"); + if (opcRequestIdHeader.isPresent()) { + builder.opcRequestId( + com.oracle.bmc.http.internal.HeaderUtils.toValue( + "opc-request-id", + opcRequestIdHeader.get().get(0), + String.class)); + } + + UpdateRemotePeeringConnectionResponse responseWrapper = + builder.build(); + + return responseWrapper; + } + }; + return transformer; + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/ConnectRemotePeeringConnectionsDetails.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/ConnectRemotePeeringConnectionsDetails.java new file mode 100644 index 00000000000..abd5c869189 --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/ConnectRemotePeeringConnectionsDetails.java @@ -0,0 +1,87 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.model; + +/** + * Information about the other remote peering connection (RPC). + *
+ * 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: 20160918") +@lombok.Value +@com.fasterxml.jackson.databind.annotation.JsonDeserialize( + builder = ConnectRemotePeeringConnectionsDetails.Builder.class +) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class ConnectRemotePeeringConnectionsDetails { + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") + @lombok.experimental.Accessors(fluent = true) + public static class Builder { + @com.fasterxml.jackson.annotation.JsonProperty("peerId") + private String peerId; + + public Builder peerId(String peerId) { + this.peerId = peerId; + this.__explicitlySet__.add("peerId"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("peerRegionName") + private String peerRegionName; + + public Builder peerRegionName(String peerRegionName) { + this.peerRegionName = peerRegionName; + this.__explicitlySet__.add("peerRegionName"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); + + public ConnectRemotePeeringConnectionsDetails build() { + ConnectRemotePeeringConnectionsDetails __instance__ = + new ConnectRemotePeeringConnectionsDetails(peerId, peerRegionName); + __instance__.__explicitlySet__.addAll(__explicitlySet__); + return __instance__; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + public Builder copy(ConnectRemotePeeringConnectionsDetails o) { + Builder copiedBuilder = peerId(o.getPeerId()).peerRegionName(o.getPeerRegionName()); + + copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); + return copiedBuilder; + } + } + + /** + * Create a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * The OCID of the RPC you want to peer with. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("peerId") + String peerId; + + /** + * The name of the region that contains the RPC you want to peer with. + *

+ * Example: `us-ashburn-1` + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("peerRegionName") + String peerRegionName; + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/CreateRemotePeeringConnectionDetails.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/CreateRemotePeeringConnectionDetails.java new file mode 100644 index 00000000000..7bc3b614d05 --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/CreateRemotePeeringConnectionDetails.java @@ -0,0 +1,104 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.model; + +/** + * + *
+ * 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: 20160918") +@lombok.Value +@com.fasterxml.jackson.databind.annotation.JsonDeserialize( + builder = CreateRemotePeeringConnectionDetails.Builder.class +) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class CreateRemotePeeringConnectionDetails { + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") + @lombok.experimental.Accessors(fluent = true) + public static class Builder { + @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("displayName") + private String displayName; + + public Builder displayName(String displayName) { + this.displayName = displayName; + this.__explicitlySet__.add("displayName"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("drgId") + private String drgId; + + public Builder drgId(String drgId) { + this.drgId = drgId; + this.__explicitlySet__.add("drgId"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); + + public CreateRemotePeeringConnectionDetails build() { + CreateRemotePeeringConnectionDetails __instance__ = + new CreateRemotePeeringConnectionDetails(compartmentId, displayName, drgId); + __instance__.__explicitlySet__.addAll(__explicitlySet__); + return __instance__; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + public Builder copy(CreateRemotePeeringConnectionDetails o) { + Builder copiedBuilder = + compartmentId(o.getCompartmentId()) + .displayName(o.getDisplayName()) + .drgId(o.getDrgId()); + + copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); + return copiedBuilder; + } + } + + /** + * Create a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * The OCID of the compartment to contain the RPC. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("compartmentId") + String compartmentId; + + /** + * A user-friendly name. Does not have to be unique, and it's changeable. + * Avoid entering confidential information. + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("displayName") + String displayName; + + /** + * The OCID of the DRG the RPC belongs to. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("drgId") + String drgId; + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/PeerRegionForRemotePeering.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/PeerRegionForRemotePeering.java new file mode 100644 index 00000000000..e4046a5cd2d --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/PeerRegionForRemotePeering.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.model; + +/** + * Details about a region that supports remote VCN peering. For more information, see [VCN Peering](https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/VCNpeering.htm). + *
+ * 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: 20160918") +@lombok.Value +@com.fasterxml.jackson.databind.annotation.JsonDeserialize( + builder = PeerRegionForRemotePeering.Builder.class +) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class PeerRegionForRemotePeering { + @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.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); + + public PeerRegionForRemotePeering build() { + PeerRegionForRemotePeering __instance__ = new PeerRegionForRemotePeering(name); + __instance__.__explicitlySet__.addAll(__explicitlySet__); + return __instance__; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + public Builder copy(PeerRegionForRemotePeering o) { + Builder copiedBuilder = name(o.getName()); + + copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); + return copiedBuilder; + } + } + + /** + * Create a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * The region's name. + *

+ * Example: `us-phoenix-1` + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("name") + String name; + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/RemotePeeringConnection.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/RemotePeeringConnection.java new file mode 100644 index 00000000000..058b300dc6f --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/RemotePeeringConnection.java @@ -0,0 +1,364 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.model; + +/** + * A remote peering connection (RPC) is an object on a DRG that lets the VCN that is attached + * to the DRG peer with a VCN in a different region. *Peering* means that the two VCNs can + * communicate using private IP addresses, but without the traffic traversing the internet or + * routing through your on-premises network. For more information, see + * [VCN Peering](https://docs.us-phoenix-1.oraclecloud.com/Content/Network/Tasks/VCNpeering.htm). + *

+ * To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, + * talk to an administrator. If you're an administrator who needs to write policies to give users access, see + * [Getting Started with Policies](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). + * + *
+ * 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: 20160918") +@lombok.Value +@com.fasterxml.jackson.databind.annotation.JsonDeserialize( + builder = RemotePeeringConnection.Builder.class +) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class RemotePeeringConnection { + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") + @lombok.experimental.Accessors(fluent = true) + public static class Builder { + @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("displayName") + private String displayName; + + public Builder displayName(String displayName) { + this.displayName = displayName; + this.__explicitlySet__.add("displayName"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("drgId") + private String drgId; + + public Builder drgId(String drgId) { + this.drgId = drgId; + this.__explicitlySet__.add("drgId"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("id") + private String id; + + public Builder id(String id) { + this.id = id; + this.__explicitlySet__.add("id"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("isCrossTenancyPeering") + private Boolean isCrossTenancyPeering; + + public Builder isCrossTenancyPeering(Boolean isCrossTenancyPeering) { + this.isCrossTenancyPeering = isCrossTenancyPeering; + this.__explicitlySet__.add("isCrossTenancyPeering"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("lifecycleState") + private LifecycleState lifecycleState; + + public Builder lifecycleState(LifecycleState lifecycleState) { + this.lifecycleState = lifecycleState; + this.__explicitlySet__.add("lifecycleState"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("peerId") + private String peerId; + + public Builder peerId(String peerId) { + this.peerId = peerId; + this.__explicitlySet__.add("peerId"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("peerRegionName") + private String peerRegionName; + + public Builder peerRegionName(String peerRegionName) { + this.peerRegionName = peerRegionName; + this.__explicitlySet__.add("peerRegionName"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("peerTenancyId") + private String peerTenancyId; + + public Builder peerTenancyId(String peerTenancyId) { + this.peerTenancyId = peerTenancyId; + this.__explicitlySet__.add("peerTenancyId"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("peeringStatus") + private PeeringStatus peeringStatus; + + public Builder peeringStatus(PeeringStatus peeringStatus) { + this.peeringStatus = peeringStatus; + this.__explicitlySet__.add("peeringStatus"); + 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.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); + + public RemotePeeringConnection build() { + RemotePeeringConnection __instance__ = + new RemotePeeringConnection( + compartmentId, + displayName, + drgId, + id, + isCrossTenancyPeering, + lifecycleState, + peerId, + peerRegionName, + peerTenancyId, + peeringStatus, + timeCreated); + __instance__.__explicitlySet__.addAll(__explicitlySet__); + return __instance__; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + public Builder copy(RemotePeeringConnection o) { + Builder copiedBuilder = + compartmentId(o.getCompartmentId()) + .displayName(o.getDisplayName()) + .drgId(o.getDrgId()) + .id(o.getId()) + .isCrossTenancyPeering(o.getIsCrossTenancyPeering()) + .lifecycleState(o.getLifecycleState()) + .peerId(o.getPeerId()) + .peerRegionName(o.getPeerRegionName()) + .peerTenancyId(o.getPeerTenancyId()) + .peeringStatus(o.getPeeringStatus()) + .timeCreated(o.getTimeCreated()); + + copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); + return copiedBuilder; + } + } + + /** + * Create a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * The OCID of the compartment that contains the RPC. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("compartmentId") + String compartmentId; + + /** + * A user-friendly name. Does not have to be unique, and it's changeable. + * Avoid entering confidential information. + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("displayName") + String displayName; + + /** + * The OCID of the DRG that this RPC belongs to. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("drgId") + String drgId; + + /** + * The OCID of the RPC. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("id") + String id; + + /** + * Whether the VCN at the other end of the peering is in a different tenancy. + *

+ * Example: `false` + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("isCrossTenancyPeering") + Boolean isCrossTenancyPeering; + /** + * The RPC's current lifecycle state. + **/ + @lombok.extern.slf4j.Slf4j + public enum LifecycleState { + Available("AVAILABLE"), + Provisioning("PROVISIONING"), + Terminating("TERMINATING"), + Terminated("TERMINATED"), + + /** + * 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 (LifecycleState v : LifecycleState.values()) { + if (v != UnknownEnumValue) { + map.put(v.getValue(), v); + } + } + } + + LifecycleState(String value) { + this.value = value; + } + + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { + return value; + } + + @com.fasterxml.jackson.annotation.JsonCreator + public static LifecycleState create(String key) { + if (map.containsKey(key)) { + return map.get(key); + } + LOG.warn( + "Received unknown value '{}' for enum 'LifecycleState', returning UnknownEnumValue", + key); + return UnknownEnumValue; + } + }; + /** + * The RPC's current lifecycle state. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("lifecycleState") + LifecycleState lifecycleState; + + /** + * If this RPC is peered, this value is the OCID of the other RPC. + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("peerId") + String peerId; + + /** + * If this RPC is peered, this value is the region that contains the other RPC. + *

+ * Example: `us-ashburn-1` + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("peerRegionName") + String peerRegionName; + + /** + * If this RPC is peered, this value is the OCID of the other RPC's tenancy. + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("peerTenancyId") + String peerTenancyId; + /** + * Whether the RPC is peered with another RPC. `NEW` means the RPC has not yet been + * peered. `PENDING` means the peering is being established. `REVOKED` means the + * RPC at the other end of the peering has been deleted. + * + **/ + @lombok.extern.slf4j.Slf4j + public enum PeeringStatus { + Invalid("INVALID"), + New("NEW"), + Pending("PENDING"), + Peered("PEERED"), + Revoked("REVOKED"), + + /** + * 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 (PeeringStatus v : PeeringStatus.values()) { + if (v != UnknownEnumValue) { + map.put(v.getValue(), v); + } + } + } + + PeeringStatus(String value) { + this.value = value; + } + + @com.fasterxml.jackson.annotation.JsonValue + public String getValue() { + return value; + } + + @com.fasterxml.jackson.annotation.JsonCreator + public static PeeringStatus create(String key) { + if (map.containsKey(key)) { + return map.get(key); + } + LOG.warn( + "Received unknown value '{}' for enum 'PeeringStatus', returning UnknownEnumValue", + key); + return UnknownEnumValue; + } + }; + /** + * Whether the RPC is peered with another RPC. `NEW` means the RPC has not yet been + * peered. `PENDING` means the peering is being established. `REVOKED` means the + * RPC at the other end of the peering has been deleted. + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("peeringStatus") + PeeringStatus peeringStatus; + + /** + * The date and time the RPC was created, in the format defined by RFC3339. + *

+ * Example: `2016-08-25T21:10:29.600Z` + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("timeCreated") + java.util.Date timeCreated; + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/model/UpdateRemotePeeringConnectionDetails.java b/bmc-core/src/main/java/com/oracle/bmc/core/model/UpdateRemotePeeringConnectionDetails.java new file mode 100644 index 00000000000..de98ff00b75 --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/model/UpdateRemotePeeringConnectionDetails.java @@ -0,0 +1,71 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.model; + +/** + * + *
+ * 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: 20160918") +@lombok.Value +@com.fasterxml.jackson.databind.annotation.JsonDeserialize( + builder = UpdateRemotePeeringConnectionDetails.Builder.class +) +@com.fasterxml.jackson.annotation.JsonFilter(com.oracle.bmc.http.internal.ExplicitlySetFilter.NAME) +public class UpdateRemotePeeringConnectionDetails { + @com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(withPrefix = "") + @lombok.experimental.Accessors(fluent = true) + public static class Builder { + @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.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); + + public UpdateRemotePeeringConnectionDetails build() { + UpdateRemotePeeringConnectionDetails __instance__ = + new UpdateRemotePeeringConnectionDetails(displayName); + __instance__.__explicitlySet__.addAll(__explicitlySet__); + return __instance__; + } + + @com.fasterxml.jackson.annotation.JsonIgnore + public Builder copy(UpdateRemotePeeringConnectionDetails o) { + Builder copiedBuilder = displayName(o.getDisplayName()); + + copiedBuilder.__explicitlySet__.retainAll(o.__explicitlySet__); + return copiedBuilder; + } + } + + /** + * Create a new builder. + */ + public static Builder builder() { + return new Builder(); + } + + /** + * A user-friendly name. Does not have to be unique, and it's changeable. + * Avoid entering confidential information. + * + **/ + @com.fasterxml.jackson.annotation.JsonProperty("displayName") + String displayName; + + @com.fasterxml.jackson.annotation.JsonIgnore + private final java.util.Set __explicitlySet__ = new java.util.HashSet(); +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/requests/ConnectRemotePeeringConnectionsRequest.java b/bmc-core/src/main/java/com/oracle/bmc/core/requests/ConnectRemotePeeringConnectionsRequest.java new file mode 100644 index 00000000000..df1091424fd --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/requests/ConnectRemotePeeringConnectionsRequest.java @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.requests; + +import com.oracle.bmc.core.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback") +@lombok.Getter +public class ConnectRemotePeeringConnectionsRequest extends com.oracle.bmc.requests.BmcRequest { + + /** + * The OCID of the remote peering connection (RPC). + */ + private String remotePeeringConnectionId; + + /** + * Details to connect peering connection with peering connection from remote region + */ + private ConnectRemotePeeringConnectionsDetails connectRemotePeeringConnectionsDetails; + + 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(ConnectRemotePeeringConnectionsRequest o) { + remotePeeringConnectionId(o.getRemotePeeringConnectionId()); + connectRemotePeeringConnectionsDetails(o.getConnectRemotePeeringConnectionsDetails()); + return this; + } + + /** + * Build the instance of ConnectRemotePeeringConnectionsRequest 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 ConnectRemotePeeringConnectionsRequest + */ + public ConnectRemotePeeringConnectionsRequest build() { + ConnectRemotePeeringConnectionsRequest request = buildWithoutInvocationCallback(); + request.setInvocationCallback(invocationCallback); + return request; + } + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/requests/CreateRemotePeeringConnectionRequest.java b/bmc-core/src/main/java/com/oracle/bmc/core/requests/CreateRemotePeeringConnectionRequest.java new file mode 100644 index 00000000000..1da068098a8 --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/requests/CreateRemotePeeringConnectionRequest.java @@ -0,0 +1,70 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.requests; + +import com.oracle.bmc.core.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback") +@lombok.Getter +public class CreateRemotePeeringConnectionRequest extends com.oracle.bmc.requests.BmcRequest { + + /** + * Request to create peering connection to remote region + */ + private CreateRemotePeeringConnectionDetails createRemotePeeringConnectionDetails; + + /** + * A token that uniquely identifies a request so it can be retried in case of a timeout or + * server error without risk of executing that same action again. Retry tokens expire after 24 + * hours, but can be invalidated before then due to conflicting operations (for example, if a resource + * has been deleted and purged from the system, then a retry of the original creation request + * may be rejected). + * + */ + private String opcRetryToken; + + 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(CreateRemotePeeringConnectionRequest o) { + createRemotePeeringConnectionDetails(o.getCreateRemotePeeringConnectionDetails()); + opcRetryToken(o.getOpcRetryToken()); + return this; + } + + /** + * Build the instance of CreateRemotePeeringConnectionRequest 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 CreateRemotePeeringConnectionRequest + */ + public CreateRemotePeeringConnectionRequest build() { + CreateRemotePeeringConnectionRequest request = buildWithoutInvocationCallback(); + request.setInvocationCallback(invocationCallback); + return request; + } + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/requests/DeleteRemotePeeringConnectionRequest.java b/bmc-core/src/main/java/com/oracle/bmc/core/requests/DeleteRemotePeeringConnectionRequest.java new file mode 100644 index 00000000000..5453cc33c0b --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/requests/DeleteRemotePeeringConnectionRequest.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.requests; + +import com.oracle.bmc.core.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback") +@lombok.Getter +public class DeleteRemotePeeringConnectionRequest extends com.oracle.bmc.requests.BmcRequest { + + /** + * The OCID of the remote peering connection (RPC). + */ + private String remotePeeringConnectionId; + + /** + * For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + * parameter to the value of the etag from a previous GET or POST response for that resource. The resource + * will be updated or deleted only if the etag you provide matches the resource's current etag value. + * + */ + private String ifMatch; + + public static class Builder { + private com.oracle.bmc.util.internal.Consumer + invocationCallback = null; + + /** + * Set the invocation callback for the request to be built. + * @param invocationCallback the invocation callback to be set for the request + * @return this builder instance + */ + public Builder invocationCallback( + com.oracle.bmc.util.internal.Consumer + invocationCallback) { + this.invocationCallback = invocationCallback; + return this; + } + + /** + * Copy method to populate the builder with values from the given instance. + * @return this builder instance + */ + public Builder copy(DeleteRemotePeeringConnectionRequest o) { + remotePeeringConnectionId(o.getRemotePeeringConnectionId()); + ifMatch(o.getIfMatch()); + return this; + } + + /** + * Build the instance of DeleteRemotePeeringConnectionRequest 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 DeleteRemotePeeringConnectionRequest + */ + public DeleteRemotePeeringConnectionRequest build() { + DeleteRemotePeeringConnectionRequest request = buildWithoutInvocationCallback(); + request.setInvocationCallback(invocationCallback); + return request; + } + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/requests/GetRemotePeeringConnectionRequest.java b/bmc-core/src/main/java/com/oracle/bmc/core/requests/GetRemotePeeringConnectionRequest.java new file mode 100644 index 00000000000..6f4efe2965f --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/requests/GetRemotePeeringConnectionRequest.java @@ -0,0 +1,59 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.requests; + +import com.oracle.bmc.core.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback") +@lombok.Getter +public class GetRemotePeeringConnectionRequest extends com.oracle.bmc.requests.BmcRequest { + + /** + * The OCID of the remote peering connection (RPC). + */ + private String remotePeeringConnectionId; + + 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(GetRemotePeeringConnectionRequest o) { + remotePeeringConnectionId(o.getRemotePeeringConnectionId()); + return this; + } + + /** + * Build the instance of GetRemotePeeringConnectionRequest 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 GetRemotePeeringConnectionRequest + */ + public GetRemotePeeringConnectionRequest build() { + GetRemotePeeringConnectionRequest request = buildWithoutInvocationCallback(); + request.setInvocationCallback(invocationCallback); + return request; + } + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/requests/ListAllowedPeerRegionsForRemotePeeringRequest.java b/bmc-core/src/main/java/com/oracle/bmc/core/requests/ListAllowedPeerRegionsForRemotePeeringRequest.java new file mode 100644 index 00000000000..f0144ea8f0c --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/requests/ListAllowedPeerRegionsForRemotePeeringRequest.java @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.requests; + +import com.oracle.bmc.core.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback") +@lombok.Getter +public class ListAllowedPeerRegionsForRemotePeeringRequest + extends com.oracle.bmc.requests.BmcRequest { + + 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(ListAllowedPeerRegionsForRemotePeeringRequest o) { + + return this; + } + + /** + * Build the instance of ListAllowedPeerRegionsForRemotePeeringRequest 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 ListAllowedPeerRegionsForRemotePeeringRequest + */ + public ListAllowedPeerRegionsForRemotePeeringRequest build() { + ListAllowedPeerRegionsForRemotePeeringRequest request = + buildWithoutInvocationCallback(); + request.setInvocationCallback(invocationCallback); + return request; + } + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/requests/ListRemotePeeringConnectionsRequest.java b/bmc-core/src/main/java/com/oracle/bmc/core/requests/ListRemotePeeringConnectionsRequest.java new file mode 100644 index 00000000000..7bb2a536b61 --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/requests/ListRemotePeeringConnectionsRequest.java @@ -0,0 +1,81 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.requests; + +import com.oracle.bmc.core.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback") +@lombok.Getter +public class ListRemotePeeringConnectionsRequest extends com.oracle.bmc.requests.BmcRequest { + + /** + * The OCID of the compartment. + */ + private String compartmentId; + + /** + * The OCID of the DRG. + */ + private String drgId; + + /** + * The maximum number of items to return in a paginated \"List\" call. + *

+ * Example: `500` + * + */ + private Integer limit; + + /** + * The value of the `opc-next-page` response header from the previous \"List\" call. + * + */ + private String page; + + 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(ListRemotePeeringConnectionsRequest o) { + compartmentId(o.getCompartmentId()); + drgId(o.getDrgId()); + limit(o.getLimit()); + page(o.getPage()); + return this; + } + + /** + * Build the instance of ListRemotePeeringConnectionsRequest 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 ListRemotePeeringConnectionsRequest + */ + public ListRemotePeeringConnectionsRequest build() { + ListRemotePeeringConnectionsRequest request = buildWithoutInvocationCallback(); + request.setInvocationCallback(invocationCallback); + return request; + } + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/requests/UpdateRemotePeeringConnectionRequest.java b/bmc-core/src/main/java/com/oracle/bmc/core/requests/UpdateRemotePeeringConnectionRequest.java new file mode 100644 index 00000000000..a91bb9aadfc --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/requests/UpdateRemotePeeringConnectionRequest.java @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.requests; + +import com.oracle.bmc.core.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.Builder(builderClassName = "Builder", buildMethodName = "buildWithoutInvocationCallback") +@lombok.Getter +public class UpdateRemotePeeringConnectionRequest extends com.oracle.bmc.requests.BmcRequest { + + /** + * The OCID of the remote peering connection (RPC). + */ + private String remotePeeringConnectionId; + + /** + * Request to the update the peering connection to remote region + */ + private UpdateRemotePeeringConnectionDetails updateRemotePeeringConnectionDetails; + + /** + * For optimistic concurrency control. In the PUT or DELETE call for a resource, set the `if-match` + * parameter to the value of the etag from a previous GET or POST response for that resource. The resource + * will be updated or deleted only if the etag you provide matches the resource's current etag value. + * + */ + private String ifMatch; + + public static class Builder { + private com.oracle.bmc.util.internal.Consumer + invocationCallback = null; + + /** + * Set the invocation callback for the request to be built. + * @param invocationCallback the invocation callback to be set for the request + * @return this builder instance + */ + public Builder invocationCallback( + com.oracle.bmc.util.internal.Consumer + invocationCallback) { + this.invocationCallback = invocationCallback; + return this; + } + + /** + * Copy method to populate the builder with values from the given instance. + * @return this builder instance + */ + public Builder copy(UpdateRemotePeeringConnectionRequest o) { + remotePeeringConnectionId(o.getRemotePeeringConnectionId()); + updateRemotePeeringConnectionDetails(o.getUpdateRemotePeeringConnectionDetails()); + ifMatch(o.getIfMatch()); + return this; + } + + /** + * Build the instance of UpdateRemotePeeringConnectionRequest 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 UpdateRemotePeeringConnectionRequest + */ + public UpdateRemotePeeringConnectionRequest build() { + UpdateRemotePeeringConnectionRequest request = buildWithoutInvocationCallback(); + request.setInvocationCallback(invocationCallback); + return request; + } + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/responses/ConnectRemotePeeringConnectionsResponse.java b/bmc-core/src/main/java/com/oracle/bmc/core/responses/ConnectRemotePeeringConnectionsResponse.java new file mode 100644 index 00000000000..2fdba37fe56 --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/responses/ConnectRemotePeeringConnectionsResponse.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.responses; + +import com.oracle.bmc.core.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.Builder(builderClassName = "Builder") +@lombok.Getter +public class ConnectRemotePeeringConnectionsResponse { + + /** + * Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + * a particular request, please provide the request ID. + * + */ + private String opcRequestId; + + public static class Builder { + /** + * Copy method to populate the builder with values from the given instance. + * @return this builder instance + */ + public Builder copy(ConnectRemotePeeringConnectionsResponse o) { + opcRequestId(o.getOpcRequestId()); + + return this; + } + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/responses/CreateRemotePeeringConnectionResponse.java b/bmc-core/src/main/java/com/oracle/bmc/core/responses/CreateRemotePeeringConnectionResponse.java new file mode 100644 index 00000000000..ee129ac75b2 --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/responses/CreateRemotePeeringConnectionResponse.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.responses; + +import com.oracle.bmc.core.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.Builder(builderClassName = "Builder") +@lombok.Getter +public class CreateRemotePeeringConnectionResponse { + + /** + * For optimistic concurrency control. See `if-match`. + */ + private String etag; + + /** + * Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + * a particular request, please provide the request ID. + * + */ + private String opcRequestId; + + /** + * The returned RemotePeeringConnection instance. + */ + private RemotePeeringConnection remotePeeringConnection; + + public static class Builder { + /** + * Copy method to populate the builder with values from the given instance. + * @return this builder instance + */ + public Builder copy(CreateRemotePeeringConnectionResponse o) { + etag(o.getEtag()); + opcRequestId(o.getOpcRequestId()); + remotePeeringConnection(o.getRemotePeeringConnection()); + + return this; + } + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/responses/DeleteRemotePeeringConnectionResponse.java b/bmc-core/src/main/java/com/oracle/bmc/core/responses/DeleteRemotePeeringConnectionResponse.java new file mode 100644 index 00000000000..92bb051b512 --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/responses/DeleteRemotePeeringConnectionResponse.java @@ -0,0 +1,31 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.responses; + +import com.oracle.bmc.core.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.Builder(builderClassName = "Builder") +@lombok.Getter +public class DeleteRemotePeeringConnectionResponse { + + /** + * Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + * a particular request, please provide the request ID. + * + */ + private String opcRequestId; + + public static class Builder { + /** + * Copy method to populate the builder with values from the given instance. + * @return this builder instance + */ + public Builder copy(DeleteRemotePeeringConnectionResponse o) { + opcRequestId(o.getOpcRequestId()); + + return this; + } + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/responses/GetRemotePeeringConnectionResponse.java b/bmc-core/src/main/java/com/oracle/bmc/core/responses/GetRemotePeeringConnectionResponse.java new file mode 100644 index 00000000000..cd9a5b7a725 --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/responses/GetRemotePeeringConnectionResponse.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.responses; + +import com.oracle.bmc.core.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.Builder(builderClassName = "Builder") +@lombok.Getter +public class GetRemotePeeringConnectionResponse { + + /** + * For optimistic concurrency control. See `if-match`. + */ + private String etag; + + /** + * Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + * a particular request, please provide the request ID. + * + */ + private String opcRequestId; + + /** + * The returned RemotePeeringConnection instance. + */ + private RemotePeeringConnection remotePeeringConnection; + + public static class Builder { + /** + * Copy method to populate the builder with values from the given instance. + * @return this builder instance + */ + public Builder copy(GetRemotePeeringConnectionResponse o) { + etag(o.getEtag()); + opcRequestId(o.getOpcRequestId()); + remotePeeringConnection(o.getRemotePeeringConnection()); + + return this; + } + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/responses/ListAllowedPeerRegionsForRemotePeeringResponse.java b/bmc-core/src/main/java/com/oracle/bmc/core/responses/ListAllowedPeerRegionsForRemotePeeringResponse.java new file mode 100644 index 00000000000..f59537bcf2a --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/responses/ListAllowedPeerRegionsForRemotePeeringResponse.java @@ -0,0 +1,37 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.responses; + +import com.oracle.bmc.core.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.Builder(builderClassName = "Builder") +@lombok.Getter +public class ListAllowedPeerRegionsForRemotePeeringResponse { + + /** + * 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 PeerRegionForRemotePeering 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(ListAllowedPeerRegionsForRemotePeeringResponse o) { + opcRequestId(o.getOpcRequestId()); + items(o.getItems()); + + return this; + } + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/responses/ListRemotePeeringConnectionsResponse.java b/bmc-core/src/main/java/com/oracle/bmc/core/responses/ListRemotePeeringConnectionsResponse.java new file mode 100644 index 00000000000..5897138921f --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/responses/ListRemotePeeringConnectionsResponse.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.responses; + +import com.oracle.bmc.core.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.Builder(builderClassName = "Builder") +@lombok.Getter +public class ListRemotePeeringConnectionsResponse { + + /** + * A pagination token to the start of the next page, if one exist. + */ + 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 RemotePeeringConnection 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(ListRemotePeeringConnectionsResponse o) { + opcNextPage(o.getOpcNextPage()); + opcRequestId(o.getOpcRequestId()); + items(o.getItems()); + + return this; + } + } +} diff --git a/bmc-core/src/main/java/com/oracle/bmc/core/responses/UpdateRemotePeeringConnectionResponse.java b/bmc-core/src/main/java/com/oracle/bmc/core/responses/UpdateRemotePeeringConnectionResponse.java new file mode 100644 index 00000000000..e86f25215f2 --- /dev/null +++ b/bmc-core/src/main/java/com/oracle/bmc/core/responses/UpdateRemotePeeringConnectionResponse.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +package com.oracle.bmc.core.responses; + +import com.oracle.bmc.core.model.*; + +@javax.annotation.Generated(value = "OracleSDKGenerator", comments = "API Version: 20160918") +@lombok.Builder(builderClassName = "Builder") +@lombok.Getter +public class UpdateRemotePeeringConnectionResponse { + + /** + * For optimistic concurrency control. See `if-match`. + */ + private String etag; + + /** + * Unique Oracle-assigned identifier for the request. If you need to contact Oracle about + * a particular request, please provide the request ID. + * + */ + private String opcRequestId; + + /** + * The returned RemotePeeringConnection instance. + */ + private RemotePeeringConnection remotePeeringConnection; + + public static class Builder { + /** + * Copy method to populate the builder with values from the given instance. + * @return this builder instance + */ + public Builder copy(UpdateRemotePeeringConnectionResponse o) { + etag(o.getEtag()); + opcRequestId(o.getOpcRequestId()); + remotePeeringConnection(o.getRemotePeeringConnection()); + + return this; + } + } +} diff --git a/bmc-database/pom.xml b/bmc-database/pom.xml index c98bca0077e..f47c7bbcac7 100644 --- a/bmc-database/pom.xml +++ b/bmc-database/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.29 + 1.2.33 ../pom.xml @@ -18,7 +18,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.29 + 1.2.33 diff --git a/bmc-database/src/main/java/com/oracle/bmc/database/DatabaseAsyncClient.java b/bmc-database/src/main/java/com/oracle/bmc/database/DatabaseAsyncClient.java index a0145e5b779..5f3e03bf26d 100644 --- a/bmc-database/src/main/java/com/oracle/bmc/database/DatabaseAsyncClient.java +++ b/bmc-database/src/main/java/com/oracle/bmc/database/DatabaseAsyncClient.java @@ -102,6 +102,34 @@ public DatabaseAsyncClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 DatabaseAsyncClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -119,8 +147,17 @@ public DatabaseAsyncClient( 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); + } } /** @@ -143,6 +180,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -207,6 +245,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Build the client, with the authentication details provider. * @param authenticationDetailsProvider authentication details provider @@ -221,7 +304,8 @@ public DatabaseAsyncClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-database/src/main/java/com/oracle/bmc/database/DatabaseClient.java b/bmc-database/src/main/java/com/oracle/bmc/database/DatabaseClient.java index 5eeb912da4c..04ea2006be7 100644 --- a/bmc-database/src/main/java/com/oracle/bmc/database/DatabaseClient.java +++ b/bmc-database/src/main/java/com/oracle/bmc/database/DatabaseClient.java @@ -107,6 +107,34 @@ public DatabaseClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 DatabaseClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -141,8 +169,17 @@ public DatabaseClient( 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); + } } /** @@ -165,6 +202,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -229,6 +267,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Set the authentication details provider. Once this is called, the builder can build the client. * @param authenticationDetailsProvider authentication details provider @@ -243,7 +326,8 @@ public DatabaseClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-database/src/main/java/com/oracle/bmc/database/model/DbSystem.java b/bmc-database/src/main/java/com/oracle/bmc/database/model/DbSystem.java index 917923d2bd3..0ecde3738ee 100644 --- a/bmc-database/src/main/java/com/oracle/bmc/database/model/DbSystem.java +++ b/bmc-database/src/main/java/com/oracle/bmc/database/model/DbSystem.java @@ -7,7 +7,7 @@ * The Database Service supports several types of DB Systems, ranging in size, price, and performance. For details about each type of system, see: *

* - [Exadata DB Systems](https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Concepts/exaoverview.htm) - * - [Bare Metal or VM DB Systems](https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Concepts/overview.htm) + * - [Bare Metal and Virtual Machine DB Systems](https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Concepts/overview.htm) *

* To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see [Getting Started with Policies](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). * diff --git a/bmc-database/src/main/java/com/oracle/bmc/database/model/DbSystemShapeSummary.java b/bmc-database/src/main/java/com/oracle/bmc/database/model/DbSystemShapeSummary.java index 6561b01063b..24a809c07a9 100644 --- a/bmc-database/src/main/java/com/oracle/bmc/database/model/DbSystemShapeSummary.java +++ b/bmc-database/src/main/java/com/oracle/bmc/database/model/DbSystemShapeSummary.java @@ -37,6 +37,42 @@ public Builder availableCoreCount(Integer availableCoreCount) { return this; } + @com.fasterxml.jackson.annotation.JsonProperty("coreCountIncrement") + private Integer coreCountIncrement; + + public Builder coreCountIncrement(Integer coreCountIncrement) { + this.coreCountIncrement = coreCountIncrement; + this.__explicitlySet__.add("coreCountIncrement"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("maximumNodeCount") + private Integer maximumNodeCount; + + public Builder maximumNodeCount(Integer maximumNodeCount) { + this.maximumNodeCount = maximumNodeCount; + this.__explicitlySet__.add("maximumNodeCount"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("minimumCoreCount") + private Integer minimumCoreCount; + + public Builder minimumCoreCount(Integer minimumCoreCount) { + this.minimumCoreCount = minimumCoreCount; + this.__explicitlySet__.add("minimumCoreCount"); + return this; + } + + @com.fasterxml.jackson.annotation.JsonProperty("minimumNodeCount") + private Integer minimumNodeCount; + + public Builder minimumNodeCount(Integer minimumNodeCount) { + this.minimumNodeCount = minimumNodeCount; + this.__explicitlySet__.add("minimumNodeCount"); + return this; + } + @com.fasterxml.jackson.annotation.JsonProperty("name") private String name; @@ -60,7 +96,14 @@ public Builder shape(String shape) { public DbSystemShapeSummary build() { DbSystemShapeSummary __instance__ = - new DbSystemShapeSummary(availableCoreCount, name, shape); + new DbSystemShapeSummary( + availableCoreCount, + coreCountIncrement, + maximumNodeCount, + minimumCoreCount, + minimumNodeCount, + name, + shape); __instance__.__explicitlySet__.addAll(__explicitlySet__); return __instance__; } @@ -69,6 +112,10 @@ public DbSystemShapeSummary build() { public Builder copy(DbSystemShapeSummary o) { Builder copiedBuilder = availableCoreCount(o.getAvailableCoreCount()) + .coreCountIncrement(o.getCoreCountIncrement()) + .maximumNodeCount(o.getMaximumNodeCount()) + .minimumCoreCount(o.getMinimumCoreCount()) + .minimumNodeCount(o.getMinimumNodeCount()) .name(o.getName()) .shape(o.getShape()); @@ -85,11 +132,35 @@ public static Builder builder() { } /** - * The maximum number of CPU cores that can be enabled on the DB System. + * The maximum number of CPU cores that can be enabled on the DB System for this shape. **/ @com.fasterxml.jackson.annotation.JsonProperty("availableCoreCount") Integer availableCoreCount; + /** + * The discrete number by which the CPU core count for this shape can be increased or decreased. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("coreCountIncrement") + Integer coreCountIncrement; + + /** + * The maximum number of database nodes available for this shape. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("maximumNodeCount") + Integer maximumNodeCount; + + /** + * The minimum number of CPU cores that can be enabled on the DB System for this shape. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("minimumCoreCount") + Integer minimumCoreCount; + + /** + * The minimum number of database nodes available for this shape. + **/ + @com.fasterxml.jackson.annotation.JsonProperty("minimumNodeCount") + Integer minimumNodeCount; + /** * The name of the shape used for the DB System. **/ diff --git a/bmc-database/src/main/java/com/oracle/bmc/database/model/DbSystemSummary.java b/bmc-database/src/main/java/com/oracle/bmc/database/model/DbSystemSummary.java index bacabb39118..b1f40383d3e 100644 --- a/bmc-database/src/main/java/com/oracle/bmc/database/model/DbSystemSummary.java +++ b/bmc-database/src/main/java/com/oracle/bmc/database/model/DbSystemSummary.java @@ -7,7 +7,7 @@ * The Database Service supports several types of DB Systems, ranging in size, price, and performance. For details about each type of system, see: *

* - [Exadata DB Systems](https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Concepts/exaoverview.htm) - * - [Bare Metal or VM DB Systems](https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Concepts/overview.htm) + * - [Bare Metal and Virtual Machine DB Systems](https://docs.us-phoenix-1.oraclecloud.com/Content/Database/Concepts/overview.htm) *

* To use any of the API operations, you must be authorized in an IAM policy. If you're not authorized, talk to an administrator. If you're an administrator who needs to write policies to give users access, see [Getting Started with Policies](https://docs.us-phoenix-1.oraclecloud.com/Content/Identity/Concepts/policygetstarted.htm). * diff --git a/bmc-dns/pom.xml b/bmc-dns/pom.xml index 6c2dbb322e4..4a3d4879841 100644 --- a/bmc-dns/pom.xml +++ b/bmc-dns/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.29 + 1.2.33 ../pom.xml @@ -18,7 +18,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.29 + 1.2.33 diff --git a/bmc-dns/src/main/java/com/oracle/bmc/dns/DnsAsyncClient.java b/bmc-dns/src/main/java/com/oracle/bmc/dns/DnsAsyncClient.java index b8ff66ce95e..aba60121aa9 100644 --- a/bmc-dns/src/main/java/com/oracle/bmc/dns/DnsAsyncClient.java +++ b/bmc-dns/src/main/java/com/oracle/bmc/dns/DnsAsyncClient.java @@ -102,6 +102,34 @@ public DnsAsyncClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 DnsAsyncClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -119,8 +147,17 @@ public DnsAsyncClient( 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); + } } /** @@ -143,6 +180,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -207,6 +245,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Build the client, with the authentication details provider. * @param authenticationDetailsProvider authentication details provider @@ -221,7 +304,8 @@ public DnsAsyncClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-dns/src/main/java/com/oracle/bmc/dns/DnsClient.java b/bmc-dns/src/main/java/com/oracle/bmc/dns/DnsClient.java index c7c569be364..a9b99f387a0 100644 --- a/bmc-dns/src/main/java/com/oracle/bmc/dns/DnsClient.java +++ b/bmc-dns/src/main/java/com/oracle/bmc/dns/DnsClient.java @@ -107,6 +107,34 @@ public DnsClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 DnsClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -141,8 +169,17 @@ public DnsClient( 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); + } } /** @@ -165,6 +202,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -229,6 +267,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Set the authentication details provider. Once this is called, the builder can build the client. * @param authenticationDetailsProvider authentication details provider @@ -243,7 +326,8 @@ public DnsClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-email/pom.xml b/bmc-email/pom.xml index c2280d2fa5e..ca42e90ea8f 100644 --- a/bmc-email/pom.xml +++ b/bmc-email/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.29 + 1.2.33 ../pom.xml @@ -18,8 +18,8 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.29 + 1.2.33 - \ No newline at end of file + diff --git a/bmc-email/src/main/java/com/oracle/bmc/email/EmailAsyncClient.java b/bmc-email/src/main/java/com/oracle/bmc/email/EmailAsyncClient.java index 7f103993451..ed4131798f8 100644 --- a/bmc-email/src/main/java/com/oracle/bmc/email/EmailAsyncClient.java +++ b/bmc-email/src/main/java/com/oracle/bmc/email/EmailAsyncClient.java @@ -102,6 +102,34 @@ public EmailAsyncClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 EmailAsyncClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -119,8 +147,17 @@ public EmailAsyncClient( 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); + } } /** @@ -143,6 +180,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -207,6 +245,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Build the client, with the authentication details provider. * @param authenticationDetailsProvider authentication details provider @@ -221,7 +304,8 @@ public EmailAsyncClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-email/src/main/java/com/oracle/bmc/email/EmailClient.java b/bmc-email/src/main/java/com/oracle/bmc/email/EmailClient.java index ace2d856daa..337df76c25c 100644 --- a/bmc-email/src/main/java/com/oracle/bmc/email/EmailClient.java +++ b/bmc-email/src/main/java/com/oracle/bmc/email/EmailClient.java @@ -107,6 +107,34 @@ public EmailClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 EmailClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -141,8 +169,17 @@ public EmailClient( 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); + } } /** @@ -165,6 +202,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -229,6 +267,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Set the authentication details provider. Once this is called, the builder can build the client. * @param authenticationDetailsProvider authentication details provider @@ -243,7 +326,8 @@ public EmailClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-examples/pom.xml b/bmc-examples/pom.xml index aaedae8499b..94f940a3d25 100644 --- a/bmc-examples/pom.xml +++ b/bmc-examples/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.29 + 1.2.33 ../pom.xml @@ -19,7 +19,7 @@ com.oracle.oci.sdk oci-java-sdk-bom - 1.2.29 + 1.2.33 pom import diff --git a/bmc-examples/src/main/java/RemotePeeringConnectionExample.java b/bmc-examples/src/main/java/RemotePeeringConnectionExample.java new file mode 100644 index 00000000000..fef56365b01 --- /dev/null +++ b/bmc-examples/src/main/java/RemotePeeringConnectionExample.java @@ -0,0 +1,450 @@ +/** + * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + */ +import com.oracle.bmc.Region; +import com.oracle.bmc.auth.AuthenticationDetailsProvider; +import com.oracle.bmc.auth.ConfigFileAuthenticationDetailsProvider; +import com.oracle.bmc.core.VirtualNetwork; +import com.oracle.bmc.core.VirtualNetworkClient; +import com.oracle.bmc.core.model.ConnectRemotePeeringConnectionsDetails; +import com.oracle.bmc.core.model.CreateDrgAttachmentDetails; +import com.oracle.bmc.core.model.CreateDrgDetails; +import com.oracle.bmc.core.model.CreateRemotePeeringConnectionDetails; +import com.oracle.bmc.core.model.CreateVcnDetails; +import com.oracle.bmc.core.model.Drg; +import com.oracle.bmc.core.model.DrgAttachment; +import com.oracle.bmc.core.model.RemotePeeringConnection; +import com.oracle.bmc.core.model.Vcn; +import com.oracle.bmc.core.requests.ConnectRemotePeeringConnectionsRequest; +import com.oracle.bmc.core.requests.CreateDrgAttachmentRequest; +import com.oracle.bmc.core.requests.CreateDrgRequest; +import com.oracle.bmc.core.requests.CreateRemotePeeringConnectionRequest; +import com.oracle.bmc.core.requests.CreateVcnRequest; +import com.oracle.bmc.core.requests.DeleteDrgAttachmentRequest; +import com.oracle.bmc.core.requests.DeleteDrgRequest; +import com.oracle.bmc.core.requests.DeleteRemotePeeringConnectionRequest; +import com.oracle.bmc.core.requests.DeleteVcnRequest; +import com.oracle.bmc.core.requests.GetDrgAttachmentRequest; +import com.oracle.bmc.core.requests.GetDrgRequest; +import com.oracle.bmc.core.requests.GetRemotePeeringConnectionRequest; +import com.oracle.bmc.core.requests.GetVcnRequest; +import com.oracle.bmc.core.responses.CreateDrgAttachmentResponse; +import com.oracle.bmc.core.responses.CreateDrgResponse; +import com.oracle.bmc.core.responses.CreateRemotePeeringConnectionResponse; +import com.oracle.bmc.core.responses.CreateVcnResponse; + +import java.util.concurrent.TimeUnit; + +/** + * Sample to demonstrate remote peering of two virtual cloud networks between two different regions within a single + * compartment. + *

+ * The sample relies on the correct IAM policies already being in place for a given compartment ID. + * For more information, please refer to the + * Remote VCN + * Peering documentation that is found on the Oracle Cloud Infrastructure developer portal. + *

+ * The order of operations and waiting for the appropriate states is important. Each VCN can be set up + * concurrently until the point where the connection is established. Deleting the connection and + * resources can not be performed concurrently until the remote peering connection has been revoked. This sample + * demonstrates the creation of resources on a single thread to more clearly demonstrate remote peering connections. + * It is also worth noting that each VCN utilizes a dynamic routing gateway. DRGs are a finite resource and may require + * contacting customer support if limits have been exceeded for a given tenancy. + */ +public class RemotePeeringConnectionExample { + // Set this with your own compartment ID + public static final String COMPARTMENT_ID = ""; + + private static final String LOCAL_CIDR_BLOCK = "10.5.0.0/16"; + private static final String PEER_CIDR_BLOCK = "10.6.0.0/16"; + + private static final String TIMESTAMP_SUFFIX = + String.valueOf(System.currentTimeMillis() % TimeUnit.SECONDS.toMillis(10L)); + + private final VirtualNetwork localVirtualNetwork; + private final VirtualNetwork peerVirtualNetwork; + + private final Region localRegion; + private final Region peerRegion; + + /** + * Creates a new {@code RemotePeeringConnectionExample} object. + * + * @param localRegion the local region (e.g., "us-phoenix-1") + * @param localVirtualNetwork the virtual network client for the local region + * @param peerRegion the peer region (e.g., "us-ashburn-1") + * @param peerVirtualNetwork the virtual network client for the peer region + */ + public RemotePeeringConnectionExample( + final Region localRegion, + final VirtualNetwork localVirtualNetwork, + final Region peerRegion, + final VirtualNetwork peerVirtualNetwork) { + this.localRegion = localRegion; + this.localVirtualNetwork = localVirtualNetwork; + this.peerRegion = peerRegion; + this.peerVirtualNetwork = peerVirtualNetwork; + } + + /** + * Main entry point for the example. + * + * @param args command line arguments (not used) + * @throws Exception if an error occurred + */ + public static void main(final String... args) throws Exception { + if ("".equals(COMPARTMENT_ID)) { + throw new IllegalStateException("A compartment ID must be defined"); + } + + final AuthenticationDetailsProvider authProvider = + new ConfigFileAuthenticationDetailsProvider("~/.oci/config", "DEFAULT"); + + // The local virtual network client (PHX) + final VirtualNetworkClient phxVirtualNetwork = new VirtualNetworkClient(authProvider); + phxVirtualNetwork.setRegion(Region.US_PHOENIX_1); + + // The peer virtual network client (IAD) + final VirtualNetworkClient iadVirtualNetwork = new VirtualNetworkClient(authProvider); + iadVirtualNetwork.setRegion(Region.US_ASHBURN_1); + + final RemotePeeringConnectionExample example = + new RemotePeeringConnectionExample( + Region.US_PHOENIX_1, + phxVirtualNetwork, + Region.US_ASHBURN_1, + iadVirtualNetwork); + example.run(); + } + + /** + * The primary business logic that creates two VCNs, establishes a remote peering connection, and cleans up. + * + * @throws Exception if an error occurred + */ + public void run() throws Exception { + final String localRegionCode = localRegion.getRegionCode().toUpperCase(); // PHX + final String peerRegionCode = peerRegion.getRegionCode().toUpperCase(); // IAD + + // ------------------------------ + // Set up a VCN in PHX as 'local' + + System.out.println(String.format("Setting up VCN in %s...", localRegionCode)); + System.out.println(" Creating VCN"); + final String localVcnId = createVcn(localVirtualNetwork, localRegion, LOCAL_CIDR_BLOCK); + System.out.println(" Created VCN with ID: " + localVcnId); + + System.out.println(" Creating DRG"); + final String localDrgId = createDrg(localVirtualNetwork, localRegion); + System.out.println(" Created DRG with ID: " + localDrgId); + + System.out.println(" Creating DRG Attachment"); + final String localDrgAttachmentId = + createDrgAttachment(localVirtualNetwork, localRegion, localVcnId, localDrgId); + System.out.println(" Created DRG Attachment with ID: " + localDrgAttachmentId); + + System.out.println(" Creating Remote Peering Connection"); + final String localRemotePeeringConnectionId = + createRemotePeeringConnection(localVirtualNetwork, localRegion, localDrgId); + System.out.println( + " Created Remote Peering Connection with ID: " + + localRemotePeeringConnectionId); + + // --------------------------------- + // Set up a VCN in IAD as the 'peer' + + System.out.println(String.format("Setting up VCN in %s...", peerRegionCode)); + System.out.println(" Creating VCN"); + final String peerVcnId = createVcn(peerVirtualNetwork, peerRegion, PEER_CIDR_BLOCK); + System.out.println(" Created VCN with ID: " + peerVcnId); + + System.out.println(" Creating DRG"); + final String peerDrgId = createDrg(peerVirtualNetwork, peerRegion); + System.out.println(" Created DRG with ID: " + peerDrgId); + + System.out.println(" Creating DRG Attachment"); + final String peerDrgAttachmentId = + createDrgAttachment(peerVirtualNetwork, peerRegion, peerVcnId, peerDrgId); + System.out.println(" Created DRG Attachment with ID: " + peerDrgAttachmentId); + + System.out.println(" Creating Remote Peering Connection"); + final String peerRemotePeeringConnectionId = + createRemotePeeringConnection(peerVirtualNetwork, peerRegion, peerDrgId); + System.out.println( + " Created Remote Peering Connection with ID: " + + peerRemotePeeringConnectionId); + + // -------------------------------------------- + // Establish the connection between PHX and IAD + + System.out.println("\nEstablishing remote peering connection..."); + final ConnectRemotePeeringConnectionsRequest request = + ConnectRemotePeeringConnectionsRequest.builder() + .connectRemotePeeringConnectionsDetails( + ConnectRemotePeeringConnectionsDetails.builder() + .peerId( + peerRemotePeeringConnectionId) // The peer's remote peering connection ID in IAD + .peerRegionName( + peerRegion.getRegionId()) // e.g., "us-ashburn-1" + .build()) + .remotePeeringConnectionId( + localRemotePeeringConnectionId) // The local peering connection ID in PHX + .build(); + localVirtualNetwork.connectRemotePeeringConnections(request); + + // Ensure that the connection reflects the peering status in both regions + localVirtualNetwork + .getWaiters() + .forRemotePeeringConnection( + GetRemotePeeringConnectionRequest.builder() + .remotePeeringConnectionId(localRemotePeeringConnectionId) + .build(), + RemotePeeringConnection.PeeringStatus.Peered) + .execute(); + peerVirtualNetwork + .getWaiters() + .forRemotePeeringConnection( + GetRemotePeeringConnectionRequest.builder() + .remotePeeringConnectionId(peerRemotePeeringConnectionId) + .build(), + RemotePeeringConnection.PeeringStatus.Peered) + .execute(); + System.out.println(" Remote Peering connection established"); + + // -------- + // Clean up + + System.out.println("\nCleaning up resources..."); + System.out.println(" Deleting local remote peering connection in " + localRegionCode); + deleteRemotePeeringConnection(localVirtualNetwork, localRemotePeeringConnectionId); + + // Note: It is important to wait for the PeeringStatus to reflect a REVOKED status before proceeding + + System.out.println( + " Waiting for remote peering connection status to be revoked in " + + peerRegionCode); + peerVirtualNetwork + .getWaiters() + .forRemotePeeringConnection( + GetRemotePeeringConnectionRequest.builder() + .remotePeeringConnectionId(peerRemotePeeringConnectionId) + .build(), + RemotePeeringConnection.PeeringStatus.Revoked) + .execute(); + + System.out.println( + " Waiting for remote peering connection status to be revoked in " + + localRegionCode); + localVirtualNetwork + .getWaiters() + .forRemotePeeringConnection( + GetRemotePeeringConnectionRequest.builder() + .remotePeeringConnectionId(localRemotePeeringConnectionId) + .build(), + RemotePeeringConnection.PeeringStatus.Revoked) + .execute(); + + System.out.println(" Deleting remote peering connection in " + peerRegionCode); + deleteRemotePeeringConnection(peerVirtualNetwork, peerRemotePeeringConnectionId); + + System.out.println(" Deleting DRG Attachment in " + peerRegionCode); + deleteDrgAttachment(peerVirtualNetwork, peerDrgAttachmentId); + + System.out.println(" Deleting DRG in " + peerRegionCode); + deleteDrg(peerVirtualNetwork, peerDrgId); + + System.out.println(" Deleting VCN in " + peerRegionCode); + deleteVcn(peerVirtualNetwork, peerVcnId); + + System.out.println(" Deleting DRG Attachment in " + localRegionCode); + deleteDrgAttachment(localVirtualNetwork, localDrgAttachmentId); + + System.out.println(" Deleting DRG in " + localRegionCode); + deleteDrg(localVirtualNetwork, localDrgId); + + System.out.println(" Deleting VCN in " + localRegionCode); + deleteVcn(localVirtualNetwork, localVcnId); + } + + // ----------------- + // Create Operations + + public static String createVcn( + final VirtualNetwork virtualNetwork, final Region region, final String cidrBlock) + throws Exception { + final CreateVcnRequest request = + CreateVcnRequest.builder() + .createVcnDetails( + CreateVcnDetails.builder() + .cidrBlock(cidrBlock) + .compartmentId(COMPARTMENT_ID) + .displayName( + String.format( + "VCN-%s-%s", + region.getRegionId(), + TIMESTAMP_SUFFIX)) + .dnsLabel( + String.format( + "dns%s%s", + region.getRegionCode(), + TIMESTAMP_SUFFIX)) + .build()) + .build(); + + final CreateVcnResponse response = virtualNetwork.createVcn(request); + final String vcnId = response.getVcn().getId(); + + virtualNetwork + .getWaiters() + .forVcn(GetVcnRequest.builder().vcnId(vcnId).build(), Vcn.LifecycleState.Available) + .execute(); + return vcnId; + } + + public static String createDrg(final VirtualNetwork virtualNetwork, final Region region) + throws Exception { + final CreateDrgRequest request = + CreateDrgRequest.builder() + .createDrgDetails( + CreateDrgDetails.builder() + .compartmentId(COMPARTMENT_ID) + .displayName( + String.format( + "Drg-%s-%s", + region.getRegionId(), + TIMESTAMP_SUFFIX)) + .build()) + .build(); + + final CreateDrgResponse response = virtualNetwork.createDrg(request); + final String drgId = response.getDrg().getId(); + + virtualNetwork + .getWaiters() + .forDrg(GetDrgRequest.builder().drgId(drgId).build(), Drg.LifecycleState.Available) + .execute(); + return drgId; + } + + public static String createDrgAttachment( + final VirtualNetwork virtualNetwork, + final Region region, + final String vcnId, + final String drgId) + throws Exception { + final CreateDrgAttachmentRequest request = + CreateDrgAttachmentRequest.builder() + .createDrgAttachmentDetails( + CreateDrgAttachmentDetails.builder() + .displayName( + String.format( + "DrgAttachment-%s-%s", + region.getRegionId(), + TIMESTAMP_SUFFIX)) + .drgId(drgId) + .vcnId(vcnId) + .build()) + .build(); + + final CreateDrgAttachmentResponse response = virtualNetwork.createDrgAttachment(request); + final String drgAttachmentId = response.getDrgAttachment().getId(); + + virtualNetwork + .getWaiters() + .forDrgAttachment( + GetDrgAttachmentRequest.builder().drgAttachmentId(drgAttachmentId).build(), + DrgAttachment.LifecycleState.Attached) + .execute(); + return drgAttachmentId; + } + + public static String createRemotePeeringConnection( + final VirtualNetwork virtualNetwork, final Region region, final String drgId) + throws Exception { + final CreateRemotePeeringConnectionRequest request = + CreateRemotePeeringConnectionRequest.builder() + .createRemotePeeringConnectionDetails( + CreateRemotePeeringConnectionDetails.builder() + .compartmentId(COMPARTMENT_ID) + .displayName( + String.format( + "RemotePeeringConnection-%s-%s", + region.getRegionId(), + TIMESTAMP_SUFFIX)) + .drgId(drgId) + .build()) + .build(); + + final CreateRemotePeeringConnectionResponse response = + virtualNetwork.createRemotePeeringConnection(request); + final String remotePeeringConnectionId = response.getRemotePeeringConnection().getId(); + + virtualNetwork + .getWaiters() + .forRemotePeeringConnection( + GetRemotePeeringConnectionRequest.builder() + .remotePeeringConnectionId(remotePeeringConnectionId) + .build(), + RemotePeeringConnection.LifecycleState.Available) + .execute(); + return remotePeeringConnectionId; + } + + // ----------------- + // Delete operations + + public static void deleteRemotePeeringConnection( + final VirtualNetwork virtualNetwork, final String remotePeeringConnectionId) + throws Exception { + final DeleteRemotePeeringConnectionRequest request = + DeleteRemotePeeringConnectionRequest.builder() + .remotePeeringConnectionId(remotePeeringConnectionId) + .build(); + virtualNetwork.deleteRemotePeeringConnection(request); + + virtualNetwork + .getWaiters() + .forRemotePeeringConnection( + GetRemotePeeringConnectionRequest.builder() + .remotePeeringConnectionId(remotePeeringConnectionId) + .build(), + RemotePeeringConnection.LifecycleState.Terminated) + .execute(); + } + + public static void deleteDrgAttachment( + final VirtualNetwork virtualNetwork, final String drgAttachmentId) throws Exception { + final DeleteDrgAttachmentRequest request = + DeleteDrgAttachmentRequest.builder().drgAttachmentId(drgAttachmentId).build(); + virtualNetwork.deleteDrgAttachment(request); + + virtualNetwork + .getWaiters() + .forDrgAttachment( + GetDrgAttachmentRequest.builder().drgAttachmentId(drgAttachmentId).build(), + DrgAttachment.LifecycleState.Detached) + .execute(); + } + + public static void deleteDrg(final VirtualNetwork virtualNetwork, final String drgId) + throws Exception { + final DeleteDrgRequest request = DeleteDrgRequest.builder().drgId(drgId).build(); + virtualNetwork.deleteDrg(request); + + virtualNetwork + .getWaiters() + .forDrg(GetDrgRequest.builder().drgId(drgId).build(), Drg.LifecycleState.Terminated) + .execute(); + } + + public static void deleteVcn(final VirtualNetwork virtualNetwork, final String vcnId) + throws Exception { + final DeleteVcnRequest request = DeleteVcnRequest.builder().vcnId(vcnId).build(); + virtualNetwork.deleteVcn(request); + + virtualNetwork + .getWaiters() + .forVcn(GetVcnRequest.builder().vcnId(vcnId).build(), Vcn.LifecycleState.Terminated) + .execute(); + } +} diff --git a/bmc-filestorage/pom.xml b/bmc-filestorage/pom.xml index 13788f70f3e..169bc0a884c 100644 --- a/bmc-filestorage/pom.xml +++ b/bmc-filestorage/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.29 + 1.2.33 ../pom.xml @@ -18,8 +18,8 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.29 + 1.2.33 - \ No newline at end of file + diff --git a/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorage.java b/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorage.java index 11c18720cb1..84d81f73b6f 100644 --- a/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorage.java +++ b/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorage.java @@ -93,6 +93,9 @@ public interface FileStorage extends AutoCloseable { * client mount commands. These private IP addresses are listed * in the privateIpIds property of the mount target and are highly available. Mount * targets also consume additional IP addresses in their subnet. + * Do not use /30 or smaller subnets for mount target creation because they + * do not have sufficient available IP addresses. + * Allow at least three IP addresses for each mount target. *

* For information about access control and compartments, see * [Overview of the IAM diff --git a/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageAsync.java b/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageAsync.java index 0937c428f91..dccc453d67b 100644 --- a/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageAsync.java +++ b/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageAsync.java @@ -107,6 +107,9 @@ java.util.concurrent.Future createFileSystem( * client mount commands. These private IP addresses are listed * in the privateIpIds property of the mount target and are highly available. Mount * targets also consume additional IP addresses in their subnet. + * Do not use /30 or smaller subnets for mount target creation because they + * do not have sufficient available IP addresses. + * Allow at least three IP addresses for each mount target. *

* For information about access control and compartments, see * [Overview of the IAM diff --git a/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageAsyncClient.java b/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageAsyncClient.java index 51d207c4278..149d9e3294a 100644 --- a/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageAsyncClient.java +++ b/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageAsyncClient.java @@ -102,6 +102,34 @@ public FileStorageAsyncClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 FileStorageAsyncClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -119,8 +147,17 @@ public FileStorageAsyncClient( 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); + } } /** @@ -143,6 +180,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -207,6 +245,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Build the client, with the authentication details provider. * @param authenticationDetailsProvider authentication details provider @@ -221,7 +304,8 @@ public FileStorageAsyncClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageClient.java b/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageClient.java index e8381a666ef..fb6c4841feb 100644 --- a/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageClient.java +++ b/bmc-filestorage/src/main/java/com/oracle/bmc/filestorage/FileStorageClient.java @@ -107,6 +107,34 @@ public FileStorageClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 FileStorageClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -141,8 +169,17 @@ public FileStorageClient( 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); + } } /** @@ -165,6 +202,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -229,6 +267,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Set the authentication details provider. Once this is called, the builder can build the client. * @param authenticationDetailsProvider authentication details provider @@ -243,7 +326,8 @@ public FileStorageClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-identity/pom.xml b/bmc-identity/pom.xml index 37bb8aa0281..cc8ccfbff2d 100644 --- a/bmc-identity/pom.xml +++ b/bmc-identity/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.29 + 1.2.33 ../pom.xml @@ -18,7 +18,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.29 + 1.2.33 diff --git a/bmc-identity/src/main/java/com/oracle/bmc/identity/IdentityAsyncClient.java b/bmc-identity/src/main/java/com/oracle/bmc/identity/IdentityAsyncClient.java index 996198a597f..947f028fc17 100644 --- a/bmc-identity/src/main/java/com/oracle/bmc/identity/IdentityAsyncClient.java +++ b/bmc-identity/src/main/java/com/oracle/bmc/identity/IdentityAsyncClient.java @@ -102,6 +102,34 @@ public IdentityAsyncClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 IdentityAsyncClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -119,8 +147,17 @@ public IdentityAsyncClient( 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); + } } /** @@ -143,6 +180,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -207,6 +245,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Build the client, with the authentication details provider. * @param authenticationDetailsProvider authentication details provider @@ -221,7 +304,8 @@ public IdentityAsyncClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-identity/src/main/java/com/oracle/bmc/identity/IdentityClient.java b/bmc-identity/src/main/java/com/oracle/bmc/identity/IdentityClient.java index cca685eb0a4..b26a3193466 100644 --- a/bmc-identity/src/main/java/com/oracle/bmc/identity/IdentityClient.java +++ b/bmc-identity/src/main/java/com/oracle/bmc/identity/IdentityClient.java @@ -107,6 +107,34 @@ public IdentityClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 IdentityClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -141,8 +169,17 @@ public IdentityClient( 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); + } } /** @@ -165,6 +202,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -229,6 +267,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Set the authentication details provider. Once this is called, the builder can build the client. * @param authenticationDetailsProvider authentication details provider @@ -243,7 +326,8 @@ public IdentityClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-identity/src/main/java/com/oracle/bmc/identity/model/CreateRegionSubscriptionDetails.java b/bmc-identity/src/main/java/com/oracle/bmc/identity/model/CreateRegionSubscriptionDetails.java index 713a24a5990..a01d4d96087 100644 --- a/bmc-identity/src/main/java/com/oracle/bmc/identity/model/CreateRegionSubscriptionDetails.java +++ b/bmc-identity/src/main/java/com/oracle/bmc/identity/model/CreateRegionSubscriptionDetails.java @@ -65,6 +65,7 @@ public static Builder builder() { * - `PHX` * - `IAD` * - `FRA` + * - `LHR` *

* Example: `PHX` * diff --git a/bmc-identity/src/main/java/com/oracle/bmc/identity/model/Region.java b/bmc-identity/src/main/java/com/oracle/bmc/identity/model/Region.java index 6adb1c29190..d143cdec7e1 100644 --- a/bmc-identity/src/main/java/com/oracle/bmc/identity/model/Region.java +++ b/bmc-identity/src/main/java/com/oracle/bmc/identity/model/Region.java @@ -78,6 +78,7 @@ public static Builder builder() { * - `PHX` * - `IAD` * - `FRA` + * - `LHR` * **/ @com.fasterxml.jackson.annotation.JsonProperty("key") @@ -90,6 +91,7 @@ public static Builder builder() { * - `us-phoenix-1` * - `us-ashburn-1` * - `eu-frankfurt-1` + * - `uk-london-1` * **/ @com.fasterxml.jackson.annotation.JsonProperty("name") diff --git a/bmc-identity/src/main/java/com/oracle/bmc/identity/model/RegionSubscription.java b/bmc-identity/src/main/java/com/oracle/bmc/identity/model/RegionSubscription.java index 673e44a2470..ff2d8b087c9 100644 --- a/bmc-identity/src/main/java/com/oracle/bmc/identity/model/RegionSubscription.java +++ b/bmc-identity/src/main/java/com/oracle/bmc/identity/model/RegionSubscription.java @@ -102,6 +102,7 @@ public static Builder builder() { * - `PHX` * - `IAD` * - `FRA` + * - `LHR` * **/ @com.fasterxml.jackson.annotation.JsonProperty("regionKey") @@ -114,6 +115,7 @@ public static Builder builder() { * - `us-phoenix-1` * - `us-ashburn-1` * - `eu-frankurt-1` + * - `uk-london-1` * **/ @com.fasterxml.jackson.annotation.JsonProperty("regionName") diff --git a/bmc-identity/src/main/java/com/oracle/bmc/identity/model/Tenancy.java b/bmc-identity/src/main/java/com/oracle/bmc/identity/model/Tenancy.java index e0ff9872746..15939d8462e 100644 --- a/bmc-identity/src/main/java/com/oracle/bmc/identity/model/Tenancy.java +++ b/bmc-identity/src/main/java/com/oracle/bmc/identity/model/Tenancy.java @@ -135,12 +135,14 @@ public static Builder builder() { String description; /** - * The region key for the tenancy's home region. + * The region key for the tenancy's home region. For more information about regions, see + * [Regions and Availability Domains](https://docs.us-phoenix-1.oraclecloud.com/Content/General/Concepts/regions.htm). *

* Allowed values are: * - `IAD` * - `PHX` * - `FRA` + * - `LHR` * **/ @com.fasterxml.jackson.annotation.JsonProperty("homeRegionKey") diff --git a/bmc-loadbalancer/pom.xml b/bmc-loadbalancer/pom.xml index 61a70482273..3bf0b6f4c1b 100644 --- a/bmc-loadbalancer/pom.xml +++ b/bmc-loadbalancer/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.29 + 1.2.33 ../pom.xml @@ -18,7 +18,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.29 + 1.2.33 diff --git a/bmc-loadbalancer/src/main/java/com/oracle/bmc/loadbalancer/LoadBalancerAsyncClient.java b/bmc-loadbalancer/src/main/java/com/oracle/bmc/loadbalancer/LoadBalancerAsyncClient.java index 65e8071188d..593b09a9fdf 100644 --- a/bmc-loadbalancer/src/main/java/com/oracle/bmc/loadbalancer/LoadBalancerAsyncClient.java +++ b/bmc-loadbalancer/src/main/java/com/oracle/bmc/loadbalancer/LoadBalancerAsyncClient.java @@ -102,6 +102,34 @@ public LoadBalancerAsyncClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 LoadBalancerAsyncClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -119,8 +147,17 @@ public LoadBalancerAsyncClient( 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); + } } /** @@ -143,6 +180,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -207,6 +245,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Build the client, with the authentication details provider. * @param authenticationDetailsProvider authentication details provider @@ -221,7 +304,8 @@ public LoadBalancerAsyncClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-loadbalancer/src/main/java/com/oracle/bmc/loadbalancer/LoadBalancerClient.java b/bmc-loadbalancer/src/main/java/com/oracle/bmc/loadbalancer/LoadBalancerClient.java index a352609c386..5dbca011683 100644 --- a/bmc-loadbalancer/src/main/java/com/oracle/bmc/loadbalancer/LoadBalancerClient.java +++ b/bmc-loadbalancer/src/main/java/com/oracle/bmc/loadbalancer/LoadBalancerClient.java @@ -107,6 +107,34 @@ public LoadBalancerClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 LoadBalancerClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -141,8 +169,17 @@ public LoadBalancerClient( 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); + } } /** @@ -165,6 +202,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.STANDARD); + protected String endpoint; private Builder() {} @@ -229,6 +267,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Set the authentication details provider. Once this is called, the builder can build the client. * @param authenticationDetailsProvider authentication details provider @@ -243,7 +326,8 @@ public LoadBalancerClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-objectstorage/bmc-objectstorage-combined/pom.xml b/bmc-objectstorage/bmc-objectstorage-combined/pom.xml index 8f0247ae13a..ba97bccc3f2 100644 --- a/bmc-objectstorage/bmc-objectstorage-combined/pom.xml +++ b/bmc-objectstorage/bmc-objectstorage-combined/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk-objectstorage-parent - 1.2.29 + 1.2.33 ../pom.xml @@ -47,14 +47,14 @@ com.oracle.oci.sdk oci-java-sdk-objectstorage-generated - 1.2.29 + 1.2.33 jar compile com.oracle.oci.sdk oci-java-sdk-objectstorage-extensions - 1.2.29 + 1.2.33 jar compile diff --git a/bmc-objectstorage/bmc-objectstorage-extensions/pom.xml b/bmc-objectstorage/bmc-objectstorage-extensions/pom.xml index ff2d3ff8319..f49c1b11291 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-objectstorage-parent - 1.2.29 + 1.2.33 ../pom.xml @@ -18,12 +18,12 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.29 + 1.2.33 com.oracle.oci.sdk oci-java-sdk-objectstorage-generated - 1.2.29 + 1.2.33 diff --git a/bmc-objectstorage/bmc-objectstorage-generated/pom.xml b/bmc-objectstorage/bmc-objectstorage-generated/pom.xml index 8eec9e76cc7..2c03ba1d346 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-objectstorage-parent - 1.2.29 + 1.2.33 ../pom.xml @@ -18,8 +18,8 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.29 + 1.2.33 - \ No newline at end of file + diff --git a/bmc-objectstorage/bmc-objectstorage-generated/src/main/java/com/oracle/bmc/objectstorage/ObjectStorageAsyncClient.java b/bmc-objectstorage/bmc-objectstorage-generated/src/main/java/com/oracle/bmc/objectstorage/ObjectStorageAsyncClient.java index 768f4090a80..3360ed3db42 100644 --- a/bmc-objectstorage/bmc-objectstorage-generated/src/main/java/com/oracle/bmc/objectstorage/ObjectStorageAsyncClient.java +++ b/bmc-objectstorage/bmc-objectstorage-generated/src/main/java/com/oracle/bmc/objectstorage/ObjectStorageAsyncClient.java @@ -102,6 +102,34 @@ public ObjectStorageAsyncClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 ObjectStorageAsyncClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -121,8 +149,17 @@ public ObjectStorageAsyncClient( 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); + } } /** @@ -145,6 +182,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.OBJECT_STORAGE); + protected String endpoint; private Builder() {} @@ -209,6 +247,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Build the client, with the authentication details provider. * @param authenticationDetailsProvider authentication details provider @@ -223,7 +306,8 @@ public ObjectStorageAsyncClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-objectstorage/bmc-objectstorage-generated/src/main/java/com/oracle/bmc/objectstorage/ObjectStorageClient.java b/bmc-objectstorage/bmc-objectstorage-generated/src/main/java/com/oracle/bmc/objectstorage/ObjectStorageClient.java index 98796e42785..7ca02adfc23 100644 --- a/bmc-objectstorage/bmc-objectstorage-generated/src/main/java/com/oracle/bmc/objectstorage/ObjectStorageClient.java +++ b/bmc-objectstorage/bmc-objectstorage-generated/src/main/java/com/oracle/bmc/objectstorage/ObjectStorageClient.java @@ -106,6 +106,34 @@ public ObjectStorageClient( com.oracle.bmc.http.ClientConfigurator clientConfigurator, com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, java.util.List additionalClientConfigurators) { + this( + authenticationDetailsProvider, + configuration, + clientConfigurator, + requestSignerFactory, + 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 requestSignerFactory 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 ObjectStorageClient( + com.oracle.bmc.auth.AbstractAuthenticationDetailsProvider authenticationDetailsProvider, + com.oracle.bmc.ClientConfiguration configuration, + com.oracle.bmc.http.ClientConfigurator clientConfigurator, + com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory, + java.util.List additionalClientConfigurators, + String endpoint) { this.authenticationDetailsProvider = authenticationDetailsProvider; com.oracle.bmc.http.internal.RestClientFactory restClientFactory = com.oracle.bmc.http.internal.RestClientFactoryBuilder.builder() @@ -127,8 +155,17 @@ public ObjectStorageClient( 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); + } } /** @@ -151,6 +188,7 @@ public static class Builder { protected com.oracle.bmc.http.signing.RequestSignerFactory requestSignerFactory = new com.oracle.bmc.http.signing.internal.DefaultRequestSignerFactory( com.oracle.bmc.http.signing.SigningStrategy.OBJECT_STORAGE); + protected String endpoint; private Builder() {} @@ -215,6 +253,51 @@ public Builder requestSignerFactory( return this; } + /** + * Set the endpoint for the client to be created. + * @param endpoint endpoint + * @return this builder + */ + public Builder endpoint(String endpoint) { + this.endpoint = endpoint; + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(com.oracle.bmc.Region region) { + com.google.common.base.Optional endpoint = region.getEndpoint(SERVICE); + if (endpoint.isPresent()) { + endpoint(endpoint.get()); + } else { + throw new IllegalArgumentException( + "Endpoint for " + SERVICE + " is not known in region " + region); + } + return this; + } + + /** + * Set the region for the client to be created. + * @param region region + * @return this builder + */ + public Builder region(String regionId) { + regionId = regionId.toLowerCase(Locale.ENGLISH); + try { + com.oracle.bmc.Region region = com.oracle.bmc.Region.fromRegionId(regionId); + return region(region); + } catch (IllegalArgumentException e) { + LOG.info( + "Unknown regionId '{}', falling back to default endpoint format", regionId); + String endpoint = + com.oracle.bmc.Region.formatDefaultRegionEndpoint(SERVICE, regionId); + return endpoint(endpoint); + } + } + /** * Set the authentication details provider. Once this is called, the builder can build the client. * @param authenticationDetailsProvider authentication details provider @@ -229,7 +312,8 @@ public ObjectStorageClient build( configuration, clientConfigurator, requestSignerFactory, - additionalClientConfigurators); + additionalClientConfigurators, + endpoint); } } diff --git a/bmc-objectstorage/bmc-objectstorage-generated/src/main/java/com/oracle/bmc/objectstorage/ObjectStoragePaginators.java b/bmc-objectstorage/bmc-objectstorage-generated/src/main/java/com/oracle/bmc/objectstorage/ObjectStoragePaginators.java index f16344a94a1..9a0909e95fa 100644 --- a/bmc-objectstorage/bmc-objectstorage-generated/src/main/java/com/oracle/bmc/objectstorage/ObjectStoragePaginators.java +++ b/bmc-objectstorage/bmc-objectstorage-generated/src/main/java/com/oracle/bmc/objectstorage/ObjectStoragePaginators.java @@ -370,6 +370,116 @@ public java.util.List apply( }); } + /** + * Creates a new iterable which will iterate over the responses received from the listObjects operation. This iterable + * will fetch more data from the server as needed. + * + * @param request a request which can be sent to the service operation + * @return an {@link java.lang.Iterable} which can be used to iterate over the responses received from the service. + */ + public Iterable listObjectsResponseIterator( + final ListObjectsRequest request) { + return new com.oracle.bmc.paginator.internal.ResponseIterable< + ListObjectsRequest.Builder, ListObjectsRequest, ListObjectsResponse>( + new com.google.common.base.Supplier() { + @Override + public ListObjectsRequest.Builder get() { + return ListObjectsRequest.builder().copy(request); + } + }, + new com.google.common.base.Function() { + @Override + public String apply(ListObjectsResponse response) { + return response.getListObjects().getNextStartWith(); + } + }, + new com.google.common.base.Function< + com.oracle.bmc.paginator.internal.RequestBuilderAndToken< + ListObjectsRequest.Builder>, + ListObjectsRequest>() { + @Override + public ListObjectsRequest apply( + com.oracle.bmc.paginator.internal.RequestBuilderAndToken< + ListObjectsRequest.Builder> + input) { + if (input.getToken() == null) { + return input.getRequestBuilder().build(); + } else { + return input.getRequestBuilder() + .start(input.getToken().orNull()) + .build(); + } + } + }, + new com.google.common.base.Function() { + @Override + public ListObjectsResponse apply(ListObjectsRequest request) { + return client.listObjects(request); + } + }); + } + + /** + * Creates a new iterable which will iterate over the {@link com.oracle.bmc.objectstorage.model.ObjectSummary} objects + * contained in responses from the listObjects operation. This iterable will fetch more data from the + * server as needed. + * + * @param request a request which can be sent to the service operation + * @return an {@link java.lang.Iterable} which can be used to iterate over the {@link com.oracle.bmc.objectstorage.model.ObjectSummary} objects + * contained in responses received from the service. + */ + public Iterable listObjectsRecordIterator( + final ListObjectsRequest request) { + return new com.oracle.bmc.paginator.internal.ResponseRecordIterable< + ListObjectsRequest.Builder, ListObjectsRequest, ListObjectsResponse, + com.oracle.bmc.objectstorage.model.ObjectSummary>( + new com.google.common.base.Supplier() { + @Override + public ListObjectsRequest.Builder get() { + return ListObjectsRequest.builder().copy(request); + } + }, + new com.google.common.base.Function() { + @Override + public String apply(ListObjectsResponse response) { + return response.getListObjects().getNextStartWith(); + } + }, + new com.google.common.base.Function< + com.oracle.bmc.paginator.internal.RequestBuilderAndToken< + ListObjectsRequest.Builder>, + ListObjectsRequest>() { + @Override + public ListObjectsRequest apply( + com.oracle.bmc.paginator.internal.RequestBuilderAndToken< + ListObjectsRequest.Builder> + input) { + if (input.getToken() == null) { + return input.getRequestBuilder().build(); + } else { + return input.getRequestBuilder() + .start(input.getToken().orNull()) + .build(); + } + } + }, + new com.google.common.base.Function() { + @Override + public ListObjectsResponse apply(ListObjectsRequest request) { + return client.listObjects(request); + } + }, + new com.google.common.base.Function< + ListObjectsResponse, + java.util.List>() { + @Override + public java.util.List apply( + ListObjectsResponse response) { + return response.getListObjects().getObjects(); + } + }); + } + /** * Creates a new iterable which will iterate over the responses received from the listPreauthenticatedRequests operation. This iterable * will fetch more data from the server as needed. diff --git a/bmc-objectstorage/pom.xml b/bmc-objectstorage/pom.xml index 95d8283b742..677c3549b82 100644 --- a/bmc-objectstorage/pom.xml +++ b/bmc-objectstorage/pom.xml @@ -5,7 +5,7 @@ com.oracle.oci.sdk oci-java-sdk - 1.2.29 + 1.2.33 ../pom.xml @@ -19,7 +19,7 @@ com.oracle.oci.sdk oci-java-sdk-common - 1.2.29 + 1.2.33 @@ -31,4 +31,4 @@ bmc-objectstorage-combined - \ No newline at end of file + diff --git a/pom.xml b/pom.xml index 7e34cb59b5b..d5d3645190d 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 com.oracle.oci.sdk oci-java-sdk - 1.2.29 + 1.2.33 pom Oracle Cloud Infrastructure SDK This project contains the SDK used for Oracle Cloud Infrastructure @@ -29,8 +29,48 @@ 4.11 1.16.16 1.16.16.0 + 3.0.2 + 1.7.23 + 1.1.0.Final + 2.0.1 + 1.10 + 3.4 + 2.5 + + + 1.52 + + sign + + + + org.commonjava.maven.plugins + directory-maven-plugin + 0.1 + + + directories + + directory-of + + initialize + + ocijavasdk.basedir + + com.oracle.oci.sdk + oci-java-sdk + + + + + + + + dev @@ -284,7 +324,7 @@ org.apache.maven.plugins maven-assembly-plugin - 2.6 + 3.1.0 @@ -343,17 +383,17 @@ javax.ws.rs javax.ws.rs-api - 2.0.1 + ${javax.ws.rs-api.version} javax.validation validation-api - 1.1.0.Final + ${validation-api.version} org.slf4j slf4j-api - 1.7.23 + ${slf4j.version} @@ -366,7 +406,7 @@ com.google.code.findbugs jsr305 - 3.0.2 + ${jsr305.version} com.google.guava @@ -382,17 +422,17 @@ commons-codec commons-codec - 1.10 + ${commons-codec.version} org.apache.commons commons-lang3 - 3.4 + ${commons-lang3.version} commons-io commons-io - 2.5 + ${commons-io.version} com.fasterxml.jackson.jaxrs