Skip to content

Commit c2605c4

Browse files
sync upstream
1 parent 68cb3d5 commit c2605c4

File tree

14 files changed

+905
-14
lines changed

14 files changed

+905
-14
lines changed

README.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,64 @@ if err != nil {
2727
}
2828
```
2929

30+
### Retries
31+
32+
If you want to add retries to SDK, provide configuration using `retry/v1` package:
33+
34+
```go
35+
import (
36+
...
37+
38+
ycsdk "bb.yandex-team.ru/cloud/cloud-go/sdk"
39+
"bb.yandex-team.ru/cloud/cloud-go/sdk/pkg/retry/v1"
40+
)
41+
42+
...
43+
44+
retriesDialOption, err := retry.RetryDialOption(
45+
retry.WithRetries(retry.DefaultNameConfig(), 2),
46+
retry.WithRetryableStatusCodes(retry.DefaultNameConfig(), codes.AlreadyExists, codes.Unavailable),
47+
)
48+
if err != nil {
49+
log.Fatal(err)
50+
}
51+
52+
_, err = ycsdk.Build(
53+
ctx,
54+
ycsdk.Config{
55+
Credentials: ycsdk.OAuthToken(*token),
56+
},
57+
retriesDialOption,
58+
)
59+
```
60+
61+
It's **strongly recommended** to use provided default configuration to avoid retry amplification:
62+
63+
```go
64+
import (
65+
...
66+
67+
ycsdk "bb.yandex-team.ru/cloud/cloud-go/sdk"
68+
"bb.yandex-team.ru/cloud/cloud-go/sdk/pkg/retry/v1"
69+
)
70+
71+
...
72+
73+
retriesDialOption, err := retry.DefaultRetryDialOption()
74+
if err != nil {
75+
log.Fatal(err)
76+
}
77+
78+
_, err = ycsdk.Build(
79+
ctx,
80+
ycsdk.Config{
81+
Credentials: ycsdk.OAuthToken(*token),
82+
},
83+
retriesDialOption,
84+
)
85+
```
86+
87+
3088
### More examples
3189

3290
More examples can be found in [examples dir](examples).

gen/cic/privateconnection.go

Lines changed: 162 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)