The Oracle Cloud Infrastructure SDK for Go enables you to write code to manage Oracle Cloud Infrastructure resources.
This SDK and sample is dual-licensed under the Universal Permissive License 1.0 and the Apache License 2.0; third-party content is separately licensed as described in the code.
Documentation: The reference documentation is available from Oracle here and at godoc.org.
Tip
Cloud Shell: The SDK for Go is pre-configured with your credentials and ready to use immediately from within Cloud Shell. For more information on using the SDK for Go from within Cloud Shell, see SDK for Go Cloud Shell Quick Start.
Oracle Linux Cloud Developer image: The SDK for Go is pre-installed on the Oracle Linux Cloud Developer platform image. For more information, see Oracle Linux Cloud Developer.
Requirements
To use the SDK for Go, you must have the following:
An Oracle Cloud Infrastructure account.
A user created in that account, in a group with a policy that grants the desired
permissions. This can be a user for yourself, or another person/system that needs to
call the API. For an example of how to set up a new user, group, compartment, and
policy, see Adding Users. For a list of typical
policies, you may want to use, see Common Policies.
A key pair used for signing API requests, with the public key uploaded to Oracle.
Only the user calling the API should be in possession of the private key. For more
information, see Configure the SDK.
The OCI Go SDK will be located
in/usr/share/gocode/src/github.com/oracle/oci-go-sdk.
Golang 1.16.3 enables the go module by default, even when no go.mod is
present. You need to turn the go module off to ensure that the OCI Go SDK can be
referenced from the filesystem where yum installed the Go SDK. To do so, set the
following environment
variables: