SDK for Go

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.

Download: Download the SDK from GitHub.

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.
  • Go version 1.14, 1.15, 1.16, or 1.17.

Services Supported

  • Account Management
  • AI Anomaly Detection
  • AI Language
  • AI Speech
  • AI Vision
  • Analytics Cloud
  • Announcements
  • API Gateway
  • Application Dependency Management
  • Application Management
  • Application Performance Monitoring
  • Audit
  • Autoscaling (Compute)
  • Bastion
  • Big Data Service
  • Blockchain Platform
  • Budgets
  • Build
  • Certificates
  • Classic Migration Service
  • Compute Instance Agent (Oracle Cloud Agent)
  • Console Dashboard
  • Container Engine for Kubernetes
  • Content Management
  • Core Services (Networking, Compute, Block Volume)
  • Cloud Guard
  • Data Catalog
  • Data Connectivity Management
  • Data Flow
  • Data Integration
  • Data Labeling
  • Data Safe
  • Data Science
  • Data Transfer
  • Database
  • Database Management
  • Database Migration
  • Database Tools
  • DevOps
  • Digital Assistant
  • DNS
  • Email Delivery
  • Events
  • File Storage
  • Functions
  • Generic Artifacts
  • GoldenGate
  • Governance Rules
  • Health Checks
  • IAM
  • Integration Cloud
  • Java Management
  • Key Management (for the Vault service)
  • License Manager
  • Limits
  • Load Balancing
  • Logging
  • Logging Analytics
  • Logging Search
  • Logging Ingestion
  • Management Agent Cloud
  • Management Dashboard
  • Marketplace
  • Monitoring
  • MySQL Database
  • Network Firewall
  • Network Load Balancing
  • Network Monitoring
  • Networking Topology
  • NoSQL Database Cloud
  • Notifications
  • Object Storage
  • OCI Registry
  • OneSubscription
  • Operations Insights
  • Operator Access Control
  • Optimizer
  • Organizations
  • OS Management
  • Quotas
  • Resource Manager
  • Roving Edge Infrastructure
  • Search
  • Secret Management (for the Vault service)
  • Service Catalog
  • Service Connector Hub
  • Service Mesh
  • Source Code Management
  • Stack Monitoring
  • Streaming
  • Support Management
  • Threat Intelligence
  • Usage
  • Visual Builder
  • VMWare Solution
  • Vulnerability Scanning
  • Web Application Acceleration and Security
  • Work Requests (Compute, Database)

Installing with yum

If you're using Oracle Linux 7 or 8, you can use yum to install the OCI SDK for Go. GoLang 1.16.3 will also be installed.

For Oracle Linux 7:

sudo yum-config-manager --enable ol7_developer
sudo yum install go-oci-sdk
For Oracle Linux 8:
sudo yum-config-manager --enable ol8_developer
sudo yum install go-oci-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:
export GOPATH=/usr/share/gocode
export GO111MODULE=off