Package oracle.nosql.driver.iam
Class OCIConfigFileReader
- java.lang.Object
-
- oracle.nosql.driver.iam.OCIConfigFileReader
-
public class OCIConfigFileReader extends Object
Cloud service only.An instance that reads an Oracle Cloud Infrastructure (OCI) configuration file. Note, an OCI configuration file MUST contain a "DEFAULT" profile, additional profiles are optional.
An OCI configuration file allows use of custom key-value pairs, which can be loaded and referenced using this class. For example, the frequently used compartment OCID can be put in a configuration file.
In the configuration file, add one custom parameter "custom_compartment_id" [DEFAULT] ... custom_compartment_id=ocid1.compartment.oc1..aaa... Then it can be retrieved using this class: OCIConfigFile config = OCIConfigFileReader.parse("~/.oci/config"); String compartmentId = config.get("custom_compartment_id");
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOCIConfigFileReader.OCIConfigFileCloud service only.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static OCIConfigFileReader.OCIConfigFileparse(InputStream configStream, String profile)Create a new instance using an UTF-8 input stream.static OCIConfigFileReader.OCIConfigFileparse(InputStream configStream, String profile, Charset charset)Create a new instance using an input stream.static OCIConfigFileReader.OCIConfigFileparse(String configFilePath)Create a new instance using a file at a given location.static OCIConfigFileReader.OCIConfigFileparse(String configFilePath, String profile)Create a new instance using a file at a given location.
-
-
-
Method Detail
-
parse
public static OCIConfigFileReader.OCIConfigFile parse(String configFilePath) throws IOException
Create a new instance using a file at a given location.This method is the same as calling
parse(String, String)with "DEFAULT" as the profile.- Parameters:
configFilePath- The path to the config file.- Returns:
- A new OCIConfigFile instance.
- Throws:
IOException- if the file could not be read.
-
parse
public static OCIConfigFileReader.OCIConfigFile parse(String configFilePath, String profile) throws IOException
Create a new instance using a file at a given location.- Parameters:
configFilePath- The path to the config file.profile- The profile name to load, or null if you want to load the "DEFAULT" profile.- Returns:
- A new OCIConfigFile instance.
- Throws:
IOException- if the file could not be read.
-
parse
public static OCIConfigFileReader.OCIConfigFile parse(InputStream configStream, String profile) throws IOException
Create a new instance using an UTF-8 input stream.- Parameters:
configStream- The path to the config file.profile- The profile name to load, or null if you want to load the "DEFAULT" profile.- Returns:
- A new OCIConfigFile instance.
- Throws:
IOException- if the file could not be read.
-
parse
public static OCIConfigFileReader.OCIConfigFile parse(InputStream configStream, String profile, Charset charset) throws IOException
Create a new instance using an input stream.- Parameters:
configStream- The path to the config file.profile- The profile name to load, or null if you want to load the "DEFAULT" profile.charset- The charset used when parsing the input stream- Returns:
- A new OCIConfigFile instance.
- Throws:
IOException- if the file could not be read.
-
-