{"id":13564105,"url":"https://github.com/oracle/oci-go-sdk","last_synced_at":"2025-05-14T03:06:17.996Z","repository":{"id":37285541,"uuid":"111465030","full_name":"oracle/oci-go-sdk","owner":"oracle","description":"Go SDK for Oracle Cloud Infrastructure ","archived":false,"fork":false,"pushed_at":"2025-04-01T17:10:05.000Z","size":177464,"stargazers_count":185,"open_issues_count":42,"forks_count":83,"subscribers_count":44,"default_branch":"master","last_synced_at":"2025-04-03T17:47:08.752Z","etag":null,"topics":["cloud","go","oracle-cloud","oracle-cloud-infrastructure","sdk"],"latest_commit_sha":null,"homepage":"https://cloud.oracle.com/cloud-infrastructure","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oracle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":"audit/audit_client.go","citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":"governancerulescontrolplane/action_type.go","roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-20T21:30:35.000Z","updated_at":"2025-04-01T17:08:26.000Z","dependencies_parsed_at":"2023-02-16T22:15:36.685Z","dependency_job_id":"f712ad93-02da-4283-948d-f1e397cfa4ea","html_url":"https://github.com/oracle/oci-go-sdk","commit_stats":{"total_commits":496,"total_committers":32,"mean_commits":15.5,"dds":0.8044354838709677,"last_synced_commit":"3c5764ea07bb369a1f3acc65ef09cb567bdbc297"},"previous_names":[],"tags_count":305,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle%2Foci-go-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle%2Foci-go-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle%2Foci-go-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oracle%2Foci-go-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oracle","download_url":"https://codeload.github.com/oracle/oci-go-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248294977,"owners_count":21080012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cloud","go","oracle-cloud","oracle-cloud-infrastructure","sdk"],"created_at":"2024-08-01T13:01:26.614Z","updated_at":"2025-04-10T20:46:03.501Z","avatar_url":"https://github.com/oracle.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Oracle Cloud Infrastructure Golang SDK\n[![wercker status](https://app.wercker.com/status/09bc4818e7b1d70b04285331a9bdbc41/s/master \"wercker status\")](https://app.wercker.com/project/byKey/09bc4818e7b1d70b04285331a9bdbc41)\n\nThis is the Go SDK for Oracle Cloud Infrastructure. This project is open source and maintained by Oracle Corp. \nThe home page for the project is [here](https://godoc.org/github.com/oracle/oci-go-sdk/v65/).\n\n## Survey\nAre you a Developer using the OCI SDK? If so, please fill out our survey to help us make the OCI SDK better for you. Click [here](https://oracle.questionpro.com/t/APeMlZka26?custom3=pkg) for the survey page.\n\n\n## Dependencies\n- Install [Go programming language](https://golang.org/dl/), Go1.17, 1.18, 1.19, 1.20, and 1.21 are supported By OCI Go SDK.\n- Install [GNU Make](https://www.gnu.org/software/make/), using the package manager or binary distribution tool appropriate for your platform.\n \n## Versioning\n- The breaking changes in service client APIs will no longer result in a major version bump (x+1.y.z relative to the last published version). Instead, we will bump the minor version of the SDK (x.y+1.z relative to the last published version).\n- If there are no breaking changes in a release, we will bump the patch version of the SDK (x.y.z+1 relative to the last published version).\nWe will continue to announce any breaking changes in a new version under the Breaking Changes section in the release changelog and on the Github release page [https://github.com/oracle/oci-go-sdk/releases].\n- However, breaking changes in the SDK's common module will continue to result in a major version bump (x+1.y.z relative to the last published version). That said, we'll continue to maintain backward compatibility as much as possible to minimize the effort involved in upgrading the SDK version used by your code.\n\n## Installing\nIf you want to install the SDK under $GOPATH, you can use `go get` to retrieve the SDK:\n```\ngo get -u github.com/oracle/oci-go-sdk\n```\nIf you are using Go modules, you can install by running the following command within a folder containing a `go.mod` file:\n```\ngo get -d github.com/oracle/oci-go-sdk/v49@latest\n```\nThe latest major version (for example `v49`) can be identified on the [Github releases page](https://github.com/oracle/oci-go-sdk/releases).\n\nAlternatively, you can install a specific version (supported from `v25.0.0` on):\n```\ngo get -d github.com/oracle/oci-go-sdk/v49@v49.1.0\n```\nRun `go mod tidy`\n\nIn your project, you also need to ensure the import paths contain the correct major-version:\n```\nimport \"github.com/oracle/oci-go-sdk/v49/common\"  // or whatever major version you're using\n```\n\n## Working with the Go SDK\nTo start working with the Go SDK, you import the service package, create a client, and then use that client to make calls.\n\n### Configuring \nBefore using the SDK, set up a config file with the required credentials. See [SDK and Tool Configuration](https://docs.oracle.com/iaas/Content/API/Concepts/sdkconfig.htm) for instructions.\n\nNote that the Go SDK does not support profile inheritance or defining custom values in the configuration file.\n\nOnce a config file has been setup, call `common.DefaultConfigProvider()` function as follows:\n\n ```go\n // Import necessary packages\n import (\n\t\"github.com/oracle/oci-go-sdk/v49/common\"\n\t\"github.com/oracle/oci-go-sdk/v49/identity\" // Identity or any other service you wish to make requests to\n)\n \n //...\n \nconfigProvider := common.DefaultConfigProvider()\n```\n\n Or, to configure the SDK programmatically instead, implement the `ConfigurationProvider` interface shown below:\n ```go\n// ConfigurationProvider wraps information about the account owner\ntype ConfigurationProvider interface {\n\tKeyProvider\n\tTenancyOCID() (string, error)\n\tUserOCID() (string, error)\n\tKeyFingerprint() (string, error)\n\tRegion() (string, error)\n\t// AuthType() is used for specify the needed auth type, like UserPrincipal, InstancePrincipal, etc. AuthConfig is used for getting auth related paras in config file.\n\tAuthType() (AuthConfig, error)\n}\n```\nOr simply use one of  structs exposed by the `oci-go-sdk` that already implement the above [interface](https://godoc.org/github.com/oracle/oci-go-sdk/v65/common#ConfigurationProvider)\n\n### Making a Request\nTo 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.\n\n- *Creating a client*: All packages provide a function to create clients, using the naming convention `New\u003cServiceName\u003eClientWithConfigurationProvider`,\nsuch as `NewVirtualNetworkClientWithConfigurationProvider` or `NewIdentityClientWithConfigurationProvider`. To create a new client, \npass a struct that conforms to the `ConfigurationProvider` interface, or use the `DefaultConfigProvider()` function in the common package.\n\nFor example: \n```go\nconfig := common.DefaultConfigProvider()\nclient, err := identity.NewIdentityClientWithConfigurationProvider(config)\nif err != nil { \n     panic(err)\n}\n```\n\n- *Making calls*: After successfully creating a client, requests can now be made to the service. Generally all functions associated with an operation\naccept [`context.Context`](https://golang.org/pkg/context/) and a struct that wraps all input parameters. The functions then return a response struct\nthat contains the desired data, and an error struct that describes the error if an error occurs.\n\nFor example:\n```go\nid := \"your_group_id\"\nresponse, err := client.GetGroup(context.Background(), identity.GetGroupRequest{GroupId:\u0026id})\nif err != nil {\n\t//Something happened\n\tpanic(err)\n}\n//Process the data in response struct\nfmt.Println(\"Group's name is:\", response.Name)\n```\n\n- *Expect header*: Some services specified \"PUT/POST\" requests add Expect 100-continue header by default, if it is not expected, please explicitly set the env var:\n```sh\nexport OCI_GOSDK_USING_EXPECT_HEADER=FALSE\n```\n\n- *Circuit Breaker*: By default, circuit breaker feature is enabled, if it is not expected, please explicitly set the env var:\n```sh\nexport OCI_SDK_DEFAULT_CIRCUITBREAKER_ENABLED=FALSE\n```\n- *Cicuit Breaker*: Circuit Breaker error message includes a set of previous failed responses. By default, the number of the failed responses is set to 5. It can be explicitly set using the env var:\n```sh\nexport OCI_SDK_CIRCUITBREAKER_NUM_HISTORY_RESPONSE=\u003cint value\u003e\n``` \n\n## Organization of the SDK\nThe `oci-go-sdk` contains the following:\n- **Service packages**: All packages except `common` and any other package found inside `cmd`. These packages represent \nthe Oracle Cloud Infrastructure services supported by the Go SDK. Each package represents a service. \nThese packages include methods to interact with the service, structs that model \ninput and output parameters, and a client struct that acts as receiver for the above methods.\n\n- **Common package**: Found in the `common` directory. The common package provides supporting functions and structs used by service packages.\nIncludes HTTP request/response (de)serialization, request signing, JSON parsing, pointer to reference and other helper functions. Most of the functions\nin this package are meant to be used by the service packages.\n\n- **cmd**: Internal tools used by the `oci-go-sdk`.\n\n## Examples\nExamples can be found [here](https://github.com/oracle/oci-go-sdk/tree/master/example)\n\n## Documentation\nFull documentation can be found [on the godocs site](https://godoc.org/github.com/oracle/oci-go-sdk/v65/).\n\n## Help\n* The [Issues](https://github.com/oracle/oci-go-sdk/issues) page of this GitHub repository.\n* [Stack Overflow](https://stackoverflow.com/), use the [oracle-cloud-infrastructure](https://stackoverflow.com/questions/tagged/oracle-cloud-infrastructure) and [oci-go-sdk](https://stackoverflow.com/questions/tagged/oci-go-sdk) tags in your post.\n* [Developer Tools](https://community.oracle.com/community/cloud_computing/bare-metal/content?filterID=contentstatus%5Bpublished%5D~category%5Bdeveloper-tools%5D\u0026filterID=contentstatus%5Bpublished%5D~objecttype~objecttype%5Bthread%5D) of the Oracle Cloud forums.\n* [My Oracle Support](https://support.oracle.com).\n\n\n## Contributing\nThis project welcomes contributions from the community. Before submitting a pull request, please [review our contribution guide](./CONTRIBUTING.md)\n\n## Security\nPlease consult the [security guide](./SECURITY.md) for our responsible security vulnerability disclosure process\n\n## License\nCopyright (c) 2016, 2023, Oracle and/or its affiliates.  All rights reserved.\nThis software is dual-licensed to you under the Universal Permissive License (UPL) 1.0 as shown at https://oss.oracle.com/licenses/upl\nor Apache License 2.0 as shown at http://www.apache.org/licenses/LICENSE-2.0. You may choose either license.\n\nSee [LICENSE](/LICENSE.txt) for more details.\n\n## Changes\nSee [CHANGELOG](/CHANGELOG.md).\n\n## Known Issues\nYou can find information on any known issues with the SDK here and under the [Issues](https://github.com/oracle/oci-go-sdk/issues) tab of this project's GitHub repository.\n\n## Building and Testing\n### Dev Dependencies\nFor Go versions below 1.17\n\n- Install [Testify](https://github.com/stretchr/testify) with the command:\n```sh\ngo get github.com/stretchr/testify\n```\n- Install [gobreaker](https://github.com/sony/gobreaker) with the command:\n```sh\ngo get github.com/sony/gobreaker\n```\n- Install [flock](https://github.com/gofrs/flock) with the command:\n```sh\ngo get github.com/gofrs/flock\n```\n- Install [go lint](https://github.com/golang/lint) with the command:\n```\ngo get -u golang.org/x/lint/golint\n```\n\nFor Go versions 1.17 and above\n\n- Install [Testify](https://github.com/stretchr/testify) with the command:\n```sh\ngo install github.com/stretchr/testify\n```\n- Install [gobreaker](https://github.com/sony/gobreaker) with the command:\n```sh\ngo install github.com/sony/gobreaker\n```\n- Install [flock](https://github.com/gofrs/flock) with the command:\n```sh\ngo install github.com/gofrs/flock\n```\n- Install [go lint](https://github.com/golang/lint) with the command:\n```\ngo install github.com/golang/lint/golint\n```\n- Install [staticcheck](https://github.com/dominikh/go-tools) with the command:\n```\ngo install honnef.co/go/tools/cmd/staticcheck@2023.1.7\n```\n\n### Linting and Staticcheck\nLinting (performed by golint) can be done with the following command:\n\n```\nmake lint\n```\nLinting will perform a number of formatting changes across the code base.\n\n\n```\nmake static-check\n```\nThis command is also run by the make build and make test commands.\nStaticcheck will provide formatting warnings but will not make any changes to any files.\nYou can also cause staticcheck to be run before calls to \"git commit\" with the pre-commit plugin.\n\n```\npre-commit install\n```\nYou can install pre-commit itself, you can use your package manager of choice, such as\n\n```\nbrew install pre-commit\n```\n\n### Build\nBuilding is provided by the make file at the root of the project. To build the project execute.\n\n```\nmake build\n```\n\nTo run the tests:\n```\nmake test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foracle%2Foci-go-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foracle%2Foci-go-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foracle%2Foci-go-sdk/lists"}