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.17, 1.18, 1.19, 1.20, or 1.21.

Services Supported

  • Access Governance
  • 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
  • Autonomous Recovery
  • Autoscaling (Compute)
  • Bastion
  • Big Data Service
  • Blockchain Platform
  • Budgets
  • Build
  • OCI Cache
  • Certificates
  • Cloud Bridge
  • Cloud Migrations
  • Cluster Placement Groups
  • Compute Cloud@Customer
  • Compute Instance Agent (Oracle Cloud Agent)
  • Console Dashboard
  • Kubernetes Engine
  • Container Instances
  • Content Management
  • Core Services (Networking, Compute, Block Volume)
  • Cloud Guard
  • Connector Hub
  • Data Catalog
  • Data Flow
  • Data Integration
  • Data Labeling
  • Data Safe
  • Data Science
  • Data Transfer
  • Database
  • Database Management
  • Database Migration
  • Database Tools
  • Delegate Access Control
  • Demand Signal
  • DevOps
  • Digital Assistant
  • Digital Media
  • Disaster Recovery
  • DNS
  • Document Understanding
  • Email Delivery
  • Enterprise Manager Warehouse
  • Events
  • Exadata Fleet Update
  • File Storage
  • Fleet Application Management
  • Functions
  • Fusion Apps as a Service
  • Generative AI
  • Generative AI Agent
  • Generative AI Inference
  • Generic Artifacts
  • Globally Distributed Database
  • GoldenGate
  • Governance Rules
  • Health Checks
  • IAM
  • Identity Domains
  • Integration Cloud
  • Java Management
  • Java Management Service Downloads
  • Key Management (for the Vault service)
  • License Manager
  • Limits
  • Load Balancer
  • Logging
  • Logging Analytics
  • Logging Search
  • Logging Ingestion
  • Managed Access
  • Management Agent Cloud
  • Management Dashboard
  • Marketplace
  • Marketplace Private Offer
  • Monitoring
  • HeatWave
  • Network Firewall
  • Network Load Balancing
  • Network Monitoring
  • Networking Topology
  • NoSQL Database Cloud
  • Notifications
  • Object Storage
  • OCI Control Center
  • OCI Registry
  • OCI Secure Desktops
  • OneSubscription
  • Operations Insights
  • Operator Access Control
  • Optimizer
  • Organizations
  • OS Management
  • PostgreSQL
  • Process Automation
  • Publisher
  • Queue Service
  • Quotas
  • Resource Manager
  • Resource Scheduler
  • Roving Edge Infrastructure
  • Search
  • Secret Management (for the Vault service)
  • Secure Desktops
  • Security Attribute
  • Service Catalog
  • 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)
  • Zero Trust Packet Routing

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