https://github.com/yandex-cloud/go-sdk
Yandex.Cloud Go SDK
https://github.com/yandex-cloud/go-sdk
go golang yandex-cloud
Last synced: 5 months ago
JSON representation
Yandex.Cloud Go SDK
- Host: GitHub
- URL: https://github.com/yandex-cloud/go-sdk
- Owner: yandex-cloud
- License: mit
- Created: 2018-09-21T14:27:54.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2025-05-14T12:10:50.000Z (5 months ago)
- Last Synced: 2025-05-14T13:34:56.923Z (5 months ago)
- Topics: go, golang, yandex-cloud
- Language: Go
- Homepage:
- Size: 1.41 MB
- Stars: 87
- Watchers: 9
- Forks: 15
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Authors: AUTHORS
Awesome Lists containing this project
README
# Yandex.Cloud Go SDK
[](https://godoc.org/github.com/yandex-cloud/go-sdk)
[](https://circleci.com/gh/yandex-cloud/go-sdk)Go SDK for Yandex.Cloud services.
**NOTE:** SDK is under development, and may make
backwards-incompatible changes.## Installation
```bash
go get github.com/yandex-cloud/go-sdk
```## Example usages
### Initializing SDK
```go
sdk, err := ycsdk.Build(ctx, ycsdk.Config{
Credentials: ycsdk.OAuthToken(token),
})
if err != nil {
log.Fatal(err)
}
```### Retries
SDK provide built-in retry policy, that supports [exponential backoff and jitter](https://aws.amazon.com/ru/blogs/architecture/exponential-backoff-and-jitter/), and also [retry budget](https://github.com/grpc/proposal/blob/master/A6-client-retries.md#throttling-retry-attempts-and-hedged-rpcs).
It's necessary to avoid retry amplification.```go
import (
...
ycsdk "github.com/yandex-cloud/go-sdk"
"github.com/yandex-cloud/go-sdk/pkg/retry/v1"
)...
retriesDialOption, err := retry.DefaultRetryDialOption()
if err != nil {
log.Fatal(err)
}_, err = ycsdk.Build(
ctx,
ycsdk.Config{
Credentials: ycsdk.OAuthToken(*token),
},
retriesDialOption,
)
```SDK provide different modes for retry throttling policy:
* `persistent` is suitable when you use SDK in any long-lived application, when SDK instance will live long enough for manage budget;
* `temporary` is suitable when you use SDK in any short-lived application, e.g. scripts or CI/CD.By default, SDK will use temporary mode, but you can change it through functional option.
### More examples
More examples can be found in [examples dir](examples).