Skip to content

Commit

Permalink
Merge pull request #18 from oracle/topic_sync_PR_1aug
Browse files Browse the repository at this point in the history
bean and support matrix fixes
  • Loading branch information
jitendrazkumar authored Aug 1, 2023
2 parents c861af3 + d4813b9 commit 440e12d
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 10 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
> **Warning**
>
> Code in this repository is work-in-progress and has not been released officially.
>
>
> Not recommended for personal or production use at this point.
## Introduction
Expand All @@ -19,7 +19,7 @@ For a deep dive into the project, refer to the Spring Cloud OCI documentation:

| Version | Reference Docs | API Docs |
|------------------------|---------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| Spring Cloud OCI 1.0.0 | [Reference Docs](https://oracle.github.io/spring-cloud-oci/1.0.0/reference/html/index.html) | [API Docs](https://oracle.github.io/spring-cloud-oci/1.0.0/javadocs/index.html) |
| Spring Cloud OCI 1.0.0 | [Reference Docs](https://oracle.github.io/spring-cloud-oci/1.0.0/reference/html/index.html) | [API Docs](https://oracle.github.io/spring-cloud-oci/1.0.0/javadocs/index.html) |


## Compatibility with Spring Project Versions
Expand All @@ -28,7 +28,7 @@ This project has dependency and transitive dependencies on Spring Projects. The

| Spring Cloud OCI | Spring Cloud | Spring Boot | OCI Java SDK |
|-------------------|-----------------|---------------------|--------------|
| 1.0.0 | <to-be-checked> | 2.7.x, 3.0.x, 3.1.x | 3.19.0 |
| 1.0.0 | <to-be-checked> | 3.0.x, 3.1.x | 3.19.0 |


## Try out samples
Expand Down Expand Up @@ -102,4 +102,3 @@ Copyright (c) 2023 Oracle and/or its affiliates.

Released under the Universal Permissive License v1.0 as shown at
<https://oss.oracle.com/licenses/upl/>.

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
@EnableConfigurationProperties(CredentialsProperties.class)
public class CredentialsProviderAutoConfiguration {

public static final String credentialsProviderQualifier = "credentialsProvider";

private static final String PROFILE_DEFAULT = "DEFAULT";
private final CredentialsProperties properties;

Expand All @@ -41,7 +43,7 @@ public CredentialsProviderAutoConfiguration(CredentialsProperties properties) {
* @return
* @throws IOException
*/
@Bean
@Bean (name = credentialsProviderQualifier)
@ConditionalOnMissingBean
public BasicAuthenticationDetailsProvider credentialsProvider() throws IOException {
return createCredentialsProvider(properties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
@EnableConfigurationProperties(RegionProperties.class)
public class RegionProviderAutoConfiguration {

public static final String regionProviderQualifier = "regionProvider";
private final RegionProperties properties;

public RegionProviderAutoConfiguration(RegionProperties properties) {
this.properties = properties;
}

@Bean
@Bean (name = regionProviderQualifier)
@ConditionalOnMissingBean
public RegionProvider regionProvider() {
return createRegionProvider(properties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@
import com.oracle.bmc.auth.BasicAuthenticationDetailsProvider;
import com.oracle.bmc.auth.RegionProvider;
import com.oracle.bmc.loggingingestion.LoggingClient;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;

import static com.oracle.cloud.spring.autoconfigure.core.CredentialsProviderAutoConfiguration.credentialsProviderQualifier;
import static com.oracle.cloud.spring.autoconfigure.core.RegionProviderAutoConfiguration.regionProviderQualifier;

/**
* Auto-configuration for initializing the OCI Logging component.
* Depends on {@link com.oracle.cloud.spring.autoconfigure.core.CredentialsProviderAutoConfiguration} and
Expand Down Expand Up @@ -43,7 +47,8 @@ Logging getLoggingImpl(com.oracle.bmc.loggingingestion.Logging logging) {

@Bean
@ConditionalOnMissingBean
com.oracle.bmc.loggingingestion.Logging loggingClient(RegionProvider regionProvider,
com.oracle.bmc.loggingingestion.Logging loggingClient(@Qualifier(regionProviderQualifier) RegionProvider regionProvider,
@Qualifier(credentialsProviderQualifier)
BasicAuthenticationDetailsProvider adp) {
com.oracle.bmc.loggingingestion.Logging logging = new LoggingClient(adp);
if (regionProvider.getRegion() != null) logging.setRegion(regionProvider.getRegion());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@
import com.oracle.bmc.ons.NotificationControlPlaneClient;
import com.oracle.bmc.ons.NotificationDataPlane;
import com.oracle.bmc.ons.NotificationDataPlaneClient;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;

import static com.oracle.cloud.spring.autoconfigure.core.CredentialsProviderAutoConfiguration.credentialsProviderQualifier;
import static com.oracle.cloud.spring.autoconfigure.core.RegionProviderAutoConfiguration.regionProviderQualifier;

/**
* Auto-configuration for initializing the OCI Notification component.
* Depends on {@link com.oracle.cloud.spring.autoconfigure.core.CredentialsProviderAutoConfiguration} and
Expand All @@ -38,7 +42,8 @@ Notification getNotificationImpl(NotificationDataPlane notificationDataPlane, No

@Bean
@ConditionalOnMissingBean
NotificationDataPlane notificationDataPlaneClient(RegionProvider regionProvider,
NotificationDataPlane notificationDataPlaneClient(@Qualifier(regionProviderQualifier) RegionProvider regionProvider,
@Qualifier(credentialsProviderQualifier)
BasicAuthenticationDetailsProvider adp) {
NotificationDataPlane notificationDataPlaneClient = new NotificationDataPlaneClient(adp);
if (regionProvider.getRegion() != null) notificationDataPlaneClient.setRegion(regionProvider.getRegion());
Expand All @@ -47,7 +52,8 @@ NotificationDataPlane notificationDataPlaneClient(RegionProvider regionProvider,

@Bean
@ConditionalOnMissingBean
NotificationControlPlane notificationControlPlaneClient(RegionProvider regionProvider,
NotificationControlPlane notificationControlPlaneClient(@Qualifier(regionProviderQualifier) RegionProvider regionProvider,
@Qualifier(credentialsProviderQualifier)
BasicAuthenticationDetailsProvider adp) {
NotificationControlPlane notificationControlPlaneClient = new NotificationControlPlaneClient(adp);
if (regionProvider.getRegion() != null) notificationControlPlaneClient.setRegion(regionProvider.getRegion());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.oracle.bmc.auth.RegionProvider;
import com.oracle.bmc.objectstorage.ObjectStorageClient;
import com.oracle.cloud.spring.core.compartment.CompartmentProvider;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
Expand All @@ -20,6 +21,9 @@

import java.util.Optional;

import static com.oracle.cloud.spring.autoconfigure.core.CredentialsProviderAutoConfiguration.credentialsProviderQualifier;
import static com.oracle.cloud.spring.autoconfigure.core.RegionProviderAutoConfiguration.regionProviderQualifier;

/**
* Auto-configuration for initializing the OCI Storage component.
* Depends on {@link com.oracle.cloud.spring.autoconfigure.core.CompartmentProviderAutoConfiguration},
Expand Down Expand Up @@ -48,7 +52,8 @@ Storage storageActions(ObjectStorageClient osClient, StorageOutputStreamProvider

@Bean
@ConditionalOnMissingBean
ObjectStorageClient objectStorageClient(RegionProvider regionProvider,
ObjectStorageClient objectStorageClient(@Qualifier(regionProviderQualifier) RegionProvider regionProvider,
@Qualifier(credentialsProviderQualifier)
BasicAuthenticationDetailsProvider adp) {
ObjectStorageClient osClient = new ObjectStorageClient(adp);
if (regionProvider.getRegion() != null) osClient.setRegion(regionProvider.getRegion());
Expand Down

0 comments on commit 440e12d

Please sign in to comment.