Orchestrate ATP instances or any other resource in Oracle Cloud using your favourite programming language. SDK sample scripts available for Python, Java and Node.js
Download the code
wget --content-disposition https://github.com/vmleon/OracleATPGettingStarted/blob/master/store/sdkjava.zip?raw=true
Unzip the file and change the directory to java
unzip sdkjava.zip && cd sdkjava
There is a config file template we need to copy with the proper name to be picked by the application
cp src/main/resources/config.properties.template src/main/resources/config.properties
Get the value from COMPARTMENT_OCID
from
Edit the properties file so it matches your settings. Make sure you change the COMPARTMENT_OCID
and REGION_ID
, everything else should be fine but make sure it matches your configuration.
vim src/main/resources/config.properties
CONFIG_LOCATION=~/.oci/config
COMPARTMENT_OCID=ocid1.compartment.oc1..blablabla
CONFIG_PROFILE=DEFAULT
REGION_ID=uk-london-1
This is a Gradle project, which means we can install dependencies and run the code all in one simple command.
./gradlew run
It will take some time doing the downloads, compilation, etc but you should see something like this, listing the Availability Domains of London region and the list of Autonomous Databases
uk-london-1 ADs: mDbm:UK-LONDON-1-AD-1, mDbm:UK-LONDON-1-AD-2, mDbm:UK-LONDON-1-AD-3
ATPs: atpworkshop, playground
Feel free to inspect the code on Github in the folder src/sdkjava.
All the meat is in src/sdkjava/src/main/java/page/cateam/SDK.java
!
Well done, you configure the SDK Java app to ask to Oracle Cloud for the list of Availability Domains and the list of Autonomous Databases in a compartment.
You can find information about JAVA SDK and other languages at Oracle Cloud SDKs Documentation
Congratulations! You have finish the workshop! Go to appendix for some extra information and much more content available.