X

Introducing the Go SDK for Oracle Cloud Infrastructure

Mine Tanrinian Demir
Senior Manager, Product Management

Today, we are happy to announce the Go SDK for Oracle Cloud Infrastructure is now available! The Go SDK supports all Oracle Cloud Infrastructure services and will continue to support the same set of features as the Java, Python and Ruby SDKs. Similar to our open source developer tools and SDKs, the Go SDK is available at GitHub oci-go-sdk repo.

The Go programming language attracts developers with its ease of use and simplicity. It is particularly popular when it comes to cloud development, including the use of Kubernetes and Terraform. To provide developers with similar experiences, we are launching the Go SDK for Oracle Cloud Infrastructure. The Oracle Cloud Infrastructure Terraform Provider also uses the latest Go SDK, you can refer to details about Terraform Provider here.

Along with launching the first version of the Go SDK for Oracle Cloud Infrastructure, we are looking for your feedback on future improvements. We’d love to hear from you on the GitHub issues page.

Here is how you can get started:

  1. Install the Go SDK
    
    go get -u github.com/oracle/oci-go-sdk 
  2. Configure the SDK with your Oracle Cloud Infrastructure credentials
  3. Start making API calls, such as this example:
    
    package example
    
    import (
    	"context"
    	"fmt"
    	"log"
    
    	"github.com/oracle/oci-go-sdk/common"
    	"github.com/oracle/oci-go-sdk/example/helpers"
    	"github.com/oracle/oci-go-sdk/identity"
    )
    
    // ExampleListAvailabilityDomains Lists the Availability Domains in your tenancy.
    // Specify the OCID of either the tenancy or another of your compartments as
    // the value for the compartment ID (remember that the tenancy is simply the root compartment).
    func ExampleListAvailabilityDomains() {
    	c, err := identity.NewIdentityClientWithConfigurationProvider(common.DefaultConfigProvider())
    	helpers.LogIfError(err)
    
    	// The OCID of the tenancy containing the compartment.
    	tenancyID, err := common.DefaultConfigProvider().TenancyOCID()
    	helpers.LogIfError(err)
    
    	request := identity.ListAvailabilityDomainsRequest{
    		CompartmentId: &tenancyID,
    	}
    
    	r, err := c.ListAvailabilityDomains(context.Background(), request)
    	helpers.LogIfError(err)
    
    	log.Printf("list of available domains: %v", r.Items)
    	fmt.Println("list available domains completed")
    
    	// Output:
    	// list available domains completed
    }
    
    

To learn more, you can also refer to:

If you need help, you can utilize these channels:

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.