The starter kit now comes with the Oracle Cloud Infrastructure (OCI) Python SDK preinstalled.
- Follow the instructions on OCI's Tools Configuration page to generate, upload the API key and configure the SDK.
- Place the API key and
config
file in a subdirectory.oci
, under the home directory of the user. In Mac and Linux, the home directory is expressed by the environment variable$HOME
, and in Windows,%USERPROFILE%
. - Uncomment the following line in devcontainer.json:
"-v", "${env:HOME}${env:USERPROFILE}/.oci:/home/vscode/.oci",
Running the following Python code should return the user object if the SDK is configured correctly:
import oci
config=oci.config.from_file("~/.oci/config", "DEFAULT")
identity = oci.identity.IdentityClient(config)
user = identity.get_user(config["user"]).data
print(user)