Files
developer.sailpoint.com/docs/tools/sdk/go/retries.md
darrell-thobe-sp 2cd5ccfc81 Prettified Code!
2024-04-18 10:31:05 +00:00

1.4 KiB

id, title, pagination_label, sidebar_label, sidebar_position, sidebar_class_name, keywords, description, slug, tags
id title pagination_label sidebar_label sidebar_position sidebar_class_name keywords description slug tags
go-sdk-retries Retries with the Go SDK Go SDK Retries 7 gosdk
go
golang
sdk
retry
Learn how to paginate results with the Golang SDK in this guide. /tools/sdk/go/retries
SDK
Software Development Kit

The SDK uses the go-retryablehttp module to support retry logic.

On line 17-18 of the following example, the SDK is set to retry if there is an unexpected error up to 10 times and wait 2 seconds between each retry:

package main

import (
 "context"
 "fmt"
 "os"

 sailpoint "github.com/sailpoint-oss/golang-sdk"
)

func main() {

 ctx := context.TODO()
 configuration := sailpoint.NewDefaultConfiguration()
 apiClient := sailpoint.NewAPIClient(configuration)

 configuration.HTTPClient.RetryMax = 10
 configuration.HTTPClient.RetryWaitMax = time.Second * 2

 resp, r, err := apiClient.V3.TransformsApi.ListTransforms(ctx).Filters("This is an incorrect string").Execute()
 if err != nil {
  fmt.Fprintf(os.Stderr, "Error when calling `TransformsApi.ListTransforms``: %v\n", err)
  fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
 }
 // response from `ListAccounts`: []Account
 fmt.Fprintf(os.Stdout, "First response from `TransformsApi.ListTransforms`: %v\n", resp)

}