Getting started with the Go SDK
Once your SDK is installed and configured, you can start accessing the SDK's different functionalities. This guide will walk through some examples of this functionality. To learn how to install and configure the Golang SDK, refer to Installation and Configuration.
List Transforms
Create a file in your project called sdk.go
with the following content:
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)
resp, r, err := apiClient.V3.TransformsApi.ListTransforms(ctx).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)
}
fmt.Fprintf(os.Stdout, "All Transforms from `TransformsApi.ListTransforms`: %v\n", resp)
}
To run the code, run this command:
go run sdk.go
You can make changes to the API you are calling by changing this line:
resp, r, err := apiClient.V3.TransformsApi.ListTransforms(ctx).Execute()
- To call a different version of the APIs, change
V3
toBeta
,V2
, orCC
. - To call a different API collection, change
TransformsApi
to another collection, likeSourcesApi
, for example. - To call a different endpoint, change
ListTransforms
to another endpoint, likeGetTransform
, for example.