All Projects → oracle → Oci Go Sdk

oracle / Oci Go Sdk

Licence: other
Go SDK for Oracle Cloud Infrastructure

Programming Languages

go
31211 projects - #10 most used programming language

Labels

Projects that are alternatives of or similar to Oci Go Sdk

Oci Python Sdk
Oracle Cloud Infrastructure SDK for Python
Stars: ✭ 191 (+130.12%)
Mutual labels:  cloud, sdk
Go Tfe
Terraform Cloud/Enterprise API Client/SDK in Golang
Stars: ✭ 98 (+18.07%)
Mutual labels:  cloud, sdk
Dorita980
Unofficial iRobot Roomba and Braava (i7/i7+, 980, 960, 900, e5, 690, 675, m6, etc) node.js library (SDK) to control your robot
Stars: ✭ 523 (+530.12%)
Mutual labels:  cloud, sdk
Cloudinary ios
Cloudinary iOS SDK
Stars: ✭ 133 (+60.24%)
Mutual labels:  cloud, sdk
Openapi Sdk Php Client
Official repository of the Alibaba Cloud Client for PHP
Stars: ✭ 206 (+148.19%)
Mutual labels:  cloud, sdk
Openapi Sdk Php
Alibaba Cloud SDK for PHP
Stars: ✭ 423 (+409.64%)
Mutual labels:  cloud, sdk
Cpprestsdk
The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.
Stars: ✭ 6,631 (+7889.16%)
Mutual labels:  cloud, sdk
Aws Ml Guide
[Video]AWS Certified Machine Learning-Specialty (ML-S) Guide
Stars: ✭ 78 (-6.02%)
Mutual labels:  cloud
Enseada
A Cloud native multi-package registry
Stars: ✭ 80 (-3.61%)
Mutual labels:  cloud
Docusign Java Client
The Official DocuSign Java Client Library used to interact with the eSign REST API. Send, sign, and approve documents using this client.
Stars: ✭ 77 (-7.23%)
Mutual labels:  sdk
Blockerized Dockchain
Because all problems are solvable with containers and blockchains
Stars: ✭ 77 (-7.23%)
Mutual labels:  cloud
Azure
Azure-related repository
Stars: ✭ 78 (-6.02%)
Mutual labels:  cloud
Android Consent Sdk
Configurable consent SDK for Android
Stars: ✭ 80 (-3.61%)
Mutual labels:  sdk
Uploadcare Php
PHP API client that handles uploads and further operations with files by wrapping Uploadcare Upload and REST APIs.
Stars: ✭ 77 (-7.23%)
Mutual labels:  sdk
Vault
Easy persistence of Contentful data for Android over SQLite.
Stars: ✭ 80 (-3.61%)
Mutual labels:  sdk
Architecture Center
Azure Architecture Center
Stars: ✭ 1,207 (+1354.22%)
Mutual labels:  cloud
Openlimits
A Rust high performance cryptocurrency trading API with support for multiple exchanges and language wrappers.
Stars: ✭ 83 (+0%)
Mutual labels:  sdk
Minio Go
MinIO Client SDK for Go
Stars: ✭ 1,231 (+1383.13%)
Mutual labels:  cloud
Deploy Spring Boot Aws Eb
Deploying Spring Boot Apps to AWS using Elastic Beanstalk
Stars: ✭ 79 (-4.82%)
Mutual labels:  cloud
Android Sdk Installer
Linux utility which aims to automatically install and configures Android SDK, Eclipse ADT Plugin, adds hardware support for devices and enables full MTP support.
Stars: ✭ 78 (-6.02%)
Mutual labels:  sdk

Oracle Cloud Infrastructure Golang SDK

wercker status

This is the Go SDK for Oracle Cloud Infrastructure. This project is open source and maintained by Oracle Corp. The home page for the project is here.

***WARNING:***: To avoid automatically consuming breaking changes if we have to rev the major version of the Go SDK, please consider using the Go dependency management tool, or vendoring the SDK. This will allow you to pin to a specific version of the Go SDK in your project, letting you control how and when you move to the next major version.

Dependencies

Installing

Use the following command to install this SDK:

go get -u github.com/oracle/oci-go-sdk

Alternatively you can git clone this repo.

We've applied Go Module after v25.0.0, for legacy user not using Go Module, you can still clone the repo under Go Path and use same import as before.

If you're using Go Module to import OCI Go SDK and you want to use the latest or specific Go SDK version, you need to update your require in go.mod:

require github.com/oracle/oci-go-sdk/{major-version} {version}

And in the code, you also need to update the import following this pattern:

import (
 "github.com/oracle/oci-go-sdk/{major-version}/common"
)

If you don't update your import and use your import like this github.com/oracle/oci-go-sdk/common, your Go SDK version will remain at version: v24.3.0

Everytime after a major version release (which means it will include some breaking changes), you'll need to update the version in require and import to get the latest changes.

import (
    "github.com/oracle/oci-go-sdk/v25"
)

in go.mod or run go mod tidy / go build after updating the import

require (
    github.com/oracle/oci-go-sdk/{updated-major-version} {version}
)

The version will not be impacted without updating the import

Working with the Go SDK

To start working with the Go SDK, you import the service package, create a client, and then use that client to make calls.

Configuring

Before using the SDK, set up a config file with the required credentials. See SDK and Tool Configuration for instructions.

Note that the Go SDK does not support profile inheritance or defining custom values in the configuration file.

Once a config file has been setup, call common.DefaultConfigProvider() function as follows:

// Import necessary packages
import (
   "github.com/oracle/oci-go-sdk/common"
   "github.com/oracle/oci-go-sdk/identity" // Identity or any other service you wish to make requests to
)

//...

configProvider := common.DefaultConfigProvider()

Or, to configure the SDK programmatically instead, implement the ConfigurationProvider interface shown below:

// ConfigurationProvider wraps information about the account owner
type ConfigurationProvider interface {
   KeyProvider
   TenancyOCID() (string, error)
   UserOCID() (string, error)
   KeyFingerprint() (string, error)
   Region() (string, error)
   // AuthType() is used for specify the needed auth type, like UserPrincipal, InstancePrincipal, etc. AuthConfig is used for getting auth related paras in config file.
   AuthType() (AuthConfig, error)
}

Or simply use one of structs exposed by the oci-go-sdk that already implement the above interface

Making a Request

To make a request to an Oracle Cloud Infrastructure service, create a client for the service and then use the client to call a function from the service.

  • Creating a client: All packages provide a function to create clients, using the naming convention New<ServiceName>ClientWithConfigurationProvider, such as NewVirtualNetworkClientWithConfigurationProvider or NewIdentityClientWithConfigurationProvider. To create a new client, pass a struct that conforms to the ConfigurationProvider interface, or use the DefaultConfigProvider() function in the common package.

For example:

config := common.DefaultConfigProvider()
client, err := identity.NewIdentityClientWithConfigurationProvider(config)
if err != nil { 
     panic(err)
}
  • Making calls: After successfully creating a client, requests can now be made to the service. Generally all functions associated with an operation accept context.Context and a struct that wraps all input parameters. The functions then return a response struct that contains the desired data, and an error struct that describes the error if an error occurs.

For example:

id := "your_group_id"
response, err := client.GetGroup(context.Background(), identity.GetGroupRequest{GroupId:&id})
if err != nil {
	//Something happened
	panic(err)
}
//Process the data in response struct
fmt.Println("Group's name is:", response.Name)

Organization of the SDK

The oci-go-sdk contains the following:

  • Service packages: All packages except common and any other package found inside cmd. These packages represent the Oracle Cloud Infrastructure services supported by the Go SDK. Each package represents a service. These packages include methods to interact with the service, structs that model input and output parameters, and a client struct that acts as receiver for the above methods.

  • Common package: Found in the common directory. The common package provides supporting functions and structs used by service packages. Includes HTTP request/response (de)serialization, request signing, JSON parsing, pointer to reference and other helper functions. Most of the functions in this package are meant to be used by the service packages.

  • cmd: Internal tools used by the oci-go-sdk.

Examples

Examples can be found here

Documentation

Full documentation can be found on the godocs site.

Help

Contributing

oci-go-sdk is an open source project. See CONTRIBUTING for details.

Oracle gratefully acknowledges the contributions to oci-go-sdk that have been made by the community.

License

Copyright (c) 2016, 2018, 2020, Oracle and/or its affiliates. All rights reserved. This software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl or Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.

See LICENSE for more details.

Changes

See CHANGELOG.

Known Issues

You can find information on any known issues with the SDK here and under the Issues tab of this project's GitHub repository.

Building and Testing

Dev Dependencies

  • Install Testify with the command:
go get github.com/stretchr/testify
  • Install go lint with the command:
go get -u github.com/golang/lint/golint

Build

Building is provided by the make file at the root of the project. To build the project execute.

make build

To run the tests:

make test
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].